Move the screen prop up into AppletInterface.
This makes 'plasmoid.screen' available not just for con- tainments, but for all applets, as required by the Task Manager applet. Unfortunately Qt's APIs don't expose any screen numbering, so that route was off the table. Ack'ed by Marco Martin.
This commit is contained in:
parent
47efcc2f03
commit
c4075ddaed
@ -80,6 +80,10 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
||||
connect(m_appletScriptEngine, &DeclarativeAppletScript::contextChanged,
|
||||
this, &AppletInterface::contextChanged);
|
||||
|
||||
if (applet()->containment()) {
|
||||
connect(applet()->containment(), &Plasma::Containment::screenChanged,
|
||||
this, &ContainmentInterface::screenChanged);
|
||||
}
|
||||
|
||||
m_qmlObject = new QmlObject(this);
|
||||
m_qmlObject->setInitializationDelayed(true);
|
||||
@ -597,6 +601,15 @@ Plasma::Types::ItemStatus AppletInterface::status() const
|
||||
return applet()->status();
|
||||
}
|
||||
|
||||
int AppletInterface::screen() const
|
||||
{
|
||||
if (applet()->containment()) {
|
||||
return applet()->containment()->screen();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString AppletInterface::downloadPath(const QString &file)
|
||||
{
|
||||
const QString downloadDir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/Plasma/" + applet()->pluginInfo().pluginName() + '/';
|
||||
|
@ -71,6 +71,12 @@ class AppletInterface : public QQuickItem
|
||||
Q_PROPERTY(Plasma::Types::ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
|
||||
|
||||
// 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
|
||||
// screen numbering. An alternate solution that doesn't extend the applet interface
|
||||
// would be preferrable if found.
|
||||
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
||||
|
||||
//Size hints Note that the containments may chose to not respect them.
|
||||
Q_PROPERTY(qreal minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
|
||||
Q_PROPERTY(qreal minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
|
||||
@ -149,6 +155,8 @@ public:
|
||||
void setStatus(const Plasma::Types::ItemStatus &status);
|
||||
Plasma::Types::ItemStatus status() const;
|
||||
|
||||
int screen() const;
|
||||
|
||||
QString activeConfig() const;
|
||||
void setActiveConfig(const QString &name);
|
||||
|
||||
@ -179,6 +187,7 @@ Q_SIGNALS:
|
||||
void backgroundHintsChanged();
|
||||
void busyChanged();
|
||||
void expandedChanged();
|
||||
void screenChanged();
|
||||
|
||||
void minimumWidthChanged();
|
||||
void minimumHeightChanged();
|
||||
|
@ -63,8 +63,6 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
|
||||
this, &ContainmentInterface::appletRemovedForward);
|
||||
connect(containment(), &Plasma::Containment::appletAdded,
|
||||
this, &ContainmentInterface::appletAddedForward);
|
||||
connect(containment(), &Plasma::Containment::screenChanged,
|
||||
this, &ContainmentInterface::screenChanged);
|
||||
connect(containment(), &Plasma::Containment::activityChanged,
|
||||
this, &ContainmentInterface::activityChanged);
|
||||
connect(containment(), &Plasma::Containment::wallpaperChanged,
|
||||
@ -127,11 +125,6 @@ void ContainmentInterface::setContainmentType(Plasma::Types::ContainmentType typ
|
||||
m_appletScriptEngine->setContainmentType(type);
|
||||
}
|
||||
|
||||
int ContainmentInterface::screen() const
|
||||
{
|
||||
return containment()->screen();
|
||||
}
|
||||
|
||||
void ContainmentInterface::lockWidgets(bool locked)
|
||||
{
|
||||
containment()->setImmutability(!locked ? Plasma::Types::Mutable : Plasma::Types::UserImmutable);
|
||||
|
@ -40,7 +40,6 @@ class ContainmentInterface : public AppletInterface
|
||||
Q_PROPERTY(QList <QObject *> applets READ applets NOTIFY appletsChanged)
|
||||
Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper)
|
||||
Q_PROPERTY(Plasma::Types::ContainmentType containmentType READ containmentType WRITE setContainmentType)
|
||||
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
||||
Q_PROPERTY(QString activity READ activity NOTIFY activityChanged)
|
||||
|
||||
public:
|
||||
@ -57,7 +56,6 @@ public:
|
||||
bool drawWallpaper();
|
||||
Plasma::Types::ContainmentType containmentType() const;
|
||||
void setContainmentType(Plasma::Types::ContainmentType type);
|
||||
int screen() const;
|
||||
|
||||
QString activity() const;
|
||||
|
||||
@ -78,7 +76,6 @@ protected:
|
||||
Q_SIGNALS:
|
||||
void appletAdded(QObject *applet, int x, int y);
|
||||
void appletRemoved(QObject *applet);
|
||||
void screenChanged();
|
||||
void activityChanged();
|
||||
void availableScreenRegionChanged();
|
||||
void appletsChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user