From c5e2a61a651b7ecf1a395390003e218b7ce51c24 Mon Sep 17 00:00:00 2001 From: Rob Scheepmaker Date: Wed, 2 Sep 2009 02:21:41 +0000 Subject: [PATCH] non compiling skeleton code svn path=/trunk/KDE/kdelibs/; revision=1018653 --- CMakeLists.txt | 11 +++- accessmanager.cpp | 115 +++++++++++++++++++++++++++++++++++ accessmanager.h | 113 ++++++++++++++++++++++++++++++++++ private/remoteservice.cpp | 52 ++++++++++++++++ private/remoteservice_p.h | 45 ++++++++++++++ private/remoteservicejob.cpp | 58 ++++++++++++++++++ private/remoteservicejob_p.h | 47 ++++++++++++++ private/serviceprovider.cpp | 107 ++++++++++++++++++++++++++++++++ private/serviceprovider_p.h | 47 ++++++++++++++ serviceaccessjob.cpp | 67 ++++++++++++++++++++ serviceaccessjob.h | 69 +++++++++++++++++++++ 11 files changed, 730 insertions(+), 1 deletion(-) create mode 100644 accessmanager.cpp create mode 100644 accessmanager.h create mode 100644 private/remoteservice.cpp create mode 100644 private/remoteservice_p.h create mode 100644 private/remoteservicejob.cpp create mode 100644 private/remoteservicejob_p.h create mode 100644 private/serviceprovider.cpp create mode 100644 private/serviceprovider_p.h create mode 100644 serviceaccessjob.cpp create mode 100644 serviceaccessjob.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dedc0a20..e1aa52f40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,8 @@ if(QT_QTOPENGL_FOUND AND OPENGL_FOUND) include_directories(${OPENGL_INCLUDE_DIR}) endif(QT_QTOPENGL_FOUND AND OPENGL_FOUND) +find_package(libQtJolie REQUIRED) + add_subdirectory(tests) add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1209) @@ -53,6 +55,7 @@ set(plasmagik_SRCS set(plasma_LIB_SRCS ${plasmagik_SRCS} abstractrunner.cpp + accessmanager.cpp animationdriver.cpp animator.cpp applet.cpp @@ -81,7 +84,10 @@ set(plasma_LIB_SRCS private/nativetabbar.cpp private/packages.cpp private/paneltoolbox.cpp + private/remoteservice.cpp + private/remoteservicejob.cpp private/runnerjobs.cpp + private/serviceprovider.cpp private/style.cpp private/toolbox.cpp private/tooltip.cpp @@ -96,6 +102,7 @@ set(plasma_LIB_SRCS scripting/runnerscript.cpp scripting/scriptengine.cpp service.cpp + serviceaccessjob.cpp servicejob.cpp svg.cpp theme.cpp @@ -157,7 +164,7 @@ endif(PHONON_FOUND) kde4_add_library(plasma SHARED ${plasma_LIB_SRCS}) -target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} knewstuff2 +target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} knewstuff2 libQtJolie ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY} threadweaver ${KDE4_SOLID_LIBS} ) if(X11_FOUND) @@ -199,6 +206,7 @@ install(FILES ${plasmagik_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/ CO set(plasma_LIB_INCLUDES abstractrunner.h + accessmanager.h animationdriver.h animator.h applet.h @@ -226,6 +234,7 @@ set(plasma_LIB_INCLUDES runnermanager.h runnersyntax.h service.h + serviceaccessjob.h servicejob.h svg.h theme.h diff --git a/accessmanager.cpp b/accessmanager.cpp new file mode 100644 index 000000000..623747e2e --- /dev/null +++ b/accessmanager.cpp @@ -0,0 +1,115 @@ +/* + * Copyright 2009 by Rob Scheepmaker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include "accessmanager.h" + +#include "service.h" +#include "serviceaccessjob.h" + +#include +#include + +#include +#include + +#include + +namespace Plasma +{ + +class AccessManagerPrivate +{ + public: + AccessManagerPrivate() + { + //TODO: store at a sensible place... kwallet keyring for private key maybe? + privateKey = QCA::PrivateKey::fromPemFile("/home/rob/plasma_private_key.pem"); + publicKey = QCA::PrivateKey::fromPemFile("/home/rob/plasma_public_key.pem"); + if (privateKey.isNull()) { + //generate public/private key pair + QCA::KeyGenerator generator; + privateKey = generator.createRSA(2048); + publicKey = privateKey.toPublicKey(); + privateKey.toPEMFile("/home/rob/plasma_private_key.pem"); + publicKey.toPEMFile("/home/rob/plasma_public_key.pem"); + } + }; + + ~AccessManagerPrivate() {}; + + //TODO: is this bool based authorisation management detailed enough? + QMap >; + //Needed for QCA support + QCA::Initializer initializer; + QCA:PrivateKey privateKey; + QCA:PrivateKey publicKey; +}; + +class AccessManagerSingleton +{ + public: + AccessManager self; +}; + +K_GLOBAL_STATIC(AccessManagerSingleton, privateAccessManagerSelf) + +AccessManager *AccessManager::self() +{ + return &privateAccessManagerSelf->self; +} + +AccessManager::AccessManager() + : d(new AccessManagerPrivate) +{ +} + +AccessManager::~AccessManager() +{ + delete d; +} + +Jolie::Message AccessManager::signMessage(Jolie::Message message) const +{ + //TODO:what about multiple interfaces? + QString host = QNetworkInterface::allAddresses().first(); + message.children("host") << Jolie::Value(host); + QByteArray serializedMessage = //serialize sodep message + QByteArray signature = d->privateKey->signMessage(MemoryRegion(serializedMessage)); + message.children("signature") << Jolie::Value(signature); + return message; +} + +ServiceAccessJob* AccessManager::accessService(KUrl location) const +{ + ServiceAccesJob *job = new ServiceAccessJob(location); + QTimer::singleShot(0, job, SLOT(slotStart())); + return job; +} + +ServiceAccessJob* AccessManager::accessService(const QString &jolieScript, + const QMap &initValues) const +{ + ServiceAccesJob *job = new ServiceAccessJob(jolieScript, initValues); + QTimer::singleShot(0, job, SLOT(slotStart())); + return job; +} + +} // Plasma namespace + +#include "accessmanager.moc" diff --git a/accessmanager.h b/accessmanager.h new file mode 100644 index 000000000..e65036704 --- /dev/null +++ b/accessmanager.h @@ -0,0 +1,113 @@ +/* + * Copyright 2009 by Rob Scheepmaker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef PLASMA_ACCESSMANAGER_H +#define PLASMA_ACCESSMANAGER_H + +#include "plasma_export.h" + +#include + +class QString; +class QMap; +class KUrl; + +namespace Plasma +{ + +class ServiceAccessJob; + +/** + * @class AccessManager plasma/accessmanager.h + * + * @short Allows access to remote Plasma::Service, Plasma::DataEngine and Plasma::Applet classes. + * + * This manager provides a way to access a Plasma::Service, Plasma::DataEngine or Plasma::Applet + * that is hosted on another machine. Besides functions to access those resources, this class is + * also the place that tracks which remote computers are allowed to access each published resource, + * and it provides a mechanism to discover services announced to the network through zeroconf or + * bluetooth. + * All url's passed to the access functions need to be valid JOLIE urls, that have this format: + * plasma://:/!/ + * All access function are asynchronous. The services need to be accessed over the network, and + * might even have to be authorized by the user of that machine first. All access functions + * therefore return a job that can be monitored to see when the service is ready for use. + * + * @since 4.4? + */ +class PLASMA_EXPORT AccessManager : public QObject +{ + Q_OBJECT + public: + /** + * Singleton pattern accessor. + */ + static AccessManager *self(); + + /** + * Access a native Plasma::Service hosted on another machine. + * + * @param location a valid JOLIE url + * @returns a job that can be monitored to see when access to the remote service is + * obtained, or if it failed. + */ + ServiceAccessJob* accessService(KUrl location) const; + + /** + * TODO: I think there should be a more elegant way to access SOAP services right? Plus if + * we want this to work with RemoteService, the JOLIE script is required to have the exact + * native plasma service interface.... which means, amonst others: provide an + * operationsDescription operation which returns valid ConfigXml. This way of accessing is + * easy enough, but I fear the creation of the jolieScript will become more complicated then + * it needs to be.... or we need to have some utility in the feature that automagically + * creates JOLIE script from WSDL... which would be totally awesome. + * Create a Plasma::Service that accesses a not native Plasma::Service like a SOAP service. + * To accomplish this you'll need to provide the name of a JOLIE script that accesses this + * service and has a valid interface (TODO: I'll need to provide a include for jolie scripts + * for this) and optionally a map that will be passed to the JOLIE script's init function, + * and can contain things like username/password, url etc. + * @param jolieScript filename of the jolie script. TODO: which path's to look? + * @param initValues map of strings>variants that will get passed to the jolie script's init + * function. + * @returns a job that can be monitored to see when access to the remote service is + * obtained, or if it failed. + */ + ServiceAccessJob* accessService(const QString &jolieScript, + const QMap &initValues) const; + + Jolie::Message signMessage(Jolie::Message message) const; + + //TODO: access functions for engines and applets... which are higher level things built on + //top of Plasma::Service, which means I'll first need to get services working and + //everything. + + //TODO: functions for service discovery through bluetooth and zeroconf + + private: + AccessManager(); + ~AccessManager(); + + AccessManagerPrivate * const d; + + friend class AccessManagerSingleton; +}; +} // Plasma namespace + +#endif + diff --git a/private/remoteservice.cpp b/private/remoteservice.cpp new file mode 100644 index 000000000..4cd31a947 --- /dev/null +++ b/private/remoteservice.cpp @@ -0,0 +1,52 @@ +/* + * Copyright © 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef REMOTESERVICE_H +#define REMOTESERVICE_H + +#include + +#include "remoteservice_p.h" +#include "remoteservicejob_p.h" + +namespace Plasma +{ + +RemoteService::RemoteService(QObject* parent, KUrl location) + : m_location(location), + m_client(Jolie::Client(location->host(), location->port())) +{ + Jolie::Message getOpDesc(location->path(), "getOperationNames"); + //TODO: async + Jolie::Message response = m_client->call(AccessManager::self()->signMessage(getOpDesc)); + QBuffer buffer(response.data().toByteArray()); + buffer.open(QBuffer::ReadWrite); + setOperationsScheme(&buffer); +} + +RemoteService::ServiceJob* createJob(const QString& operation, + QMap& parameters) +{ + return new RemoteServiceJob(m_location, operation, parameters, parent()); +} + +} //namespace Plasma + +#include "remoteservice_p.moc" + +#endif // REMOTESERVICE_H diff --git a/private/remoteservice_p.h b/private/remoteservice_p.h new file mode 100644 index 000000000..c4b784fe7 --- /dev/null +++ b/private/remoteservice_p.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2008 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef REMOTESERVICE_H +#define REMOTESERVICE_H + +#include "../service.h" + +namespace Plasma +{ + +class RemoteService : public Plasma::Service +{ + Q_OBJECT + + public: + RemoteService(QObject* parent, KUrl location); + + protected: + ServiceJob* createJob(const QString& operation, + QMap& parameters); + + private: + KUrl m_location; + +}; + +} //namespace Plasma + +#endif // REMOTESERVICE_H diff --git a/private/remoteservicejob.cpp b/private/remoteservicejob.cpp new file mode 100644 index 000000000..35aa1f5a4 --- /dev/null +++ b/private/remoteservicejob.cpp @@ -0,0 +1,58 @@ +/* + * Copyright © 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +#include + +#include "../servicejob.h" + +namespace Plasma +{ + +RemoteServiceJob::RemoteServiceJob(KUrl location, + const QString& operation, + QMap& parameters, + QObject* parent = 0); + : ServiceJob(location, operation, parameters, parent), + m_location(location) +{ +} + +void RemoteServiceJob::start() +{ + Jolie::Client client(location.host(), location.port()); + Jolie::Message message(location.path(), "startOperation"); + Jolie::Message response = client.call(AccessManager::self()->signMessage(message)); + //TODO:async + if (response.fault().isValid()) { + setErrorText(response.fault().data().toByteArray()); + return; + } + if (response.data().isDouble()) { + setResult(response.data().toDouble()); + } else if (response.data().isInt()) { + setResult(response.data().toInt()); + } else { + setResult(respoonse.data().toByteArray()); + } +} + +} // namespace Plasma + +#endif //REMOTESERVICEJOB_H diff --git a/private/remoteservicejob_p.h b/private/remoteservicejob_p.h new file mode 100644 index 000000000..618096201 --- /dev/null +++ b/private/remoteservicejob_p.h @@ -0,0 +1,47 @@ +/* + * Copyright © 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef REMOTESERVICEJOB_H +#define REMOTESERVICEJOB_H + +#include + +#include "../servicejob.h" + +namespace Plasma +{ + +class RemoteServiceJob : public Plasma::ServiceJob +{ + Q_OBJECT + + public: + RemoteServiceJob(KUrl location, + const QString& operation, + QMap& parameters, + QObject* parent = 0); + + void start(); + + private: + KUrl m_location; +}; + +} // namespace Plasma + +#endif //REMOTESERVICEJOB_H diff --git a/private/serviceprovider.cpp b/private/serviceprovider.cpp new file mode 100644 index 000000000..ceeea5eba --- /dev/null +++ b/private/serviceprovider.cpp @@ -0,0 +1,107 @@ +/* + * Copyright © 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef REMOTESERVICE_H +#define REMOTESERVICE_H + +#include "serviceprovider_p.h" + +namespace Plasma +{ + +ServiceProvider::ServiceProvider(Service *service) + : m_service(service) +{ + //we need some resource name and a redirect should be added under that name. the actual chosen + //resource name (a number might be appended by jolie to avoid conflicts), should probably be made + //available through a resourceName() function by the jolie adaptor, or maybe just a KUrl url() + //since that would be convenient when wanting to announce services on the network through + //zeroconf, and the resource name is easily obtained from there as well. + setResourceName(service->name()); + connect(AccessManager::self(), + SIGNAL(authorizationSuccesful(Plasma::Service *service, Jolie::Message)), + this, SLOT(messageAuthorized(Plasma::Service *service, Jolie::Message))); +} + +ServiceProvider::messageReceived(Jolie::Message message) +{ + //authorization occurs by checking the value of two children that are added to every + //message that get's sent by RemoteService (the client side of ServiceProvider): "host" + //(full hostname or ip) and "signature" (a digital signature made by encrypting a hash + //of the entire sodep message and verified by obtaining the public key from a PublicKeyService + //running at the computer sending this message. obviously this authorization needs to be + //async. + AccessManager::self()->authorize(this, message); +} + +ServiceProvider::sendOperationNames(Jolie::Message message) +{ + Jolie::Message response(resourceName(), message->operationName(), message->id()); + foreach (const QString &operationName, m_service->operationNames()) { + response.children("operationNames") << Jolie::Value(operationName); + } + sendMessage(response); +} + +ServiceProvider::sendOperationDescription(Jolie::Message message) +{ + QByteArray operationDescription = //serialize the operationDescription KConfigGroup. Hmm, reading the KConfigGroup apidox this seems rather ugly. It looks like it can only be done by using a KSharedConfig to write to a temporary file, and read that. Let's hope I'm wrong :p + Jolie::Message response(resourceName(), message->operationName(), message->id()); + response.setData(Jolie::Value(operationDescription)); + sendMessage(response); +} + +ServiceProvider::startOperationCall(Jolie::Message message) +{ + KConfigGroup description = //deserialize the KConfigGroup + m_service->startOperationCall(description); + //map finished signal through signalmapper to include the message, and connect to + //operationCompleted slot. +} + +ServiceProvider::messageAuthorized(Plasma::Service *service, Jolie::Message message) +{ + if (service != this) { + return; + } + + //would be lovely if this kind of stuff could be autogenerated code from xml like in dbus adaptors + if (message.operationName() == "getOperationNames") { + sendOperationNames(message); + } else if (message.operationName() == "getOperationDescription") { + sendOperationDescription(message); + } else if (message.operationName() == "startOperationCall") { + startOperationCall(message); + } +} + +ServiceProvider::operationCompleted(Plasma::ServiceJob *job, Jolie::Message message) +{ + Jolie::Message response(resourceName(), message->operationName(), message->id()); + response.setData(Jolie::Value(job->reply())); //convert first to one of the 3 supported sodep message types. double or int as values, serialize the variant otherwise + if (Jolie::Value(job->error())) { + reponse.children("error") << Jolie::Value(job->error()); + } + sendMessage(response); +} + +} //namespace Plasma + +#include "serviceprovider_p.moc" + +#endif //SERVICEPROVIDER_H diff --git a/private/serviceprovider_p.h b/private/serviceprovider_p.h new file mode 100644 index 000000000..a388ee09e --- /dev/null +++ b/private/serviceprovider_p.h @@ -0,0 +1,47 @@ +/* + * Copyright © 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef SERVICEPROVIDER_H +#define SERVICEPROVIDER_H + +namespace Plasma +{ + +class Service; + +class ServiceProvider : public Jolie::Interface +{ + Q_OBJECT + + public: + ServiceProvider(Service *service); + + protected: + messageReceived(Jolie::Message message); + + private: + void sendOperationNames(); + void sendOperationDescription(const QString &operationName); + void startOperationCall(const QString &destination, const QByteArray &description) + + Service *m_service; +}; + +} //namespace Plasma + +#endif //SERVICEPROVIDER_H diff --git a/serviceaccessjob.cpp b/serviceaccessjob.cpp new file mode 100644 index 000000000..5499a3c68 --- /dev/null +++ b/serviceaccessjob.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "serviceaccessjob.h" + +namespace Plasma +{ + +class ServiceAccessJobPrivate +{ +public: + ServiceAccessJobPrivate(ServiceJob *owner, KUrl location) + : q(owner), + location(location) + { + } + + void slotStart() + { + q->start(); + } + + ServiceAccessJob *q; + KUrl location; +}; + +ServiceAccessJob::ServiceAccessJob(KUrl location, QObject *parent) + : KJob(parent), + d(new ServiceAccessJobPrivate(this, location)) +{ +} + +ServiceAccessJob::~ServiceAccessJob() +{ + delete d; +} + +Service *ServiceAccessJob::service() const +{ + return d->destination; +} + +void ServiceAccessJob::start() +{ + //TODO: implement +} + +} // namespace Plasma + +#include "servicejob.moc" + diff --git a/serviceaccessjob.h b/serviceaccessjob.h new file mode 100644 index 000000000..4f2ea9894 --- /dev/null +++ b/serviceaccessjob.h @@ -0,0 +1,69 @@ +/* + * Copyright 2009 Rob Scheepmaker + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PLASMA_SERVICEACCESSJOB_H +#define PLASMA_SERVICEACCESSJOB_H + +#include +#include + +#include + +class KUrl; + +namespace Plasma +{ + +class ServiceAccessJobPrivate; + +/** + * @class ServiceAccessJob plasma/serviceaccessjob.h + * + * @short This class is used for asynchronously accessing a job published on a remote system. After + * calling AccessManager::accessService, monitor this job to track when the remote service is ready + * to be used, and to obtain the service when finished. + */ +class PLASMA_EXPORT ServiceAccessJob : public KJob +{ + Q_OBJECT + +public: + ~ServiceJob(); + + Service *service() const; + +protected: + /** + * Default constructor + * + * @arg location the location of the service + * @arg parent the parent object for this service + */ + ServiceJob(KUrl location, QObject *parent = 0); + +private: + Q_PRIVATE_SLOT(d, void slotStart()) + + ServiceAccessJobPrivate * const d; +}; + +} // namespace Plasma + +#endif // multiple inclusion guard +