[Kst] kdeextragear-2/kst/kst/datasources/ascii
George Staikos
staikos at kde.org
Wed Sep 29 15:40:08 CEST 2004
CVS commit by staikos:
use fieldList_ascii to make autocompletion faster
M +29 -12 ascii.cpp 1.23
--- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp #1.22:1.23
@@ -28,5 +28,5 @@
AsciiSource::AsciiSource(const QString& filename, const QString& type)
- : KstDataSource(filename, type) {
+: KstDataSource(filename, type) {
if (!type.isEmpty() && type != "ASCII") {
return;
@@ -253,9 +253,7 @@ bool AsciiSource::isEmpty() const {
-// FIXME: refactor to cache the number of columns and just update it in
-// ::update() as needed
-QStringList AsciiSource::fieldList() const {
+static QStringList fieldListFor(const QString& filename) {
QStringList rc;
- QFile file(_filename);
+ QFile file(filename);
bool done = false;
QString line;
@@ -285,4 +283,11 @@ QStringList AsciiSource::fieldList() con
+// FIXME: refactor to cache the number of columns and just update it in
+// ::update() as needed
+QStringList AsciiSource::fieldList() const {
+ return fieldListFor(_filename);
+}
+
+
void AsciiSource::save(QTextStream &ts, const QString& indent) {
KstDataSource::save(ts, indent);
@@ -333,4 +338,16 @@ int understands_ascii(const QString& fil
return 0;
}
+
+
+QStringList fieldList_ascii(const QString& filename, const QString& type) {
+ if ((!type.isEmpty() && !provides_ascii().contains(type)) ||
+ !understands_ascii(filename)) {
+ return QStringList();
+ }
+
+ return fieldListFor(filename);
+}
+
+
}
More information about the Kst
mailing list