QStringList KstDataSource::pluginList() { QStringList rc; if (pluginInfo.isEmpty()) { scanPlugins(); } for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) { rc += (*it)->service->property("Name").toString(); } return rc; }
bool KstDataSource::pluginHasConfigWidget(const QString& plugin) { if (pluginInfo.isEmpty()) { scanPlugins(); } KST::PluginInfoList info = Q3DeepCopy<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) { if (pluginInfo.isEmpty()) { scanPlugins(); } KST::PluginInfoList info = Q3DeepCopy<KST::PluginInfoList>(pluginInfo); for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) { if (KST::DataSourcePlugin *p = kst_cast<KST::DataSourcePlugin>(*it)) { if (p->service->property("Name").toString() == plugin) { return p->configWidget(qSettingsObject, QString::null); } } } return 0L; }
static QList<PluginSortContainer> bestPluginsForSource(const QString& filename, const QString& type) { QList<PluginSortContainer> bestPlugins; if (pluginInfo.isEmpty()) { scanPlugins(); } KST::PluginInfoList info = Q3DeepCopy<KST::PluginInfoList>(pluginInfo); if (!type.isEmpty()) { for (KST::PluginInfoList::iterator it = info.begin(); it != info.end(); ++it) { if (KST::DataSourcePlugin *p = dynamic_cast<KST::DataSourcePlugin*>((*it).data())) { if (p && p->provides(type)) { PluginSortContainer psc; psc.match = 100; psc.plugin = p; bestPlugins.append(psc); return bestPlugins; } } } } for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) { PluginSortContainer psc; if (KST::DataSourcePlugin *p = kst_cast<KST::DataSourcePlugin>(*it)) { if ((psc.match = p->understands(qSettingsObject, filename)) > 0) { psc.plugin = p; bestPlugins.append(psc); } } } qSort(bestPlugins); return bestPlugins; }