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@kde.org

svn path=/trunk/KDE/kdelibs/; revision=1157190
This commit is contained in:
Marco Martin 2010-07-30 12:46:22 +00:00
parent 94a87ab2a3
commit 02faf90355
2 changed files with 29 additions and 0 deletions

View File

@ -279,6 +279,7 @@ public:
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::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);

View File

@ -262,6 +262,15 @@ public:
*/
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 @@ 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);