[Kst] extragear/graphics/kst/src/libkstapp

Adam Treat treat at kde.org
Mon Nov 27 21:54:41 CET 2006


SVN commit 608544 by treat:

* When creating a new cplugin make sure to initialize
the dialog with the name of the selected plugin.


 M  +3 -2      kstdatamanager_i.cpp  
 M  +12 -1     kstplugindialog_i.cpp  
 M  +2 -0      kstplugindialog_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kstdatamanager_i.cpp #608543:608544
@@ -945,8 +945,9 @@
   else if ( newPlugins.contains( p ) ) {
     KstDataObjectPtr ptr = KstDataObject::plugin(p);
     ptr->showDialog();
-  } else if ( oldPlugins.contains( p ) )
-      KstPluginDialogI::globalInstance()->show();
+  } else if ( oldPlugins.contains( p ) ) {
+      KstPluginDialogI::globalInstance()->showNew(p);
+  }
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstplugindialog_i.cpp #608543:608544
@@ -69,6 +69,7 @@
 
   _pluginInfoGrid = 0L;
   _pluginInputOutputGrid = 0L;
+  _pluginName = QString::null;
 }
 
 
@@ -181,7 +182,8 @@
 
 void KstPluginDialogI::fillFieldsForNew() {
   updatePluginList();
-  _w->PluginCombo->setCurrentItem(0);
+  int i = _pluginList.findIndex(_pluginName);
+  _w->PluginCombo->setCurrentItem(i);
   pluginChanged(_w->PluginCombo->currentItem());
   _tagName->setText(plugin_defaultTag);
 }
@@ -688,6 +690,15 @@
 }
 
 
+void KstPluginDialogI::showNew(const QString &field) {
+  //Call init every time on showNew, because the field might equal propertyString()...
+  _pluginName = field;
+  _newDialog = true;
+  init();
+  KstDataDialog::showNew(field);
+}
+
+
 void KstPluginDialogI::generateEntries(bool input, int& cnt, QWidget *parent, QGridLayout *grid, const QValueList<Plugin::Data::IOValue>& table) {
   QString scalarLabelTemplate, vectorLabelTemplate, stringLabelTemplate;
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstplugindialog_i.h #608543:608544
@@ -38,6 +38,7 @@
     void update();
     bool newObject();
     bool editObject();
+    virtual void showNew(const QString &field);
     virtual void updatePluginList();
 
   protected slots:
@@ -65,6 +66,7 @@
     QValueList<QWidget*> _pluginWidgets;
 
   private:
+    QString _pluginName;
     static QGuardedPtr<KstPluginDialogI> _inst;
 
   protected:


More information about the Kst mailing list