Пример #1
0
void PluginManager::loadAllPlugins()
{
    kDebug();
    KSharedConfig::Ptr config = KGlobal::config();
    if ( config->hasGroup( QLatin1String( "Plugins" ) ) )
    {
        QMap<QString, bool> pluginsMap;

        QMap<QString, QString> entries = config->entryMap( QLatin1String( "Plugins" ) );
        QMap<QString, QString>::Iterator it;
        for ( it = entries.begin(); it != entries.end(); ++it )
        {
            QString key = it.key();
            if ( key.endsWith( QLatin1String( "Enabled" ) ) )
                pluginsMap.insert( key.left(key.length() - 7), (it.value() == QLatin1String( "true" )) );
        }

        QList<KPluginInfo> plugins = availablePlugins( QString::null );    //krazy:exclude=nullstrassign for old broken gcc
        QList<KPluginInfo>::ConstIterator it2 = plugins.constBegin();
        QList<KPluginInfo>::ConstIterator end = plugins.constEnd();
        for ( ; it2 != end; ++it2 )
        {
            if ( it2->category() == QLatin1String( "MicroBlogs" ) ||
                 it2->category() == QLatin1String( "Shorteners" ) )
                continue;

            QString pluginName = it2->pluginName();
            if ( pluginsMap.value( pluginName, it2->isPluginEnabledByDefault() ) )
            {
                if ( !plugin( pluginName ) )
                    _kpmp->pluginsToLoad.push( pluginName );
            }
            else
            {
                //This happens if the user unloaded plugins with the config plugin page.
                // No real need to be assync because the user usually unload few plugins
                // compared tto the number of plugin to load in a cold start. - Olivier
                if ( plugin( pluginName ) )
                    unloadPlugin( pluginName );
            }
        }
    }
    else
    {
        // we had no config, so we load any plugins that should be loaded by default.
        QList<KPluginInfo> plugins = availablePlugins( QString::null );    //krazy:exclude=nullstrassign for old broken gcc
        QList<KPluginInfo>::ConstIterator it = plugins.constBegin();
        QList<KPluginInfo>::ConstIterator end = plugins.constEnd();
        for ( ; it != end; ++it )
        {
            if ( it->category() == QLatin1String( "MicroBlogs" ) ||
                it->category() == QLatin1String( "Shorteners" ) )
                continue;
            if ( it->isPluginEnabledByDefault() )
                _kpmp->pluginsToLoad.push( it->pluginName() );
        }
    }
    // Schedule the plugins to load
    QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
}
Пример #2
0
void Repository::Private::readConfig()
{
    KSharedConfig::Ptr config = KGlobal::config();

    // Sometimes the location can be unequal to the entry in the CVS/Root.
    //
    // This can happen when the checkout was done with a repository name
    // like :pserver:[email protected]:/home/kde. When cvs then saves the
    // name into the .cvspass file, it adds the default cvs port to it like
    // this :pserver:[email protected]:2401/home/kde. This name is then also
    // used for the configuration group.
    //
    // In order to be able to read this group, we then have to manually add
    // the port number to it.
    QString repositoryGroup = QLatin1String("Repository-") + location;
    if( !config->hasGroup(repositoryGroup) )
    {
        // find the position of the first path separator
        const int insertPos = repositoryGroup.indexOf('/');
        if( insertPos > 0 )
        {
            // add port to location
            // (1) :pserver:[email protected]:/path
            if( repositoryGroup.at(insertPos - 1) == ':' )
                repositoryGroup.insert(insertPos, "2401");
            // (2) :pserver:[email protected]/path
            else
                repositoryGroup.insert(insertPos, ":2401");
        }
    }

    KConfigGroup group = config->group(repositoryGroup);

    // should we retrieve the CVSROOT/cvsignore file from the cvs server?
    retrieveCvsignoreFile = group.readEntry("RetrieveCvsignore", false);

    // see if there is a specific compression level set for this repository
    compressionLevel = group.readEntry("Compression", -1);

    // use default global compression level instead?
    if( compressionLevel < 0 )
    {
        KConfigGroup cs(config, "General");
        compressionLevel = cs.readEntry("Compression", 0);
    }

    // get remote shell client to access the remote repository
    rsh = group.readPathEntry("rsh", QString());

    // get program to start on the server side
    server = group.readEntry("cvs_server");
}
Пример #3
0
  KAuthorizedPrivate()
    :   actionRestrictions( false ), blockEverything(false),mutex(QMutex::Recursive)
  {
    Q_ASSERT_X(QCoreApplication::instance(),"KAuthorizedPrivate()","There has to be an existing QCoreApplication::instance() pointer");

    KSharedConfig::Ptr config = KGlobal::config();

    Q_ASSERT_X(config,"KAuthorizedPrivate()","There has to be an existing KGlobal::config() pointer");
    if (!config) {
      blockEverything=true;
      return;
    }
    actionRestrictions = config->hasGroup("KDE Action Restrictions" ) && !kde_kiosk_exception;
  }
    //______________________________________________________________
    void ExceptionList::writeConfig( KSharedConfig::Ptr config )
    {

        // remove all existing exceptions
        QString groupName;
        for( int index = 0; config->hasGroup( groupName = exceptionGroupName( index ) ); ++index )
        { config->deleteGroup( groupName ); }

        // rewrite current exceptions
        int index = 0;
        foreach( const ConfigurationPtr& exception, _exceptions )
        {

            Util::writeConfig( exception.data(), config.data(), exceptionGroupName( index ) );
            ++index;

        }
Пример #5
0
void ExtensionManager::initialize()
{
//    kDebug(1210) << "ExtensionManager::loadContainerConfig()";
    KSharedConfig::Ptr config = KGlobal::config();
    PluginManager* pm = PluginManager::self();

    // set up the "main" panel
    if (config->hasGroup("Main Panel"))
    {
		KConfigGroup cg(config,"Main Panel");
        if (cg.hasKey("DesktopFile"))
        {
            m_mainPanel = pm->createExtensionContainer(cg.readPathEntry("DesktopFile", false),
                                                       true, cg.readPathEntry("ConfigFile", false),
                                                       "Main Panel");
        }
    }

    if (!m_mainPanel)
    {
        // fall back to a regular ol' PanelExtension
        m_mainPanel = pm->createExtensionContainer(
                            "childpanelextension.desktop",
                            true,
                            QString(KGlobal::mainComponent().aboutData()->appName()) + "rc",
                            "Main Panel");
    }

    if (!m_mainPanel)
    {
        KMessageBox::error(0, i18n("The KDE panel (kicker) could not load the main panel "
                                   "due to a problem with your installation. "),
                           i18n("Fatal Error"));
        exit(1);
    }

    configureMenubar(true);

    m_mainPanel->readConfig();
    m_mainPanel->show();
    kapp->processEvents();

    // read extension list
	KConfigGroup cg2(config, "General");
    QStringList elist = cg2.readEntry("Extensions2", QStringList() );

    // now restore the extensions
    foreach (QString extensionId, elist)
    {
        // create a matching applet container
        if (extensionId.indexOf("Extension") == -1)
        {
            continue;
        }

        // is there a config group for this extension?
        if (!config->hasGroup(extensionId))
        {
            continue;
        }

        // set config group
		KConfigGroup cg3(config, extensionId);

        ExtensionContainer* e =
            pm->createExtensionContainer(cg3.readPathEntry("DesktopFile", false),
                                         true, // is startup
                                         cg3.readPathEntry("ConfigFile", false),
                                         extensionId);

        if (e)
        {
            addContainer(e);
            e->readConfig();
            e->show();
            kapp->processEvents();
        }
    }

    pm->clearUntrustedLists();
    connect(Kicker::self(), SIGNAL(configurationChanged()), SLOT(configurationChanged()));

    QDBusInterface dbus("org.kde.ksmserver", "/ksmserver");
    dbus.call("resumeStartup", "kicker");
}