add more spacing
[personal-kdebase.git] / workspace / plasma / dataengines / applicationjobs / kuiserverengine.h
blob37a1b13baf1b03045d8d7848a9bf5c4eb2c133bc
1 /*
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>
26 class JobView;
28 namespace Plasma
30 class Service;
31 } // namespace Plasma
33 class KuiserverEngine : public Plasma::DataEngine
35 Q_OBJECT
36 Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewServer")
38 public:
39 KuiserverEngine(QObject* parent, const QVariantList& args);
40 ~KuiserverEngine();
42 QDBusObjectPath requestView(const QString &appName, const QString &appIconName,
43 int capabilities);
44 Plasma::Service* serviceForSource(const QString& source);
46 static uint s_jobId;
48 public Q_SLOTS:
49 void sourceUpdated(JobView* jobView);
51 protected:
52 void init();
54 private:
55 QMap<QString, JobView*> m_jobViews;
59 class JobView : public QObject
61 Q_OBJECT
62 Q_CLASSINFO("D-Bus Interface", "org.kde.JobView")
64 public:
65 enum State {
66 Running = 0,
67 Suspended = 1,
68 Stopped = 2
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;
100 Q_SIGNALS:
101 void suspendRequested();
102 void resumeRequested();
103 void cancelRequested();
105 void viewUpdated(JobView* view);
107 private:
108 QDBusObjectPath m_objectPath;
110 uint m_capabilities;
111 uint m_jobId;
112 uint m_percent;
114 qlonglong m_speed;
116 State m_state;
118 QString m_infoMessage;
119 QString m_appName;
120 QString m_appIconName;
121 QString m_error;
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;
132 #endif