[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri May 16 06:01:22 CEST 2003


CVS commit by staikos: 

saving new plugins and deleting old ones now works partially


  M +31 -4     kstplugindialog_i.cpp   1.10


--- kdeextragear-2/kst/kst/kstplugindialog_i.cpp  #1.9:1.10
@@ -108,5 +108,5 @@ void KstPluginDialogI::update(int new_in
   // fill the Select combo with curve tags
   Select->clear();
-  for (int i = 0; i < doc->pluginList.count(); i++) {
+  for (unsigned i = 0; i < doc->pluginList.count(); i++) {
     Select->insertItem(doc->pluginList.at(i)->tagName());
   }
@@ -123,4 +123,26 @@ void KstPluginDialogI::update(int new_in
 
 void KstPluginDialogI::new_I() {
+  KstPlugin *plugin = 0L;
+  QString tagName = Select->currentText();
+
+  if (doc->dataTagNameNotUnique(tagName)) {
+    return;
+  }
+
+  int pitem = PluginCombo->currentItem();
+  if (pitem >= 0 && PluginCombo->count() > 0) {
+    plugin = new KstPlugin();
+    plugin->setPlugin(PluginCollection::self()->plugin(_pluginList[pitem]));
+    plugin->setTagName(tagName);
+  }
+
+  if (!plugin || !plugin->isValid()) {
+    KMessageBox::sorry(0L, i18n("There is an error in the plugin you entered.\nPlease fix it."));
+    return;
+  }
+
+  doc->pluginList.append(KSharedPtr<KstPlugin>(plugin));
+  doc->setModified();
+  doc->updateDialogs();
 }
 
@@ -129,7 +151,12 @@ void KstPluginDialogI::edit_I() {
 
 void KstPluginDialogI::delete_I() {
-  doc->setModified();
-  doc->update();
-  doc->updateDialogs();
+  QString tag = Select->currentText();
+
+  if (tag.isEmpty()) {
+    KMessageBox::sorry(0L, i18n("You need to select an active plugin to delete."));
+    return;
+  }
+
+  doc->removeDataObject(tag);
 }
 




More information about the Kst mailing list