本文整理汇总了C++中KConfig::readUnsignedNumEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfig::readUnsignedNumEntry方法的具体用法?C++ KConfig::readUnsignedNumEntry怎么用?C++ KConfig::readUnsignedNumEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::readUnsignedNumEntry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readSettings
void KatapultSettings::readSettings()
{
KConfig *config = kapp->config();
_hideSessionNotification = config->readNumEntry("HideSessionNotification", 1);
_hideUserNotification = config->readNumEntry("HideUserNotification", 0);
_notificationTimeout = config->readNumEntry("NotificationTimeout", 5000);
_hideDelay = config->readUnsignedNumEntry("HideDelay", 1000);
_noResultsDelay = config->readUnsignedNumEntry("NoResultsDelay", 2500);
_noResultsAction = (NRAction) config->readUnsignedNumEntry("NoResultsAction", NR_ClearQuery);
_systrayIcon = config->readBoolEntry("SystrayIcon", TRUE);
_autoExec = config->readBoolEntry("AutoExec", FALSE);
_displayName = config->readEntry("Display", "Pure Display");
if (_displayName == "Name=Glass Display")
{
_displayName = "Glass Display";
}
QStringList defCatalogs;
defCatalogs << "Program Catalog" << "Bookmark Catalog" << "Document Catalog" << "Calculator Catalog" << "Amarok Catalog" << "Spell Catalog" << "Google Catalog" << "Execution Catalog";
_activeCatalogNames = config->readListEntry("Catalogs", defCatalogs);
// Force a config write if notification is to be shown once.
// (in writeSettings(), _hideSessionNotification or _hideUserNotification
// is changed before writing [if necessary]).
_forceWrite = ((kapp->isSessionRestored() && _hideSessionNotification == 1) ||
(!kapp->isSessionRestored() && _hideUserNotification == 1));
}
示例2: readConfig
void NetworkAccount::readConfig(/*const*/ KConfig/*Base*/ & config)
{
KMAccount::readConfig(config);
setLogin(config.readEntry("login"));
if(config.readNumEntry("store-passwd", false)) // ### s/Num/Bool/
{
mStorePasswd = true;
QString encpasswd = config.readEntry("pass");
if(encpasswd.isEmpty())
{
encpasswd = config.readEntry("passwd");
if(!encpasswd.isEmpty()) encpasswd = importPassword(encpasswd);
}
if(!encpasswd.isEmpty())
{
setPasswd(decryptStr(encpasswd), true);
// migrate to KWallet if available
if(Wallet::isEnabled())
{
config.deleteEntry("pass");
config.deleteEntry("passwd");
mPasswdDirty = true;
mStorePasswdInConfig = false;
}
else
{
mPasswdDirty = false; // set by setPasswd() on first read
mStorePasswdInConfig = true;
}
}
else
{
// read password if wallet is already open, otherwise defer to on-demand loading
if(Wallet::isOpen(Wallet::NetworkWallet()))
readPassword();
}
}
else
{
setPasswd("", false);
}
setHost(config.readEntry("host"));
unsigned int port = config.readUnsignedNumEntry("port", defaultPort());
if(port > USHRT_MAX) port = defaultPort();
setPort(port);
setAuth(config.readEntry("auth", "*"));
setUseSSL(config.readBoolEntry("use-ssl", false));
setUseTLS(config.readBoolEntry("use-tls", false));
mSieveConfig.readConfig(config);
}
示例3: readConfig
void KAccount::readConfig( KConfig &config, const QString &group )
{
QString oldGroup = config.group();
if (!group.isEmpty())
config.setGroup(group);
mId = config.readUnsignedNumEntry("Id", 0);
mName = config.readEntry("Name");
if (!group.isEmpty()) // restore
config.setGroup(oldGroup);
}
示例4: loadSettings
void WStreamAdd::loadSettings()
{
KConfig * conf = new KSimpleConfig(configName());
conf->setGroup("main");
comboBox1->setCurrentItem(conf->readUnsignedNumEntry("type", 1));
kIntNumInput1->setValue(conf->readUnsignedNumEntry("port", 5000));
kLineEdit1->setText(conf->readEntry("host", ""));
slider1->setValue(conf->readUnsignedNumEntry("package", 1));
kIntNumInput2->setValue(conf->readUnsignedNumEntry("length", 40));
checkBox1->setChecked(conf->readBoolEntry("len_rnd", false));
kIntNumInput3->setValue(conf->readUnsignedNumEntry("cov", 8));
checkBox2->setChecked(conf->readBoolEntry("cov_rnd", false));
kLineEdit2->setText(conf->readEntry("filename", ""));
checkBox3->setChecked(conf->readBoolEntry("reloop", false));
delete conf;
typeChanged();
}
示例5: saveGroup
void
KAArchieSettings::readConfig()
{
KConfig *config = KApplication::getKApplication()->getConfig();
KConfigGroupSaver saveGroup( config, "HostConfig" );
uint currentHostId = config->readUnsignedNumEntry( "CurrentHostId", 0 );
if ((uint)hostname->count() < currentHostId-1) {
currentHostId = 0;
}
hostname->setCurrentItem( currentHostId );
timeoutline->setText( config->readEntry( "Timeout", "4" ) );
triesline->setText( config->readEntry( "Retries", "3" ) );
}
示例6: activateSession
void KateSessionManager::activateSession(KateSession::Ptr session, bool closeLast, bool saveLast, bool loadNew)
{
// don't reload.
// ### comparing the pointers directly is b0rk3d :(
if(!session->sessionName().isEmpty() && session->sessionName() == m_activeSession->sessionName())
return;
// try to close last session
if(closeLast)
{
if(KateApp::self()->activeMainWindow())
{
if(!KateApp::self()->activeMainWindow()->queryClose_internal())
return;
}
}
// save last session or not?
if(saveLast)
saveActiveSession(true);
// really close last
if(closeLast)
{
KateDocManager::self()->closeAllDocuments();
}
// set the new session
m_activeSession = session;
if(loadNew)
{
// open the new session
Kate::Document::setOpenErrorDialogsActivated(false);
KConfig *sc = activeSession()->configRead();
if(sc)
KateApp::self()->documentManager()->restoreDocumentList(sc);
// if we have no session config object, try to load the default
// (anonymous/unnamed sessions)
if(!sc)
sc = new KSimpleConfig(sessionsDir() + "/default.katesession");
// window config
if(sc)
{
KConfig *c = KateApp::self()->config();
c->setGroup("General");
if(c->readBoolEntry("Restore Window Configuration", true))
{
// a new, named session, read settings of the default session.
if(!sc->hasGroup("Open MainWindows"))
sc = new KSimpleConfig(sessionsDir() + "/default.katesession");
sc->setGroup("Open MainWindows");
unsigned int wCount = sc->readUnsignedNumEntry("Count", 1);
for(unsigned int i = 0; i < wCount; ++i)
{
if(i >= KateApp::self()->mainWindows())
{
KateApp::self()->newMainWindow(sc, QString("MainWindow%1").arg(i));
}
else
{
sc->setGroup(QString("MainWindow%1").arg(i));
KateApp::self()->mainWindow(i)->readProperties(sc);
}
}
if(wCount > 0)
{
while(wCount < KateApp::self()->mainWindows())
{
KateMainWindow *w = KateApp::self()->mainWindow(KateApp::self()->mainWindows() - 1);
KateApp::self()->removeMainWindow(w);
delete w;
}
}
}
}
Kate::Document::setOpenErrorDialogsActivated(true);
}
}
示例7: aboutData
//.........这里部分代码省略.........
if(profile.isEmpty())
sessionconfig = a->sessionConfig();
sessionconfig->setDesktopGroup();
int n = 1;
QString key;
QString sTitle;
QString sPgm;
QString sTerm;
QString sIcon;
QString sCwd;
int n_tabbar;
// TODO: Session management stores everything in same group,
// should use one group / mainwindow
while(KMainWindow::canBeRestored(n) || !profile.isEmpty())
{
sessionconfig->setGroup(QString("%1").arg(n));
if(!sessionconfig->hasKey("Pgm0"))
sessionconfig->setDesktopGroup(); // Backwards compatible
int session_count = sessionconfig->readNumEntry("numSes");
int counter = 0;
wname = sessionconfig->readEntry("class", wname).latin1();
sPgm = sessionconfig->readEntry("Pgm0", shell);
sessionconfig->readListEntry("Args0", eargs);
sTitle = sessionconfig->readEntry("Title0", title);
sTerm = sessionconfig->readEntry("Term0");
sIcon = sessionconfig->readEntry("Icon0", "konsole");
sCwd = sessionconfig->readPathEntry("Cwd0");
workDir = sessionconfig->readPathEntry("workdir");
n_tabbar = QMIN(sessionconfig->readUnsignedNumEntry("tabbar", Konsole::TabBottom), 2);
Konsole *m = new Konsole(wname, histon, menubaron, tabbaron, frameon, scrollbaron, 0 /*type*/, true, n_tabbar, workDir);
m->newSession(sPgm, eargs, sTerm, sIcon, sTitle, sCwd);
m->enableFullScripting(full_script);
m->enableFixedSize(fixed_size);
m->restore(n);
sessionconfig->setGroup(QString("%1").arg(n));
if(!sessionconfig->hasKey("Pgm0"))
sessionconfig->setDesktopGroup(); // Backwards compatible
m->makeGUI();
m->setEncoding(sessionconfig->readNumEntry("Encoding0"));
m->setSchema(sessionconfig->readEntry("Schema0"));
// Use konsolerc default as tmpFont instead?
QFont tmpFont = KGlobalSettings::fixedFont();
m->initSessionFont(sessionconfig->readFontEntry("SessionFont0", &tmpFont));
m->initSessionKeyTab(sessionconfig->readEntry("KeyTab0"));
m->initMonitorActivity(sessionconfig->readBoolEntry("MonitorActivity0", false));
m->initMonitorSilence(sessionconfig->readBoolEntry("MonitorSilence0", false));
m->initMasterMode(sessionconfig->readBoolEntry("MasterMode0", false));
m->initTabColor(sessionconfig->readColorEntry("TabColor0"));
// -1 will be changed to the default history in konsolerc
m->initHistory(sessionconfig->readNumEntry("History0", -1), sessionconfig->readBoolEntry("HistoryEnabled0", true));
counter++;
// show() before 2nd+ sessions are created allows --profile to
// initialize the TE size correctly.
m->show();
while(counter < session_count)
{
key = QString("Title%1").arg(counter);
示例8: load
void KuickData::load()
{
KConfig *kc = KGlobal::config();
KuickData def;
kc->setGroup( "GeneralConfiguration" );
fileFilter = kc->readEntry( "FileFilter", def.fileFilter );
slideDelay = kc->readNumEntry( "SlideShowDelay", def.slideDelay );
slideshowCycles = kc->readUnsignedNumEntry( "SlideshowCycles", 1 );
slideshowFullscreen = kc->readBoolEntry( "SlideshowFullscreen", true );
slideshowStartAtFirst = kc->readBoolEntry("SlideshowStartAtFirst", true );
preloadImage = kc->readBoolEntry( "PreloadNextImage", def.preloadImage );
fullScreen = kc->readBoolEntry( "Fullscreen", def.fullScreen);
autoRotation = kc->readBoolEntry( "AutoRotation", def.autoRotation);
downScale = kc->readBoolEntry( "ShrinkToScreenSize", def.downScale );
upScale = kc->readBoolEntry( "ZoomToScreenSize", def.upScale );
flipVertically = kc->readBoolEntry( "FlipVertically", def.flipVertically );
flipHorizontally = kc->readBoolEntry( "FlipHorizontally",
def.flipHorizontally );
maxUpScale = kc->readNumEntry( "MaxUpscale Factor", def.maxUpScale );
rotation = (Rotation) kc->readNumEntry( "Rotation", def.rotation );
isModsEnabled = kc->readBoolEntry( "ApplyDefaultModifications",
def.isModsEnabled );
brightnessSteps = kc->readNumEntry("BrightnessStepSize",def.brightnessSteps);
contrastSteps = kc->readNumEntry("ContrastStepSize", def.contrastSteps);
gammaSteps = kc->readNumEntry("GammaStepSize", def.gammaSteps);
scrollSteps = kc->readNumEntry("ScrollingStepSize", def.scrollSteps);
zoomSteps = kc->readDoubleNumEntry("ZoomStepSize", def.zoomSteps);
maxZoomFactor = kc->readDoubleNumEntry( "MaximumZoomFactorByDesktop", def.maxZoomFactor );
maxCachedImages = kc->readUnsignedNumEntry( "MaxCachedImages",
def.maxCachedImages );
backgroundColor = kc->readColorEntry( "BackgroundColor", &Qt::black );
startInLastDir = kc->readBoolEntry( "StartInLastDir", true);
idata->load( kc );
// compatibility with KuickShow <= 0.8.3
switch ( rotation )
{
case 90:
rotation = ROT_90;
break;
case 180:
rotation = ROT_180;
break;
case 270:
rotation = ROT_270;
break;
default:
if ( (rotation < ROT_0) || (rotation > ROT_270) )
rotation = ROT_0;
break;
}
}
示例9: read
/******************************************************************************
* Read preference values from the config file.
*/
void Preferences::read()
{
initialise();
KConfig *config = KGlobal::config();
config->setGroup(GENERAL_SECTION);
QStringList cols = config->readListEntry(MESSAGE_COLOURS);
if(!cols.count())
mMessageColours = default_messageColours;
else
{
mMessageColours.clear();
for(QStringList::Iterator it = cols.begin(); it != cols.end(); ++it)
{
QColor c((*it));
if(c.isValid())
mMessageColours.insert(c);
}
}
mDefaultBgColour = config->readColorEntry(MESSAGE_BG_COLOUR, &default_defaultBgColour);
mMessageFont = config->readFontEntry(MESSAGE_FONT, &mDefault_messageFont);
mRunInSystemTray = config->readBoolEntry(RUN_IN_SYSTEM_TRAY, default_runInSystemTray);
mDisableAlarmsIfStopped = config->readBoolEntry(DISABLE_IF_STOPPED, default_disableAlarmsIfStopped);
mAutostartTrayIcon = config->readBoolEntry(AUTOSTART_TRAY, default_autostartTrayIcon);
mModalMessages = config->readBoolEntry(MODAL_MESSAGES, default_modalMessages);
mMessageButtonDelay = config->readNumEntry(MESSAGE_BUTTON_DELAY, default_messageButtonDelay);
if(mMessageButtonDelay > 10)
mMessageButtonDelay = 10; // prevent windows being unusable for a long time
if(mMessageButtonDelay < -1)
mMessageButtonDelay = -1;
mTooltipAlarmCount = static_cast<int>(config->readUnsignedNumEntry(TOOLTIP_ALARM_COUNT, default_tooltipAlarmCount));
if(mTooltipAlarmCount < 1)
mTooltipAlarmCount = 1;
mShowTooltipAlarmTime = config->readBoolEntry(TOOLTIP_ALARM_TIME, default_showTooltipAlarmTime);
mShowTooltipTimeToAlarm = config->readBoolEntry(TOOLTIP_TIME_TO_ALARM, default_showTooltipTimeToAlarm);
mTooltipTimeToPrefix = config->readEntry(TOOLTIP_TIME_TO_PREFIX, default_tooltipTimeToPrefix);
mDaemonTrayCheckInterval = static_cast<int>(config->readUnsignedNumEntry(DAEMON_TRAY_INTERVAL, default_daemonTrayCheckInterval));
if(mDaemonTrayCheckInterval < 1)
mDaemonTrayCheckInterval = 1;
QCString client = config->readEntry(EMAIL_CLIENT,
defaultEmailClient).local8Bit(); // don't use readPathEntry() here (values are hard-coded)
mEmailClient = (client == "sendmail" ? SENDMAIL : KMAIL);
mEmailCopyToKMail = config->readBoolEntry(EMAIL_COPY_TO_KMAIL, default_emailCopyToKMail);
QString from = config->readEntry(EMAIL_FROM, emailFrom(default_emailFrom(), false, false));
mEmailFrom = emailFrom(from);
QString bccFrom = config->readEntry(EMAIL_BCC_ADDRESS, emailFrom(default_emailBccFrom, false, true));
mEmailBccFrom = emailFrom(bccFrom);
if(mEmailFrom == MAIL_FROM_CONTROL_CENTRE || mEmailBccFrom == MAIL_FROM_CONTROL_CENTRE)
mEmailAddress = mEmailBccAddress = KAMail::controlCentreAddress();
if(mEmailFrom == MAIL_FROM_ADDR)
mEmailAddress = from;
if(mEmailBccFrom == MAIL_FROM_ADDR)
mEmailBccAddress = bccFrom;
mCmdXTermCommand = translateXTermPath(config, config->readEntry(CMD_XTERM_COMMAND), false);
QDateTime defStartOfDay(QDate(1900, 1, 1), default_startOfDay);
mStartOfDay = config->readDateTimeEntry(START_OF_DAY, &defStartOfDay).time();
mOldStartOfDay.setHMS(0, 0, 0);
int sod = config->readNumEntry(START_OF_DAY_CHECK, 0);
if(sod)
mOldStartOfDay = mOldStartOfDay.addMSecs(sod ^ SODxor);
mDisabledColour = config->readColorEntry(DISABLED_COLOUR, &default_disabledColour);
mExpiredColour = config->readColorEntry(EXPIRED_COLOUR, &default_expiredColour);
mExpiredKeepDays = config->readNumEntry(EXPIRED_KEEP_DAYS, default_expiredKeepDays);
config->setGroup(DEFAULTS_SECTION);
mDefaultLateCancel = static_cast<int>(config->readUnsignedNumEntry(DEF_LATE_CANCEL, default_defaultLateCancel));
mDefaultAutoClose = config->readBoolEntry(DEF_AUTO_CLOSE, default_defaultAutoClose);
mDefaultConfirmAck = config->readBoolEntry(DEF_CONFIRM_ACK, default_defaultConfirmAck);
mDefaultCopyToKOrganizer = config->readBoolEntry(DEF_COPY_TO_KORG, default_defaultCopyToKOrganizer);
int soundType = config->readNumEntry(DEF_SOUND_TYPE, default_defaultSoundType);
mDefaultSoundType = (soundType < 0 || soundType > SoundPicker::SPEAK)
? default_defaultSoundType : (SoundPicker::Type)soundType;
mDefaultSoundVolume = static_cast<float>(config->readDoubleNumEntry(DEF_SOUND_VOLUME, default_defaultSoundVolume));
#ifdef WITHOUT_ARTS
mDefaultSoundRepeat = false;
#else
mDefaultSoundRepeat = config->readBoolEntry(DEF_SOUND_REPEAT, default_defaultSoundRepeat);
#endif
mDefaultSoundFile = config->readPathEntry(DEF_SOUND_FILE);
mDefaultCmdScript = config->readBoolEntry(DEF_CMD_SCRIPT, default_defaultCmdScript);
int logType = config->readNumEntry(DEF_CMD_LOG_TYPE, default_defaultCmdLogType);
mDefaultCmdLogType = (logType < EditAlarmDlg::DISCARD_OUTPUT || logType > EditAlarmDlg::EXEC_IN_TERMINAL)
? default_defaultCmdLogType : (EditAlarmDlg::CmdLogType)logType;
mDefaultCmdLogFile = config->readPathEntry(DEF_LOG_FILE);
mDefaultEmailBcc = config->readBoolEntry(DEF_EMAIL_BCC, default_defaultEmailBcc);
int recurPeriod = config->readNumEntry(DEF_RECUR_PERIOD, default_defaultRecurPeriod);
mDefaultRecurPeriod = (recurPeriod < RecurrenceEdit::SUBDAILY || recurPeriod > RecurrenceEdit::ANNUAL)
? default_defaultRecurPeriod : (RecurrenceEdit::RepeatType)recurPeriod;
QCString feb29 = config->readEntry(FEB29_RECUR_TYPE, defaultFeb29RecurType).local8Bit();
mDefaultFeb29Type = (feb29 == "Mar1") ? KARecurrence::FEB29_MAR1 : (feb29 == "Feb28") ? KARecurrence::FEB29_FEB28 : KARecurrence::FEB29_FEB29;
QString remindUnits = config->readEntry(DEF_REMIND_UNITS);
mDefaultReminderUnits = (remindUnits == QString::fromLatin1("Minutes")) ? TimePeriod::MINUTES
: (remindUnits == QString::fromLatin1("HoursMinutes")) ? TimePeriod::HOURS_MINUTES
: (remindUnits == QString::fromLatin1("Days")) ? TimePeriod::DAYS
: (remindUnits == QString::fromLatin1("Weeks")) ? TimePeriod::WEEKS : default_defaultReminderUnits;
mDefaultPreAction = config->readEntry(DEF_PRE_ACTION, default_defaultPreAction);
mDefaultPostAction = config->readEntry(DEF_POST_ACTION, default_defaultPostAction);
//.........这里部分代码省略.........