[Kst] kdeextragear-2/kst/kst/datasources
George Staikos
staikos at kde.org
Wed Sep 29 16:00:28 CEST 2004
CVS commit by staikos:
implement fieldListForSource in these datasources - should give a nice speedup
for autocompletion
M +28 -0 dirfile/dirfile.cpp 1.13
M +19 -0 indirect/indirect.cpp 1.8
M +11 -0 planck/planck.cpp 1.23
M +6 -0 template/template.cpp 1.8
--- kdeextragear-2/kst/kst/datasources/dirfile/dirfile.cpp #1.12:1.13
@@ -152,4 +152,32 @@ int understands_dirfile(const QString& f
}
+
+QStringList fieldList_dirfile(const QString& filename, const QString& type) {
+ Q_UNUSED(type)
+ int err = 0;
+ struct FormatType *ft = GetFormat(filename.latin1(), &err);
+ QStringList fieldList;
+
+ if (err == GD_E_OK) {
+ fieldList.append("INDEX");
+ for (int i = 0; i < ft->n_lincom; i++) {
+ fieldList.append(ft->lincomEntries[i].field);
+ }
+
+ for (int i = 0; i < ft->n_linterp; i++) {
+ fieldList.append(ft->linterpEntries[i].field);
+ }
+
+ for (int i = 0; i < ft->n_bit; i++) {
+ fieldList.append(ft->bitEntries[i].field);
+ }
+
+ for (int i = 0; i < ft->n_raw; i++) {
+ fieldList.append(ft->rawEntries[i].field);
+ }
+ }
+ return fieldList;
+}
+
}
--- kdeextragear-2/kst/kst/datasources/indirect/indirect.cpp #1.7:1.8
@@ -146,4 +146,23 @@ int understands_indirect(const QString&
}
+
+QStringList fieldList_indirect(const QString& filename, const QString& type) {
+ if ((!type.isEmpty() && !provides_indirect().contains(type)) || !understands_indirect(filename)) {
+ return QStringList();
+ }
+
+ QFile f(filename);
+ if (!f.open(IO_ReadOnly)) {
+ return QStringList();
+ }
+
+ QString ifn;
+ if (0 >= f.readLine(ifn, 1000)) {
+ return QStringList();
+ }
+
+ return KstDataSource::fieldListForSource(ifn.stripWhiteSpace(), type);
+}
+
}
--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp #1.22:1.23
@@ -179,4 +179,15 @@ int understands_planck(const QString& fi
}
+QStringList fieldList_planck(const QString& filename, const QString& type) {
+ KstSharedPtr<Planck::Object> pobj = new Planck::Object;
+ if (!pobj->setGroup(filename) || !pobj->isValid()) {
+ return QStringList();
+ }
+
+ QStringList rc = pobj->fields();
+ rc.append("INDEX");
+ return rc;
+}
+
}
--- kdeextragear-2/kst/kst/datasources/template/template.cpp #1.7:1.8
@@ -95,4 +95,10 @@ int understands_template(const QString&
}
+QStringList fieldList_template(const QString& filename, const QString& type) {
+ Q_UNUSED(filename)
+ Q_UNUSED(type)
+ return QStringList();
+}
+
}
More information about the Kst
mailing list