[Kst] branches/work/kst/portto4/kst/src/libkst
Mike Fenton
mike at staikos.net
Mon Dec 1 20:35:52 CET 2008
SVN commit 891339 by fenton:
Add static validDataSource based on file check.
M +18 -0 datasource.cpp
M +1 -0 datasource.h
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #891338:891339
@@ -258,8 +258,26 @@
}
+bool DataSource::validSource(const QString& filename) {
+#ifndef Q_WS_WIN32
+ if (filename == "stdin" || filename == "-") {
+ return true;
+ }
+#endif
+ QString fn = obtainFile(filename);
+ if (fn.isEmpty()) {
+ return false;
+ }
+ // Use a local version of the store, we don't want to save this.
+ ObjectStore store;
+ if (DataSourcePtr dataSource = findPluginFor(&store, fn, QString::null)) {
+ return true;
+ }
+ return false;
+}
+
bool DataSource::hasConfigWidget() const {
return sourceHasConfigWidget(_filename, fileType());
}
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #891338:891339
@@ -71,6 +71,7 @@
static SharedPtr<DataSource> loadSource(ObjectStore *store, const QString& filename, const QString& type = QString::null);
static SharedPtr<DataSource> loadSource(ObjectStore *store, QDomElement& e);
static SharedPtr<DataSource> findOrLoadSource(ObjectStore *store, const QString& filename);
+ static bool validSource(const QString& filename);
static bool sourceHasConfigWidget(const QString& filename, const QString& type = QString());
static DataSourceConfigWidget *configWidgetForSource(const QString& filename, const QString& type = QString());
More information about the Kst
mailing list