当前位置: 首页>>代码示例>>C++>>正文


C++ KConfigGroup::deleteGroup方法代码示例

本文整理汇总了C++中KConfigGroup::deleteGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::deleteGroup方法的具体用法?C++ KConfigGroup::deleteGroup怎么用?C++ KConfigGroup::deleteGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KConfigGroup的用法示例。


在下文中一共展示了KConfigGroup::deleteGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeBuildDirConfig

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();
    }
}
开发者ID:salamanderrake,项目名称:KDevelop,代码行数:28,代码来源:cmakeutils.cpp

示例2: remove

bool AvatarManager::remove(Kopete::AvatarManager::AvatarEntry entryToRemove)
{
	// We need name and path to remove an avatar from the storage.
	if( entryToRemove.name.isEmpty() && entryToRemove.path.isEmpty() )
		return false;
	
	// We don't allow removing avatars from Contact category
	if( entryToRemove.category & Kopete::AvatarManager::Contact )
		return false;

	// Delete the image file first, file delete is more likely to fail than config group remove.
	if( KIO::NetAccess::del(KUrl(entryToRemove.path),0) )
	{
		kDebug(14010) << "Removing avatar from config.";

		KUrl configUrl(d->baseDir);
		configUrl.addPath( UserDir );
		configUrl.addPath( AvatarConfig );

		KConfigGroup avatarConfig ( KSharedConfig::openConfig( configUrl.toLocalFile(), KConfig::SimpleConfig ), entryToRemove.name );
		avatarConfig.deleteGroup();
		avatarConfig.sync();

		emit avatarRemoved(entryToRemove);

		return true;
	}
	
	return false;
}
开发者ID:Jtalk,项目名称:kopete-fork-xep0136,代码行数:30,代码来源:kopeteavatarmanager.cpp

示例3: saveTo

void CustomBuildSystemConfigWidget::saveTo( KConfig* cfg, KDevelop::IProject* /*project*/ )
{
    KConfigGroup subgrp = cfg->group( ConfigConstants::customBuildSystemGroup );
    subgrp.deleteGroup();
    for( int i = 0; i < ui->currentConfig->count(); i++ ) {
        configs[i].title = ui->currentConfig->itemText(i);
        saveConfig( subgrp, configs[i], i );
    }
    cfg->sync();
}
开发者ID:alstef,项目名称:kdevelop,代码行数:10,代码来源:custombuildsystemconfigwidget.cpp

示例4: newInstance

ProviderPtr
ImporterManager::createProvider( QVariantMap config )
{
    Controller *controller = Amarok::Components::statSyncingController();

    // First, get rid of the old provider instance. Note: the StatSyncing::Config
    // remembers the provider by the id, even when it's unregistered. After this
    // block, old instance should be destroyed, its destructor called.
    if( config.contains( "uid" ) )
    {
        const QString providerId = config.value( "uid" ).toString();
        if( m_providers.contains( providerId ) )
        {
            ProviderPtr oldProvider = m_providers.take( providerId );
            if( controller )
                controller->unregisterProvider( oldProvider );
        }
    }

    // Create a concrete provider using the config. The QueuedConnection in connect()
    // is important, because on reconfigure we *destroy* the old provider instance
    ImporterProviderPtr provider = newInstance( config );
    if( !provider )
    {
        warning() << __PRETTY_FUNCTION__ << "created provider is null!";
        return provider;
    }

    connect( provider.data(), SIGNAL(reconfigurationRequested(QVariantMap)),
                                SLOT(createProvider(QVariantMap)), Qt::QueuedConnection);
    m_providers.insert( provider->id(), provider );

    // Register the provider
    if( controller )
    {
        controller->registerProvider( provider );

        // Set provider to offline
        if( Config *config = controller->config() )
        {
            config->updateProvider( provider->id(), provider->prettyName(),
                                    provider->icon(), /*online*/ false );
            config->save();
        }
    }

    // Save the settings
    KConfigGroup group = providerConfig( provider );
    group.deleteGroup();
    foreach( const QString &key, provider->m_config.keys() )
        group.writeEntry( key, provider->m_config.value( key ) );
    group.sync();

    return provider;
}
开发者ID:KDE,项目名称:amarok,代码行数:55,代码来源:ImporterManager.cpp

示例5: devadaptor

    foreach(const QString& dev, devices) {
        const DeviceType* deviceType = DeviceType::find(dev);
        assert(deviceType != NULL);

        KConfigGroup               devconfig  = KConfigGroup(&config, dev);
        DeviceProfile              devprofile = d->profile->getDevice(*deviceType);
        DeviceProfileConfigAdaptor devadaptor(devprofile);

        devconfig.deleteGroup();
        devadaptor.saveConfig(devconfig);
    }
开发者ID:KDE,项目名称:wacomtablet,代码行数:11,代码来源:tabletprofileconfigadaptor.cpp

示例6: slotRemoveAccount

void FlickrWindow::slotRemoveAccount()
{
    KConfig config("kipirc");
    KConfigGroup grp = config.group(QString("%1%2Export Settings").arg(m_serviceName).arg(m_username));
    if(grp.exists())
    {
        kDebug()<<"Removing Account having group"<<QString("%1%2Export Settings").arg(m_serviceName);
	grp.deleteGroup();
    }
    m_username = QString();
    kDebug() << "SlotTokenObtained invoked setting user Display name to " << m_username;
    m_userNameDisplayLabel->setText(QString("<b>%1</b>").arg(m_username));
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:13,代码来源:flickrwindow.cpp

示例7: rebuildConfig

    // Reconstructs configGroup from configData and mIncomingMetaData
    void rebuildConfig()
    {
        configGroup->deleteGroup(KConfigGroup::WriteConfigFlags());

        // mIncomingMetaData cascades over config, so we write config first,
        // to let it be overwritten
        MetaData::ConstIterator end = configData.constEnd();
        for (MetaData::ConstIterator it = configData.constBegin(); it != end; ++it)
            configGroup->writeEntry(it.key(), it->toUtf8(), KConfigGroup::WriteConfigFlags());

        end = q->mIncomingMetaData.constEnd();
        for (MetaData::ConstIterator it = q->mIncomingMetaData.constBegin(); it != end; ++it)
            configGroup->writeEntry(it.key(), it->toUtf8(), KConfigGroup::WriteConfigFlags());
    }
开发者ID:vasi,项目名称:kdelibs,代码行数:15,代码来源:slavebase.cpp

示例8: providerConfig

void
ImporterManager::slotProviderForgotten( const QString &providerId )
{
    // Check if the provider is managed by this ImporterManager
    if( !m_providers.contains( providerId ) )
        return;

    ProviderPtr provider = m_providers.take( providerId );
    if( Controller *controller = Amarok::Components::statSyncingController() )
        controller->unregisterProvider( provider );

    // Remove configuration
    KConfigGroup group = providerConfig( providerId );
    group.deleteGroup();
    group.sync();
}
开发者ID:KDE,项目名称:amarok,代码行数:16,代码来源:ImporterManager.cpp

示例9: saveEntries

    void saveEntries( const KConfigGroup &grp)
    {
        KConfigGroup cg = grp;

        if (cg.name().isEmpty()) {
            cg = KConfigGroup(cg.config(),"RecentFiles");
        }
        cg.deleteGroup();

        // write file list
        for (int i = 1; i <= recentFilesIndex.size(); ++i) {
            // i - 1 because we started from 1
            cg.writePathEntry(QString("File%1").arg(i), recentFiles[i - 1]);
            cg.writePathEntry(QString("Name%1").arg(i), recentFilesIndex[i - 1]);
        }
    }
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:16,代码来源:RecentFileManager.cpp

示例10: gotRemoveGroup

void KonfUpdate::gotRemoveGroup(const QString &_group)
{
    m_oldGroup = parseGroupString(_group);

    if (!m_oldConfig1) {
        logFileError() << "RemoveGroup without previous File specification" << endl;
        return;
    }

    KConfigGroup cg = KConfigUtils::openGroup(m_oldConfig2, m_oldGroup);
    if (!cg.exists()) {
        return;
    }
    // Delete group.
    cg.deleteGroup();
    log() << m_currentFilename << ": RemoveGroup removes group " << m_oldFile << ":" << m_oldGroup << endl;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:17,代码来源:kconf_update.cpp

示例11: saveConfig

void CustomBuildSystemConfigWidget::saveConfig( KConfigGroup& grp, CustomBuildSystemConfig& c, int index )
{
    // Generate group name, access and clear it
    KConfigGroup subgrp = grp.group( ConfigConstants::buildConfigPrefix + QString::number(index) );
    subgrp.deleteGroup();

    // Write current configuration key, if our group is current
    if( ui->currentConfig->currentIndex() == index )
        grp.writeEntry( ConfigConstants::currentConfigKey, subgrp.name() );

    subgrp.writeEntry( ConfigConstants::configTitleKey, c.title );
    subgrp.writeEntry<QUrl>( ConfigConstants::buildDirKey, c.buildDir );
    foreach( const CustomBuildSystemTool& tool, c.tools ) {
        KConfigGroup toolgrp = subgrp.group( generateToolGroupName( tool.type ) );
        toolgrp.writeEntry( ConfigConstants::toolType, int(tool.type) );
        toolgrp.writeEntry( ConfigConstants::toolEnvironment , tool.envGrp );
        toolgrp.writeEntry( ConfigConstants::toolEnabled, tool.enabled );
        toolgrp.writeEntry<QUrl>( ConfigConstants::toolExecutable, tool.executable );
        toolgrp.writeEntry( ConfigConstants::toolArguments, tool.arguments );
    }
}
开发者ID:alstef,项目名称:kdevelop,代码行数:21,代码来源:custombuildsystemconfigwidget.cpp

示例12: save

void UserAgentDlg::save()
{
    Q_ASSERT (m_config);

    // Put all the groups except the default into the delete list.
    QStringList deleteList = m_config->groupList();

    //Remove all the groups that DO NOT contain a "UserAgent" entry...
    QStringList::ConstIterator endIt = deleteList.constEnd();
    for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
        if ( (*it) == QLatin1String ("<default>"))
            continue;

        KConfigGroup cg (m_config, *it);
        if (!cg.hasKey ("UserAgent"))
            deleteList.removeAll (*it);
    }

    QString domain;
    QTreeWidgetItem* item;
    int itemCount = ui.sitePolicyTreeWidget->topLevelItemCount();

    // Save and remove from the delete list all the groups that were
    // not deleted by the end user.
    for (int i = 0; i < itemCount; i++) {
        item = ui.sitePolicyTreeWidget->topLevelItem (i);
        domain = item->text (0);
        KConfigGroup cg (m_config, domain);
        cg.writeEntry ("UserAgent", item->text (2));
        deleteList.removeAll (domain);
        qDebug ("UserAgentDlg::save: Removed [%s] from delete list", domain.toLatin1().constData());
    }

    // Write the global configuration information...
    KConfigGroup cg (m_config, QString());
    cg.writeEntry ("SendUserAgent", ui.sendUACheckBox->isChecked());
    cg.writeEntry ("UserAgentKeys", m_ua_keys);

    // Sync up all the changes so far...
    m_config->sync();

    // If delete list is not empty, delete the specified domains.
    if (!deleteList.isEmpty()) {
        // Remove entries from local file.
        endIt = deleteList.constEnd();
        KConfig cfg (QStringLiteral("kio_httprc"), KConfig::SimpleConfig);

        for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
            KConfigGroup cg (&cfg, *it);
            cg.deleteEntry ("UserAgent");
            qDebug ("UserAgentDlg::save: Deleting UserAgent of group [%s]", (*it).toLatin1().constData());
            if (cg.keyList().count() < 1)
                cg.deleteGroup();
        }

        // Sync up the configuration...
        cfg.sync();

        // Check everything is gone, reset to blank otherwise.
        m_config->reparseConfiguration();
        endIt = deleteList.constEnd();
        for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
            KConfigGroup cg (m_config, *it);
            if (cg.hasKey ("UserAgent"))
                cg.writeEntry ("UserAgent", QString());
        }

        // Sync up the configuration...
        m_config->sync();
    }

    KSaveIOConfig::updateRunningIOSlaves (this);
    configChanged (false);
}
开发者ID:emmanuel099,项目名称:kio,代码行数:74,代码来源:useragentdlg.cpp

示例13: process

void process(Mode mode, KConfigGroup &grp, QString key, QString value)
{
    switch (mode) {
    case Read:
        if (IS_A_TTY(1))
            std::cout << CHAR(key) << ": " << CHAR(grp.readEntry(key, "does not exist")) << " (" << CHAR(path(grp)) << ")" << std::endl;
        else
            std::cout << CHAR(grp.readEntry(key, ""));
        break;
    case Write: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        bool added = !grp.hasKey(key);
        QString oldv;
        if (!added) oldv = grp.readEntry(key);
        grp.writeEntry(key, QString(value));
        grp.sync();
        if (added)
            std::cout << "New " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
        else
            std::cout << CHAR(key) << ": " << CHAR(oldv) << " -> " << CHAR(grp.readEntry(key)) << std::endl;
        break;
    }
    case Delete: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        if (grp.hasKey(key)) {
            std::cout << "Removed " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
            grp.deleteEntry(key);
            grp.sync();
        } else if (grp.hasGroup(key)) {
            std::cout << "There's a group, but no key: " << CHAR(key) << "\nPlease explicitly use deletegroup" << std::endl;
            exit(1);
        } else {
            std::cout << "There's no key " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case DeleteGroup: {
        if (grp.hasGroup(key)) {
            grp = grp.group(key);
            if (grp.isImmutable()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
                exit(1);
            }
            QMap<QString, QString> map = grp.entryMap();
            std::cout << "Removed " << CHAR(key) << gs_separator << std::endl;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
            }
            grp.deleteGroup();
            grp.sync();
        } else {
            std::cout << "There's no group " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case List:
    case ListKeys: {
        if (!grp.exists()) { // could be parent group
            if (mode == ListKeys)
                exit(1);
            QStringList groups = grp.parent().exists() ? grp.parent().groupList() : grp.config()->groupList();
            if (groups.isEmpty()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " does not exist" << std::endl;
                exit(1);
            }
            std::cout << "Groups in " << CHAR(path(grp)) << gs_separator << std::endl;
            foreach (const QString &s, groups)
                if (key.isEmpty() || s.contains(key, Qt::CaseInsensitive))
                    std::cout << CHAR(s) << std::endl;
            exit(0);
        }

        QMap<QString, QString> map = grp.entryMap();
        if (map.isEmpty()) {
            std::cout << "The group " << CHAR(path(grp)) << " is empty" << std::endl;
            break;
        }

        if (mode == List) {
            bool matchFound = false;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                if (key.isEmpty() || it.key().contains(key, Qt::CaseInsensitive)) {
                    if (!matchFound)
                        std::cout << std::endl << CHAR(path(grp)) << gs_separator << std::endl;
                    matchFound = true;
                    std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
                }
            }

            if (!matchFound)
                std::cout << "No present key matches \"" << CHAR(key) << "\" in " << CHAR(path(grp));
            std::cout << std::endl;
//.........这里部分代码省略.........
开发者ID:luebking,项目名称:KLItools,代码行数:101,代码来源:kconfig.cpp

示例14: saveSettings

void SettingsCore::saveSettings()
{
#ifdef ABAKUS_QTONLY
    //TODO
#else
    KConfigGroup config = KGlobal::config()->group("Settings");
    
    config.writeEntry("Trigonometric mode",
                      trigMode() == Abakus::Degrees
                      ? "Degrees"
                      : "Radians");
    
    config.writeEntry("Decimal Precision", Abakus::m_prec);
    config.writeEntry("History Limit", m_historyLimit);
    
    
    config = KGlobal::config()->group("GUI");
    
    config.writeEntry("InCompactMode", m_compactMode);
    
    config.writeEntry("ShowMathematicalSidebar", m_mathematicalSidebarVisible);
    
    config.writeEntry("MathematicalSidebarActiveTab", m_mathematicalSidebarActiveView);
    config.writeEntry("MathematicalSidebarWidth", m_mathematicalSidebarWidth);
    
    config.writeEntry("Size", m_windowSize);
    
    
    config = KGlobal::config()->group("Variables");
    config.deleteGroup();
    
    QStringList saveList;
    QStringList::ConstIterator it;
    int fieldWidth;
    int numberOfEntries;
    
    // Set precision to max for most accuracy
    Abakus::m_prec = 75;
    
    
    QStringList values = NumeralModel::instance()->valueNames();
    for(it = values.begin(), numberOfEntries = 0; it != values.end(); ++it) {
        if(NumeralModel::instance()->isValueReadOnly(*it))
            continue;
        
        ++numberOfEntries;
    }
    fieldWidth = QString("%1").arg(numberOfEntries).length();
    int j = 0;
    for(it = values.begin(); it != values.end(); ++it) {
        if(NumeralModel::instance()->isValueReadOnly(*it))
            continue;
        
        saveList.clear();
        saveList << *it;
        saveList << NumeralModel::instance()->value(*it).toString(Abakus::DEC);
        saveList << QString("%1").arg(NumeralModel::instance()->value(*it).numeralSystem());
        config.writeEntry(QString("%1").arg(j, fieldWidth, 10, QLatin1Char('0')), saveList);
        ++j;
    }
    
    
    config = KGlobal::config()->group("Functions");
    config.deleteGroup();
    
    FunctionModel *manager = FunctionModel::instance();
    UnaryFunction *fn;
    QString variable;
    QString expression;
    QString saveString;
    QStringList userFunctions = manager->functionList(FunctionModel::UserDefined);
    fieldWidth = QString("%1").arg(userFunctions.count()).length();
    j = 0;
    foreach(QString functionName, userFunctions)
    {
        fn = dynamic_cast<UnaryFunction *>(manager->function(functionName)->userFn->fn);
        variable = manager->function(functionName)->userFn->varName;
        expression = fn->operand()->infixString();
        
        saveString = QString("%1(%2) = %3").arg(functionName).arg(variable).arg(expression);
        config.writeEntry(QString("%1").arg(j, fieldWidth, 10, QLatin1Char('0')), saveString);
        ++j;
    }
开发者ID:KDE,项目名称:abakus,代码行数:83,代码来源:settingscore.cpp

示例15: newInstance

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;
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:83,代码来源:plasmaapp.cpp


注:本文中的KConfigGroup::deleteGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。