CVS commit by staikos: Added stdin support, fixed a couple of buglets. Autocompletion population still needs to be fixed because it conflicts with the stdin plugin now. A stdinsource.cpp 1.1 [GPL (v2+)] A stdinsource.h 1.1 [GPL (v2+)] M +1 -1 Makefile.am 1.48 M +9 -0 kstdatasource.cpp 1.10 M +10 -4 main.cpp 1.41 M +4 -1 datasources/ascii/ascii.cpp 1.7 R kstfile.cpp 1.24 R kstfile.h 1.11 --- kdeextragear-2/kst/kst/Makefile.am #1.47:1.48 @@ -7,5 +7,5 @@ lib_LTLIBRARIES = libkst.la -libkst_la_SOURCES = kstobject.cpp kstdatasource.cpp +libkst_la_SOURCES = kstobject.cpp kstdatasource.cpp stdinsource.cpp libkst_la_LDFLAGS = -version-info 1:0:0 -no-undefined $(all_libraries) libkst_la_LIBADD = $(LIB_KIO) --- kdeextragear-2/kst/kst/kstdatasource.cpp #1.9:1.10 @@ -27,4 +27,5 @@ #include +#include "stdinsource.h" @@ -164,4 +165,8 @@ static KstDataSourcePtr findPluginFor(co KstDataSourcePtr KstDataSource::loadSource(const QString& filename, const QString& type) { kdDebug() << "LOAD SOURCE" << endl; + if (filename == "stdin") { + return new KstStdinSource; + } + return findPluginFor(filename, type); } @@ -182,4 +187,8 @@ KstDataSourcePtr KstDataSource::loadSour } n = n.nextSibling(); + } + + if (filename == "stdin") { + return new KstStdinSource; } --- kdeextragear-2/kst/kst/main.cpp #1.40:1.41 @@ -275,11 +275,17 @@ int main(int argc, char *argv[]) { file = KstDataSource::loadSource(args->arg(i_file)); - if (!file || !file->isValid() || file->frameCount() < 1) { + if (!file) { + kdWarning() << I18N_NOOP("Error: No data in file: ") + << args->arg(i_file) << endl; + delete kst; + exit(0); + } + + if (!file->isValid() || file->frameCount() < 1) { kdWarning() << I18N_NOOP("Error: No data in file: ") << args->arg(i_file) << endl; // The file might get data later! - //delete kst; - //exit(0); } + KST::dataSourceList.append(file); --- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp #1.6:1.7 @@ -58,5 +58,8 @@ bool AsciiSource::initFile() { } - return update() == KstObject::UPDATE; + // Allow files to start out empty (stdin, for instance) + //return update() == KstObject::UPDATE; + update(); + return true; }