Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kcontrol / kfontinst / kcmfontinst / FontLister.h
blob58a9efed5165005e869435af8c4941b70b552b8e
1 #ifndef __FONT_LISTER_H__
2 #define __FONT_LISTER_H__
4 /*
5 * KFontInst - KDE Font Installer
7 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
9 * ----
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 class KJob;
28 class QString;
30 #include <KDE/KIO/Job>
31 #include <KDE/KFileItem>
32 #include <QtCore/QObject>
33 #include <QtCore/QHash>
35 namespace KFI
38 struct Rename
40 Rename(const KUrl &f, const KUrl &t)
41 : from(f), to(t) { }
43 KUrl from,
44 to;
47 typedef QList<Rename> RenameList;
49 class CFontLister : public QObject
51 Q_OBJECT
53 private:
55 enum EListing
57 LIST_ALL,
58 LIST_USER,
59 LIST_SYS
62 public:
65 CFontLister(QObject *parent);
67 void scan(const KUrl &url=KUrl());
68 void setAutoUpdate(bool e);
69 bool busy() const { return NULL!=itsJob; }
71 Q_SIGNALS:
73 void newItems(const KFileItemList &items);
74 void deleteItems(const KFileItemList &items);
75 void renameItems(const RenameList &items);
76 void started();
77 void completed();
78 void percent(int);
79 void message(const QString &msg);
81 private Q_SLOTS:
83 void fileRenamed(const QString &from, const QString &to);
84 void filesAdded(const QString &dir);
85 void filesRemoved(const QStringList &files);
86 void result(KJob *job);
87 void entries(KIO::Job *job, const KIO::UDSEntryList &entries);
88 void processedSize(KJob *job, qulonglong s);
89 void totalSize(KJob *job, qulonglong s);
90 void infoMessage(KJob *job, const QString &msg);
92 private:
94 void removeItems(KFileItemList &items);
95 bool inScope(const KUrl &url);
97 static EListing listing(const KUrl &url);
99 private:
101 typedef QHash<KUrl, KFileItem> ItemCont;
103 EListing itsListing;
104 ItemCont itsItems;
105 bool itsAutoUpdate,
106 itsUpdateRequired;
107 KIO::Job *itsJob;
108 qulonglong itsJobSize;
109 RenameList itsItemsToRename;
114 #endif