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


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

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


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

示例1: testLoadAllEffects

void TestPluginEffectLoader::testLoadAllEffects()
{
    MockEffectsHandler mockHandler(KWin::OpenGL2Compositing);
    mockHandler.setProperty("testEnabledByDefault", true);
    KWin::PluginEffectLoader loader;
    loader.setPluginSubDirectory(QString());

    KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);

    // prepare the configuration to hard enable/disable the effects we want to load
    KConfigGroup plugins = config->group("Plugins");
    plugins.writeEntry(QStringLiteral("fakeeffectpluginEnabled"), false);
    plugins.sync();

    loader.setConfig(config);

    qRegisterMetaType<KWin::Effect*>();
    QSignalSpy spy(&loader, SIGNAL(effectLoaded(KWin::Effect*,QString)));
    // connect to signal to ensure that we delete the Effect again as the Effect doesn't have a parent
    connect(&loader, &KWin::PluginEffectLoader::effectLoaded,
        [](KWin::Effect *effect) {
            effect->deleteLater();
        }
    );

    // the config is prepared so that no Effect gets loaded!
    loader.queryAndLoadAll();

    // we need to wait some time because it's queued and in a thread
    QVERIFY(!spy.wait(100));

    // now let's prepare a config which has one effect explicitly enabled
    plugins.writeEntry(QStringLiteral("fakeeffectpluginEnabled"), true);
    plugins.sync();

    loader.queryAndLoadAll();
    // should load one effect in first go
    QVERIFY(spy.wait(100));
    // and afterwards it should not load another one
    QVERIFY(!spy.wait(10));

    QCOMPARE(spy.size(), 1);
    // if we caught a signal it should have the effect name we passed in
    QList<QVariant> arguments = spy.takeFirst();
    QCOMPARE(arguments.count(), 2);
    QCOMPARE(arguments.at(1).toString(), QStringLiteral("fakeeffectplugin"));
    spy.clear();
}
开发者ID:8l,项目名称:kwin,代码行数:48,代码来源:test_plugin_effectloader.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:

KTagsView::~KTagsView()
{
  // remember the splitter settings for startup
  KConfigGroup grp = KSharedConfig::openConfig()->group("Last Use Settings");
  grp.writeEntry("KTagsViewSplitterSize", m_splitter->saveState());
  grp.sync();
}
开发者ID:KDE,项目名称:kmymoney,代码行数:7,代码来源:ktagsview.cpp

示例4: indexingFinished

void CheckIndexingManager::indexingFinished(qint64 index, bool reindexCollection)
{
    if (index != -1) {
        if (!mCollectionsIndexed.contains(index)) {
            mCollectionsIndexed.append(index);
        }
    }
    if (reindexCollection) {
        if (!mCollectionsNeedToBeReIndexed.contains(index)) {
            mCollectionsNeedToBeReIndexed.append(index);
        }
        if (mCollectionsNeedToBeReIndexed.count() > 30) {
            callToReindexCollection();
            mCollectionsNeedToBeReIndexed.clear();
        }
    }
    mIndex++;
    if (mIndex < mListCollection.count()) {
        mTimer->start();
    } else {
        mIsReady = true;
        mIndex = 0;
        callToReindexCollection();
        mListCollection.clear();
        mCollectionsNeedToBeReIndexed.clear();

        const KSharedConfig::Ptr cfg = KSharedConfig::openConfig(QStringLiteral("kmailsearchindexingrc"));
        KConfigGroup grp = cfg->group(QStringLiteral("General"));
        grp.writeEntry(QStringLiteral("lastCheck"), QDateTime::currentDateTime());
        grp.deleteEntry(QStringLiteral("collectionsIndexed"));
        grp.sync();
    }
}
开发者ID:KDE,项目名称:kdepim,代码行数:33,代码来源:checkindexingmanager.cpp

示例5: save

void KWApplicationConfig::save()
{
    KSharedConfigPtr config = KGlobal::config();
    KConfigGroup interface = config->group("Interface");
    interface.writeEntry("ViewFormattingChars", m_showFormattingChars);
    interface.writeEntry("ViewFieldShadings", m_showInlineObjectVisualization);
    interface.writeEntry("ViewTableBorders", m_showTableBorders);
    interface.writeEntry("ViewFrameBorders", m_viewFrameBorders);
    interface.writeEntry("Zoom", m_zoom);
    interface.writeEntry("ZoomMode", (int)m_zoomMode);
//    interface.writeEntry("showDocStruct", m_bShowDocStruct);
    interface.writeEntry("Rulers", m_viewRulers);
//    interface.writeEntry("viewmode", m_viewModeType) ;
//    interface.writeEntry("AllowAutoFormat", m_bAllowAutoFormat);
//    interface.writeEntry("ShowGrid" , m_bShowGrid);
//    interface.writeEntry("SnapToGrid" , m_bSnapToGrid);
    interface.writeEntry("StatusBarShowPage", m_statusBarShowPage);
    interface.writeEntry("StatusBarShowPageStyle", m_statusBarShowPageStyle);
    interface.writeEntry("StatusBarShowPageSize", m_statusBarShowPageSize);
    interface.writeEntry("StatusBarShowLineNumber", m_statusBarShowLineNumber);
    interface.writeEntry("StatusBarShowModified", m_statusBarShowModified);
    interface.writeEntry("StatusBarShowMouse", m_statusBarShowMouse);
    interface.writeEntry("StatusBarShowZoom", m_statusBarShowZoom);
    interface.writeEntry("StatusBarShowWordCount", m_statusBarShowWordCount);
    interface.sync();
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:26,代码来源:KWApplicationConfig.cpp

示例6: setUnit

void KWApplicationConfig::setUnit(const KoUnit &unit)
{
    KSharedConfigPtr config = KGlobal::config();
    KConfigGroup misc = config->group("Misc");
    misc.writeEntry("Units", unit.symbol());
    misc.sync();
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:7,代码来源:KWApplicationConfig.cpp

示例7: setProxyFor

void KSaveIOConfig::setProxyFor( const QString& protocol,
                                 const QString& _proxy )
{
  KConfigGroup cfg (config(), "Proxy Settings");
  cfg.writeEntry(protocol.toLower() + "Proxy", _proxy);
  cfg.sync();
}
开发者ID:emmanuel099,项目名称:kio,代码行数:7,代码来源:ksaveioconfig.cpp

示例8: setHistoryItems

void QalculateSettings::setHistoryItems(QStringList items)
{
    m_historyItems = items;
    KConfigGroup cfg = m_applet->config();
    cfg.writeEntry("historyItems", m_historyItems);
    cfg.sync();
}
开发者ID:KDE,项目名称:kdeplasma-addons,代码行数:7,代码来源:qalculate_settings.cpp

示例9: menuCardDeck

// Choose a card deck
void Mainwindow::menuCardDeck()
{
    QString front = mCardTheme;

    KConfigGroup grp = KGlobal::config()->group("ProgramData");
    KCardWidget *cardwidget = new KCardWidget();
    QPointer<KCardDialog> dlg;

    cardwidget->readSettings(grp);
    dlg = new KCardDialog(cardwidget);
    if (dlg->exec() == QDialog::Accepted)
    {
        // Always store the settings, other things than the deck may have changed
        cardwidget->saveSettings(grp);
        grp.sync();
        if (global_debug > 0) kDebug() << "NEW CARDDECK:" << front;
        bool change = false; // Avoid unnecessary changes
        if (!cardwidget->deckName().isEmpty() && cardwidget->deckName() != mCardTheme)
        {
            mCardTheme    = cardwidget->deckName();
            change = true;
        }
        if (change)
        {
            mTheme->updateCardTheme(mCardTheme);
            mView->update(); // Be on the safe side and update
        }
    }
    delete dlg;
}
开发者ID:KDE,项目名称:lskat,代码行数:31,代码来源:mainwindow.cpp

示例10: removeResource

void ManagerImpl::removeResource( Resource *resource )
{
  QString key = resource->identifier();

  if ( !d->mConfig ) {
    createStandardConfig();
  }

  KConfigGroup group = d->mConfig->group( "General" );
  QStringList activeKeys = group.readEntry( "ResourceKeys", QStringList() );
  if ( activeKeys.contains( key ) ) {
    activeKeys.removeAll( key );
    group.writeEntry( "ResourceKeys", activeKeys );
  } else {
    QStringList passiveKeys= group.readEntry( "PassiveResourceKeys", QStringList() );
    passiveKeys.removeAll( key );
    group.writeEntry( "PassiveResourceKeys", passiveKeys );
  }

  QString standardKey = group.readEntry( "Standard" );
  if ( standardKey == key ) {
    group.writeEntry( "Standard", "" );
  }

  d->mConfig->deleteGroup( "Resource_" + resource->identifier() );
  group.sync();
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:27,代码来源:managerimpl.cpp

示例11: downloadAndConvertFinished

    void IPBlockingPrefPage::downloadAndConvertFinished(KJob* j)
    {
        if (j != m_job)
            return;

        KConfigGroup g = KSharedConfig::openConfig()->group("IPFilterAutoUpdate");
        if (!j->error())
        {
            g.writeEntry("last_updated", QDateTime::currentDateTime());
            g.writeEntry("last_update_ok", true);
        }
        else
        {
            g.writeEntry("last_update_attempt", QDateTime::currentDateTime());
            g.writeEntry("last_update_ok", false);
        }

        g.sync();

        m_job = 0;
        m_plugin->loadAntiP2P();
        restoreGUI();
        updateAutoUpdate();
        updateFinished();
    }
开发者ID:biwin,项目名称:ktorrent,代码行数:25,代码来源:ipblockingprefpage.cpp

示例12: writeConfig

void KIGPDialog::writeConfig()
{
 KConfigGroup group = m_config->group("Look");
 group.writeEntry("ImagesPerRow", getImagesPerRow());
 group.writeEntry("ImageName", printImageName());
 group.writeEntry("ImageSize", printImageSize());
 group.writeEntry("ImageProperty", printImageProperty());
 group.writeEntry("FontName", getFontName());
 group.writeEntry("FontSize", getFontSize());
 group.writeEntry("ForegroundColor", getForegroundColor().name() );
 group.writeEntry("BackgroundColor", getBackgroundColor().name());

 group =m_config->group("Directory");
 group.writeEntry("RecurseSubDirectories", recurseSubDirectories());
 group.writeEntry("RecursionLevel", recursionLevel());
 group.writeEntry("CopyOriginalFiles", copyOriginalFiles());
 group.writeEntry("UseCommentFile", useCommentFile());

 group = m_config->group("Thumbnails");
 group.writeEntry("ThumbnailSize", getThumbnailSize());
 group.writeEntry("ColorDepth", getColorDepth());
 group.writeEntry("ColorDepthSet", colorDepthSet());
 group.writeEntry("ImageFormat", getImageFormat());
 group.sync();
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:25,代码来源:imgallerydialog.cpp

示例13: initTestCase

void QuickTilingTest::initTestCase()
{
    qRegisterMetaType<KWin::ShellClient*>();
    qRegisterMetaType<KWin::AbstractClient*>();
    qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode");
    QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
    QVERIFY(workspaceCreatedSpy.isValid());
    kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
    QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
    QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));

    // set custom config which disables the Outline
    KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
    KConfigGroup group = config->group("Outline");
    group.writeEntry(QStringLiteral("QmlPath"), QString("/does/not/exist.qml"));
    group.sync();

    kwinApp()->setConfig(config);

    kwinApp()->start();
    QVERIFY(workspaceCreatedSpy.wait());
    QCOMPARE(screens()->count(), 2);
    QCOMPARE(screens()->geometry(0), QRect(0, 0, 1280, 1024));
    QCOMPARE(screens()->geometry(1), QRect(1280, 0, 1280, 1024));
}
开发者ID:shadeslayer,项目名称:kwin,代码行数:25,代码来源:quick_tiling_test.cpp

示例14: setColorSimilarityInternal

// private
void kpColorSimilarityToolBarItem::setColorSimilarityInternal (double similarity,
        bool writeConfig)
{
#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM
    qCDebug(kpLogWidgets) << "kpColorSimilarityToolBarItem::setColorSimilarityInternal("
              << "similarity=" << similarity << ",writeConfig=" << writeConfig
              << ")" << endl;
#endif

    m_oldColorSimilarity = colorSimilarity ();

    kpColorSimilarityHolder::setColorSimilarity (similarity);
    m_processedColorSimilarity = kpColor::processSimilarity (colorSimilarity ());

    updateIcon ();
    updateToolTip ();

    if (writeConfig)
    {
        KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupGeneral);
        cfg.writeEntry (kpSettingColorSimilarity, colorSimilarity ());
        cfg.sync ();
    }

    emit colorSimilarityChanged (colorSimilarity (), m_processedColorSimilarity);
}
开发者ID:KDE,项目名称:kolourpaint,代码行数:27,代码来源:kpColorSimilarityToolBarItem.cpp

示例15: setCacheControl

void KSaveIOConfig::setCacheControl(KIO::CacheControl policy)
{
  KConfigGroup cfg (http_config(), QString());
  QString tmp = KIO::getCacheControlString(policy);
  cfg.writeEntry("cache", tmp);
  cfg.sync();
}
开发者ID:emmanuel099,项目名称:kio,代码行数:7,代码来源:ksaveioconfig.cpp


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