void removeBuildDirConfig( KDevelop::IProject* project ) { int buildDirIndex = currentBuildDirIndex( project ); if ( !buildDirGroupExists( project, buildDirIndex ) ) { qWarning() << "build directory config" << buildDirIndex << "to be removed but does not exist"; return; } int bdCount = buildDirCount(project); setBuildDirCount( project, bdCount - 1 ); removeOverrideBuildDirIndex( project ); setCurrentBuildDirIndex( project, -1 ); // move (rename) the upper config groups to keep the numbering // if there's nothing to move, just delete the group physically if (buildDirIndex + 1 == bdCount) buildDirGroup( project, buildDirIndex ).deleteGroup(); else for (int i = buildDirIndex + 1; i < bdCount; ++i) { KConfigGroup src = buildDirGroup( project, i ); KConfigGroup dest = buildDirGroup( project, i - 1 ); dest.deleteGroup(); src.copyTo(&dest); src.deleteGroup(); } }
void MousePluginWidget::prepareForSave() { if (!m_configButton->isVisible() || m_pluginInstance || m_lastConfigLocation.isEmpty()) { return; } //back up our config because it'll be erased for saving KConfigGroup cfg = m_containment->containmentActionsConfig(); cfg = KConfigGroup(&cfg, m_lastConfigLocation); cfg.copyTo(&m_tempConfig); //kDebug() << "copied to temp"; }
int PlasmaApp::newInstance() { KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); if (args->count() == 0) { KCmdLineArgs::usage(); return 0; } QString pluginName; if (args->count() > 0) { pluginName = args->arg(0); } //is the applet already running? if (m_viewForPlugin.contains(pluginName)) { m_viewForPlugin.value(pluginName)->activateWindow(); m_viewForPlugin.value(pluginName)->raise(); return 0; } QVariantList appletArgs; for (int i = 1; i < args->count(); ++i) { appletArgs << args->arg(i); } int appletId; Plasma::Containment *containment = m_corona->addContainment("null"); containment->setFormFactor(Plasma::Planar); containment->setLocation(Plasma::Floating); appletId = ++m_maxId; if (m_storedApplets.contains(pluginName)) { int storedAppletId = m_storedApplets.values(pluginName).first(); KConfigGroup config = storedConfig(storedAppletId); KConfigGroup actualConfig(containment->config()); actualConfig = KConfigGroup(&actualConfig, "Applets"); actualConfig = KConfigGroup(&actualConfig, QString::number(appletId)); config.copyTo(&actualConfig); config.deleteGroup(); m_storedApplets.remove(pluginName, storedAppletId); } SingleView *view = new SingleView(m_corona, containment, pluginName, appletId, appletArgs); if (!view->applet()) { delete view; return 0; } connect(view, SIGNAL(storeApplet(Plasma::Applet*)), this, SLOT(storeApplet(Plasma::Applet*))); connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*))); if (args->isSet("border")) { view->setBackgroundBrush(KColorUtils::mix(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor), Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor), 0.15)); connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(themeChanged())); view->applet()->setBackgroundHints(Plasma::Applet::NoBackground); } else { view->setWindowFlags(Qt::FramelessWindowHint); view->setAttribute(Qt::WA_TranslucentBackground); view->setAutoFillBackground(false); view->viewport()->setAutoFillBackground(false); view->setAttribute(Qt::WA_NoSystemBackground); view->viewport()->setAttribute(Qt::WA_NoSystemBackground); Plasma::WindowEffects::overrideShadow(view->winId(), true); } if (args->isSet("fullscreen")) { view->setWindowState(Qt::WindowFullScreen); } args->clear(); m_viewForPlugin[pluginName] = view; m_pluginForView[view] = pluginName; KWindowSystem::setOnDesktop(view->winId(), KWindowSystem::currentDesktop()); view->show(); view->raise(); return 0; }