Beispiel #1
0
void CompMgrClient::loadCompositeSettingsInternal()
{
    m_enableComposite = ScimKdeSettings::enable_Composite();

    disconnect(SkimPluginManager::self(), SIGNAL(allPluginsLoaded()), this, SLOT(updateCompositeSettings()));
    if(m_enableComposite)
    {
        if(!m_createdAtoms || m_useKompmgr != ScimKdeSettings::use_Kompmgr())
        {
            m_useKompmgr = ScimKdeSettings::use_Kompmgr();
            create_X11_atoms();
        }
        connect(SkimPluginManager::self(), SIGNAL(allPluginsLoaded()), this, SLOT(updateCompositeSettings()));
    }
    
    QStringList availableWindows;
    QValueList<QObject *>  list = SkimPluginManager::self()->specialProperyObjects();
    QValueList<QObject *>::iterator it;

    QWidget * w;
    for ( it = list.begin(); it != list.end(); ++it ) {
        w = (*it)->isWidgetType()?static_cast<QWidget *>(*it) : 0;
        if(w)
            availableWindows << w->name();
    }

    m_compSetting.clear();
    for(uint i=0; i < availableWindows.size(); i++)
    {
        fillWidgetSetting(availableWindows[i]);
    }
}
Beispiel #2
0
ScimSetupWindow::ScimSetupWindow(scim::SocketServerThread *parent, const char */*name*/, KConfigSkeleton */*config*/)
 : KCMultiDialog(KDialogBase::TreeList, i18n("Configure skim"), 0), d(new ScimSetupWindowPrivate)
{
    m_mc = SkimPluginManager::self();
    setIcon(KGlobal::iconLoader()->loadIcon("configure", KIcon::NoGroup));
    d->inputServer = parent;
    d->scim_backend_need_update = false;
    setShowIconsInTreeList( true );
    connect( this, SIGNAL( configCommitted( const QCString & ) ),
      KSettings::Dispatcher::self(), SLOT( reparseConfiguration( const QCString & ) ) );
    connect( this, SIGNAL( configCommitted( const QCString & ) ), 
      SLOT(slotConfigurationChangedFor( const QCString & )));
    connect( m_mc, SIGNAL(allPluginsLoaded()), this, SLOT(load()));

    //we cache all the available kcms and their hierarchy, so that we do not
    //need to reload them everytime load() is called
    QValueList<SkimPluginInfo *> skimplugins = SkimPluginInfo::fromServices( KTrader::self()->query( "Skim/SetupDir", "[X-KDE-PluginInfo-Category] == 'Root'" ));

    QValueList<SkimPluginInfo *>::ConstIterator pit;

    ScimSetupWindowPrivate::SetupDirInfo curDir;
    for ( pit = skimplugins.begin(); pit != skimplugins.end(); ++pit )
    {
        curDir.sortedMods.clear();
        curDir.path.clear();
        QValueList< KService::Ptr > services =
                KTrader::self()->query( "Skim/KCModule",
        "[X-KDE-PluginInfo-DisplayParent] == '" + (*pit)->pluginName() + "'" );

        std::multimap<int, int> sortedMods; //map weight to index in mods
        /*if( services.size() > 1)*/
        {
            curDir.path << (*pit)->name();
            curDir.iconfile = (*pit)->icon();

            //sort the kcm according to their weight. 0 will be the first
            for( QValueList<KService::Ptr>::ConstIterator it =
                 services.begin();
                 it != services.end(); ++it )
            {
                KCModuleInfo mod(*it);
                d->mods.push_back(mod);
                curDir.sortedMods.insert(std::pair<int, int> (mod.weight(), d->mods.size()-1));
            }
            QVariant v = ( *pit )->weight();
            int weight = v.isValid () ? v.toInt() : 1000;
            //sort the dir according to their weight. 0 will be the first
            d->dirReposition.insert(std::pair<int, ScimSetupWindowPrivate::SetupDirInfo> (weight, curDir));
        }
    }

    load();

    if(ScimKdeSettings::self()->config()->hasGroup(SetupWindowGroup))
    {
        ScimKdeSettings::self()->config()->setGroup(SetupWindowGroup);
        if( ScimKdeSettings::self()->config()->hasKey(SetupWindowSize))
            resize(ScimKdeSettings::self()->config()->readSizeEntry(SetupWindowSize));
    }
}
void PluginManager::slotLoadNextPlugin()
{
	if ( _kpmp->pluginsToLoad.isEmpty() )
	{
		if ( _kpmp->shutdownMode == PluginManagerPrivate::StartingUp )
		{
			_kpmp->shutdownMode = PluginManagerPrivate::Running;
			_kpmp->isAllPluginsLoaded = true;
			emit allPluginsLoaded();
		}
		return;
	}

	QString key = _kpmp->pluginsToLoad.pop();
	loadPluginInternal( key );

	// Schedule the next run unconditionally to avoid code duplication on the
	// allPluginsLoaded() signal's handling. This has the added benefit that
	// the signal is delayed one event loop, so the accounts are more likely
	// to be instantiated.
	QTimer::singleShot( 0, this, SLOT(slotLoadNextPlugin()) );
}
void KopeteApplication::slotLoadPlugins()
{
	// we have to load the address book early, because calling this enters the Qt event loop when there are remote resources.
	// The plugin manager is written with the assumption that Kopete will not reenter the event loop during plugin load,
	// otherwise lots of things break as plugins are loaded, then contacts are added to incompletely initialised MCLVIs
	Kopete::KABCPersistence::self()->addressBook();

	//Create the command handler (looks silly)
	Kopete::CommandHandler::commandHandler();

	//Create the view manager
	KopeteViewManager::viewManager();

	Kopete::AccountManager::self()->load();
	Kopete::ContactList::self()->load();

	KConfig *config = KGlobal::config();

	// Parse command-line arguments
	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	bool showConfigDialog = false;

	config->setGroup( "Plugins" );

	/* FIXME: This is crap, if something purged that groups but your accounts
	 * are still working kopete will load the necessary plugins but still show the
	 * stupid accounts dialog (of course empty at that time because account data
	 * gets loaded later on). [mETz - 29.05.2004]
	 */
	if ( !config->hasGroup( "Plugins" ) )
		showConfigDialog = true;

	// Listen to arguments
	/*
	// TODO: conflicts with emoticon installer and the general meaning
	// of %U in kopete.desktop
	if ( args->count() > 0 )
	{
		showConfigDialog = false;
		for ( int i = 0; i < args->count(); i++ )
			Kopete::PluginManager::self()->setPluginEnabled( args->arg( i ), true );
	}
	*/

	// Prevent plugins from loading? (--disable=foo,bar)
	QStringList disableArgs = QStringList::split( ',', args->getOption( "disable" ) );
	for ( QStringList::ConstIterator it = disableArgs.begin(); it != disableArgs.end(); ++it )
	{
		showConfigDialog = false;
		Kopete::PluginManager::self()->setPluginEnabled( *it, false );
	}

	// Load some plugins exclusively? (--load-plugins=foo,bar)
	if ( args->isSet( "load-plugins" ) )
	{
		config->deleteGroup( "Plugins", true );
		showConfigDialog = false;
		QStringList plugins = QStringList::split( ',', args->getOption( "load-plugins" ) );
		for ( QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it )
			Kopete::PluginManager::self()->setPluginEnabled( *it, true );
	}

	config->sync();

	// Disable plugins altogether? (--noplugins)
	if ( !args->isSet( "plugins" ) )
	{
		// If anybody reenables this I'll get a sword and make a nice chop-suy out
		// of your body :P [mETz - 29.05.2004]
		// This screws up kopeterc because there is no way to get the Plugins group back!
		//config->deleteGroup( "Plugins", true );

		showConfigDialog = false;
		// pretend all plugins were loaded :)
		QTimer::singleShot(0, this, SLOT( slotAllPluginsLoaded() ));
	}
	else
	{
		Kopete::PluginManager::self()->loadAllPlugins();
	}

	connect( Kopete::PluginManager::self(), SIGNAL( allPluginsLoaded() ),
		this, SLOT( slotAllPluginsLoaded() ));

	if( showConfigDialog )
	{
		// No plugins specified. Show the config dialog.
		// FIXME: Although it's a bit stupid it is theoretically possible that a user
		//        explicitly configured Kopete to not load plugins on startup. In this
		//        case we don't want this dialog. We need some other config setting
		//        like a bool hasRunKopeteBefore or so to trigger the loading of the
		//        wizard. Maybe using the last run version number is more useful even
		//        as it also allows for other features. - Martijn
		// FIXME: Possibly we need to influence the showConfigDialog bool based on the
		//        command line arguments processed below. But how exactly? - Martijn
		// NB: the command line args are completely broken atm.  
		// I don't want to fix them for 3.5 as plugin loading will change for KDE4.	- Will
		AddAccountWizard *m_addwizard = new AddAccountWizard( Kopete::UI::Global::mainWidget(), "addAccountWizard", true, true );
		m_addwizard->exec();
		Kopete::AccountManager::self()->save();
	}
}