document DataSource

This commit is contained in:
Marco Martin 2011-12-23 13:28:02 +01:00
parent f75cef4f87
commit 922029e27b

View File

@ -54,31 +54,61 @@ public:
DataSource(QObject* parent=0);
/**
* true if the connection to the Plasma DataEngine is valid
*/
Q_PROPERTY(bool valid READ valid)
bool valid() const {return m_dataEngine && m_dataEngine->isValid();}
/**
* Polling interval in milliseconds when the data will be fetched again. If 0 no polling will be done.
*/
Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged)
int interval() const {return m_interval;}
void setInterval(const int interval);
/**
* Plugin name of the Plasma DataEngine
*/
Q_PROPERTY(QString dataEngine READ engine WRITE setEngine NOTIFY engineChanged)
Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged)
QString engine() const {return m_engine;}
void setEngine(const QString &e);
/**
* String array of all the source names connected to the DataEngine
*/
Q_PROPERTY(QStringList connectedSources READ connectedSources WRITE setConnectedSources NOTIFY connectedSourcesChanged)
QStringList connectedSources() const {return m_connectedSources;}
void setConnectedSources(const QStringList &s);
/**
* Read only string array of all the sources available from the DataEngine (connected or not)
*/
Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged)
QStringList sources() const {if (m_dataEngine) return m_dataEngine->sources(); else return QStringList();}
/**
* All the data fetched by this dataengine.
* This is an hash of hashes. At the first level, there are the source names, at the secons, they keys set by the DataEngine
*/
Q_PROPERTY(QVariantHash data READ data NOTIFY dataChanged);
QVariantHash data() const {return m_data;}
/**
* @returns a Plasma::Service given a source name
* @arg QString source source name we want a service of
*/
Q_INVOKABLE Plasma::Service *serviceForSource(const QString &source);
/**
* Connect a new source. It adds it to connectedSources
*/
Q_INVOKABLE void connectSource(const QString &source);
/**
* Disconnects from a DataEngine Source. It also removes it from connectedSources
*/
Q_INVOKABLE void disconnectSource(const QString &source);
protected Q_SLOTS: