2009-09-02 04:21:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2009 by Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
#include <QtCore/QList>
|
2009-09-02 04:21:41 +02:00
|
|
|
#include <QtCore/QObject>
|
2009-09-02 04:27:16 +02:00
|
|
|
#include <QtCore/QString>
|
|
|
|
|
2009-09-02 08:18:36 +02:00
|
|
|
#include <kdebug.h>
|
2009-09-02 04:27:16 +02:00
|
|
|
#include "accessappletjob.h"
|
|
|
|
#include "packagemetadata.h"
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
class QString;
|
|
|
|
class KUrl;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
class AccessManagerPrivate;
|
2009-09-02 04:21:41 +02:00
|
|
|
class ServiceAccessJob;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class AccessManager plasma/accessmanager.h <Plasma/AccessManager>
|
|
|
|
*
|
2009-09-02 04:27:16 +02:00
|
|
|
* @short Allows access to remote Plasma::Applet classes.
|
2009-09-02 04:21:41 +02:00
|
|
|
*
|
2009-09-02 04:27:16 +02:00
|
|
|
* This manager provides a way to access a plasmoid that is hosted on another machine. It also
|
|
|
|
* provides a mechanism to discover services announced to the network through zeroconf or
|
2009-09-02 04:21:41 +02:00
|
|
|
* bluetooth.
|
|
|
|
*
|
2009-09-02 04:27:16 +02:00
|
|
|
* @since 4.4
|
2009-09-02 04:21:41 +02:00
|
|
|
*/
|
2009-09-02 04:27:16 +02:00
|
|
|
|
2009-09-02 04:21:41 +02:00
|
|
|
class PLASMA_EXPORT AccessManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-09-02 04:27:16 +02:00
|
|
|
|
2009-09-02 04:21:41 +02:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Singleton pattern accessor.
|
|
|
|
*/
|
|
|
|
static AccessManager *self();
|
|
|
|
|
|
|
|
/**
|
2009-09-02 04:27:16 +02:00
|
|
|
* Access a native plasmoid hosted on another machine.
|
|
|
|
* @param location the location of the remote plasmoids. Exmples of valid urls:
|
|
|
|
* plasma://ip:port/resourceName
|
|
|
|
* zeroconf://PlasmoidName
|
|
|
|
* @returns a job that can be used to track when a remote plasmoid is ready for use, and to
|
|
|
|
* obtain the applet when the package is sent over.
|
2009-09-02 04:21:41 +02:00
|
|
|
*/
|
2009-09-02 04:27:16 +02:00
|
|
|
AccessAppletJob *accessRemoteApplet(const KUrl &location) const;
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
/**
|
2009-09-02 04:27:16 +02:00
|
|
|
* @returns a map mapping service names to the plasmoid's metadata.
|
2009-09-02 04:21:41 +02:00
|
|
|
*/
|
2009-09-02 04:27:16 +02:00
|
|
|
QList<PackageMetadata> remoteApplets() const;
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* fires when a AccessAppletJob is finished.
|
|
|
|
*/
|
|
|
|
void finished(Plasma::AccessAppletJob*);
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
/**
|
|
|
|
* fires when a new plasmoid is announced on the network.
|
|
|
|
*/
|
|
|
|
void remoteAppletAnnounced(Plasma::PackageMetadata metadata);
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
/**
|
|
|
|
* fires when an announced plasmoid disappears from the network.
|
|
|
|
*/
|
|
|
|
void remoteAppletUnannounced(Plasma::PackageMetadata metadata);
|
2009-09-02 04:21:41 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
AccessManager();
|
|
|
|
~AccessManager();
|
|
|
|
|
|
|
|
AccessManagerPrivate * const d;
|
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
Q_PRIVATE_SLOT(d, void slotJobFinished(KJob*))
|
|
|
|
Q_PRIVATE_SLOT(d, void slotAddService(DNSSD::RemoteService::Ptr service))
|
|
|
|
Q_PRIVATE_SLOT(d, void slotRemoveService(DNSSD::RemoteService::Ptr service))
|
|
|
|
|
|
|
|
friend class AccessManagerPrivate;
|
2009-09-02 04:21:41 +02:00
|
|
|
friend class AccessManagerSingleton;
|
|
|
|
};
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|