2009-09-02 04:21:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#ifndef PLASMA_REMOTESERVICE_P_H
|
|
|
|
#define PLASMA_REMOTESERVICE_P_H
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
#include <QtCore/QQueue>
|
|
|
|
#include <QtJolie/Message>
|
|
|
|
|
2009-09-03 01:49:46 +02:00
|
|
|
#include "../service.h"
|
2009-09-02 04:27:16 +02:00
|
|
|
|
|
|
|
namespace Jolie
|
|
|
|
{
|
|
|
|
class Client;
|
|
|
|
class PendingCallWatcher;
|
|
|
|
}
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
class ClientPinRequest;
|
|
|
|
class RemoteServiceJob;
|
|
|
|
|
2009-09-02 04:21:41 +02:00
|
|
|
class RemoteService : public Plasma::Service
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2009-09-02 04:27:16 +02:00
|
|
|
RemoteService(QObject* parent);
|
2009-09-02 04:21:41 +02:00
|
|
|
RemoteService(QObject* parent, KUrl location);
|
2009-09-02 04:27:16 +02:00
|
|
|
~RemoteService();
|
|
|
|
|
|
|
|
void setLocation(const KUrl &location);
|
|
|
|
QString location() const;
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-10-20 20:22:38 +02:00
|
|
|
bool isReady() const;
|
|
|
|
bool isBusy() const;
|
|
|
|
|
2009-09-02 04:21:41 +02:00
|
|
|
protected:
|
|
|
|
ServiceJob* createJob(const QString& operation,
|
2011-05-26 19:01:44 +02:00
|
|
|
QHash<QString,QVariant>& parameters);
|
2009-09-02 04:27:16 +02:00
|
|
|
void registerOperationsScheme();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void callCompleted(Jolie::PendingCallWatcher *watcher);
|
|
|
|
void slotFinished();
|
|
|
|
void slotGotPin(Plasma::ClientPinRequest *request);
|
|
|
|
void slotUpdateEnabledOperations();
|
|
|
|
void slotReadyForRemoteAccess();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Jolie::Message signMessage(const Jolie::Message &message) const;
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
private:
|
2009-09-02 04:27:16 +02:00
|
|
|
KUrl m_location;
|
|
|
|
Jolie::Client *m_client;
|
|
|
|
QByteArray m_token;
|
|
|
|
QByteArray m_operationsScheme;
|
|
|
|
bool m_ready;
|
|
|
|
QQueue<RemoteServiceJob*> m_queue;
|
|
|
|
bool m_busy;
|
|
|
|
QString m_pin;
|
|
|
|
QString m_uuid;
|
|
|
|
|
|
|
|
friend class RemoteServiceJob;
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace Plasma
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#endif // PLASMA_REMOTESERVICE_P_H
|