5
* KFontInst - KDE Font Installer
7
* Copyright 2003-2009 Craig Drummond <craig@kde.org>
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; see the file COPYING. If not, write to
23
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24
* Boston, MA 02110-1301, USA.
27
#include <QtCore/QObject>
28
#include <QtCore/QStringList>
29
#include <QtCore/QSet>
30
#include <QtDBus/QtDBus>
34
#include "FontinstIface.h"
35
#include "kfontinst_export.h"
37
#define FONTINST_PATH "/FontInst"
44
class KFONTINST_EXPORT FontInst : public QObject
47
Q_CLASSINFO("D-Bus Interface", "org.kde.fontinst")
54
STATUS_SERVICE_DIED = KJob::UserDefinedError+500,
55
STATUS_BITMAPS_DISABLED,
56
STATUS_ALREADY_INSTALLED,
58
STATUS_PARTIAL_DELETE,
59
STATUS_NO_SYS_CONNECTION
76
static void registerTypes()
78
qDBusRegisterMetaType<Families>();
79
qDBusRegisterMetaType<Family>();
80
qDBusRegisterMetaType<Style>();
81
qDBusRegisterMetaType<File>();
82
qDBusRegisterMetaType<Style>();
83
qDBusRegisterMetaType<QList< Families > >();
86
static bool isStarted(OrgKdeFontinstInterface *iface)
88
QDBusReply<QStringList> reply=iface->connection().interface()->registeredServiceNames();
91
QStringList services(reply.value());
92
QStringList::ConstIterator it(services.begin()),
95
if((*it)==OrgKdeFontinstInterface::staticInterfaceName())
106
Q_NOREPLY void list(int folders, int pid);
107
Q_NOREPLY void stat(const QString &font, int folders, int pid);
108
Q_NOREPLY void install(const QString &file, bool createAfm, bool toSystem, int pid, bool checkConfig);
109
Q_NOREPLY void uninstall(const QString &family, quint32 style, bool fromSystem, int pid, bool checkConfig);
110
Q_NOREPLY void uninstall(const QString &name, bool fromSystem, int pid, bool checkConfig);
111
Q_NOREPLY void move(const QString &family, quint32 style, bool toSystem, int pid, bool checkConfig);
112
Q_NOREPLY void enable(const QString &family, quint32 style, bool inSystem, int pid, bool checkConfig);
113
Q_NOREPLY void disable(const QString &family, quint32 style, bool inSystem, int pid, bool checkConfig);
114
Q_NOREPLY void removeFile(const QString &family, quint32 style, const QString &file, bool fromSystem, int pid,
116
Q_NOREPLY void reconfigure(int pid);
117
Q_SCRIPTABLE void saveDisabled();
121
void fontList(int pid, const QList<KFI::Families> &families);
122
void status(int pid, int status);
123
void fontStat(int pid, const KFI::Family &font);
124
void fontsAdded(const KFI::Families &families);
125
void fontsRemoved(const KFI::Families &families);
129
void connectionsTimeout();
130
void fontListTimeout();
134
void updateFontList(bool emitChanges=true);
135
void toggle(bool enable, const QString &family, quint32 style, bool inSystem, int pid, bool checkConfig);
136
void addModifedSysFolders(const Family &family);
137
void checkConnections();
138
bool findFontReal(const QString &family, const QString &style, EFolder folder,
139
FamilyCont::ConstIterator &fam, StyleCont::ConstIterator &st);
140
bool findFont(const QString &font, EFolder folder,
141
FamilyCont::ConstIterator &fam, StyleCont::ConstIterator &st,
142
bool updateList=true);
143
bool findFontReal(const QString &family, quint32 style, EFolder folder,
144
FamilyCont::ConstIterator &fam, StyleCont::ConstIterator &st);
145
bool findFont(const QString &family, quint32 style, EFolder folder,
146
FamilyCont::ConstIterator &fam, StyleCont::ConstIterator &st,
147
bool updateList=true);
148
int performAction(const QVariantMap &args);
150
static void emergencySave(int sig);
154
QTimer *itsConnectionsTimer,
156
QSet<int> itsConnections;