Esempio n. 1
0
void ExtensionManager::configureMenubar(bool duringInit)
{
    TDEConfig menuConfig( "kdesktoprc", true );
    if( TDEConfigGroup( &menuConfig, "KDE" ).readBoolEntry("macStyle", false)
        || TDEConfigGroup( &menuConfig, "Menubar" ).readBoolEntry( "ShowMenubar", false ))
    {
        if (TDEGlobal::dirs()->findResource("applets", "menuapplet.desktop").isEmpty() ||
            m_menubarPanel)
        {
            return;
        }

        if (duringInit)
        {
            AppletInfo menubarInfo("menuapplet.desktop", TQString::null, AppletInfo::Applet);
            if (PluginManager::the()->hasInstance(menubarInfo))
            {
                // it's already there, in the main panel!
                return;
            }
            migrateMenubar();
        }

        AppletInfo info("childpanelextension.desktop",
                        "kicker_menubarpanelrc",
                        AppletInfo::Extension);
        KPanelExtension* menubar = new MenubarExtension(info);
        m_menubarPanel = new ExtensionContainer(menubar, info, "Menubar Panel");
        m_menubarPanel->setPanelOrder(-1);
        m_menubarPanel->readConfig();
        m_menubarPanel->setPosition(KPanelExtension::Top);
        m_menubarPanel->setXineramaScreen(XineramaAllScreens);
        m_menubarPanel->setHideButtons(false, false);

        // this takes care of resizing the panel so it shows with the right height
        updateMenubar();

        m_menubarPanel->show();
        connect(kapp, TQT_SIGNAL(tdedisplayFontChanged()), TQT_SLOT(updateMenubar()));
    }
    else if (m_menubarPanel)
    {
        int screen = m_menubarPanel->xineramaScreen();
        delete m_menubarPanel;
        m_menubarPanel = 0;

        if (!m_loadingContainers) {
            emit desktopIconsAreaChanged(desktopIconsArea(screen), screen);
        }
    }
}
void ExtensionManager::configureMenubar(bool duringInit)
{
    KConfig menuConfig("kdesktoprc");
    if (KConfigGroup(&menuConfig, "KDE").readEntry("macStyle", false)
        || KConfigGroup(&menuConfig, "Menubar").readEntry("ShowMenubar", false))
    {
        if (KGlobal::dirs()->findResource("applets", "menuapplet.desktop").isEmpty() ||
            m_menubarPanel)
        {
            return;
        }

        if (duringInit)
        {
            AppletInfo menubarInfo("menuapplet.desktop", QString(), AppletInfo::Applet);
            if (PluginManager::self()->hasInstance(menubarInfo))
            {
                // it's already there, in the main panel!
                return;
            }
            migrateMenubar();
        }

        AppletInfo info("childpanelextension.desktop",
                        "kicker_menubarpanelrc",
                        AppletInfo::Extension);
        KPanelExtension* menubar = new MenubarExtension(info);
        m_menubarPanel = new ExtensionContainer(menubar, info, "Menubar Panel");
        m_menubarPanel->setPanelOrder(-1);
        m_menubarPanel->readConfig();
        m_menubarPanel->setPosition(Plasma::Top);
        m_menubarPanel->setXineramaScreen(Plasma::XineramaAllScreens);
        m_menubarPanel->setHideButtons(false, false);

        // this takes care of resizing the panel so it shows with the right height
        updateMenubar();

        m_menubarPanel->show();
        connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), SLOT(updateMenubar()));
    }
    else if (m_menubarPanel)
    {
        delete m_menubarPanel;
        m_menubarPanel = 0;
    }
}