~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/kfontinst/kcmfontinst/JobRunner.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * KFontInst - KDE Font Installer
 
3
 *
 
4
 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
 
5
 *
 
6
 * ----
 
7
 *
 
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.
 
12
 *
 
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.
 
17
 *
 
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.
 
22
 */
 
23
 
 
24
#ifndef __JOB_RUNNER_H__
 
25
#define __JOB_RUNNER_H__
 
26
 
 
27
#include <KDE/KUrl>
 
28
#include <KDE/KDialog>
 
29
#include "FontInstInterface.h"
 
30
 
 
31
class QLabel;
 
32
class QProgressBar;
 
33
class QStackedWidget;
 
34
class QEventLoop;
 
35
class QCloseEvent;
 
36
class QCheckBox;
 
37
class KJob;
 
38
class KTempDir;
 
39
 
 
40
namespace KFI
 
41
{
 
42
 
 
43
class CActionLabel;
 
44
 
 
45
class CJobRunner : public KDialog
 
46
{
 
47
    Q_OBJECT
 
48
 
 
49
    public:
 
50
 
 
51
    struct Item : public KUrl
 
52
    {
 
53
        enum EType
 
54
        {
 
55
            TYPE1_FONT,
 
56
            TYPE1_AFM,
 
57
            TYPE1_PFM,
 
58
            OTHER_FONT
 
59
        };
 
60
 
 
61
        Item(const KUrl &u=KUrl(), const QString &n=QString());
 
62
        Item(const QString &file, const QString &family, quint32 style, bool system);
 
63
        QString displayName() const { return name.isEmpty() ? prettyUrl() : name; }
 
64
        QString name,
 
65
                fileName;  // Only required so that we can sort an ItemList so that afm/pfms follow after pfa/pfbs
 
66
        EType   type;
 
67
 
 
68
        bool operator<(const Item &o) const;
 
69
    };
 
70
 
 
71
    typedef QList<Item> ItemList;
 
72
 
 
73
    enum ECommand
 
74
    {
 
75
        CMD_INSTALL,
 
76
        CMD_DELETE,
 
77
        CMD_ENABLE,
 
78
        CMD_DISABLE,
 
79
        CMD_UPDATE,
 
80
        CMD_MOVE,
 
81
        CMD_REMOVE_FILE
 
82
    };
 
83
 
 
84
    explicit CJobRunner(QWidget *parent, int xid=0);
 
85
    ~CJobRunner();
 
86
 
 
87
    static FontInstInterface * dbus();
 
88
    static void startDbusService();
 
89
 
 
90
    static KUrl encode(const QString &family, quint32 style, bool system);
 
91
 
 
92
    static void     getAssociatedUrls(const KUrl &url, KUrl::List &list, bool afmAndPfm, QWidget *widget);
 
93
    int             exec(ECommand cmd, const ItemList &urls, bool destIsSystem);
 
94
 
 
95
    Q_SIGNALS:
 
96
 
 
97
    void configuring();
 
98
 
 
99
    private Q_SLOTS:
 
100
 
 
101
    void doNext();
 
102
    void checkInterface();
 
103
    void dbusServiceOwnerChanged(const QString &name, const QString &from, const QString &to);
 
104
    void dbusStatus(int pid, int status);
 
105
    void slotButtonClicked(int button);
 
106
 
 
107
    private:
 
108
 
 
109
    void    closeEvent(QCloseEvent *e);
 
110
    void    setPage(int page, const QString &msg=QString());
 
111
    QString fileName(const KUrl &url);
 
112
    QString errorString(int value) const;
 
113
 
 
114
    private:
 
115
 
 
116
    ECommand                itsCmd;
 
117
    ItemList                itsUrls;
 
118
    ItemList::ConstIterator itsIt,
 
119
                            itsEnd,
 
120
                            itsPrev;
 
121
    bool                    itsDestIsSystem;
 
122
    QLabel                  *itsStatusLabel,
 
123
                            *itsSkipLabel,
 
124
                            *itsErrorLabel;
 
125
    QProgressBar            *itsProgress;
 
126
    bool                    itsAutoSkip,
 
127
                            itsCancelClicked,
 
128
                            itsModified;
 
129
    KTempDir                *itsTempDir;
 
130
    QString                 itsCurrentFile;
 
131
    CActionLabel            *itsActionLabel;
 
132
    QStackedWidget          *itsStack;
 
133
    int                     itsResponse;
 
134
    QEventLoop              *itsLoop;
 
135
    QCheckBox               *itsDontShowFinishedMsg;
 
136
};
 
137
 
 
138
}
 
139
 
 
140
#endif