add a new property in containment, for an edit mode
Summary: used for opening the handles when the toolbox is open or potentially other places Test Plan: handles open Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: plasma-devel, #frameworks Tags: #plasma, #frameworks Differential Revision: https://phabricator.kde.org/D5153
This commit is contained in:
parent
088a79d131
commit
244baaf928
@ -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<Plasma::Containment *>(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<QMimeData*>(mimeDataProxy);
|
||||
|
@ -77,6 +77,14 @@ class ContainmentInterface : public AppletInterface
|
||||
*/
|
||||
Q_PROPERTY(QList<QObject *> 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<ContainmentInterface *>(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<Plasma::Containment> m_containment;
|
||||
QWeakPointer<QMenu> m_contextMenu;
|
||||
int m_wheelDelta;
|
||||
bool m_editMode : 1;
|
||||
friend class AppletInterface;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user