[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Tue Apr 5 20:17:07 CEST 2005
CVS commit by staikos:
more efficient - assume we have a widget if we have a function
M +19 -0 kstdatasource.cpp 1.58
M +1 -0 kstdatasource.h 1.38
M +1 -4 kstsettingsdlg.ui.h 1.18
--- kdeextragear-2/kst/kst/kstdatasource.cpp #1.57:1.58
@@ -119,4 +119,8 @@ namespace KST {
}
+ bool hasConfigWidget() const {
+ return 0L != symbol("widget");
+ }
+
KstDataSourceConfigWidget *configWidget(KConfig *cfg, const QString& filename) const {
QWidget *(*sym)(const QString&) = (QWidget *(*)(const QString&))symbol("widget");
@@ -356,4 +360,19 @@ KstDataSourceConfigWidget* KstDataSource
+bool KstDataSource::pluginHasConfigWidget(const QString& plugin) {
+ scanPlugins();
+
+ KST::PluginInfoList info = QDeepCopy<KST::PluginInfoList>(pluginInfo);
+
+ for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
+ if ((*it)->service->property("Name").toString() == plugin) {
+ return (*it)->hasConfigWidget();
+ }
+ }
+
+ return false;
+}
+
+
KstDataSourceConfigWidget* KstDataSource::configWidgetForPlugin(const QString& plugin) {
scanPlugins();
--- kdeextragear-2/kst/kst/kstdatasource.h #1.37:1.38
@@ -58,4 +58,5 @@ class KST_EXPORT KstDataSource : public
static KstDataSourceConfigWidget *configWidgetForSource(const QString& filename, const QString& type);
static KstDataSourceConfigWidget *configWidgetForPlugin(const QString& plugin);
+ static bool pluginHasConfigWidget(const QString& plugin);
--- kdeextragear-2/kst/kst/kstsettingsdlg.ui.h #1.17:1.18
@@ -193,8 +193,5 @@ void KstSettingsDlg::configureSource()
void KstSettingsDlg::sourceChanged(const QString& name)
{
- // FIXME: inefficient
- KstDataSourceConfigWidget *cw = KstDataSource::configWidgetForPlugin(name);
- _configureSource->setEnabled(cw != 0L);
- delete cw;
+ _configureSource->setEnabled(KstDataSource::pluginHasConfigWidget(name));
}
More information about the Kst
mailing list