diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index f2c4fbfcc..2ba4a8218 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -61,7 +61,8 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, cons : AppletInterface(parent, args), m_wallpaperInterface(0), m_activityInfo(0), - m_wheelDelta(0) + m_wheelDelta(0), + m_editMode(false) { m_containment = static_cast(appletScript()->applet()->containment()); @@ -409,6 +410,21 @@ QPointF ContainmentInterface::adjustToAvailableScreenRegion(int x, int y, int w, return rect.topLeft(); } +bool ContainmentInterface::isEditMode() const +{ + return m_editMode; +} + +void ContainmentInterface::setEditMode(bool edit) +{ + if (edit == m_editMode) { + return; + } + + m_editMode = edit; + emit editModeChanged(); +} + void ContainmentInterface::processMimeData(QObject *mimeDataProxy, int x, int y, KIO::DropJob *dropJob) { QMimeData* mime = qobject_cast(mimeDataProxy); diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.h b/src/scriptengines/qml/plasmoid/containmentinterface.h index a95b7118e..aa2df487d 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.h +++ b/src/scriptengines/qml/plasmoid/containmentinterface.h @@ -77,6 +77,14 @@ class ContainmentInterface : public AppletInterface */ Q_PROPERTY(QList actions READ actions NOTIFY actionsChanged) + /** + * True when the containment is in an edit mode that allows to move + * things around: it's different from userConfiguring as it's about + * editing plasmoids inside the containment, rather than the containment + * settings dialog itself + */ + Q_PROPERTY(bool editMode READ isEditMode WRITE setEditMode NOTIFY editModeChanged) + public: ContainmentInterface(DeclarativeAppletScript *parent, const QVariantList &args = QVariantList()); @@ -141,6 +149,9 @@ public: */ Q_INVOKABLE QPointF adjustToAvailableScreenRegion(int x, int y, int w, int h) const; + bool isEditMode() const; + void setEditMode(bool edit); + static ContainmentInterface *qmlAttachedProperties(QObject *object) { return qobject_cast(AppletQuickItem::qmlAttachedProperties(object)); @@ -179,6 +190,7 @@ Q_SIGNALS: void drawWallpaperChanged(); void containmentTypeChanged(); void actionsChanged(); + void editModeChanged(); protected Q_SLOTS: void appletAddedForward(Plasma::Applet *applet); @@ -205,6 +217,7 @@ private: QPointer m_containment; QWeakPointer m_contextMenu; int m_wheelDelta; + bool m_editMode : 1; friend class AppletInterface; };