diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index b1064c741..a2f81220b 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -332,12 +332,12 @@ void Containment::restoreContents(KConfigGroup &group) } } -Containment::Type Containment::containmentType() const +Plasma::ContainmentType Containment::containmentType() const { return d->type; } -void Containment::setContainmentType(Containment::Type type) +void Containment::setContainmentType(Plasma::ContainmentType type) { if (d->type == type) { return; diff --git a/src/plasma/containment.h b/src/plasma/containment.h index 893045be9..b6609d4f7 100644 --- a/src/plasma/containment.h +++ b/src/plasma/containment.h @@ -68,15 +68,6 @@ class PLASMA_EXPORT Containment : public Applet public: - enum Type { - NoContainmentType = -1, /**< @internal */ - DesktopContainment = 0, /**< A desktop containment */ - PanelContainment, /**< A desktop panel */ - CustomContainment = 127, /**< A containment that is neither a desktop nor a panel - but something application specific */ - CustomPanelContainment = 128 /**< A customized desktop panel */ - }; - enum ToolType { AddTool = 0, ConfigureTool = 100, @@ -120,7 +111,7 @@ class PLASMA_EXPORT Containment : public Applet /** * Returns the type of containment */ - Type containmentType() const; + Plasma::ContainmentType containmentType() const; /** * Returns the Corona (if any) that this Containment is hosted by @@ -316,7 +307,7 @@ Q_SIGNALS: /** * Sets the type of this containment. */ - void setContainmentType(Containment::Type type); + void setContainmentType(Plasma::ContainmentType type); /** * Sets whether wallpaper is painted or not. diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index fd046ae28..b4f971eed 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -219,8 +219,8 @@ Containment *Corona::containmentForScreen(int screen) const { foreach (Containment *containment, d->containments) { if (containment->screen() == screen && - (containment->containmentType() == Containment::DesktopContainment || - containment->containmentType() == Containment::CustomContainment)) { + (containment->containmentType() == Plasma::DesktopContainment || + containment->containmentType() == Plasma::CustomContainment)) { return containment; } } @@ -287,12 +287,12 @@ void Corona::loadDefaultLayout() { } -void Corona::setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin) +void Corona::setPreferredToolBoxPlugin(const Plasma::ContainmentType type, const QString &plugin) { d->toolBoxPlugins[type] = plugin; } -QString Corona::preferredToolBoxPlugin(const Containment::Type type) const +QString Corona::preferredToolBoxPlugin(const Plasma::ContainmentType type) const { return d->toolBoxPlugins.value(type); } @@ -413,12 +413,12 @@ void Corona::addShortcuts(KActionCollection *newShortcuts) } } -void Corona::setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config) +void Corona::setContainmentActionsDefaults(Plasma::ContainmentType containmentType, const ContainmentActionsPluginsConfig &config) { d->containmentActionsDefaults.insert(containmentType, config); } -ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Containment::Type containmentType) +ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Plasma::ContainmentType containmentType) { return d->containmentActionsDefaults.value(containmentType); } diff --git a/src/plasma/corona.h b/src/plasma/corona.h index b7aead416..8bcdded43 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -216,13 +216,13 @@ public: * @since 4.4 * Sets the default containmentactions plugins for the given containment type */ - void setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config); + void setContainmentActionsDefaults(ContainmentType containmentType, const ContainmentActionsPluginsConfig &config); /** * @since 4.4 * Returns the default containmentactions plugins for the given containment type */ - ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType); + ContainmentActionsPluginsConfig containmentActionsDefaults(ContainmentType containmentType); /** * @param the AbstractDialogManager implementaion @@ -245,7 +245,7 @@ public: * @param type the containment type of which we want to know the associated toolbox plugin * @since 4.6 */ - QString preferredToolBoxPlugin(const Containment::Type type) const; + QString preferredToolBoxPlugin(const ContainmentType type) const; /** * Imports an applet layout from a config file. The results will be added to the @@ -385,7 +385,7 @@ protected: * @param plugin the toolbox plugin name * @since 4.6 */ - void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin); + void setPreferredToolBoxPlugin(const ContainmentType type, const QString &plugin); /** * Sets the default containment plugin to try and load diff --git a/src/plasma/plasma.h b/src/plasma/plasma.h index 3dfc8108f..49babe75b 100644 --- a/src/plasma/plasma.h +++ b/src/plasma/plasma.h @@ -76,6 +76,21 @@ enum FormFactor { for the desktop or the particular device. */ }; +/** + * This enumeration describes the type of the Containment. + * DesktopContainments represent main containments that will own a screen in a mutually exclusive fashion, + * while PanelContainments are accessories which can be present multiple per screen. + */ +enum ContainmentType { + NoContainmentType = -1, /**< @internal */ + DesktopContainment = 0, /**< A desktop containment */ + PanelContainment, /**< A desktop panel */ + CustomContainment = 127, /**< A containment that is neither a desktop nor a panel + but something application specific */ + CustomPanelContainment = 128 /**< A customized desktop panel */ +}; +Q_ENUMS(ContainmentType) + /** * The Direction enumeration describes in which direction, relative to the * Applet (and its managing container), popup menus, expanders, balloons, diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index b9e2b483a..6558cab81 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -115,8 +115,8 @@ void ContainmentPrivate::setScreen(int newScreen) //kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type; Containment *swapScreensWith(0); - const bool isDesktopContainment = type == Containment::DesktopContainment || - type == Containment::CustomContainment; + const bool isDesktopContainment = type == Plasma::DesktopContainment || + type == Plasma::CustomContainment; if (isDesktopContainment) { if (newScreen > -1) { // sanity check to make sure someone else doesn't have this screen already! @@ -262,7 +262,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra } } - if (constraints & Plasma::StartupCompletedConstraint && type < Containment::CustomContainment) { + if (constraints & Plasma::StartupCompletedConstraint && type < Plasma::CustomContainment) { checkRemoveAction(); } } @@ -306,7 +306,7 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet) bool ContainmentPrivate::isPanelContainment() const { - return type == Containment::PanelContainment || type == Containment::CustomPanelContainment; + return type == Plasma::PanelContainment || type == Plasma::CustomPanelContainment; } } diff --git a/src/plasma/private/containment_p.h b/src/plasma/private/containment_p.h index 56055f812..4358e66e9 100644 --- a/src/plasma/private/containment_p.h +++ b/src/plasma/private/containment_p.h @@ -50,7 +50,7 @@ public: formFactor(Planar), location(Floating), screen(-1), // no screen - type(Containment::NoContainmentType), + type(Plasma::NoContainmentType), drawWallpaper(false), containmentActionsSource(ContainmentActions::Global) { @@ -107,7 +107,7 @@ public: QHash localActionPlugins; int screen; QString activityId; - Containment::Type type; + ContainmentType type; bool drawWallpaper : 1; ContainmentActions::ContainmentActionsSource containmentActionsSource; diff --git a/src/plasma/private/corona_p.h b/src/plasma/private/corona_p.h index 06513ec9d..47723b49a 100644 --- a/src/plasma/private/corona_p.h +++ b/src/plasma/private/corona_p.h @@ -64,10 +64,10 @@ public: QList containments; QHash offscreenWidgets; KActionCollection actions; - QMap containmentActionsDefaults; + QMap containmentActionsDefaults; QWeakPointer shortcutsDlg; QWeakPointer dialogManager; - QHash toolBoxPlugins; + QHash toolBoxPlugins; QList > actionCollections; }; diff --git a/src/plasma/scripting/appletscript.cpp b/src/plasma/scripting/appletscript.cpp index 8f9435fcb..5019e90f1 100644 --- a/src/plasma/scripting/appletscript.cpp +++ b/src/plasma/scripting/appletscript.cpp @@ -172,18 +172,18 @@ void AppletScript::setDrawWallpaper(bool drawWallpaper) } } -Containment::Type AppletScript::containmentType() const +Plasma::ContainmentType AppletScript::containmentType() const { Q_ASSERT(d->applet); Plasma::Containment *cont = qobject_cast(d->applet); if (cont) { return cont->containmentType(); } else { - return Containment::NoContainmentType; + return Plasma::NoContainmentType; } } -void AppletScript::setContainmentType(Containment::Type type) +void AppletScript::setContainmentType(Plasma::ContainmentType type) { Q_ASSERT(d->applet); Plasma::Containment *cont = qobject_cast(d->applet); diff --git a/src/plasma/scripting/appletscript.h b/src/plasma/scripting/appletscript.h index 290fc8a26..b5d2d9dcf 100644 --- a/src/plasma/scripting/appletscript.h +++ b/src/plasma/scripting/appletscript.h @@ -144,13 +144,13 @@ public: * @see Containment * @since 4.7 */ - Containment::Type containmentType() const; + Plasma::ContainmentType containmentType() const; /** * @see Containment * @since 4.7 */ - void setContainmentType(Containment::Type type); + void setContainmentType(Plasma::ContainmentType type); Q_SIGNALS: /** diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index fa459be42..9f9035718 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -90,7 +90,7 @@ ContainmentInterface::Type ContainmentInterface::containmentType() const void ContainmentInterface::setContainmentType(ContainmentInterface::Type type) { - m_appletScriptEngine->setContainmentType((Plasma::Containment::Type)type); + m_appletScriptEngine->setContainmentType((Plasma::ContainmentType)type); } int ContainmentInterface::screen() const @@ -343,7 +343,7 @@ void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *eve if (actions.isEmpty()) { //it probably didn't bother implementing the function. give the user a chance to set //a better plugin. note that if the user sets no-plugin this won't happen... - if ((containment()->containmentType() != Plasma::Containment::PanelContainment && containment()->containmentType() != Plasma::Containment::CustomPanelContainment) && containment()->action("configure")) { + if ((containment()->containmentType() != Plasma::PanelContainment && containment()->containmentType() != Plasma::CustomPanelContainment) && containment()->action("configure")) { desktopMenu.addAction(containment()->action("configure")); } } else { diff --git a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp index ac5539b03..8a64f4ce0 100644 --- a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp +++ b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp @@ -74,13 +74,13 @@ bool DeclarativeAppletScript::init() QString type = pc->pluginInfo().property("X-Plasma-ContainmentType").toString(); if (type == "DesktopContainment") { - pc->setContainmentType(Plasma::Containment::DesktopContainment); + pc->setContainmentType(Plasma::DesktopContainment); } else if (type == "PanelContainment") { - pc->setContainmentType(Plasma::Containment::PanelContainment); + pc->setContainmentType(Plasma::PanelContainment); } if (type == "CustomContainment") { - pc->setContainmentType(Plasma::Containment::CustomContainment); + pc->setContainmentType(Plasma::CustomContainment); } else if (type == "CustomPanelContainment") { - pc->setContainmentType(Plasma::Containment::CustomPanelContainment); + pc->setContainmentType(Plasma::CustomPanelContainment); } } diff --git a/src/shell/desktopcorona.cpp b/src/shell/desktopcorona.cpp index e978249bc..1e875fd14 100644 --- a/src/shell/desktopcorona.cpp +++ b/src/shell/desktopcorona.cpp @@ -103,9 +103,9 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists) continue; } - Plasma::Containment::Type t = c->containmentType(); - if (t == Plasma::Containment::PanelContainment || - t == Plasma::Containment::CustomPanelContainment) { + Plasma::ContainmentType t = c->containmentType(); + if (t == Plasma::PanelContainment || + t == Plasma::CustomPanelContainment) { emit containmentAdded(c); } } diff --git a/src/shell/view.cpp b/src/shell/view.cpp index d5ab7be8a..3ef49bed1 100644 --- a/src/shell/view.cpp +++ b/src/shell/view.cpp @@ -78,8 +78,8 @@ void View::setContainment(Plasma::Containment *cont) //graphicObject->setProperty("visible", false); graphicObject->setProperty("drawWallpaper", - (cont->containmentType() == Plasma::Containment::DesktopContainment || - cont->containmentType() == Plasma::Containment::CustomContainment)); + (cont->containmentType() == Plasma::DesktopContainment || + cont->containmentType() == Plasma::CustomContainment)); graphicObject->setProperty("parent", QVariant::fromValue(rootObject())); rootObject()->setProperty("containment", QVariant::fromValue(graphicObject)); } else {