Beispiel #1
0
void ExtensionManager::addExtension( const TQString& desktopFile )
{
    PluginManager* pm = PluginManager::the();
    ExtensionContainer *e = pm->createExtensionContainer(desktopFile,
                                                         false, // is not startup
                                                         TQString::null, // no config
                                                         uniqueId());
    

    kdDebug(1210) << "ExtensionManager::addExtension" << endl;

    if (e)
    {
        e->readConfig();
        // as a new panel, the position will be set to the preferred position
        // we just need to make sure this works with the rest of the panel layout
        e->setPosition(initialPanelPosition(e->position()));
        kdDebug(1210)<<"after e->readConfig(): pos="<<e->position()<<endl;
        addContainer(e);
        e->show();
        e->writeConfig();
        saveContainerConfig();
    }
}
Beispiel #2
0
void ExtensionManager::initialize()
{
    m_loadingContainers = true;

//    kdDebug(1210) << "ExtensionManager::loadContainerConfig()" << endl;
    TDEConfig* config = TDEGlobal::config();
    PluginManager* pm = PluginManager::the();

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

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

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

    configureMenubar(true);

    Kicker::the()->setMainWidget(m_mainPanel);

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

    // read extension list
    config->setGroup("General");
    TQStringList elist = config->readListEntry("Extensions2");

    // now restore the extensions
    TQStringList::iterator itEnd = elist.end();
    for (TQStringList::iterator it = elist.begin(); it !=  elist.end(); ++it)
    {
        // last container?
        TQStringList::iterator lastcheck(it);
        lastcheck++;
        if (lastcheck == elist.end()) {
            m_loadingContainers = false;
        }

        // extension id
        TQString extensionId(*it);

        // create a matching applet container
        if (extensionId.find("Extension") == -1)
        {
            continue;
        }

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

        // set config group
        config->setGroup(extensionId);

        ExtensionContainer* e = pm->createExtensionContainer(config->readPathEntry("DesktopFile"),
                                                             true, // is startup
                                                             config->readPathEntry("ConfigFile"),
                                                             extensionId);
        if (e)
        {
            addContainer(e);
            e->readConfig();
            e->show();
            kapp->processEvents();
        }
    }
    m_loadingContainers = false;

    pm->clearUntrustedLists();
    connect(Kicker::the(), TQT_SIGNAL(configurationChanged()), TQT_SLOT(configurationChanged()));
    DCOPRef r( "ksmserver", "ksmserver" );
    r.send( "resumeStartup", TQCString( "kicker" ));
}
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");
}