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>
23
#include <QBasicTimer>
26
#include <Plasma/DataContainer>
27
#include <Plasma/DataEngine>
36
class KuiserverEngine : public Plasma::DataEngine
39
Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewServer")
42
KuiserverEngine(QObject* parent, const QVariantList& args);
47
QDBusObjectPath requestView(const QString &appName, const QString &appIconName,
49
Plasma::Service* serviceForSource(const QString& source);
52
void processPendingJobs();
55
QTimer m_pendingJobsTimer;
56
QList<JobView *> m_pendingJobs;
59
class JobView : public Plasma::DataContainer
62
Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewV2")
72
JobView(QObject *parent = 0);
76
JobView::State state();
78
void setTotalAmount(qlonglong amount, const QString &unit);
79
QString totalAmountSize() const;
80
QString totalAmountFiles() const;
82
void setProcessedAmount(qlonglong amount, const QString &unit);
84
void setSpeed(qlonglong bytesPerSecond);
85
QString speedString() const;
87
void setInfoMessage(const QString &infoMessage);
88
QString infoMessage() const;
90
bool setDescriptionField(uint number, const QString &name, const QString &value);
91
void clearDescriptionField(uint number);
93
void setAppName(const QString &appName);
94
void setAppIconName(const QString &appIconName);
95
void setCapabilities(int capabilities);
96
void setPercent(uint percent);
97
void setSuspended(bool suspended);
99
//vestigal, required to implement this dbus interface
100
void setDestUrl(const QDBusVariant &destUrl);
102
void terminate(const QString &errorMessage);
104
QDBusObjectPath objectPath() const;
106
void requestStateChange(State state);
112
void suspendRequested();
113
void resumeRequested();
114
void cancelRequested();
117
void timerEvent(QTimerEvent *event);
120
void scheduleUpdate();
122
int unitId(const QString &unit);
124
QDBusObjectPath m_objectPath;
125
QBasicTimer m_updateTimer;
131
// for ETA calculation we cache these values
133
qlonglong m_totalBytes;
134
qlonglong m_processedBytes;
138
QMap<QString, int> m_unitMap;