Containment::Type -> Plasma::ContainmentType

This commit is contained in:
Marco Martin 2013-02-19 13:52:32 +01:00
parent 444d49709b
commit f5b51c7c54
14 changed files with 53 additions and 47 deletions

View File

@ -332,12 +332,12 @@ void Containment::restoreContents(KConfigGroup &group)
} }
} }
Containment::Type Containment::containmentType() const Plasma::ContainmentType Containment::containmentType() const
{ {
return d->type; return d->type;
} }
void Containment::setContainmentType(Containment::Type type) void Containment::setContainmentType(Plasma::ContainmentType type)
{ {
if (d->type == type) { if (d->type == type) {
return; return;

View File

@ -68,15 +68,6 @@ class PLASMA_EXPORT Containment : public Applet
public: 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 { enum ToolType {
AddTool = 0, AddTool = 0,
ConfigureTool = 100, ConfigureTool = 100,
@ -120,7 +111,7 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Returns the type of containment * Returns the type of containment
*/ */
Type containmentType() const; Plasma::ContainmentType containmentType() const;
/** /**
* Returns the Corona (if any) that this Containment is hosted by * Returns the Corona (if any) that this Containment is hosted by
@ -316,7 +307,7 @@ Q_SIGNALS:
/** /**
* Sets the type of this containment. * Sets the type of this containment.
*/ */
void setContainmentType(Containment::Type type); void setContainmentType(Plasma::ContainmentType type);
/** /**
* Sets whether wallpaper is painted or not. * Sets whether wallpaper is painted or not.

View File

@ -219,8 +219,8 @@ Containment *Corona::containmentForScreen(int screen) const
{ {
foreach (Containment *containment, d->containments) { foreach (Containment *containment, d->containments) {
if (containment->screen() == screen && if (containment->screen() == screen &&
(containment->containmentType() == Containment::DesktopContainment || (containment->containmentType() == Plasma::DesktopContainment ||
containment->containmentType() == Containment::CustomContainment)) { containment->containmentType() == Plasma::CustomContainment)) {
return containment; 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; 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); 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); d->containmentActionsDefaults.insert(containmentType, config);
} }
ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Containment::Type containmentType) ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Plasma::ContainmentType containmentType)
{ {
return d->containmentActionsDefaults.value(containmentType); return d->containmentActionsDefaults.value(containmentType);
} }

View File

@ -216,13 +216,13 @@ public:
* @since 4.4 * @since 4.4
* Sets the default containmentactions plugins for the given containment type * 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 * @since 4.4
* Returns the default containmentactions plugins for the given containment type * Returns the default containmentactions plugins for the given containment type
*/ */
ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType); ContainmentActionsPluginsConfig containmentActionsDefaults(ContainmentType containmentType);
/** /**
* @param the AbstractDialogManager implementaion * @param the AbstractDialogManager implementaion
@ -245,7 +245,7 @@ public:
* @param type the containment type of which we want to know the associated toolbox plugin * @param type the containment type of which we want to know the associated toolbox plugin
* @since 4.6 * @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 * 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 * @param plugin the toolbox plugin name
* @since 4.6 * @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 * Sets the default containment plugin to try and load

View File

@ -76,6 +76,21 @@ enum FormFactor {
for the desktop or the particular device. */ 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 * The Direction enumeration describes in which direction, relative to the
* Applet (and its managing container), popup menus, expanders, balloons, * Applet (and its managing container), popup menus, expanders, balloons,

View File

@ -115,8 +115,8 @@ void ContainmentPrivate::setScreen(int newScreen)
//kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type; //kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type;
Containment *swapScreensWith(0); Containment *swapScreensWith(0);
const bool isDesktopContainment = type == Containment::DesktopContainment || const bool isDesktopContainment = type == Plasma::DesktopContainment ||
type == Containment::CustomContainment; type == Plasma::CustomContainment;
if (isDesktopContainment) { if (isDesktopContainment) {
if (newScreen > -1) { if (newScreen > -1) {
// sanity check to make sure someone else doesn't have this screen already! // 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(); checkRemoveAction();
} }
} }
@ -306,7 +306,7 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet)
bool ContainmentPrivate::isPanelContainment() const bool ContainmentPrivate::isPanelContainment() const
{ {
return type == Containment::PanelContainment || type == Containment::CustomPanelContainment; return type == Plasma::PanelContainment || type == Plasma::CustomPanelContainment;
} }
} }

View File

@ -50,7 +50,7 @@ public:
formFactor(Planar), formFactor(Planar),
location(Floating), location(Floating),
screen(-1), // no screen screen(-1), // no screen
type(Containment::NoContainmentType), type(Plasma::NoContainmentType),
drawWallpaper(false), drawWallpaper(false),
containmentActionsSource(ContainmentActions::Global) containmentActionsSource(ContainmentActions::Global)
{ {
@ -107,7 +107,7 @@ public:
QHash<QString, ContainmentActions*> localActionPlugins; QHash<QString, ContainmentActions*> localActionPlugins;
int screen; int screen;
QString activityId; QString activityId;
Containment::Type type; ContainmentType type;
bool drawWallpaper : 1; bool drawWallpaper : 1;
ContainmentActions::ContainmentActionsSource containmentActionsSource; ContainmentActions::ContainmentActionsSource containmentActionsSource;

View File

@ -64,10 +64,10 @@ public:
QList<Containment*> containments; QList<Containment*> containments;
QHash<uint, QGraphicsWidget*> offscreenWidgets; QHash<uint, QGraphicsWidget*> offscreenWidgets;
KActionCollection actions; KActionCollection actions;
QMap<Containment::Type, ContainmentActionsPluginsConfig> containmentActionsDefaults; QMap<Plasma::ContainmentType, ContainmentActionsPluginsConfig> containmentActionsDefaults;
QWeakPointer<KShortcutsDialog> shortcutsDlg; QWeakPointer<KShortcutsDialog> shortcutsDlg;
QWeakPointer<AbstractDialogManager> dialogManager; QWeakPointer<AbstractDialogManager> dialogManager;
QHash<Containment::Type, QString> toolBoxPlugins; QHash<Plasma::ContainmentType, QString> toolBoxPlugins;
QList<QWeakPointer<KActionCollection> > actionCollections; QList<QWeakPointer<KActionCollection> > actionCollections;
}; };

View File

@ -172,18 +172,18 @@ void AppletScript::setDrawWallpaper(bool drawWallpaper)
} }
} }
Containment::Type AppletScript::containmentType() const Plasma::ContainmentType AppletScript::containmentType() const
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet); Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);
if (cont) { if (cont) {
return cont->containmentType(); return cont->containmentType();
} else { } else {
return Containment::NoContainmentType; return Plasma::NoContainmentType;
} }
} }
void AppletScript::setContainmentType(Containment::Type type) void AppletScript::setContainmentType(Plasma::ContainmentType type)
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet); Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);

View File

@ -144,13 +144,13 @@ public:
* @see Containment * @see Containment
* @since 4.7 * @since 4.7
*/ */
Containment::Type containmentType() const; Plasma::ContainmentType containmentType() const;
/** /**
* @see Containment * @see Containment
* @since 4.7 * @since 4.7
*/ */
void setContainmentType(Containment::Type type); void setContainmentType(Plasma::ContainmentType type);
Q_SIGNALS: Q_SIGNALS:
/** /**

View File

@ -90,7 +90,7 @@ ContainmentInterface::Type ContainmentInterface::containmentType() const
void ContainmentInterface::setContainmentType(ContainmentInterface::Type type) void ContainmentInterface::setContainmentType(ContainmentInterface::Type type)
{ {
m_appletScriptEngine->setContainmentType((Plasma::Containment::Type)type); m_appletScriptEngine->setContainmentType((Plasma::ContainmentType)type);
} }
int ContainmentInterface::screen() const int ContainmentInterface::screen() const
@ -343,7 +343,7 @@ void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *eve
if (actions.isEmpty()) { if (actions.isEmpty()) {
//it probably didn't bother implementing the function. give the user a chance to set //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... //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")); desktopMenu.addAction(containment()->action("configure"));
} }
} else { } else {

View File

@ -74,13 +74,13 @@ bool DeclarativeAppletScript::init()
QString type = pc->pluginInfo().property("X-Plasma-ContainmentType").toString(); QString type = pc->pluginInfo().property("X-Plasma-ContainmentType").toString();
if (type == "DesktopContainment") { if (type == "DesktopContainment") {
pc->setContainmentType(Plasma::Containment::DesktopContainment); pc->setContainmentType(Plasma::DesktopContainment);
} else if (type == "PanelContainment") { } else if (type == "PanelContainment") {
pc->setContainmentType(Plasma::Containment::PanelContainment); pc->setContainmentType(Plasma::PanelContainment);
} if (type == "CustomContainment") { } if (type == "CustomContainment") {
pc->setContainmentType(Plasma::Containment::CustomContainment); pc->setContainmentType(Plasma::CustomContainment);
} else if (type == "CustomPanelContainment") { } else if (type == "CustomPanelContainment") {
pc->setContainmentType(Plasma::Containment::CustomPanelContainment); pc->setContainmentType(Plasma::CustomPanelContainment);
} }
} }

View File

@ -103,9 +103,9 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists)
continue; continue;
} }
Plasma::Containment::Type t = c->containmentType(); Plasma::ContainmentType t = c->containmentType();
if (t == Plasma::Containment::PanelContainment || if (t == Plasma::PanelContainment ||
t == Plasma::Containment::CustomPanelContainment) { t == Plasma::CustomPanelContainment) {
emit containmentAdded(c); emit containmentAdded(c);
} }
} }

View File

@ -78,8 +78,8 @@ void View::setContainment(Plasma::Containment *cont)
//graphicObject->setProperty("visible", false); //graphicObject->setProperty("visible", false);
graphicObject->setProperty("drawWallpaper", graphicObject->setProperty("drawWallpaper",
(cont->containmentType() == Plasma::Containment::DesktopContainment || (cont->containmentType() == Plasma::DesktopContainment ||
cont->containmentType() == Plasma::Containment::CustomContainment)); cont->containmentType() == Plasma::CustomContainment));
graphicObject->setProperty("parent", QVariant::fromValue(rootObject())); graphicObject->setProperty("parent", QVariant::fromValue(rootObject()));
rootObject()->setProperty("containment", QVariant::fromValue(graphicObject)); rootObject()->setProperty("containment", QVariant::fromValue(graphicObject));
} else { } else {