2 * Copyright © 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef KUISERVERENGINE_H
20 #define KUISERVERENGINE_H
22 #include <QDBusObjectPath>
24 #include <plasma/dataengine.h>
33 class KuiserverEngine
: public Plasma::DataEngine
36 Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewServer")
39 KuiserverEngine(QObject
* parent
, const QVariantList
& args
);
42 QDBusObjectPath
requestView(const QString
&appName
, const QString
&appIconName
,
44 Plasma::Service
* serviceForSource(const QString
& source
);
49 void sourceUpdated(JobView
* jobView
);
55 QMap
<QString
, JobView
*> m_jobViews
;
59 class JobView
: public QObject
62 Q_CLASSINFO("D-Bus Interface", "org.kde.JobView")
71 JobView(QObject
*parent
= 0);
73 void setTotalAmount(qlonglong amount
, const QString
&unit
);
74 QString
totalAmountSize() const;
75 QString
totalAmountFiles() const;
77 void setProcessedAmount(qlonglong amount
, const QString
&unit
);
79 void setSpeed(qlonglong bytesPerSecond
);
80 QString
speedString() const;
82 void setInfoMessage(const QString
&infoMessage
);
83 QString
infoMessage() const;
85 bool setDescriptionField(uint number
, const QString
&name
, const QString
&value
);
86 void clearDescriptionField(uint number
);
88 void setAppName(const QString
&appName
);
89 void setAppIconName(const QString
&appIconName
);
90 void setCapabilities(int capabilities
);
91 void setPercent(uint percent
);
92 void setSuspended(bool suspended
);
94 void terminate(const QString
&errorMessage
);
96 QString
sourceName() const;
98 QDBusObjectPath
objectPath() const;
101 void suspendRequested();
102 void resumeRequested();
103 void cancelRequested();
105 void viewUpdated(JobView
* view
);
108 QDBusObjectPath m_objectPath
;
118 QString m_infoMessage
;
120 QString m_appIconName
;
123 QMap
<int, QString
> m_labels
;
124 QMap
<int, QString
> m_labelNames
;
125 QMap
<QString
, qlonglong
> m_totalMap
;
126 QMap
<QString
, qlonglong
> m_processedMap
;
128 friend class KuiserverEngine
;
129 friend class JobAction
;