Exemplo n.º 1
0
bool Dialog::isPluginForKCMEnabled(KCModuleInfo *moduleinfo) const
{
    // if the user of this class requested to hide disabled modules
    // we check whether it should be enabled or not
    bool enabled = true;
    kdDebug(700) << "check whether the " << moduleinfo->moduleName() << " KCM should be shown" << endl;
    // for all parent components
    QStringList parentComponents = moduleinfo->service()->property("X-KDE-ParentComponents").toStringList();
    for(QStringList::ConstIterator pcit = parentComponents.begin(); pcit != parentComponents.end(); ++pcit)
    {
        // if the parentComponent is not registered ignore it
        if(d->registeredComponents.find(*pcit) == d->registeredComponents.end())
            continue;

        // we check if the parent component is a plugin
        if(!d->plugininfomap.contains(*pcit))
        {
            // if not the KCModule must be enabled
            enabled = true;
            // we're done for this KCModuleInfo
            break;
        }
        // if it is a plugin we check whether the plugin is enabled
        KPluginInfo *pinfo = d->plugininfomap[*pcit];
        pinfo->load();
        enabled = pinfo->isPluginEnabled();
        kdDebug(700) << "parent " << *pcit << " is " << (enabled ? "enabled" : "disabled") << endl;
        // if it is enabled we're done for this KCModuleInfo
        if(enabled)
            break;
    }
    return enabled;
}
Exemplo n.º 2
0
/**
 * Loads an ion plugin given a plugin name found via KService.
 */
Plasma::DataEngine *WeatherEngine::loadIon(const QString& plugName)
{
    KPluginInfo foundPlugin;

    foreach(const KPluginInfo &info, Plasma::DataEngineManager::listEngineInfo("weatherengine")) {
        if (info.pluginName() == plugName) {
            foundPlugin = info;
            break;
        }
    }

    if (!foundPlugin.isValid()) {
        return NULL;
    }

    // Load the Ion plugin, store it into a QMap to handle multiple ions.
    Plasma::DataEngine *ion = Plasma::DataEngineManager::self()->loadEngine(foundPlugin.pluginName());
    ion->setObjectName(plugName);
    connect(ion, SIGNAL(sourceAdded(QString)), this, SLOT(newIonSource(QString)));
    connect(ion, SIGNAL(forceUpdate(IonInterface*,QString)), this, SLOT(forceUpdate(IonInterface*,QString)));

    m_ions << plugName;

    return ion;
}
Exemplo n.º 3
0
void KPluginSelectionWidget::save()
{
    kdDebug(702) << k_funcinfo << endl;

    for(QMap< QCheckListItem *, KPluginInfo * >::Iterator it = d->pluginInfoMap.begin(); it != d->pluginInfoMap.end(); ++it)
    {
        KPluginInfo *info = it.data();
        bool checked = it.key()->isOn();
        info->setPluginEnabled(checked);
        info->save(d->config);
        d->plugincheckedchanged[info] = false;
    }
    QStringList updatedModules;
    for(QValueList< KCModuleProxy * >::Iterator it = d->modulelist.begin(); it != d->modulelist.end(); ++it)
        if((*it)->changed())
        {
            (*it)->save();
            QStringList *names = d->moduleParentComponents[*it];
            if(names->size() == 0)
                names->append(QString::null);
            for(QStringList::ConstIterator nameit = names->begin(); nameit != names->end(); ++nameit)
                if(updatedModules.find(*nameit) == updatedModules.end())
                    updatedModules.append(*nameit);
        }
    for(QStringList::ConstIterator it = updatedModules.begin(); it != updatedModules.end(); ++it)
        emit configCommitted((*it).latin1());

    updateConfigPage();
    kdDebug(702) << "syncing config file" << endl;
    d->config->sync();
    d->changed = 0;
    emit changed(false);
}
Plugin *PluginManager::loadPluginInternal( const QString &pluginId )
{
	//kDebug( 14010 ) << pluginId;

	KPluginInfo info = infoForPluginId( pluginId );
	if ( !info.isValid() )
	{
		kWarning( 14010 ) << "Unable to find a plugin named '" << pluginId << "'!";
		return 0L;
	}

	if ( _kpmp->loadedPlugins.contains( info ) )
		return _kpmp->loadedPlugins[ info ];

	QString error;
        Plugin *plugin = KServiceTypeTrader::createInstanceFromQuery<Plugin>( QString::fromLatin1( "Kopete/Plugin" ), QString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginId ), this, QVariantList(), &error );

	if ( plugin )
	{
		_kpmp->loadedPlugins.insert( info, plugin );
		info.setPluginEnabled( true );

		connect( plugin, SIGNAL(destroyed(QObject*)), this, SLOT(slotPluginDestroyed(QObject*)) );
		connect( plugin, SIGNAL(readyForUnload()), this, SLOT(slotPluginReadyForUnload()) );

		kDebug( 14010 ) << "Successfully loaded plugin '" << pluginId << "'";

		emit pluginLoaded( plugin );

		Protocol* protocol = dynamic_cast<Protocol*>( plugin );
		if ( protocol )
			emit protocolLoaded( protocol );
	}
	else
	{
Exemplo n.º 5
0
    DEBUG_BLOCK
    foreach( Collections::CollectionFactory *factory, factories )
    {
        if( !factory )
            continue;

        const KPluginInfo info = factory->info();
        const QString name = info.pluginName();
        const bool useMySqlServer = Amarok::config( "MySQL" ).readEntry( "UseServer", false );

        bool essential = false;
        if( (useMySqlServer && (name == QLatin1String("amarok_collection-mysqlservercollection"))) ||
            (!useMySqlServer && (name == QLatin1String("amarok_collection-mysqlecollection"))) )
        {
            essential = true;
        }

        bool enabledByDefault = info.isPluginEnabledByDefault();
        bool enabled = Amarok::config( "Plugins" ).readEntry( name + "Enabled", enabledByDefault );
        if( !enabled && !essential )
            continue;

        connect( factory, SIGNAL(newCollection(Collections::Collection*)),
                 this, SLOT(slotNewCollection(Collections::Collection*)) );
        d->factories.append( factory );
        debug() << "initializing" << name;
        factory->init();
        if( name == QLatin1String("amarok_collection-mysqlecollection") )
            m_haveEmbeddedMysql = true;
    }
Exemplo n.º 6
0
bool hasMandatoryProperties( const KPluginInfo& info )
{
    QVariant mode = info.property( "X-KDevelop-Mode" );
    QVariant version = info.property( "X-KDevelop-Version" );

    return mode.isValid() && mode.canConvert( QVariant::String )
           && version.isValid() && version.canConvert( QVariant::String );
}
FilterPlugin::FilterPlugin(const KPluginInfo &pluginInfo, KTp::AbstractMessageFilter *instance_):
    name(pluginInfo.pluginName()),
    instance(instance_)
{
    bool ok;
    weight = pluginInfo.service()->property(QLatin1String("X-KDE-PluginInfo-Weight"), QVariant::Int).toInt(&ok);
    if (!ok) {
        weight = 100;
    }
}
Exemplo n.º 8
0
bool KPluginInfo::operator>(const KPluginInfo &rhs) const
{
    if (category() > rhs.category()) {
        return true;
    }
    if (category() == rhs.category()) {
        return name() > rhs.name();
    }
    return false;
}
Exemplo n.º 9
0
void cPluginManager::findPlugins ()
{
  pluginInfo.clear ();
  KPluginInfo::List pi = KPluginInfo::fromServices (KServiceTypeTrader::self()->query (
      QString::fromLatin1("KMuddy/Plugin"),
      QString::fromLatin1("(Type == 'Service') and ([X-KMuddy-Version] == 2)")));
  
  // fill in the associative array with plugin info
  KPluginInfo::List::Iterator it;
  for (it = pi.begin(); it != pi.end(); ++it) {
    KPluginInfo info = *it;
    kDebug() << "Found plugin: " << info.name();
    pluginInfo[info.name()] = info;
  }
}
Exemplo n.º 10
0
void
Core::slotAllPluginsLoaded()
{
  QValueList<KPluginInfo*> plugins = m_pluginManager->availablePlugins();
  kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl;
  for ( QValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) {
    KPluginInfo *i = ( *it );
    kdDebug()<<"\tAvailable plugin "<< i->pluginName()
             <<", comment = "<< i->comment() <<endl;
  }

  if ( !m_stack->visibleWidget() ) {
    m_pluginManager->loadPlugin( "komposer_defaulteditor", PluginManager::LoadAsync );
  }
}
Exemplo n.º 11
0
void KPluginSelectionWidget::executed(QListViewItem *item)
{
    kdDebug(702) << k_funcinfo << endl;
    if(item == 0)
        return;

    // Why not a dynamic_cast? - Martijn
    // because this is what the Qt API suggests; and since gcc 3.x I don't
    // trust dynamic_cast anymore - mkretz
    if(item->rtti() != 1) // check for a QCheckListItem
        return;

    QCheckListItem *citem = static_cast< QCheckListItem * >(item);
    bool checked = citem->isOn();
    // kdDebug( 702 ) << "it's a " << ( checked ? "checked" : "unchecked" )
    //    << " QCheckListItem" << endl;

    KPluginInfo *info = d->pluginInfoMap[citem];
    Q_ASSERT(!info->isHidden());

    if(info->isPluginEnabled() != checked)
    {
        kdDebug(702) << "Item changed state, emitting changed()" << endl;

        if(!d->plugincheckedchanged[info])
        {
            ++d->changed;
            if(d->changed == 1)
                emit changed(true);
        }
        d->plugincheckedchanged[info] = true;

        checkDependencies(info);
    }
    else
    {
        if(d->plugincheckedchanged[info])
        {
            --d->changed;
            if(d->changed == 0)
                emit changed(false);
        }
        d->plugincheckedchanged[info] = false;
        // FIXME: plugins that depend on this plugin need to be disabled, too
    }

    updateConfigPage(info, checked);
}
Exemplo n.º 12
0
void BehaviorConfig_Shorten::slotAboutClicked()
{
    const QString shorten = shortenPlugins->itemData(shortenPlugins->currentIndex()).toString();
    if (shorten == QLatin1String("none")) {
        return;
    }
    KPluginInfo info = availablePlugins.value(shorten);

    KAboutData aboutData(info.name(), info.name(), info.version(), info.comment(),
                         KAboutLicense::byKeyword(info.license()).key(), QString(),
                         QString(), info.website());
    aboutData.addAuthor(info.author(), QString(), info.email());

    KAboutApplicationDialog aboutPlugin(aboutData, this);
    aboutPlugin.setWindowIcon(QIcon::fromTheme(info.icon()));
    aboutPlugin.exec();
}
Exemplo n.º 13
0
TestManager::TestManager(QObject *parent)
    : QObject(parent)
{
    m_manager = new PluginManager(this);
    connect(m_manager, SIGNAL(pluginLoaded(Plugin *)),
            SLOT(slotPluginLoaded(Plugin *)));
    connect(m_manager, SIGNAL(allPluginsLoaded()),
            SLOT(slotAllPluginsLoaded()));
    m_manager->loadAllPlugins();

    QValueList<KPluginInfo *> plugins = m_manager->availablePlugins();
    kdDebug() << "Number of available plugins is " << plugins.count() << endl;
    for(QValueList<KPluginInfo *>::iterator it = plugins.begin(); it != plugins.end(); ++it)
    {
        KPluginInfo *i = (*it);
        kdDebug() << "\tAvailable plugin " << i->name()
                  << ", comment = " << i->comment() << endl;
    }
}
RecordItNowPlugin *RecordItNowPluginManager::loadPlugin(const QString &name)
{

    QHashIterator<KPluginInfo, RecordItNowPlugin*> it(m_plugins);
    KPluginInfo info;
    while (it.hasNext()) {
        it.next();
        if (it.key().name().toLower() == name.toLower()) {
            if (it.value()) { // already loaded?
                return it.value();
            } else { // get info and load
                info = it.key();
                break;
            }
        }
    }
    if (!info.isValid()) {
        return 0;
    }

    kDebug() << "load plugin:" << name;

    KService::Ptr service = info.service();
    KPluginLoader loader(service->library());
    KPluginFactory *factory = loader.factory();

    if (!factory) {
        kWarning() << "KPluginFactory could not load the plugin:" << service->library() <<
        "Reason:" << loader.errorString();
        return 0;
    }

    RecordItNowPlugin *plugin = factory->create<RecordItNowPlugin>(this);
    delete factory;
    if (!plugin) {
        kWarning() << "factory::create<>() failed " << service->library();
        return 0;
    }

    return (m_plugins[info] = plugin);

}
Exemplo n.º 15
0
void KPluginSelectionWidget::load()
{
    // kdDebug( 702 ) << k_funcinfo << endl;

    for(QMap< QCheckListItem *, KPluginInfo * >::Iterator it = d->pluginInfoMap.begin(); it != d->pluginInfoMap.end(); ++it)
    {
        KPluginInfo *info = it.data();
        info->load(d->config);
        it.key()->setOn(info->isPluginEnabled());
        if(d->visible && info == d->currentplugininfo)
            d->currentchecked = info->isPluginEnabled();
    }

    for(QValueList< KCModuleProxy * >::Iterator it = d->modulelist.begin(); it != d->modulelist.end(); ++it)
        if((*it)->changed())
            (*it)->load();

    updateConfigPage();
    // TODO: update changed state
}
Exemplo n.º 16
0
void MainWindow::saveProperties( KConfig *config )
{
  Core::saveProperties( config );

  QStringList activePlugins;

  KPluginInfo::List::Iterator it = mPluginInfos.begin();
  KPluginInfo::List::Iterator end = mPluginInfos.end();
  for ( ; it != end; ++it ) {
    KPluginInfo *info = *it;
    if ( info->isPluginEnabled() ) {
      Plugin *plugin = pluginFromInfo( info );
      if ( plugin ) {
        activePlugins.append( plugin->identifier() );
        plugin->saveProperties( config );
      }
    }
  }

  config->writeEntry( "ActivePlugins", activePlugins );
}
Exemplo n.º 17
0
void IMEditorWidget::loadContact( KABC::Addressee *addr )
{
  mWidget->lvAddresses->clear();

  // see README for details of how Evolution stores IM addresses (differently)
  const QStringList customs = addr->customs();

  QStringList::ConstIterator it;
  bool isSet = false;
  for ( it = customs.constBegin(); it != customs.constEnd(); ++it ) {
    QString app, name, value;
    splitField( *it, app, name, value );

    if ( app.startsWith( QString::fromLatin1( "messaging/" ) ) ) {
      if ( name == QString::fromLatin1( "All" ) ) {
        const KPluginInfo protocol = protocolFromString( app );
        if ( protocol.isValid() ) {
          const QStringList addresses = value.split( QChar( 0xE000 ), QString::SkipEmptyParts );
          QStringList::ConstIterator end = addresses.constEnd();
          for ( QStringList::ConstIterator it = addresses.constBegin(); it != end; ++it ) {
            IMAddressLVI *imaddresslvi =
              new IMAddressLVI( mWidget->lvAddresses, protocol, *it, Any/*, false*/ );
            if ( !isSet && (*it).trimmed().toLower() == mPreferred.trimmed().toLower() ) {
              imaddresslvi->setPreferred( true );
              isSet = true;  //Only set one item to be preferred
            }
          }
        } else {
          kDebug( 5720 ) <<" no protocol found for:" << app;
        }
      }
    }
  }

  if ( mWidget->lvAddresses->topLevelItem( 0 ) ) {
    mWidget->lvAddresses->topLevelItem( 0 )->setSelected( true );
  }
}
void MessageProcessor::Private::unloadFilter(const KPluginInfo &pluginInfo)
{
    QList<FilterPlugin>::Iterator iter = filters.begin();
    for ( ; iter != filters.end(); ++iter) {
        const FilterPlugin &plugin = *iter;

        if (plugin.name == pluginInfo.pluginName()) {
            qCDebug(KTP_COMMONINTERNALS) << "unloading message filter : " << plugin.instance;
            plugin.instance->deleteLater();
            filters.erase(iter);
            return;
        }
    }
}
Exemplo n.º 19
0
 bool canUnload( const KPluginInfo& plugin )
 {
     kDebug() << "checking can unload for:" << plugin.name() << plugin.property("X-KDevelop-LoadMode");
     if( plugin.property( "X-KDevelop-LoadMode" ).toString() == "AlwaysOn" )
     {
         return false;
     }
     QStringList interfaces = plugin.property( "X-KDevelop-Interfaces" ).toStringList();
     kDebug() << "checking dependencies:" << interfaces;
     foreach( const KPluginInfo& info, loadedPlugins.keys() )
     {
         if( info.pluginName() != plugin.pluginName() )
         {
             QStringList dependencies = info.property( "X-KDevelop-IRequired" ).toStringList();
             dependencies += info.property( "X-KDevelop-IOptional" ).toStringList();
             foreach( const QString& dep, dependencies )
             {
                 if( interfaces.contains( dep ) && !canUnload( info ) )
                 {
                     return false;
                 }
             }
         }
     }
void MessageProcessor::Private::loadFilter(const KPluginInfo &pluginInfo)
{
    KService::Ptr service = pluginInfo.service();

    KPluginFactory *factory = KPluginLoader(service->library()).factory();
    if (factory) {
        qCDebug(KTP_COMMONINTERNALS) << "loaded factory :" << factory;
        AbstractMessageFilter *filter = factory->create<AbstractMessageFilter>(q);

        if (filter) {
            qCDebug(KTP_COMMONINTERNALS) << "loaded message filter : " << filter;
            filters << FilterPlugin(pluginInfo, filter);
        }
    } else {
        qCWarning(KTP_COMMONINTERNALS) << "error loading plugin :" << service->library();
    }

    // Re-sort filters by weight
    qSort(filters);
}
Exemplo n.º 21
0
void PlasmaMuleApplet::contextMenuEvent(QGraphicsSceneContextMenuEvent * event)
{
	QStringList::const_iterator constIterator;
	QMenu menu;

	if (m_catDirs.count() == 1)
	{
		menu.addAction (KIcon("folder"), QString("Default"));
	} else {
		QMenu *open_sub_menu = menu.addMenu("Open Incoming");
		for (constIterator = m_catNames.constBegin(); constIterator != m_catNames.constEnd(); constIterator++)
		{
			open_sub_menu->addAction(KIcon("folder"), "Folder for " + *constIterator);
			if (constIterator != m_catNames.constEnd())
			{
				open_sub_menu->addSeparator();
			}
		}
		menu.addSeparator();
	}

	QClipboard* clipboard = QApplication::clipboard();

	if (!clipboard->text(QClipboard::Clipboard).isEmpty() || !clipboard->text(QClipboard::Selection).isEmpty())
	{
		if (m_catDirs.count() == 1)
		{
			if (!clipboard->text(QClipboard::Clipboard).isEmpty())
			{
				menu.addAction(KIcon("arrow-down-double"), "Download Link from Clipboard");

				if (!clipboard->text(QClipboard::Selection).isEmpty())
				{
					menu.addSeparator();
				}
			}

			if (!clipboard->text(QClipboard::Selection).isEmpty())
			{
				menu.addAction(KIcon("arrow-down-double"), "Download Link from Selection");
			}
		} else	{
			QMenu *download_sub_menu = menu.addMenu("Download Link");

			for (constIterator = m_catNames.constBegin(); constIterator != m_catNames.constEnd(); constIterator++)
			{
				if (!clipboard->text(QClipboard::Clipboard).isEmpty())
				{
					download_sub_menu->addAction(KIcon("arrow-down-double"), "Clipboard->" + *constIterator);

					if (!clipboard->text(QClipboard::Selection).isEmpty())
					{
						download_sub_menu->addSeparator();
					}
				}

				if (!clipboard->text(QClipboard::Selection).isEmpty())
				{
					download_sub_menu->addAction(KIcon("arrow-down-double"), "Selection->" + *constIterator);
				}

				if (constIterator != m_catNames.constEnd())
				{
				download_sub_menu->addSeparator();
				}
			}
		}
	}

	menu.addSeparator();
	menu.addAction(KIcon("documentinfo"), "About");

	QAction* selectedItem = menu.exec(QCursor::pos());
	if (selectedItem)
	{
		if (selectedItem->text() == "About")
		{
			KPluginInfo* service = new KPluginInfo (KService::serviceByDesktopName ("plasma-applet-plasmamule"));
			KAboutData* aboutData = new KAboutData (service->name().toUtf8(),
				service->name().toUtf8(),
				ki18n(service->pluginName().toUtf8()),
				service->version().toUtf8(),
				ki18n(service->comment().toUtf8()),
				KAboutData::License_GPL_V3,
				ki18n(QByteArray()),
				ki18n(QByteArray()),
				service->website().toLatin1(),
				service->email().toLatin1());
			aboutData->addAuthor (ki18n(service->author().toUtf8()),
				ki18n(QByteArray()),
				service->email().toLatin1(),
				service->website().toLatin1());
			aboutData->setTranslator(ki18nc ("NAME OF TRANSLATORS", "Your names"),
				ki18nc("EMAIL OF TRANSLATORS", "Your emails"));
			aboutData->setProgramIconName (service->icon());

			KAboutApplicationDialog* about = new KAboutApplicationDialog(aboutData, KAboutApplicationDialog::HideTranslators);
			about->exec();
		} else if (selectedItem->text().startsWith("Folder for"))
		{
			kDebug(m_debugChannel) << "Opening Folder " << m_catDirs.at(m_catNames.indexOf(selectedItem->text().remove("Folder for ")));
			KUrl url(m_catDirs.at(m_catNames.indexOf(selectedItem->text().remove("Folder for "))) + "/");
			(void) new KRun( url, 0, true );
		} else if (selectedItem->text().startsWith("Download"))
		{
			if (selectedItem->text().remove("Download Link from ") == "Clipboard")
			{
				sendLinkToEngine (clipboard->text(QClipboard::Clipboard), 0, this, m_debugChannel);
			} else {
				sendLinkToEngine (clipboard->text(QClipboard::Selection), 0, this, m_debugChannel);
			}
		} else if (selectedItem->text().startsWith("Clipboard->"))
		{
			sendLinkToEngine (clipboard->text(QClipboard::Clipboard), m_catNames.indexOf(selectedItem->text().remove("Clipboard->")), this, m_debugChannel);
		} else if (selectedItem->text().startsWith("Selection->"))
		{
			sendLinkToEngine (clipboard->text(QClipboard::Selection), m_catNames.indexOf(selectedItem->text().remove("Selection->")), this, m_debugChannel);
		}
	}
}
Exemplo n.º 22
0
bool isGlobalPlugin( const KPluginInfo& info )
{
    return info.property( "X-KDevelop-Category" ).toString() == "Global";
}
Exemplo n.º 23
0
void BehaviorConfig_Shorten::slotConfigureClicked()
{
    qCDebug(CHOQOK);
    KPluginInfo pluginInfo = availablePlugins.value(shortenPlugins->itemData(shortenPlugins->currentIndex()).toString());
    qCDebug(CHOQOK) << pluginInfo.name() << pluginInfo.kcmServices().count();

    QPointer<QDialog> configDialog = new QDialog(this);
    configDialog->setWindowTitle(pluginInfo.name());
    // The number of KCModuleProxies in use determines whether to use a tabwidget
    QTabWidget *newTabWidget = 0;
    // Widget to use for the setting dialog's main widget,
    // either a QTabWidget or a KCModuleProxy
    QWidget *mainWidget = 0;
    // Widget to use as the KCModuleProxy's parent.
    // The first proxy is owned by the dialog itself
    QWidget *moduleProxyParentWidget = configDialog;

    for (const KService::Ptr &servicePtr: pluginInfo.kcmServices()) {
        if (!servicePtr->noDisplay()) {
            KCModuleInfo moduleInfo(servicePtr);
            KCModuleProxy *currentModuleProxy = new KCModuleProxy(moduleInfo, moduleProxyParentWidget);
            if (currentModuleProxy->realModule()) {
                moduleProxyList << currentModuleProxy;
                if (mainWidget && !newTabWidget) {
                    // we already created one KCModuleProxy, so we need a tab widget.
                    // Move the first proxy into the tab widget and ensure this and subsequent
                    // proxies are in the tab widget
                    newTabWidget = new QTabWidget(configDialog);
                    moduleProxyParentWidget = newTabWidget;
                    mainWidget->setParent(newTabWidget);
                    KCModuleProxy *moduleProxy = qobject_cast<KCModuleProxy *>(mainWidget);
                    if (moduleProxy) {
                        newTabWidget->addTab(mainWidget, moduleProxy->moduleInfo().moduleName());
                        mainWidget = newTabWidget;
                    } else {
                        delete newTabWidget;
                        newTabWidget = 0;
                        moduleProxyParentWidget = configDialog;
                        mainWidget->setParent(0);
                    }
                }

                if (newTabWidget) {
                    newTabWidget->addTab(currentModuleProxy, servicePtr->name());
                } else {
                    mainWidget = currentModuleProxy;
                }
            } else {
                delete currentModuleProxy;
            }
        }
    }

    // it could happen that we had services to show, but none of them were real modules.
    if (moduleProxyList.count()) {
        QWidget *showWidget = new QWidget(configDialog);
        QVBoxLayout *layout = new QVBoxLayout;
        showWidget->setLayout(layout);
        layout->addWidget(mainWidget);
        layout->insertSpacing(-1, QApplication::style()->pixelMetric(QStyle::PM_DialogButtonsSeparator));

        QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
        QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
        okButton->setDefault(true);
        okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
        connect(buttonBox, &QDialogButtonBox::accepted, configDialog.data(), &QDialog::accept);
        connect(buttonBox, &QDialogButtonBox::rejected, configDialog.data(), &QDialog::reject);
        layout->addWidget(buttonBox);
        showWidget->adjustSize();

//         connect(&configDialog, SIGNAL(defaultClicked()), this, SLOT(slotDefaultClicked()));

        if (configDialog->exec() == QDialog::Accepted) {
            for (KCModuleProxy *moduleProxy: moduleProxyList) {
                QStringList parentComponents = moduleProxy->moduleInfo().service()->property(QLatin1String("X-KDE-ParentComponents")).toStringList();
                moduleProxy->save();
            }
        } else {
            for (KCModuleProxy *moduleProxy: moduleProxyList) {
                moduleProxy->load();
            }
        }

        qDeleteAll(moduleProxyList);
        moduleProxyList.clear();
    }
}