bind setAssociatedApplicationUrls

add notify signal for setAssociatedApplication
Reviewed-by: Eike Hein
This commit is contained in:
Marco Martin 2014-08-07 19:34:57 +02:00
parent 1585c9b26a
commit fad59eb01a
3 changed files with 33 additions and 2 deletions

View File

@ -31,4 +31,6 @@ Item {
PlasmaComponents.Label {
text: i18n("Hello world")
}
Plasmoid.associatedApplicationUrls: "file:///home"
}

View File

@ -449,7 +449,12 @@ int AppletInterface::apiVersion() const
void AppletInterface::setAssociatedApplication(const QString &string)
{
if (applet()->associatedApplication() == string) {
return;
}
applet()->setAssociatedApplication(string);
emit associatedApplicationChanged();
}
QString AppletInterface::associatedApplication() const
@ -457,6 +462,21 @@ QString AppletInterface::associatedApplication() const
return applet()->associatedApplication();
}
void AppletInterface::setAssociatedApplicationUrls(const QList<QUrl> &urls)
{
if (applet()->associatedApplicationUrls() == urls) {
return;
}
applet()->setAssociatedApplicationUrls(urls);
emit associatedApplicationUrlsChanged();
}
QList<QUrl> AppletInterface::associatedApplicationUrls() const
{
return applet()->associatedApplicationUrls();
}
void AppletInterface::setStatus(const Plasma::Types::ItemStatus &status)
{
applet()->setStatus(status);

View File

@ -140,9 +140,13 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
/**
* Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.
* TODO: a way to set associated application urls.
*/
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication NOTIFY associatedApplicationChanged)
/**
* Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.
*/
Q_PROPERTY(QList<QUrl> associatedApplicationUrls WRITE setAssociatedApplicationUrls READ associatedApplicationUrls NOTIFY associatedApplicationUrlsChanged)
// TODO: This was moved up from ContainmentInterface because it is required by the
// Task Manager applet (for "Show only tasks from this screen") and no Qt API exposes
@ -275,6 +279,9 @@ public:
void setAssociatedApplication(const QString &string);
QString associatedApplication() const;
void setAssociatedApplicationUrls(const QList<QUrl> &urls);
QList<QUrl> associatedApplicationUrls() const;
void setStatus(const Plasma::Types::ItemStatus &status);
Plasma::Types::ItemStatus status() const;
@ -327,6 +334,8 @@ Q_SIGNALS:
void busyChanged();
void screenChanged();
void hideOnWindowDeactivateChanged();
void associatedApplicationChanged();
void associatedApplicationUrlsChanged();
void userConfiguringChanged();
void globalShortcutChanged();