generic: adjust to org.kde.JobView/org.kde.JobViewV2 interface changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-14 20:05:52 +03:00
parent a42d981176
commit 00cf2c8af7
7 changed files with 59 additions and 60 deletions

View file

@ -25,14 +25,13 @@ set(kuiserver_KDEINIT_PRIVATE
#<DBus Stuff>
#<JobView>
set(jobview_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobViewV2.xml)
set(jobview_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobView.xml)
qt4_add_dbus_adaptor(kuiserver_SRCS ${jobview_xml} jobview.h JobView jobviewadaptor )
qt4_add_dbus_interface(kuiserver_SRCS ${jobview_xml} jobview_interface )
#</JobView>
#<JobViewServer>
set(jobviewserver_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobViewServer.xml)
@ -43,7 +42,6 @@ set(kuiserver_KDEINIT_PRIVATE
qt4_add_dbus_adaptor(kuiserver_SRCS org.kde.kuiserver.xml progresslistmodel.h ProgressListModel kuiserveradaptor)
dbus_add_activation_service(org.kde.kuiserver.service.in)
#</DBus Stuff>
@ -55,6 +53,11 @@ add_executable( kuiserver ${kuiserver_SRCS})
target_link_libraries(kuiserver ${KDE4_KIO_LIBS})
install(TARGETS kuiserver ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(
TARGETS kuiserver ${INSTALL_TARGETS_DEFAULT_ARGS}
)
install( FILES kuiserver.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} )
install(
FILES kuiserver.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)

View file

@ -29,6 +29,8 @@
#include <QtDBus/QDBusPendingReply>
typedef QPair<QString, org::kde::JobView*> iFacePair;
JobView::JobView(uint jobId, QObject *parent)
: QObject(parent),
m_capabilities(-1),
@ -40,7 +42,7 @@ JobView::JobView(uint jobId, QObject *parent)
m_isTerminated(false),
m_currentPendingCalls(0)
{
new JobViewV2Adaptor(this);
new JobViewAdaptor(this);
m_objectPath.setPath(QString("/JobViewServer/JobView_%1").arg(m_jobId));
QDBusConnection::sessionBus().registerObject(m_objectPath.path(), this);
@ -54,7 +56,6 @@ void JobView::terminate(const QString &errorMessage)
{
QDBusConnection::sessionBus().unregisterObject(m_objectPath.path(), QDBusConnection::UnregisterTree);
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
kDebug(7024) << "making async call of terminate for: " << pair.first;
pair.second->asyncCall(QLatin1String("terminate"), errorMessage);
@ -92,7 +93,6 @@ void JobView::requestCancel()
void JobView::setSuspended(bool suspended)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setSuspended"), suspended);
}
@ -108,7 +108,6 @@ uint JobView::state() const
void JobView::setTotalAmount(qulonglong amount, const QString &unit)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setTotalAmount"), amount, unit);
}
@ -136,7 +135,6 @@ QString JobView::sizeTotal() const
void JobView::setProcessedAmount(qulonglong amount, const QString &unit)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setProcessedAmount"), amount, unit);
}
@ -163,7 +161,6 @@ QString JobView::sizeProcessed() const
void JobView::setPercent(uint value)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setPercent"), value);
}
@ -179,7 +176,6 @@ uint JobView::percent() const
void JobView::setSpeed(qulonglong bytesPerSecond)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setSpeed"), bytesPerSecond);
}
@ -195,7 +191,6 @@ QString JobView::speed() const
void JobView::setInfoMessage(const QString &infoMessage)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setInfoMessage"), infoMessage);
}
@ -211,7 +206,6 @@ QString JobView::infoMessage() const
bool JobView::setDescriptionField(uint number, const QString &name, const QString &value)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setDescriptionField"), number, name, value);
}
@ -229,7 +223,6 @@ bool JobView::setDescriptionField(uint number, const QString &name, const QStrin
void JobView::clearDescriptionField(uint number)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("clearDescriptionField"), number);
}
@ -242,7 +235,6 @@ void JobView::clearDescriptionField(uint number)
void JobView::setAppName(const QString &appName)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setAppName"), appName);
}
@ -257,7 +249,6 @@ QString JobView::appName() const
void JobView::setAppIconName(const QString &appIconName)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setAppIconName"), appIconName);
}
@ -272,7 +263,6 @@ QString JobView::appIconName() const
void JobView::setCapabilities(int capabilities)
{
typedef QPair<QString, org::kde::JobViewV2*> iFacePair;
foreach(const iFacePair &pair, m_objectPaths) {
pair.second->asyncCall(QLatin1String("setCapabilities"), capabilities);
}
@ -313,10 +303,9 @@ QVariant JobView::destUrl() const
void JobView::addJobContact(const QString& objectPath, const QString& address)
{
org::kde::JobViewV2 *client =
new org::kde::JobViewV2(address, objectPath, QDBusConnection::sessionBus());
org::kde::JobView *client = new org::kde::JobView(address, objectPath, QDBusConnection::sessionBus());
QPair<QString, org::kde::JobViewV2*> pair(objectPath, client);
iFacePair pair(objectPath, client);
//propagate any request signals from the client's job, up to us, then to the parent KJob
//otherwise e.g. the pause button on plasma's tray would be broken.
@ -371,7 +360,7 @@ void JobView::addJobContact(const QString& objectPath, const QString& address)
QStringList JobView::jobContacts()
{
QStringList output;
QHash<QString, QPair<QString, org::kde::JobViewV2*> >::const_iterator it = m_objectPaths.constBegin();
QHash<QString, iFacePair >::const_iterator it = m_objectPaths.constBegin();
for (; it != m_objectPaths.constEnd(); ++it) {
//for debug purposes only
output.append("service name of the interface: " + it.key() + "; objectPath for the interface: " + it.value().first);
@ -407,7 +396,7 @@ void JobView::pendingCallFinished(RequestViewCallWatcher* watcher)
// do basically the same as terminate() except only for service
// since this one missed out.
org::kde::JobViewV2 *client = new org::kde::JobViewV2(address, objectPath.path(), QDBusConnection::sessionBus());
org::kde::JobView *client = new org::kde::JobView(address, objectPath.path(), QDBusConnection::sessionBus());
kDebug(7024) << "making async terminate call to objectPath: " << objectPath.path();
kDebug(7024) << "this was because a pending call was finished, but the job was already terminated before it returned.";

View file

@ -29,12 +29,12 @@
#include <kuiserversettings.h>
class RequestViewCallWatcher;
class OrgKdeJobViewV2Interface;
class OrgKdeJobViewInterface;
class JobView : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewV2")
Q_CLASSINFO("D-Bus Interface", "org.kde.JobView")
public:
@ -102,8 +102,6 @@ public:
QDBusObjectPath objectPath() const;
/**
* Set the dest Url of the job...
* sent from the jobtracker (once upon construction)
@ -129,7 +127,6 @@ public:
void requestResume();
void requestCancel();
/**
* Called by the model.
* Lets us know that a job at @p objectPath is
@ -182,29 +179,17 @@ private Q_SLOTS:
private:
int m_capabilities; ///< The capabilities of the job
QString m_applicationName; ///< The application name
QString m_appIconName; ///< The icon name
QString m_sizeTotal; ///< The total size of the operation
QString m_sizeProcessed; ///< The processed size at the moment(amount completed)
QString m_speed; ///< The current speed of the operation (human readable, example, "3Mb/s")
int m_percent; ///< The current percent completed of the job
QString m_infoMessage; ///< The information message to be shown
QString m_error; ///< The error message of the job, set when it's terminated
QString m_totalUnit; ///< The unit used in setTotalAmount
qulonglong m_totalAmount; ///< The amount used in setTotalAmount
QString m_processUnit; ///< The unit used in setProcessedAmount
qulonglong m_processAmount; ///< The processed amount (setProcessedAmount)
QHash<uint, QPair<QString, QString> > m_descFields;
@ -217,7 +202,7 @@ private:
* All for the client:
* <address name, <objectPath, interface> >
*/
QHash<QString, QPair<QString, OrgKdeJobViewV2Interface*> > m_objectPaths;
QHash<QString, QPair<QString, OrgKdeJobViewInterface*> > m_objectPaths;
const uint m_jobId;
JobState m_state; ///< Current state of this job

View file

@ -278,8 +278,7 @@ void ProgressListModel::registerService(const QString &serviceName, const QStrin
//tell this new client to create all of the same jobs that we currently have.
//also connect them so that when the method comes back, it will return a
//QDBusObjectPath value, which is where we can contact that job, within "org.kde.JobViewV2"
//TODO: KDE5 remember to replace current org.kde.JobView interface with the V2 one.. (it's named V2 for compat. reasons).
//QDBusObjectPath value, which is where we can contact that job, within "org.kde.JobView"
//TODO: this falls victim to what newJob used to be vulnerable to...async calls returning too slowly and a terminate ensuing before that.
// it may not be a problem (yet), though.

View file

@ -9,13 +9,36 @@ set(kuiserver_engine_SRCS
jobaction.cpp
)
qt4_add_dbus_adaptor(kuiserver_engine_SRCS ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobViewV2.xml kuiserverengine.h JobView jobviewadaptor )
qt4_add_dbus_adaptor(kuiserver_engine_SRCS ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobViewServer.xml kuiserverengine.h KuiserverEngine jobviewserveradaptor )
qt4_add_dbus_adaptor(kuiserver_engine_SRCS
${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobView.xml
kuiserverengine.h
JobView
jobviewadaptor
)
qt4_add_dbus_adaptor(kuiserver_engine_SRCS
${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.JobViewServer.xml
kuiserverengine.h
KuiserverEngine
jobviewserveradaptor
)
kde4_add_plugin(plasma_engine_applicationjobs ${kuiserver_engine_SRCS})
target_link_libraries(plasma_engine_applicationjobs ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS})
target_link_libraries(plasma_engine_applicationjobs
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${KDE4_PLASMA_LIBS}
)
install(TARGETS plasma_engine_applicationjobs DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(FILES plasma-dataengine-applicationjobs.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} )
install(FILES applicationjobs.operations DESTINATION ${KDE4_DATA_INSTALL_DIR}/plasma/services)
install(
TARGETS plasma_engine_applicationjobs
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
install(
FILES plasma-dataengine-applicationjobs.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)
install(
FILES applicationjobs.operations
DESTINATION ${KDE4_DATA_INSTALL_DIR}/plasma/services
)

View file

@ -47,7 +47,7 @@ JobView::JobView(QObject* parent)
m_jobId = ++s_jobId;
setObjectName(QString("Job %1").arg(s_jobId));
new JobViewV2Adaptor(this);
new JobViewAdaptor(this);
m_objectPath.setPath(QString("/DataEngine/applicationjobs/JobView_%1").arg(m_jobId));
QDBusConnection::sessionBus().registerObject(m_objectPath.path(), this);

View file

@ -59,7 +59,7 @@ private:
class JobView : public Plasma::DataContainer
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewV2")
Q_CLASSINFO("D-Bus Interface", "org.kde.JobView")
public:
enum State {