void KOrnPassword::writeKOrnPassword( int box, int account, KConfigBase& fallbackConfig, const QString& password ) { if( writeKOrnPassword( box, account, password ) ) { if( fallbackConfig.hasKey( "password" ) ) fallbackConfig.deleteEntry( "password" ); } else fallbackConfig.writeEntry( "password", password ); }
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; } } }
void KOrnPassword::deleteKOrnPassword( int box, int account, KConfigBase& fallbackConfig ) { deleteKOrnPassword( box, account ); if( fallbackConfig.hasKey( "password" ) ) fallbackConfig.deleteEntry( "password" ); }