not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / kfontinst / kcmfontinst / JobRunner.h
blob77f83bba8ab32d9a8465322feadcd77503e23d15
1 /*
2 * KFontInst - KDE Font Installer
4 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
6 * ----
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef __JOB_RUNNER_H__
25 #define __JOB_RUNNER_H__
27 #include <KDE/KIO/Job>
28 #include "ActionDialog.h"
29 #include "../config-fontinst.h"
31 class QLabel;
32 class QProgressBar;
33 class KJob;
35 namespace KFI
38 class CJobRunner : public CActionDialog
40 Q_OBJECT
42 public:
44 struct Item : public KUrl
46 enum EType
48 TYPE1_FONT,
49 TYPE1_METRICS,
50 OTHER_FONT
53 Item(const KUrl &u=KUrl(), const QString &n=QString());
54 QString displayName() const { return name.isEmpty() ? prettyUrl() : name; }
55 QString name,
56 fileName; // Only required so that we can sort an ItemList so that afm/pfms follow after pfa/pfbs
57 EType type;
59 bool operator<(const Item &o) const;
62 typedef QList<Item> ItemList;
64 enum ECommand
66 CMD_INSTALL,
67 CMD_DELETE,
68 CMD_ENABLE,
69 CMD_DISABLE,
70 CMD_UPDATE,
71 CMD_COPY,
72 CMD_MOVE
75 explicit CJobRunner(QWidget *parent, int xid=0);
76 ~CJobRunner();
78 bool getAdminPasswd(QWidget *parent);
79 #if !(defined USE_POLICYKIT && USE_POLICYKIT==1)
80 const QString & adminPasswd() const { return itsPasswd; }
81 #endif
82 static void getAssociatedUrls(const KUrl &url, KUrl::List &list, bool afmAndPfm, QWidget *widget);
83 int exec(ECommand cmd, const ItemList &urls, const KUrl &dest);
85 private Q_SLOTS:
87 void doNext();
88 void jobResult(KJob *job);
89 void cfgResult(KJob *job);
90 void slotButtonClicked(int button);
92 private:
94 void setMetaData(KIO::Job *job) const;
95 KUrl modifyUrl(const KUrl &orig) const;
97 private:
99 ECommand itsCmd;
100 ItemList itsUrls;
101 ItemList::ConstIterator itsIt,
102 itsEnd;
103 KUrl itsDest;
104 QLabel *itsStatusLabel;
105 QProgressBar *itsProgress;
106 bool itsAutoSkip,
107 itsCancelClicked,
108 itsModified;
109 #if !(defined USE_POLICYKIT && USE_POLICYKIT==1)
110 QString itsPasswd;
111 #endif
116 #endif