[Kst] branches/work/kst/1.5/kst/src/libkst

Andrew Walker arwalker at sumusltd.com
Mon May 7 22:42:50 CEST 2007


SVN commit 662309 by arwalker:

BUG:130195 warn the user if there are duplicate field names in their data source

 M  +18 -0     kstdatasource.cpp  


--- branches/work/kst/1.5/kst/src/libkst/kstdatasource.cpp #662308:662309
@@ -334,6 +334,24 @@
     QString typeSuggestion;
     rc = (*i).plugin->fieldList(kConfigObject, fn, QString::null, &typeSuggestion, complete);
     if (!rc.isEmpty()) {
+      //
+      // check for duplicate field names and warn the user if necessary...
+      //
+      QStringList::const_iterator it = rc.begin();
+      QString str;
+
+      for (; it != rc.end(); ) {
+        str = (*it);
+        ++it;
+        if (it != rc.end()) {
+          if (rc.find(it, str) != rc.end()) {
+            KstDebug::self()->log(i18n( "The datasource has at least one duplicate field name; '%1'. As a result one or more fields will not be accessible." ).arg(str), KstDebug::Error);
+
+            break;
+          }
+        }
+      }
+
       if (outType) {
         if (typeSuggestion.isEmpty()) {
           *outType = (*i).plugin->provides()[0];


More information about the Kst mailing list