KDE/kdelibs/plasma
Marco Martin
notmart at gmail.com
Fri Jul 30 14:46:22 CEST 2010
SVN commit 1157190 by mart:
new property:
preferredToolBoxPlugin(Containment::Type)
used to decide what toolbox plugin dynamically load, only corona
implementations can decide this.
api review anyone? ;)
CCMAIL:plasma-devel at kde.org
M +12 -0 corona.cpp
M +17 -0 corona.h
--- trunk/KDE/kdelibs/plasma/corona.cpp #1157189:1157190
@@ -279,6 +279,7 @@
KShortcutsDialog shortcutsDlg;
QMap<Containment::Type, ContainmentActionsPluginsConfig> containmentActionsDefaults;
QWeakPointer<AbstractDialogManager>dialogManager;
+ QHash<Containment::Type, QString> toolBoxPlugins;
};
bool CoronaPrivate::s_positioningContainments = false;
@@ -796,6 +797,17 @@
{
}
+void Corona::setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin)
+{
+ d->toolBoxPlugins[type] = plugin;
+ //TODO: react to plugin changes on the fly? still don't see the use case (maybe for laptops that become tablets?)
+}
+
+QString Corona::preferredToolBoxPlugin(const Containment::Type type) const
+{
+ return d->toolBoxPlugins.value(type);
+}
+
void Corona::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
QGraphicsScene::dragEnterEvent(event);
--- trunk/KDE/kdelibs/plasma/corona.h #1157189:1157190
@@ -262,6 +262,15 @@
*/
QList<Plasma::Containment *> importLayout(const KConfigBase &config);
+ /**
+ * Returns the name of the preferred plugin to be used as containment toolboxes.
+ * CustomContainments and CustomPanelContainments can still override it as their liking. It's also not guaranteed that the plugin will actually exist.
+ *
+ * @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;
+
public Q_SLOTS:
/**
* Initializes the layout from a config file. This will first clear any existing
@@ -417,6 +426,14 @@
*/
void mapAnimation(Animator::Animation from, const QString &to);
+ /**
+ * @return The preferred toolbox plugin name for a given containment type.
+ * @param type the containment type of which we want to know the preferred toolbox plugin.
+ * @param plugin the toolbox plugin name
+ * @since 4.6
+ */
+ void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin);
+
//Reimplemented from QGraphicsScene
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
More information about the Plasma-devel
mailing list