本文整理汇总了C++中KConfigBase::readEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigBase::readEntry方法的具体用法?C++ KConfigBase::readEntry怎么用?C++ KConfigBase::readEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigBase
的用法示例。
在下文中一共展示了KConfigBase::readEntry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readKMailPassword
QString KOrnPassword::readKMailPassword( int accountnr, const KConfigBase& fallbackConfig )
{
QString password;
open();
if( !m_wallet || !m_wallet->isOpen() || m_openFailed )
return KMailDecrypt( fallbackConfig.readEntry( "pass" ) );
if( !m_wallet->hasFolder( "kmail" ) )
return KMailDecrypt( fallbackConfig.readEntry( "pass" ));
m_wallet->setFolder( "kmail" );
if( m_wallet->readPassword( QString( "account-%1" ).arg( accountnr ), password ) != 0 )
return fallbackConfig.readEntry( "password" );
return password;
}
示例2: readKOrnPassword
QString KOrnPassword::readKOrnPassword( int box, int account, const KConfigBase &fallbackConfig )
{
QString result;
if( readKOrnPassword( box, account, result ) )
return result;
else
return fallbackConfig.readEntry( "password" );
}
示例3: load
bool HostConfig::load( KConfigBase &config )
{
name = config.readEntry( "Host" );
if ( name.isEmpty() )
return false;
port = config.readNumEntry( "Port", defaultSnmpPort() );
bool ok = false;
version = stringToSnmpVersion( config.readEntry( "Version" ), &ok );
if ( !ok )
return false;
if ( version != SnmpVersion3 ) {
community = config.readEntry( "Community" );
return true;
}
securityName = config.readEntry( "SecurityName" );
securityLevel = stringToSecurityLevel( config.readEntry( "SecurityLevel" ), &ok );
if ( !ok )
return false;
if ( securityLevel == NoAuthPriv )
return true;
authentication.protocol = stringToAuthenticationProtocol( config.readEntry( "AuthType" ), &ok );
if ( !ok )
return false;
authentication.key = KStringHandler::obscure( config.readEntry( "AuthPassphrase" ) );
if ( securityLevel == AuthNoPriv )
return true;
privacy.protocol = stringToPrivacyProtocol( config.readEntry( "PrivType" ), &ok );
if ( !ok )
return false;
privacy.key = KStringHandler::obscure( config.readEntry( "PrivPassphrase" ) );
return true;
}
示例4: readAndApplyTextSettings
// private
void kpMainWindow::readAndApplyTextSettings ()
{
KConfigGroupSaver cfgGroupSaver (kapp->config (), kpSettingsGroupText);
KConfigBase *cfg = cfgGroupSaver.config ();
m_actionTextFontFamily->setFont (cfg->readEntry (kpSettingFontFamily, QString::fromLatin1 ("Times")));
m_actionTextFontSize->setFontSize (cfg->readNumEntry (kpSettingFontSize, 14));
m_actionTextBold->setChecked (cfg->readBoolEntry (kpSettingBold, false));
m_actionTextItalic->setChecked (cfg->readBoolEntry (kpSettingItalic, false));
m_actionTextUnderline->setChecked (cfg->readBoolEntry (kpSettingUnderline, false));
m_actionTextStrikeThru->setChecked (cfg->readBoolEntry (kpSettingStrikeThru, false));
m_textOldFontFamily = m_actionTextFontFamily->font ();
m_textOldFontSize = m_actionTextFontSize->fontSize ();
}
示例5: KeyFilter
Kleo::KConfigBasedKeyFilter::KConfigBasedKeyFilter( const KConfigBase & config )
: KeyFilter(),
mSpecificity( 0 ),
mItalic( false ),
mBold( false ),
mStrikeOut( false ),
mUseFullFont( false ),
mRevoked( DoesNotMatter ),
mExpired( DoesNotMatter ),
mDisabled( DoesNotMatter ),
mRoot( DoesNotMatter ),
mCanEncrypt( DoesNotMatter ),
mCanSign( DoesNotMatter ),
mCanCertify( DoesNotMatter ),
mCanAuthenticate( DoesNotMatter ),
mHasSecret( DoesNotMatter ),
mIsOpenPGP( DoesNotMatter ),
mWasValidated( DoesNotMatter ),
mOwnerTrust( LevelDoesNotMatter ),
mOwnerTrustReferenceLevel( GpgME::Key::Unknown ),
mValidity( LevelDoesNotMatter ),
mValidityReferenceLevel( GpgME::UserID::Unknown )
{
mFgColor = config.readColorEntry( "foreground-color" );
mBgColor = config.readColorEntry( "background-color" );
mName = config.readEntry( "name", i18n("<unnamed>") );
mIcon = config.readEntry( "icon" );
if ( config.hasKey( "font" ) ) {
mUseFullFont = true;
mFont = config.readFontEntry( "font" );
} else {
mItalic = config.readBoolEntry( "font-italic", false );
mBold = config.readBoolEntry( "font-bold", false );
}
mStrikeOut = config.readBoolEntry( "font-strikeout", false );
#ifdef SET
#undef SET
#endif
#define SET(member,key) \
if ( config.hasKey( key ) ) { \
member = config.readBoolEntry( key ) ? Set : NotSet ; \
++mSpecificity; \
}
SET( mRevoked, "is-revoked" );
SET( mExpired, "is-expired" );
SET( mDisabled, "is-disabled" );
SET( mRoot, "is-root-certificate" );
SET( mCanEncrypt, "can-encrypt" );
SET( mCanSign, "can-sign" );
SET( mCanCertify, "can-certify" );
SET( mCanAuthenticate, "can-authenticate" );
SET( mHasSecret, "has-secret-key" );
SET( mIsOpenPGP, "is-openpgp-key" );
SET( mWasValidated, "was-validated" );
#undef SET
static const struct {
const char * prefix;
LevelState state;
} prefixMap[] = {
{ "is-", Is },
{ "is-not-", IsNot },
{ "is-at-least-", IsAtLeast },
{ "is-at-most-", IsAtMost },
};
for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) {
const QString key = QString( prefixMap[i].prefix ) + "ownertrust";
if ( config.hasKey( key ) ) {
mOwnerTrust = prefixMap[i].state;
mOwnerTrustReferenceLevel = map2OwnerTrust( config.readEntry( key ) );
++mSpecificity;
break;
}
}
for ( unsigned int i = 0 ; i < sizeof prefixMap / sizeof *prefixMap ; ++i ) {
const QString key = QString( prefixMap[i].prefix ) + "validity";
if ( config.hasKey( key ) ) {
mValidity = prefixMap[i].state;
mValidityReferenceLevel = map2Validity( config.readEntry( key ) );
++mSpecificity;
break;
}
}
}