本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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();
}
}
示例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();
}
示例6: setUnit
void KWApplicationConfig::setUnit(const KoUnit &unit)
{
KSharedConfigPtr config = KGlobal::config();
KConfigGroup misc = config->group("Misc");
misc.writeEntry("Units", unit.symbol());
misc.sync();
}
示例7: setProxyFor
void KSaveIOConfig::setProxyFor( const QString& protocol,
const QString& _proxy )
{
KConfigGroup cfg (config(), "Proxy Settings");
cfg.writeEntry(protocol.toLower() + "Proxy", _proxy);
cfg.sync();
}
示例8: setHistoryItems
void QalculateSettings::setHistoryItems(QStringList items)
{
m_historyItems = items;
KConfigGroup cfg = m_applet->config();
cfg.writeEntry("historyItems", m_historyItems);
cfg.sync();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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));
}
示例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);
}
示例15: setCacheControl
void KSaveIOConfig::setCacheControl(KIO::CacheControl policy)
{
KConfigGroup cfg (http_config(), QString());
QString tmp = KIO::getCacheControlString(policy);
cfg.writeEntry("cache", tmp);
cfg.sync();
}