Esempio n. 1
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
	{