make editMode a corona global property
Summary: The plans are to switch on/off the whole plasma shell into edit mode. For this it needs to be a global corona property, rather then just containmentInterface. Plasmashell would expose a dbus call to set it from systemsettings Test Plan: plasmoid.editMode=true still works Reviewers: #plasma, #vdg, ngraham Reviewed By: #vdg, ngraham Subscribers: ngraham, GB_2, broulik, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D24239
This commit is contained in:
parent
d5a5d07f0f
commit
c621ebe572
@ -380,6 +380,26 @@ void Corona::setImmutability(const Types::ImmutabilityType immutable)
|
|||||||
cg.writeEntry("immutability", (int)d->immutability);
|
cg.writeEntry("immutability", (int)d->immutability);
|
||||||
requestConfigSync();
|
requestConfigSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->immutability != Types::Mutable) {
|
||||||
|
d->editMode = false;
|
||||||
|
emit editModeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Corona::setEditMode(bool edit)
|
||||||
|
{
|
||||||
|
if (d->immutability != Plasma::Types::Mutable || edit == d->editMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->editMode = edit;
|
||||||
|
emit editModeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Corona::isEditMode() const
|
||||||
|
{
|
||||||
|
return d->editMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
|
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
|
||||||
|
@ -257,6 +257,21 @@ public:
|
|||||||
*/
|
*/
|
||||||
Types::ImmutabilityType immutability() const;
|
Types::ImmutabilityType immutability() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Corona globally into "edit mode"
|
||||||
|
* Only when the corona is of mutable type can be set of edit mode.
|
||||||
|
* This indicates the UI to make easy for the user to manipulate applets.
|
||||||
|
* @param edit
|
||||||
|
* @since 5.63
|
||||||
|
*/
|
||||||
|
void setEditMode(bool edit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns true if the corona is in edit mode
|
||||||
|
* @since 5.63
|
||||||
|
*/
|
||||||
|
bool isEditMode() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Load applet layout from a config file. The results will be added to the
|
* Load applet layout from a config file. The results will be added to the
|
||||||
@ -358,6 +373,13 @@ Q_SIGNALS:
|
|||||||
*/
|
*/
|
||||||
void screenAdded(int id);
|
void screenAdded(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted when the editMode state changes
|
||||||
|
* @see isEditMode()
|
||||||
|
* @since 5.63
|
||||||
|
*/
|
||||||
|
void editModeChanged();
|
||||||
|
|
||||||
#ifndef PLASMA_NO_DEPRECATED
|
#ifndef PLASMA_NO_DEPRECATED
|
||||||
/**
|
/**
|
||||||
* Emitted when the package for this corona has been changed.
|
* Emitted when the package for this corona has been changed.
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
QList<Containment *> containments;
|
QList<Containment *> containments;
|
||||||
KActionCollection actions;
|
KActionCollection actions;
|
||||||
int containmentsStarting;
|
int containmentsStarting;
|
||||||
|
bool editMode = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,7 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, cons
|
|||||||
: AppletInterface(parent, args),
|
: AppletInterface(parent, args),
|
||||||
m_wallpaperInterface(nullptr),
|
m_wallpaperInterface(nullptr),
|
||||||
m_activityInfo(nullptr),
|
m_activityInfo(nullptr),
|
||||||
m_wheelDelta(0),
|
m_wheelDelta(0)
|
||||||
m_editMode(false)
|
|
||||||
{
|
{
|
||||||
m_containment = static_cast<Plasma::Containment *>(appletScript()->applet()->containment());
|
m_containment = static_cast<Plasma::Containment *>(appletScript()->applet()->containment());
|
||||||
|
|
||||||
@ -72,6 +71,9 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, cons
|
|||||||
connect(m_containment.data(), &Plasma::Containment::appletAdded,
|
connect(m_containment.data(), &Plasma::Containment::appletAdded,
|
||||||
this, &ContainmentInterface::appletAddedForward);
|
this, &ContainmentInterface::appletAddedForward);
|
||||||
|
|
||||||
|
connect(m_containment->corona(), &Plasma::Corona::editModeChanged,
|
||||||
|
this, &ContainmentInterface::editModeChanged);
|
||||||
|
|
||||||
if (!m_appletInterfaces.isEmpty()) {
|
if (!m_appletInterfaces.isEmpty()) {
|
||||||
emit appletsChanged();
|
emit appletsChanged();
|
||||||
}
|
}
|
||||||
@ -402,23 +404,19 @@ QPointF ContainmentInterface::adjustToAvailableScreenRegion(int x, int y, int w,
|
|||||||
return rect.topLeft();
|
return rect.topLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction *ContainmentInterface::globalAction(QString name) const
|
||||||
|
{
|
||||||
|
return m_containment->corona()->actions()->action(name);
|
||||||
|
}
|
||||||
|
|
||||||
bool ContainmentInterface::isEditMode() const
|
bool ContainmentInterface::isEditMode() const
|
||||||
{
|
{
|
||||||
return m_editMode;
|
return m_containment->corona()->isEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainmentInterface::setEditMode(bool edit)
|
void ContainmentInterface::setEditMode(bool edit)
|
||||||
{
|
{
|
||||||
if (edit == m_editMode) {
|
m_containment->corona()->setEditMode(edit);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_containment->immutability() != Plasma::Types::Mutable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_editMode = edit;
|
|
||||||
emit editModeChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainmentInterface::processMimeData(QObject *mimeDataProxy, int x, int y, KIO::DropJob *dropJob)
|
void ContainmentInterface::processMimeData(QObject *mimeDataProxy, int x, int y, KIO::DropJob *dropJob)
|
||||||
|
@ -79,10 +79,11 @@ class ContainmentInterface : public AppletInterface
|
|||||||
Q_PROPERTY(QList<QObject *> actions READ actions NOTIFY actionsChanged)
|
Q_PROPERTY(QList<QObject *> actions READ actions NOTIFY actionsChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True when the containment is in an edit mode that allows to move
|
* True when the Plasma Shell is in an edit mode that allows to move
|
||||||
* things around: it's different from userConfiguring as it's about
|
* things around: it's different from userConfiguring as it's about
|
||||||
* editing plasmoids inside the containment, rather than the containment
|
* editing plasmoids inside the containment, rather than the containment
|
||||||
* settings dialog itself
|
* settings dialog itself.
|
||||||
|
* This is global for the whole Plasma process, all containments will have the same value for editMode
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(bool editMode READ isEditMode WRITE setEditMode NOTIFY editModeChanged)
|
Q_PROPERTY(bool editMode READ isEditMode WRITE setEditMode NOTIFY editModeChanged)
|
||||||
|
|
||||||
@ -150,6 +151,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE QPointF adjustToAvailableScreenRegion(int x, int y, int w, int h) const;
|
Q_INVOKABLE QPointF adjustToAvailableScreenRegion(int x, int y, int w, int h) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns a named action from global Corona's actions
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QAction *globalAction(QString name) const;
|
||||||
|
|
||||||
bool isEditMode() const;
|
bool isEditMode() const;
|
||||||
void setEditMode(bool edit);
|
void setEditMode(bool edit);
|
||||||
|
|
||||||
@ -220,7 +226,6 @@ private:
|
|||||||
QPointer<Plasma::Containment> m_containment;
|
QPointer<Plasma::Containment> m_containment;
|
||||||
QPointer<QMenu> m_contextMenu;
|
QPointer<QMenu> m_contextMenu;
|
||||||
int m_wheelDelta;
|
int m_wheelDelta;
|
||||||
bool m_editMode : 1;
|
|
||||||
friend class AppletInterface;
|
friend class AppletInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user