diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kmail/keyresolver.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/keyresolver.cpp')
-rw-r--r-- | kmail/keyresolver.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/kmail/keyresolver.cpp b/kmail/keyresolver.cpp index 2161031fb..e35a7f5f9 100644 --- a/kmail/keyresolver.cpp +++ b/kmail/keyresolver.cpp @@ -58,8 +58,8 @@ #include <kinputdialog.h> #include <kmessagebox.h> -#include <qstringlist.h> -#include <qtl.h> +#include <tqstringlist.h> +#include <tqtl.h> #include <time.h> @@ -81,7 +81,7 @@ static inline bool EmptyKeyList( const Kleo::KeyApprovalDialog::Item & item ) { return item.keys.empty(); } -static inline QString ItemDotAddress( const Kleo::KeyResolver::Item & item ) { +static inline TQString ItemDotAddress( const Kleo::KeyResolver::Item & item ) { return item.address; } @@ -191,15 +191,15 @@ static inline bool NotValidSMIMESigningKey( const GpgME::Key & key ) { return !ValidSMIMESigningKey( key ); } -static QStringList keysAsStrings( const std::vector<GpgME::Key>& keys ) { - QStringList strings; +static TQStringList keysAsStrings( const std::vector<GpgME::Key>& keys ) { + TQStringList strings; for ( std::vector<GpgME::Key>::const_iterator it = keys.begin() ; it != keys.end() ; ++it ) { assert( !(*it).userID(0).isNull() ); - QString keyLabel = QString::fromUtf8( (*it).userID(0).email() ); + TQString keyLabel = TQString::fromUtf8( (*it).userID(0).email() ); if ( keyLabel.isEmpty() ) - keyLabel = QString::fromUtf8( (*it).userID(0).name() ); + keyLabel = TQString::fromUtf8( (*it).userID(0).name() ); if ( keyLabel.isEmpty() ) - keyLabel = QString::fromUtf8( (*it).userID(0).id() ); + keyLabel = TQString::fromUtf8( (*it).userID(0).id() ); strings.append( keyLabel ); } return strings; @@ -231,7 +231,7 @@ static inline std::vector<GpgME::Key> TrustedOrConfirmed( const std::vector<GpgM return keys; // if some keys are not fully trusted, let the user confirm their use - QString msg = i18n("One or more of your configured OpenPGP encryption " + TQString msg = i18n("One or more of your configured OpenPGP encryption " "keys or S/MIME certificates is not fully trusted " "for encryption."); @@ -451,8 +451,8 @@ namespace { } // anon namespace -static QString canonicalAddress( const QString & _address ) { - const QString address = KPIM::getEmailAddress( _address ); +static TQString canonicalAddress( const TQString & _address ) { + const TQString address = KPIM::getEmailAddress( _address ); if ( address.find('@') == -1 ) { // local address //char hostname[1024]; @@ -471,7 +471,7 @@ struct FormatInfo { }; struct Kleo::KeyResolver::Private { - std::set<QCString> alreadyWarnedFingerprints; + std::set<TQCString> alreadyWarnedFingerprints; std::vector<GpgME::Key> mOpenPGPSigningKeys; // signing std::vector<GpgME::Key> mSMIMESigningKeys; // signing @@ -485,7 +485,7 @@ struct Kleo::KeyResolver::Private { std::map<CryptoMessageFormat,FormatInfo> mFormatInfoMap; // key=email address, value=crypto preferences for this contact (from kabc) - typedef std::map<QString, ContactPreferences> ContactPreferencesMap; + typedef std::map<TQString, ContactPreferences> ContactPreferencesMap; ContactPreferencesMap mContactPreferencesMap; }; @@ -545,7 +545,7 @@ Kpgp::Result Kleo::KeyResolver::checkKeyNearExpiry( const GpgME::Key & key, cons ? signingKeyNearExpiryWarningThresholdInDays() : encryptKeyNearExpiryWarningThresholdInDays() ); if ( threshold > -1 && daysTillExpiry <= threshold ) { - const QString msg = + const TQString msg = key.protocol() == GpgME::Context::OpenPGP ? ( mine ? sign ? i18n("<p>Your OpenPGP signing key</p><p align=center><b>%1</b> (KeyID 0x%2)</p>" @@ -562,7 +562,7 @@ Kpgp::Result Kleo::KeyResolver::checkKeyNearExpiry( const GpgME::Key & key, cons "<p>expires in less than a day.</p>", "<p>The OpenPGP key for</p><p align=center><b>%1</b> (KeyID 0x%2)</p>" "<p>expires in less than %n days.</p>", - daysTillExpiry ) ).arg( QString::fromUtf8( key.userID(0).id() ), + daysTillExpiry ) ).arg( TQString::fromUtf8( key.userID(0).id() ), key.shortKeyID() ) : ( ca ? ( key.isRoot() @@ -650,7 +650,7 @@ Kpgp::Result Kleo::KeyResolver::checkKeyNearExpiry( const GpgME::Key & key, cons return Kpgp::Ok; } -Kpgp::Result Kleo::KeyResolver::setEncryptToSelfKeys( const QStringList & fingerprints ) { +Kpgp::Result Kleo::KeyResolver::setEncryptToSelfKeys( const TQStringList & fingerprints ) { if ( !encryptToSelf() ) return Kpgp::Ok; @@ -665,7 +665,7 @@ Kpgp::Result Kleo::KeyResolver::setEncryptToSelfKeys( const QStringList & finger if ( d->mOpenPGPEncryptToSelfKeys.size() + d->mSMIMEEncryptToSelfKeys.size() < keys.size() ) { // too few keys remain... - const QString msg = i18n("One or more of your configured OpenPGP encryption " + const TQString msg = i18n("One or more of your configured OpenPGP encryption " "keys or S/MIME certificates is not usable for " "encryption. Please reconfigure your encryption keys " "and certificates for this identity in the identity " @@ -698,7 +698,7 @@ Kpgp::Result Kleo::KeyResolver::setEncryptToSelfKeys( const QStringList & finger return Kpgp::Ok; } -Kpgp::Result Kleo::KeyResolver::setSigningKeys( const QStringList & fingerprints ) { +Kpgp::Result Kleo::KeyResolver::setSigningKeys( const TQStringList & fingerprints ) { std::vector<GpgME::Key> keys = lookup( fingerprints, true ); // secret keys std::remove_copy_if( keys.begin(), keys.end(), std::back_inserter( d->mOpenPGPSigningKeys ), @@ -709,7 +709,7 @@ Kpgp::Result Kleo::KeyResolver::setSigningKeys( const QStringList & fingerprints if ( d->mOpenPGPSigningKeys.size() + d->mSMIMESigningKeys.size() < keys.size() ) { // too few keys remain... - const QString msg = i18n("One or more of your configured OpenPGP signing keys " + const TQString msg = i18n("One or more of your configured OpenPGP signing keys " "or S/MIME signing certificates is not usable for " "signing. Please reconfigure your signing keys " "and certificates for this identity in the identity " @@ -742,19 +742,19 @@ Kpgp::Result Kleo::KeyResolver::setSigningKeys( const QStringList & fingerprints return Kpgp::Ok; } -void Kleo::KeyResolver::setPrimaryRecipients( const QStringList & addresses ) { +void Kleo::KeyResolver::setPrimaryRecipients( const TQStringList & addresses ) { d->mPrimaryEncryptionKeys = getEncryptionItems( addresses ); } -void Kleo::KeyResolver::setSecondaryRecipients( const QStringList & addresses ) { +void Kleo::KeyResolver::setSecondaryRecipients( const TQStringList & addresses ) { d->mSecondaryEncryptionKeys = getEncryptionItems( addresses ); } -std::vector<Kleo::KeyResolver::Item> Kleo::KeyResolver::getEncryptionItems( const QStringList & addresses ) { +std::vector<Kleo::KeyResolver::Item> Kleo::KeyResolver::getEncryptionItems( const TQStringList & addresses ) { std::vector<Item> items; items.reserve( addresses.size() ); - for ( QStringList::const_iterator it = addresses.begin() ; it != addresses.end() ; ++it ) { - QString addr = canonicalAddress( *it ).lower(); + for ( TQStringList::const_iterator it = addresses.begin() ; it != addresses.end() ; ++it ) { + TQString addr = canonicalAddress( *it ).lower(); const ContactPreferences pref = lookupContactPreferences( addr ); items.push_back( Item( *it, /*getEncryptionKeys( *it, true ),*/ @@ -883,7 +883,7 @@ Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) { it->keys = getEncryptionKeys( it->address, false ); if ( it->keys.empty() ) return Kpgp::Canceled; - QString addr = canonicalAddress( it->address ).lower(); + TQString addr = canonicalAddress( it->address ).lower(); const ContactPreferences pref = lookupContactPreferences( addr ); it->pref = pref.encryptionPreference; it->signPref = pref.signingPreference; @@ -896,7 +896,7 @@ Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) { it->keys = getEncryptionKeys( it->address, false ); if ( it->keys.empty() ) return Kpgp::Canceled; - QString addr = canonicalAddress( it->address ).lower(); + TQString addr = canonicalAddress( it->address ).lower(); const ContactPreferences pref = lookupContactPreferences( addr ); it->pref = pref.encryptionPreference; it->signPref = pref.signingPreference; @@ -977,7 +977,7 @@ Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) { !encryptionItems( OpenPGPMIMEFormat ).empty() ) { // need them if ( d->mOpenPGPEncryptToSelfKeys.empty() ) { - const QString msg = i18n("Examination of recipient's encryption preferences " + const TQString msg = i18n("Examination of recipient's encryption preferences " "yielded that the message should be encrypted using " "OpenPGP, at least for some recipients;\n" "however, you have not configured valid trusted " @@ -1004,7 +1004,7 @@ Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) { // need them if ( d->mSMIMEEncryptToSelfKeys.empty() ) { // don't have one - const QString msg = i18n("Examination of recipient's encryption preferences " + const TQString msg = i18n("Examination of recipient's encryption preferences " "yielded that the message should be encrypted using " "S/MIME, at least for some recipients;\n" "however, you have not configured valid " @@ -1034,7 +1034,7 @@ Kpgp::Result Kleo::KeyResolver::resolveSigningKeysForEncryption() { if ( ( !encryptionItems( InlineOpenPGPFormat ).empty() || !encryptionItems( OpenPGPMIMEFormat ).empty() ) && d->mOpenPGPSigningKeys.empty() ) { - const QString msg = i18n("Examination of recipient's signing preferences " + const TQString msg = i18n("Examination of recipient's signing preferences " "yielded that the message should be signed using " "OpenPGP, at least for some recipients;\n" "however, you have not configured valid " @@ -1050,7 +1050,7 @@ Kpgp::Result Kleo::KeyResolver::resolveSigningKeysForEncryption() { if ( ( !encryptionItems( SMIMEFormat ).empty() || !encryptionItems( SMIMEOpaqueFormat ).empty() ) && d->mSMIMESigningKeys.empty() ) { - const QString msg = i18n("Examination of recipient's signing preferences " + const TQString msg = i18n("Examination of recipient's signing preferences " "yielded that the message should be signed using " "S/MIME, at least for some recipients;\n" "however, you have not configured valid " @@ -1113,7 +1113,7 @@ Kpgp::Result Kleo::KeyResolver::resolveSigningKeysForSigningOnly() { return Kpgp::Ok; } - const QString msg = i18n("Examination of recipient's signing preferences " + const TQString msg = i18n("Examination of recipient's signing preferences " "showed no common type of signature matching your " "available signing keys.\n" "Send message without signing?" ); @@ -1142,8 +1142,8 @@ std::vector<GpgME::Key> Kleo::KeyResolver::encryptToSelfKeysFor( CryptoMessageFo return std::vector<GpgME::Key>(); } -QStringList Kleo::KeyResolver::allRecipients() const { - QStringList result; +TQStringList Kleo::KeyResolver::allRecipients() const { + TQStringList result; std::transform( d->mPrimaryEncryptionKeys.begin(), d->mPrimaryEncryptionKeys.end(), std::back_inserter( result ), ItemDotAddress ); std::transform( d->mSecondaryEncryptionKeys.begin(), d->mSecondaryEncryptionKeys.end(), @@ -1243,7 +1243,7 @@ Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() { Kleo::KeyApprovalDialog dlg( items, senderKeys ); - if ( dlg.exec() == QDialog::Rejected ) + if ( dlg.exec() == TQDialog::Rejected ) return Kpgp::Canceled; items = dlg.items(); @@ -1272,7 +1272,7 @@ Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() { // show a warning if the user didn't select an encryption key for // herself: if ( encryptToSelf() && senderKeys.empty() ) { - const QString msg = i18n("You did not select an encryption key for yourself " + const TQString msg = i18n("You did not select an encryption key for yourself " "(encrypt to self). You will not be able to decrypt " "your own message if you encrypt it."); if ( KMessageBox::warningContinueCancel( 0, msg, @@ -1291,7 +1291,7 @@ Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() { // show a warning if the user didn't select an encryption key for // some of the recipients if ( items.size() == emptyListCount ) { - const QString msg = ( d->mPrimaryEncryptionKeys.size() + + const TQString msg = ( d->mPrimaryEncryptionKeys.size() + d->mSecondaryEncryptionKeys.size() == 1 ) ? i18n("You did not select an encryption key for the " "recipient of this message; therefore, the message " @@ -1305,7 +1305,7 @@ Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() { == KMessageBox::Cancel ) return Kpgp::Canceled; } else if ( emptyListCount > 0 ) { - const QString msg = ( emptyListCount == 1 ) + const TQString msg = ( emptyListCount == 1 ) ? i18n("You did not select an encryption key for one of " "the recipients: this person will not be able to " "decrypt the message if you encrypt it.") @@ -1363,13 +1363,13 @@ std::vector<GpgME::Key> Kleo::KeyResolver::signingKeys( CryptoMessageFormat f ) // -std::vector<GpgME::Key> Kleo::KeyResolver::selectKeys( const QString & person, const QString & msg, const std::vector<GpgME::Key> & selectedKeys ) const { +std::vector<GpgME::Key> Kleo::KeyResolver::selectKeys( const TQString & person, const TQString & msg, const std::vector<GpgME::Key> & selectedKeys ) const { Kleo::KeySelectionDialog dlg( i18n("Encryption Key Selection"), msg, selectedKeys, Kleo::KeySelectionDialog::ValidEncryptionKeys, true, true ); // multi-selection and "remember choice" box - if ( dlg.exec() != QDialog::Accepted ) + if ( dlg.exec() != TQDialog::Accepted ) return std::vector<GpgME::Key>(); std::vector<GpgME::Key> keys = dlg.selectedKeys(); keys.erase( std::remove_if( keys.begin(), keys.end(), @@ -1381,12 +1381,12 @@ std::vector<GpgME::Key> Kleo::KeyResolver::selectKeys( const QString & person, c } -std::vector<GpgME::Key> Kleo::KeyResolver::getEncryptionKeys( const QString & person, bool quiet ) const { +std::vector<GpgME::Key> Kleo::KeyResolver::getEncryptionKeys( const TQString & person, bool quiet ) const { - const QString address = canonicalAddress( person ).lower(); + const TQString address = canonicalAddress( person ).lower(); // First look for this person's address in the address->key dictionary - const QStringList fingerprints = keysForAddress( address ); + const TQStringList fingerprints = keysForAddress( address ); if ( !fingerprints.empty() ) { kdDebug() << "Using encryption keys 0x" @@ -1463,7 +1463,7 @@ std::vector<GpgME::Key> Kleo::KeyResolver::getEncryptionKeys( const QString & pe } -std::vector<GpgME::Key> Kleo::KeyResolver::lookup( const QStringList & patterns, bool secret ) const { +std::vector<GpgME::Key> Kleo::KeyResolver::lookup( const TQStringList & patterns, bool secret ) const { if ( patterns.empty() ) return std::vector<GpgME::Key>(); kdDebug() << "Kleo::KeyResolver::lookup( \"" << patterns.join( "\", \"" ) @@ -1529,7 +1529,7 @@ void Kleo::KeyResolver::addKeys( const std::vector<Item> & items ) { dump(); } -Kleo::KeyResolver::ContactPreferences Kleo::KeyResolver::lookupContactPreferences( const QString& address ) const +Kleo::KeyResolver::ContactPreferences Kleo::KeyResolver::lookupContactPreferences( const TQString& address ) const { const Private::ContactPreferencesMap::iterator it = d->mContactPreferencesMap.find( address ); @@ -1541,21 +1541,21 @@ Kleo::KeyResolver::ContactPreferences Kleo::KeyResolver::lookupContactPreference ContactPreferences pref; if ( !res.isEmpty() ) { KABC::Addressee addr = res.first(); - QString encryptPref = addr.custom( "KADDRESSBOOK", "CRYPTOENCRYPTPREF" ); + TQString encryptPref = addr.custom( "KADDRESSBOOK", "CRYPTOENCRYPTPREF" ); pref.encryptionPreference = Kleo::stringToEncryptionPreference( encryptPref ); - QString signPref = addr.custom( "KADDRESSBOOK", "CRYPTOSIGNPREF" ); + TQString signPref = addr.custom( "KADDRESSBOOK", "CRYPTOSIGNPREF" ); pref.signingPreference = Kleo::stringToSigningPreference( signPref ); - QString cryptoFormats = addr.custom( "KADDRESSBOOK", "CRYPTOPROTOPREF" ); + TQString cryptoFormats = addr.custom( "KADDRESSBOOK", "CRYPTOPROTOPREF" ); pref.cryptoMessageFormat = Kleo::stringToCryptoMessageFormat( cryptoFormats ); - pref.pgpKeyFingerprints = QStringList::split( ',', addr.custom( "KADDRESSBOOK", "OPENPGPFP" ) ); - pref.smimeCertFingerprints = QStringList::split( ',', addr.custom( "KADDRESSBOOK", "SMIMEFP" ) ); + pref.pgpKeyFingerprints = TQStringList::split( ',', addr.custom( "KADDRESSBOOK", "OPENPGPFP" ) ); + pref.smimeCertFingerprints = TQStringList::split( ',', addr.custom( "KADDRESSBOOK", "SMIMEFP" ) ); } // insert into map and grab resulting iterator d->mContactPreferencesMap.insert( std::make_pair( address, pref ) ); return pref; } -void Kleo::KeyResolver::saveContactPreference( const QString& email, const ContactPreferences& pref ) const +void Kleo::KeyResolver::saveContactPreference( const TQString& email, const ContactPreferences& pref ) const { d->mContactPreferencesMap.insert( std::make_pair( email, pref ) ); KABC::AddressBook *ab = KABC::StdAddressBook::self( true ); @@ -1564,7 +1564,7 @@ void Kleo::KeyResolver::saveContactPreference( const QString& email, const Conta KABC::Addressee addr; if ( res.isEmpty() ) { bool ok = true; - QString fullName = KInputDialog::getText( i18n( "Name Selection" ), i18n( "Which name shall the contact '%1' have in your addressbook?" ).arg( email ), QString::null, &ok ); + TQString fullName = KInputDialog::getText( i18n( "Name Selection" ), i18n( "Which name shall the contact '%1' have in your addressbook?" ).arg( email ), TQString::null, &ok ); if ( ok ) { addr.setNameFromString( fullName ); addr.insertEmail( email, true ); @@ -1594,20 +1594,20 @@ Kleo::KeyResolver::ContactPreferences::ContactPreferences() { } -QStringList Kleo::KeyResolver::keysForAddress( const QString & address ) const { +TQStringList Kleo::KeyResolver::keysForAddress( const TQString & address ) const { if( address.isEmpty() ) { - return QStringList(); + return TQStringList(); } - QString addr = canonicalAddress( address ).lower(); + TQString addr = canonicalAddress( address ).lower(); const ContactPreferences pref = lookupContactPreferences( addr ); return pref.pgpKeyFingerprints + pref.smimeCertFingerprints; } -void Kleo::KeyResolver::setKeysForAddress( const QString& address, const QStringList& pgpKeyFingerprints, const QStringList& smimeCertFingerprints ) const { +void Kleo::KeyResolver::setKeysForAddress( const TQString& address, const TQStringList& pgpKeyFingerprints, const TQStringList& smimeCertFingerprints ) const { if( address.isEmpty() ) { return; } - QString addr = canonicalAddress( address ).lower(); + TQString addr = canonicalAddress( address ).lower(); ContactPreferences pref = lookupContactPreferences( addr ); pref.pgpKeyFingerprints = pgpKeyFingerprints; pref.smimeCertFingerprints = smimeCertFingerprints; |