[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Sep 14 20:02:48 CEST 2004


CVS commit by arwalker: 

Display only a single error message for all the invalid vector sources.

CCMAIL: 89498-done at bugs.kde.org


  M +16 -3     kstchangefiledialog_i.cpp   1.22


--- kdeextragear-2/kst/kst/kstchangefiledialog_i.cpp  #1.21:1.22
@@ -71,6 +71,7 @@ void KstChangeFileDialogI::applyFileChan
   KstDataSourcePtr file;
   KstWriteLocker ml(&KST::dataSourceList.lock());
-
   KstDataSourceList::Iterator it = KST::dataSourceList.findFileName(_dataFile->url());
+  QString invalidSources;
+  int invalid = 0;
 
   if (it == KST::dataSourceList.end()) {
@@ -97,5 +98,9 @@ void KstChangeFileDialogI::applyFileChan
       vector->writeLock();
       if (!file->isValidField(vector->field())) {
-        KMessageBox::sorry(this, i18n("%1: Field is not defined for the requested file.").arg(vector->field()));
+        if (invalid > 0) {
+          invalidSources += ", ";
+        }
+        invalidSources += vector->field();
+        invalid++;
       } else {
         vector->changeFile(file);
@@ -105,4 +110,12 @@ void KstChangeFileDialogI::applyFileChan
   }
 
+  if (!invalidSources.isEmpty()) {
+    if (invalid == 1) {
+      KMessageBox::sorry(this, i18n("The following field is not defined for the requested file:\n%1").arg(invalidSources));
+    } else {
+      KMessageBox::sorry(this, i18n("The following fields are not defined for the requested file:\n%1").arg(invalidSources));
+    }
+  }
+  
   file->writeUnlock();
   file = 0L;





More information about the Kst mailing list