[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Feb 4 11:36:32 CET 2004


CVS commit by staikos: 

better debug messages from the data source loader, and start to remold the
piolib plugin (ironically going back in the direction it originally began)


  M +4 -0      kstdatasource.cpp   1.15
  M +3 -5      datasources/planck/planck.cpp   1.7
  M +14 -0     datasources/planck/planckdata.cpp   1.4
  M +1 -0      datasources/planck/planckdata.h   1.5


--- kdeextragear-2/kst/kst/kstdatasource.cpp  #1.14:1.15
@@ -91,4 +91,8 @@ namespace KST {
         QCString libname = QFile::encodeName(QString("kstdata_") + _plugLib);
         _lib = KLibLoader::self()->library(libname);
+        if (!_lib) {
+          kdDebug() << "Error datasource plugin [" << libname << "]" << endl;
+          kdDebug() << "Reason: " << KLibLoader::self()->lastErrorMessage() << endl;
+        }
         return _lib != 0L;
       }

--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp  #1.6:1.7
@@ -199,9 +199,7 @@ QStringList provides_planck() {
 
 bool understands_planck(const QString& filename) {
-  Planck::Database db;
-  if (!parseXML(filename, db)) {
-    return false;
-  }
-  return true;
+  bool rc = Planck::validDatabase(filename);
+  kdDebug() << "-> Valid database? " << rc << endl;
+  return rc;
 }
 

--- kdeextragear-2/kst/kst/datasources/planck/planckdata.cpp  #1.3:1.4
@@ -30,4 +30,18 @@ bool havePlanck() {
 #endif
 }
+
+bool validDatabase(const QString& db) {
+#ifdef KST_HAVE_PLANCK
+  PIOGroup *g = PIOOpenVoidGrp(const_cast<char*>(db.latin1()), const_cast<char*>("r"));
+  if (g) {
+    PIOCloseTOIGrp(g);
+    return true;
+  } else {
+    return false;
+  }
+#else
+  return false;
+#endif
+}
 }
 

--- kdeextragear-2/kst/kst/datasources/planck/planckdata.h  #1.4:1.5
@@ -35,4 +35,5 @@ extern "C" {
 namespace Planck {
     extern bool havePlanck();
+    extern bool validDatabase(const QString&);
 
 class Source : public KShared {





More information about the Kst mailing list