本文整理汇总了C++中KConfigGroup::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::exists方法的具体用法?C++ KConfigGroup::exists怎么用?C++ KConfigGroup::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigGroup
的用法示例。
在下文中一共展示了KConfigGroup::exists方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: restore
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
示例2: type
void
TestImporterManager::creatingProviderShouldSaveGeneratedId()
{
EXPECT_CALL( *m_mockManager, type() ).WillRepeatedly( Return( QString( "TestMockManager" ) ) );
QVERIFY( !m_mockManager->managerConfig().exists() );
m_mockManager->init();
StatSyncing::ProviderPtr provider = m_mockManager->createProvider( QVariantMap() );
KConfigGroup group = m_mockManager->managerConfig();
QVERIFY( group.exists() );
QVERIFY( !group.groupList().empty() );
group = m_mockManager->providerConfig( provider );
QVERIFY( group.exists() );
QCOMPARE( group.readEntry( "uid", QString() ), provider->id() );
}
示例3: path
QString path(KConfigGroup group)
{
QString ret;
while (group.exists()) {
ret.prepend( "/" + group.name());
group = group.parent();
}
ret.prepend(group.config()->name());
return ret;
}
示例4: 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));
}
示例5: exists
bool AvatarManager::exists(const QString &avatarName)
{
KUrl configUrl(d->baseDir);
configUrl.addPath( UserDir );
configUrl.addPath( AvatarConfig );
KConfigGroup avatarConfig ( KSharedConfig::openConfig( configUrl.toLocalFile(), KConfig::SimpleConfig ), avatarName );
kDebug(14010) << "Checking if an avatar exists: " << avatarName;
if(!avatarConfig.exists()){
return false;
}
return true;
}
示例6: QString
void
TestImporterManager::creatingProviderShouldSaveSettings()
{
QVariantMap cfg;
cfg["uid"] = QString( "TestId" );
cfg["custom"] = QString( "custom" );
EXPECT_CALL( *m_mockManager, type() ).WillRepeatedly( Return( QString( "TestMockManager" ) ) );
m_mockManager->init();
m_mockManager->createProvider( cfg );
KConfigGroup group = m_mockManager->providerConfig( "TestId" );
QVERIFY( group.exists() );
QCOMPARE( group.readEntry( "uid", QString() ), QString( "TestId" ) );
QCOMPARE( group.readEntry( "custom", QString() ), QString( "custom" ) );
}
示例7: 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;
}
示例8: QDialog
LoginWindow::LoginWindow(OnlineDocument::DocumentType type, QWidget *parent)
: QDialog(parent),
m_type(type),
m_authDialog(new Ui_Dialog),
m_wallet(0)
{
m_authDialog->setupUi(this);
QStringList onlineServices;
onlineServices << "Google Documents";
// Add services here
m_authDialog->comboBox->addItems(onlineServices);
connect(m_authDialog->loginButton, SIGNAL(clicked()), this, SLOT(loginService()));
connect(m_authDialog->comboBox, SIGNAL(activated(int)), this, SLOT(serviceSelected(int)));
const QString settingsGroup = "Google-Documents";
KConfigGroup interface = KoGlobal::calligraConfig()->group(settingsGroup);
if (interface.exists()) {
QString userName = interface.readEntry("userEmailId", "");
if (!userName.isEmpty()) {
m_authDialog->userEdit->setText(userName);
QString password;
if (wallet()) {
wallet()->readPassword(QString("%1-%2").arg(settingsGroup).arg(userName), password);
}
if (!password.isEmpty()) {
m_authDialog->passwordEdit->setText(password);
}
}
}
m_authDialog->userEdit->setFocus();
showProgressIndicator(false);
setWindowTitle("Online Document Services");
show();
}
示例9: loadSettings
void AkuViewOptionWidget::loadSettings()
{
KConfigGroup viewOptionConfig = KGlobal::config()->group("Views Option");
if (!viewOptionConfig.exists()) {
viewOptionConfig.writeEntry("Active View", "TreeView");
viewOptionConfig.writeEntry("IconView item size",
KIconLoader::global()->currentSize(KIconLoader::Desktop));
}
// here we load the active view
int view = 0;
if (viewOptionConfig.readEntry("Active View", "TreeView") == "IconView") {
view = 1;
}
showView(view);
// icon settings
m_iconWidget->view()->setIconSize(viewOptionConfig.readEntry("IconView item size",
KIconLoader::global()->currentSize(KIconLoader::Desktop) ));
ui.iconSizeSlider->setValue(m_iconWidget->view()->iconSize());
}
示例10: 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;
//.........这里部分代码省略.........
示例11: main
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
tryInitDrMingw();
#ifdef HAVE_IMAGE_MAGICK
InitializeMagick(nullptr);
#endif
#ifdef Q_OS_LINUX
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
// if we have some local breeze icon resource, prefer it
DXmlGuiWindow::setupIconTheme();
KLocalizedString::setApplicationDomain("digikam");
KAboutData aboutData(QLatin1String("digikam"), // component name
i18n("digiKam"), // display name
digiKamVersion());
aboutData.setShortDescription(QString::fromUtf8("%1 - %2").arg(DAboutData::digiKamSlogan()).arg(DAboutData::digiKamFamily()));
aboutData.setLicense(KAboutLicense::GPL);
aboutData.setCopyrightStatement(DAboutData::copyright());
aboutData.setOtherText(additionalInformation());
aboutData.setHomepage(DAboutData::webProjectUrl().url());
DAboutData::authorsRegistration(aboutData);
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from"),
i18n("Open camera dialog at <path>"),
QLatin1String("path")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from-udi"),
i18n("Open camera dialog for the device with Solid UDI <udi>"),
QLatin1String("udi")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("detect-camera"),
i18n("Automatically detect and open a connected gphoto2 camera")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("database-directory"),
i18n("Start digikam with the SQLite database file found in the directory <dir>"),
QLatin1String("dir")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("config"),
i18n("Start digikam with the configuration file <config>"),
QLatin1String("config")));
parser.process(app);
aboutData.processCommandLine(&parser);
MetaEngine::initializeExiv2();
// Force to use application icon for non plasma desktop as Unity for ex.
QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("digikam"), app.windowIcon()));
// Check if Qt database plugins are available.
if (!QSqlDatabase::isDriverAvailable(DbEngineParameters::SQLiteDatabaseType()) &&
!QSqlDatabase::isDriverAvailable(DbEngineParameters::MySQLDatabaseType()))
{
if (QSqlDatabase::drivers().isEmpty())
{
QMessageBox::critical(qApp->activeWindow(),
qApp->applicationName(),
i18n("Run-time Qt SQLite or MySQL database plugin is not available. "
"please install it.\n"
"There is no database plugin installed on your computer."));
}
else
{
DMessageBox::showInformationList(QMessageBox::Warning,
qApp->activeWindow(),
qApp->applicationName(),
i18n("Run-time Qt SQLite or MySQL database plugin are not available. "
"Please install it.\n"
"Database plugins installed on your computer are listed below."),
QSqlDatabase::drivers());
}
qCDebug(DIGIKAM_GENERAL_LOG) << "QT Sql drivers list: " << QSqlDatabase::drivers();
return 1;
}
QString commandLineDBPath;
if (parser.isSet(QLatin1String("database-directory")))
{
QDir commandLineDBDir(parser.value(QLatin1String("database-directory")));
if (!commandLineDBDir.exists())
{
qCDebug(DIGIKAM_GENERAL_LOG) << "The given database-directory does not exist or is not readable. Ignoring." << commandLineDBDir.path();
}
else
{
commandLineDBPath = commandLineDBDir.path();
//.........这里部分代码省略.........
示例12: load
void KWApplicationConfig::load(KWDocument *document)
{
KSharedConfigPtr config = KGlobal::config();
KConfigGroup interface = config->group("Interface");
// setCursorInProtectedArea(interface.readEntry("cursorInProtectArea", true));
// Config-file value in mm, default 10 pt
m_viewRulers = interface.readEntry("Rulers", m_viewRulers);
m_autoSaveSeconds = interface.readEntry("AutoSave", m_autoSaveSeconds);
document->setAutoSave(m_autoSaveSeconds);
m_createBackupFile = interface.readEntry("BackupFile", m_createBackupFile);
document->setBackupFile(m_createBackupFile);
// setNbPagePerRow(interface.readEntry("nbPagePerRow",4));
// m_maxRecentFiles = interface.readEntry("NbRecentFile", 10);
m_showFormattingChars = interface.readEntry("ViewFormattingChars", m_showFormattingChars);
m_showInlineObjectVisualization = interface.readEntry("ViewFieldShadings", m_showInlineObjectVisualization);
m_showTableBorders = interface.readEntry("ViewTableBorders", m_showTableBorders);
m_viewFrameBorders = interface.readEntry("ViewFrameBorders", m_viewFrameBorders);
m_zoom = interface.readEntry("Zoom", m_zoom);
m_zoomMode = static_cast<KoZoomMode::Mode>(interface.readEntry("ZoomMode", (int) m_zoomMode));
m_statusBarShowPage = interface.readEntry("StatusBarShowPage", m_statusBarShowPage);
m_statusBarShowPageStyle = interface.readEntry("StatusBarShowPageStyle", m_statusBarShowPageStyle);
m_statusBarShowPageSize = interface.readEntry("StatusBarShowPageSize", m_statusBarShowPageSize);
m_statusBarShowLineNumber = interface.readEntry("StatusBarShowLineNumber", m_statusBarShowLineNumber);
m_statusBarShowModified = interface.readEntry("StatusBarShowModified", m_statusBarShowModified);
m_statusBarShowMouse = interface.readEntry("StatusBarShowMouse", m_statusBarShowMouse);
m_statusBarShowZoom = interface.readEntry("StatusBarShowZoom", m_statusBarShowZoom);
m_statusBarShowWordCount = interface.readEntry("StatusBarShowWordCount", m_statusBarShowWordCount);
// m_bShowDocStruct = interface.readEntry("showDocStruct", true);
// m_viewModeType = interface.readEntry("viewmode", "ModeNormal");
// setShowStatusBarShow(interface.readEntry("ShowStatusBarShow" , true));
// setAllowAutoFormat(interface.readEntry("AllowAutoFormat" , true));
// setShowScrollBar(interface.readEntry("ShowScrollBar", true));
// if (isEmbedded())
// m_bShowDocStruct = false; // off by default for embedded docs, but still toggleable
// m_pgUpDownMovesCaret = interface.readEntry("PgUpDownMovesCaret", true);
// m_bInsertDirectCursor= interface.readEntry("InsertDirectCursor", false);
// m_globalLanguage=interface.readEntry("language", KGlobal::locale()->language());
// m_bGlobalHyphenation=interface.readEntry("hyphenation", false);
// setShowGrid(interface.readEntry("ShowGrid" , false));
// setSnapToGrid(interface.readEntry("SnapToGrid", false));
KConfigGroup misc = config->group("Misc");
if (misc.exists()) {
//load default unit setting - this is only used for new files (from templates) or empty files
if (document && misc.hasKey("Units"))
document->setUnit(KoUnit::fromSymbol(misc.readEntry("Units")));
m_defaultColumnSpacing = misc.readEntry("ColumnSpacing", m_defaultColumnSpacing);
}
// if(undo!=-1)
// setUndoRedoLimit(undo);
//text mode view is not a good default for a readonly document...
// if (!isReadWrite() && m_viewModeType =="ModeText")
// m_viewModeType= "ModeNormal";
// m_layoutViewMode = KWViewMode::create(m_viewModeType, this, 0 /*no canvas*/);
KConfigGroup path = config->group("Words Path");
if (path.exists()) {
// if (path.hasKey("expression path"))
// m_personalExpressionPath = path.readPathEntry("expression path", QStringList());
if (document)
document->setBackupPath(path.readPathEntry("backup path", QString()));
}
// Load personal dict
KConfigGroup spelling = KoGlobal::calligraConfig()->group("Spelling");
// m_spellCheckPersonalDict = spelling.readListEntry("PersonalDict");
}