[Kst] extragear/graphics/kst/src/libkstapp
Adam Treat
treat at kde.org
Thu Dec 14 18:07:25 CET 2006
SVN commit 613686 by treat:
* Change the menu action to list all available plugins,
old and new alike. Personally, I'd rather these top-level
menu actions go away... I don't see what they add that
can't be accomplished by going through the datamanager.
M +38 -2 kst.cpp
M +1 -0 kst.h
--- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #613685:613686
@@ -559,8 +559,7 @@
/************/
PluginDialogAction = new KAction(i18n("New &Plugin..."),
"kst_pluginnew", 0,
- KstPluginDialogI::globalInstance(),
- SLOT(show()), actionCollection(),
+ this, SLOT(selectDataPlugin()), actionCollection(),
"plugindialog_action");
PluginDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
"to create a new plugin instance."));
@@ -968,6 +967,43 @@
}
+void KstApp::selectDataPlugin() {
+ QStringList l;
+
+ //The new KstDataObject plugins...
+ const QStringList newPlugins = KstDataObject::pluginList();
+ l += newPlugins;
+
+ //The old C style plugins...
+ QStringList oldPlugins;
+
+ const QMap<QString,QString> readable =
+ PluginCollection::self()->readableNameList();
+ QMap<QString,QString>::const_iterator it = readable.begin();
+ for (; it != readable.end(); ++it) {
+ oldPlugins << it.key();
+ }
+
+ l += oldPlugins;
+
+ bool ok = false;
+ QStringList plugin =
+ KInputDialog::getItemList( i18n( "Data Plugins" ), i18n( "Create..." ), l, 0, false, &ok, this );
+
+ if ( !ok || plugin.isEmpty() )
+ return;
+
+ const QString p = plugin.join("");
+
+ if ( newPlugins.contains( p ) ) {
+ KstDataObjectPtr ptr = KstDataObject::plugin(p);
+ ptr->showDialog();
+ } else if ( oldPlugins.contains( p ) ) {
+ KstPluginDialogI::globalInstance()->showNew(readable[p]);
+ }
+}
+
+
void KstApp::forceUpdate() {
_updateThread->forceUpdate();
}
--- trunk/extragear/graphics/kst/src/libkstapp/kst.h #613685:613686
@@ -224,6 +224,7 @@
void showContextMenu(QWidget *w, const QPoint& pos);
void showContextMenu(const QPoint& pos);
void delayedDocInit();
+ void selectDataPlugin();
public slots:
void fromEnd();
More information about the Kst
mailing list