diff --git a/corona.cpp b/corona.cpp index 5f15bb278..dba23cc87 100644 --- a/corona.cpp +++ b/corona.cpp @@ -279,6 +279,7 @@ public: KShortcutsDialog shortcutsDlg; QMap containmentActionsDefaults; QWeakPointerdialogManager; + QHash toolBoxPlugins; }; bool CoronaPrivate::s_positioningContainments = false; @@ -796,6 +797,17 @@ void Corona::loadDefaultLayout() { } +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); diff --git a/corona.h b/corona.h index e6d36b82a..4b030ad03 100644 --- a/corona.h +++ b/corona.h @@ -262,6 +262,15 @@ public: */ QList 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 @@ protected: */ 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);