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; }
QString KOrnPassword::readKOrnPassword( int box, int account, const KConfigBase &fallbackConfig ) { QString result; if( readKOrnPassword( box, account, result ) ) return result; else return fallbackConfig.readEntry( "password" ); }
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; }
// 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 (); }
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; } } }