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
|
|
|
|
|
2009-09-03 01:49:46 +02:00
|
|
|
#include "accessappletjob.h"
|
|
|
|
#include "packagemetadata.h"
|
2009-09-02 04:21:41 +02:00
|
|
|
#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: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-03 01:49:46 +02:00
|
|
|
* This manager provides a way to access an applet (either a binary or packaged one) that is hosted
|
|
|
|
* on another machine. It also provides a mechanism to discover services announced to the network
|
|
|
|
* through zeroconf.
|
2009-09-02 04:21:41 +02:00
|
|
|
*
|
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-03 01:49:46 +02:00
|
|
|
* @returns a list of applets that are announced on the network through zeroconf. Use the
|
|
|
|
* remoteLocation() function in PackageMetadata to obtain an url to pass to
|
|
|
|
* accessRemoteApplet in AccessManager if you want to access one of these applets.
|
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:
|
|
|
|
/**
|
2009-09-03 01:49:46 +02:00
|
|
|
* fires when an AccessAppletJob is finished.
|
2009-09-02 04:27:16 +02:00
|
|
|
*/
|
2009-09-03 01:49:46 +02:00
|
|
|
void finished(Plasma::AccessAppletJob *);
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
/**
|
2009-09-03 01:49:46 +02:00
|
|
|
* fires when a new applet is announced on the network.
|
2009-09-02 04:27:16 +02:00
|
|
|
*/
|
|
|
|
void remoteAppletAnnounced(Plasma::PackageMetadata metadata);
|
2009-09-02 04:21:41 +02:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
/**
|
2009-09-03 01:49:46 +02:00
|
|
|
* fires when an announced applet disappears from the network.
|
2009-09-02 04:27:16 +02:00
|
|
|
*/
|
|
|
|
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
|
|
|
|
|