PlasmaApp::PlasmaApp() : KUniqueApplication(), m_corona(0), m_maxId(0) { KGlobal::locale()->insertCatalog("plasma-standaloneplasmoids"); KCrash::setFlags(KCrash::AutoRestart); KConfigGroup cg(KGlobal::config(), "General"); Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", font())); corona(); KConfigGroup applets = storedConfig(0); foreach (const QString &group, applets.groupList()) { KConfigGroup appletGroup(&applets, group); int id = appletGroup.name().toInt(); QString pluginName = appletGroup.readEntry("plugin", QString()); if (id != 0 && !pluginName.isEmpty()) { m_storedApplets.insert(pluginName, id); m_maxId = qMax(id, m_maxId); } } //newInstance(); connect(this, SIGNAL(aboutToQuit()), this, SLOT(cleanup())); setQuitOnLastWindowClosed(true); }
void Containment::restore(KConfigGroup &group) { /* #ifndef NDEBUG // qDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type; // qDebug() << " location:" << group.readEntry("location", (int)d->location); // qDebug() << " geom:" << group.readEntry("geometry", geometry()); // qDebug() << " formfactor:" << group.readEntry("formfactor", (int)d->formFactor); // qDebug() << " screen:" << group.readEntry("screen", d->screen); #endif */ setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location)); setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor)); d->lastScreen = group.readEntry("lastScreen", d->lastScreen); setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper)); d->activityId = group.readEntry("activityId", QString()); flushPendingConstraintsEvents(); restoreContents(group); setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable)); if (isContainment()) { KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins"); cfg = KConfigGroup(&cfg, QString::number(containmentType())); //qDebug() << cfg.keyList(); if (cfg.exists()) { foreach (const QString &key, cfg.keyList()) { //qDebug() << "loading" << key; setContainmentActions(key, cfg.readEntry(key, QString())); } } else { //shell defaults
void SearchLaunch::init() { Containment::init(); connect(this, SIGNAL(appletAdded(Plasma::Applet*,QPointF)), this, SLOT(layoutApplet(Plasma::Applet*,QPointF))); connect(this, SIGNAL(appletRemoved(Plasma::Applet*)), this, SLOT(appletRemoved(Plasma::Applet*))); connect(this, SIGNAL(toolBoxVisibilityChanged(bool)), this, SLOT(updateConfigurationMode(bool))); setToolBox(Plasma::AbstractToolBox::load(corona()->preferredToolBoxPlugin(Plasma::Containment::DesktopContainment), QVariantList(), this)); QAction *a = action("add widgets"); if (a) { addToolBoxAction(a); } if (toolBox()) { connect(toolBox(), SIGNAL(toggled()), this, SIGNAL(toolBoxToggled())); connect(toolBox(), SIGNAL(visibilityChanged(bool)), this, SIGNAL(toolBoxVisibilityChanged(bool))); toolBox()->show(); } a = action("configure"); if (a) { addToolBoxAction(a); a->setText(i18n("Configure Search and Launch")); } QAction *lockAction = 0; if (corona()) { lockAction = corona()->action("lock widgets"); } if (!lockAction || !lockAction->isEnabled()) { lockAction = new QAction(this); addAction("lock page", lockAction); lockAction->setText(i18n("Lock Page")); lockAction->setIcon(KIcon("object-locked")); QObject::connect(lockAction, SIGNAL(triggered(bool)), this, SLOT(toggleImmutability())); }