[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Jan 20 22:09:34 CET 2004


CVS commit by arwalker: 

Previously if the plugin dialog was open, with plugins installed, but no plugins had been used in the current session then adding a new vector through some other dialog would not result in the vector lists being updated in the plugin dialog. This has now been fixed.


  M +49 -24    kstplugindialog_i.cpp   1.48


--- kdeextragear-2/kst/kst/kstplugindialog_i.cpp  #1.47:1.48
@@ -140,4 +140,6 @@ void KstPluginDialogI::show_New() {
 
 void KstPluginDialogI::update(int new_index) {
+  QString selectedVector;
+  QString selectedScalar;
   int oldSelect = Select->currentItem();
   int oldCount = Select->count();
@@ -167,8 +169,8 @@ void KstPluginDialogI::update(int new_in
 
   int oldPluginIndex = PluginCombo->currentItem();
-
   KstPluginPtr plugin = pl[Select->currentItem()];
-  if (plugin.data() && plugin->isValid()) {
-    int newPluginIndex = _pluginList.findIndex(plugin->plugin()->data()._name);
+  KSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[PluginCombo->currentItem()]);
+  if( pPtr != 0 ) {  
+    int newPluginIndex = _pluginList.findIndex(pPtr->data()._name);
     bool updateCombos = (newPluginIndex != oldPluginIndex);
 
@@ -179,31 +181,52 @@ void KstPluginDialogI::update(int new_in
 
     // Update input vector and scalar combos
-    const QValueList<Plugin::Data::IOValue>& itable = plugin->plugin()->data()._inputs;
+    const QValueList<Plugin::Data::IOValue>& itable = pPtr->data()._inputs;
     for (QValueList<Plugin::Data::IOValue>::ConstIterator it = itable.begin(); it != itable.end(); ++it) {
       if ((*it)._type == Plugin::Data::IOValue::TableType) { // vector
         QObject *field = _frameWidget->child((*it)._name.latin1(), "VectorSelector");
         assert(field);
+        if( field )
+        {
         VectorSelector *vs = static_cast<VectorSelector*>(field);
+          selectedVector = vs->selectedVector( );
         if (!updateCombos) {
           vs->update();
         }
+          if (plugin.data() && plugin->isValid()) {
         vs->setSelection(plugin->inputVectors()[(*it)._name]->tagName());
+          }
+          else {
+            vs->setSelection(selectedVector);
+          }
+        }
       } else {
         QObject *field = _frameWidget->child((*it)._name.latin1(), "ScalarSelector");
         assert(field);
+        if( field )
+        {
         ScalarSelector *ss = static_cast<ScalarSelector*>(field);
+          selectedScalar = ss->selectedScalar( );
         if (!updateCombos) {
           ss->update();
         }
+          if (plugin.data() && plugin->isValid()) {
         ss->setSelection(plugin->inputScalars()[(*it)._name]->tagName());
       }
+          else {
+            ss->setSelection(selectedScalar);
+          }
+        }
+      }
     }
 
     // Update output vector and scalar lineedits
-    const QValueList<Plugin::Data::IOValue>& otable = plugin->plugin()->data()._outputs;
+    //    const QValueList<Plugin::Data::IOValue>& otable = plugin->plugin()->data()._outputs;
+    if (plugin.data() && plugin->isValid()) {
+      const QValueList<Plugin::Data::IOValue>& otable = pPtr->data()._outputs;
     for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin(); it != otable.end(); ++it) {
       QObject *field = _frameWidget->child((*it)._name.latin1(), "QLineEdit");
       assert(field);
-
+        if( field )
+        {
       QLineEdit *li = static_cast<QLineEdit*>(field);
       if ((*it)._type == Plugin::Data::IOValue::TableType) { // vector
@@ -213,4 +236,6 @@ void KstPluginDialogI::update(int new_in
       }
     }
+      }
+    }
   } else { // invalid plugin
     PluginCollection *pc = PluginCollection::self();





More information about the Kst mailing list