diff options
Diffstat (limited to 'libkpgp')
-rw-r--r-- | libkpgp/kpgp.cpp | 32 | ||||
-rw-r--r-- | libkpgp/kpgpbase.cpp | 4 | ||||
-rw-r--r-- | libkpgp/kpgpbase2.cpp | 122 | ||||
-rw-r--r-- | libkpgp/kpgpbase5.cpp | 90 | ||||
-rw-r--r-- | libkpgp/kpgpbase6.cpp | 90 | ||||
-rw-r--r-- | libkpgp/kpgpbaseG.cpp | 92 | ||||
-rw-r--r-- | libkpgp/kpgpkey.cpp | 2 | ||||
-rw-r--r-- | libkpgp/kpgpui.cpp | 8 |
8 files changed, 220 insertions, 220 deletions
diff --git a/libkpgp/kpgp.cpp b/libkpgp/kpgp.cpp index 3abd1d79f..6035112c8 100644 --- a/libkpgp/kpgp.cpp +++ b/libkpgp/kpgp.cpp @@ -1044,7 +1044,7 @@ Module::prepareMessageForDecryption( const TQCString& msg, start = 0; else { - start = msg.tqfind( "\n-----BEGIN PGP" ) + 1; + start = msg.find( "\n-----BEGIN PGP" ) + 1; if( start == 0 ) { nonPgpBlocks.append( msg ); @@ -1062,20 +1062,20 @@ Module::prepareMessageForDecryption( const TQCString& msg, else pgpBlock = UnknownBlock; - nextEnd = msg.tqfind( "\n-----END PGP", start + 15 ); + nextEnd = msg.find( "\n-----END PGP", start + 15 ); if( nextEnd == -1 ) { nonPgpBlocks.append( msg.mid( lastEnd+1 ) ); break; } - nextStart = msg.tqfind( "\n-----BEGIN PGP", start + 15 ); + nextStart = msg.find( "\n-----BEGIN PGP", start + 15 ); if( ( nextStart == -1 ) || ( nextEnd < nextStart ) || ( pgpBlock == ClearsignedBlock ) ) { // most likely we found a PGP block (but we don't check if it's valid) // store the preceding non-PGP block nonPgpBlocks.append( msg.mid( lastEnd+1, start-lastEnd-1 ) ); - lastEnd = msg.tqfind( "\n", nextEnd + 14 ); + lastEnd = msg.find( "\n", nextEnd + 14 ); if( lastEnd == -1 ) { pgpBlocks.append( new Block( msg.mid( start ) ) ); @@ -1086,7 +1086,7 @@ Module::prepareMessageForDecryption( const TQCString& msg, { pgpBlocks.append( new Block( msg.mid( start, lastEnd+1-start ) ) ); if( ( nextStart != -1 ) && ( nextEnd > nextStart ) ) - nextStart = msg.tqfind( "\n-----BEGIN PGP", lastEnd+1 ); + nextStart = msg.find( "\n-----BEGIN PGP", lastEnd+1 ); } } @@ -1333,7 +1333,7 @@ Module::checkForPGP(void) havePgp=FALSE; path = getenv("PATH"); - while((index = path.tqfind(":",lastindex+1)) != -1) + while((index = path.find(":",lastindex+1)) != -1) { pSearchPaths.append(path.mid(lastindex+1,index-lastindex-1)); lastindex = index; @@ -1487,12 +1487,12 @@ Module::canonicalAddress( const TQString& _adress ) address = address.stripWhiteSpace(); // just leave pure e-mail address. - if((index = address.tqfind("<")) != -1) - if((index2 = address.tqfind("@",index+1)) != -1) - if((index2 = address.tqfind(">",index2+1)) != -1) + if((index = address.find("<")) != -1) + if((index2 = address.find("@",index+1)) != -1) + if((index2 = address.find(">",index2+1)) != -1) return address.mid(index,index2-index+1); - if((index = address.tqfind("@")) == -1) + if((index = address.find("@")) == -1) { // local address //char hostname[1024]; @@ -1502,8 +1502,8 @@ Module::canonicalAddress( const TQString& _adress ) } else { - int index1 = address.tqfindRev(" ",index); - int index2 = address.tqfind(" ",index); + int index1 = address.findRev(" ",index); + int index2 = address.find(" ",index); if(index2 == -1) index2 = address.length(); return "<" + address.mid(index1+1 ,index2-index1-1) + ">"; } @@ -1705,7 +1705,7 @@ Module::keysForAddress( const TQString& address ) return KeyIDList(); } TQString addr = canonicalAddress( address ).lower(); - if( addressDataDict.tqcontains( addr ) ) { + if( addressDataDict.contains( addr ) ) { return addressDataDict[addr].keyIds; } else { @@ -1720,7 +1720,7 @@ Module::setKeysForAddress( const TQString& address, const KeyIDList& keyIds ) return; } TQString addr = canonicalAddress( address ).lower(); - if( addressDataDict.tqcontains( addr ) ) { + if( addressDataDict.contains( addr ) ) { addressDataDict[addr].keyIds = keyIds; } else { @@ -1782,7 +1782,7 @@ EncryptPref Module::encryptionPreference( const TQString& address ) { TQString addr = canonicalAddress( address ).lower(); - if( addressDataDict.tqcontains( addr ) ) { + if( addressDataDict.contains( addr ) ) { return addressDataDict[addr].encrPref; } else { @@ -1798,7 +1798,7 @@ Module::setEncryptionPreference( const TQString& address, return; } TQString addr = canonicalAddress( address ).lower(); - if( addressDataDict.tqcontains( addr ) ) { + if( addressDataDict.contains( addr ) ) { addressDataDict[addr].encrPref = pref; } else { diff --git a/libkpgp/kpgpbase.cpp b/libkpgp/kpgpbase.cpp index b9ad4d63d..f3a79216e 100644 --- a/libkpgp/kpgpbase.cpp +++ b/libkpgp/kpgpbase.cpp @@ -164,7 +164,7 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) } else if (pollin.revents & POLLOUT) { // search end of next line - if ((len2 = input.tqfind('\n', i)) == -1) + if ((len2 = input.find('\n', i)) == -1) len2 = input_length - i; else len2 = len2 - i + 1; @@ -598,7 +598,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) else if (poller[STD_IN].revents & POLLOUT) { if (!input.isEmpty()) { // search end of next line - if ((len2 = input.tqfind('\n', input_pos)) == -1) + if ((len2 = input.find('\n', input_pos)) == -1) len2 = input_length - input_pos; else len2 = len2 - input_pos + 1; diff --git a/libkpgp/kpgpbase2.cpp b/libkpgp/kpgpbase2.cpp index be96b5da9..97db773a7 100644 --- a/libkpgp/kpgpbase2.cpp +++ b/libkpgp/kpgpbase2.cpp @@ -118,16 +118,16 @@ Base2::encsign( Block& block, const KeyIDList& recipients, bool bad = FALSE; unsigned int num = 0; TQCString badkeys = ""; - if (error.tqfind("Cannot find the public key") != -1) + if (error.find("Cannot find the public key") != -1) { index = 0; num = 0; - while((index = error.tqfind("Cannot find the public key",index)) + while((index = error.find("Cannot find the public key",index)) != -1) { bad = TRUE; - index = error.tqfind('\'',index); - int index2 = error.tqfind('\'',index+1); + index = error.find('\'',index); + int index2 = error.find('\'',index+1); if (num++) badkeys += ", "; badkeys += error.mid(index, index2-index+1); @@ -149,15 +149,15 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERROR; } } - if (error.tqfind("skipping userid") != -1) + if (error.find("skipping userid") != -1) { index = 0; num = 0; - while((index = error.tqfind("skipping userid",index)) + while((index = error.find("skipping userid",index)) != -1) { bad = TRUE; - int index2 = error.tqfind('\n',index+16); + int index2 = error.find('\n',index+16); if (num++) badkeys += ", "; badkeys += error.mid(index+16, index2-index-16); @@ -187,12 +187,12 @@ Base2::encsign( Block& block, const KeyIDList& recipients, #endif if(passphrase != 0) { - if(error.tqfind("Pass phrase is good") != -1) + if(error.find("Pass phrase is good") != -1) { //kdDebug(5100) << "Base: Good Passphrase!" << endl; status |= SIGNED; } - if( error.tqfind("Bad pass phrase") != -1) + if( error.find("Bad pass phrase") != -1) { errMsg = i18n("Bad passphrase; could not sign."); status |= BADPHRASE; @@ -200,7 +200,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERROR; } } - if (error.tqfind("Signature error") != -1) + if (error.find("Signature error") != -1) { errMsg = i18n("Signing failed: please check your PGP User Identity, " "the PGP setup, and the key rings."); @@ -208,7 +208,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERR_SIGNING; status |= ERROR; } - if (error.tqfind("Encryption error") != -1) + if (error.find("Encryption error") != -1) { errMsg = i18n("Encryption failed: please check your PGP setup " "and the key rings."); @@ -238,16 +238,16 @@ Base2::decrypt( Block& block, const char *passphrase ) // pgp2.6 has sometimes problems with the ascii armor pgp5.0 produces // this hack can solve parts of the problem - if(error.tqfind("ASCII armor corrupted.") != -1) + if(error.find("ASCII armor corrupted.") != -1) { kdDebug(5100) << "removing ASCII armor header" << endl; - int index1 = input.tqfind("-----BEGIN PGP SIGNED MESSAGE-----"); + int index1 = input.find("-----BEGIN PGP SIGNED MESSAGE-----"); if(index1 != -1) - index1 = input.tqfind("-----BEGIN PGP SIGNATURE-----", index1); + index1 = input.find("-----BEGIN PGP SIGNATURE-----", index1); else - index1 = input.tqfind("-----BEGIN PGP MESSAGE-----"); - index1 = input.tqfind('\n', index1); - index2 = input.tqfind("\n\n", index1); + index1 = input.find("-----BEGIN PGP MESSAGE-----"); + index1 = input.find('\n', index1); + index2 = input.find("\n\n", index1); input.remove(index1, index2 - index1); exitqStatus = run(PGP2 " +batchmode +language=en -f", passphrase); if( !output.isEmpty() ) @@ -282,19 +282,19 @@ Base2::decrypt( Block& block, const char *passphrase ) * * You do not have the secret key needed to decrypt this file. */ - if(error.tqfind("File is encrypted.") != -1) + if(error.find("File is encrypted.") != -1) { //kdDebug(5100) << "kpgpbase: message is encrypted" << endl; status |= ENCRYPTED; - if((index = error.tqfind("Key for user ID:")) != -1) + if((index = error.find("Key for user ID:")) != -1) { // Find out the key for which the phrase is needed index += 17; - index2 = error.tqfind('\n', index); + index2 = error.find('\n', index); block.setRequiredUserId( error.mid(index, index2 - index) ); //kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n"; - if((passphrase != 0) && (error.tqfind("Bad pass phrase") != -1)) + if((passphrase != 0) && (error.find("Bad pass phrase") != -1)) { errMsg = i18n("Bad passphrase; could not decrypt."); kdDebug(5100) << "Base: passphrase is bad" << endl; @@ -314,14 +314,14 @@ Base2::decrypt( Block& block, const char *passphrase ) #if 0 // ##### FIXME: This information is anyway currently not used // I'll change it to always determine the recipients. - index = error.tqfind("can only be read by:"); + index = error.find("can only be read by:"); if(index != -1) { - index = error.tqfind('\n',index); - int end = error.tqfind("\n\n",index); + index = error.find('\n',index); + int end = error.find("\n\n",index); mRecipients.clear(); - while( (index2 = error.tqfind('\n',index+1)) <= end ) + while( (index2 = error.find('\n',index+1)) <= end ) { TQCString item = error.mid(index+1,index2-index-1); item.stripWhiteSpace(); @@ -392,19 +392,19 @@ Base2::decrypt( Block& block, const char *passphrase ) * Signature made 2001/09/09 16:01 GMT using 1024-bit key, key ID 12345678 */ - if((index = error.tqfind("File has signature")) != -1) + if((index = error.find("File has signature")) != -1) { // move index to start of next line - index = error.tqfind('\n', index+18) + 1; + index = error.find('\n', index+18) + 1; //kdDebug(5100) << "Base: message is signed" << endl; status |= SIGNED; // get signature date and signature key ID - if ((index2 = error.tqfind("Signature made", index)) != -1) { + if ((index2 = error.find("Signature made", index)) != -1) { index2 += 15; - int index3 = error.tqfind("using", index2); + int index3 = error.find("using", index2); block.setSignatureDate( error.mid(index2, index3-index2-1) ); kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n"; - index3 = error.tqfind("key ID ", index3) + 7; + index3 = error.find("key ID ", index3) + 7; block.setSignatureKeyId( error.mid(index3,8) ); kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n"; } @@ -415,38 +415,38 @@ Base2::decrypt( Block& block, const char *passphrase ) block.setSignatureKeyId( "" ); } - if( ( index2 = error.tqfind("Key matching expected", index) ) != -1) + if( ( index2 = error.find("Key matching expected", index) ) != -1) { status |= UNKNOWN_SIG; status |= GOODSIG; - int index3 = error.tqfind("Key ID ", index2) + 7; + int index3 = error.find("Key ID ", index2) + 7; block.setSignatureKeyId( error.mid(index3,8) ); block.setSignatureUserId( TQString() ); } - else if( (index2 = error.tqfind("Good signature from", index)) != -1 ) + else if( (index2 = error.find("Good signature from", index)) != -1 ) { status |= GOODSIG; // get signer - index = error.tqfind('"',index2+19); - index2 = error.tqfind('"', index+1); + index = error.find('"',index2+19); + index2 = error.find('"', index+1); block.setSignatureUserId( error.mid(index+1, index2-index-1) ); } - else if( (index2 = error.tqfind("Bad signature from", index)) != -1 ) + else if( (index2 = error.find("Bad signature from", index)) != -1 ) { status |= ERROR; // get signer - index = error.tqfind('"',index2+19); - index2 = error.tqfind('"', index+1); + index = error.find('"',index2+19); + index2 = error.find('"', index+1); block.setSignatureUserId( error.mid(index+1, index2-index-1) ); } - else if( error.tqfind("Keyring file", index) != -1 ) + else if( error.find("Keyring file", index) != -1 ) { // #### fix this hack status |= UNKNOWN_SIG; status |= GOODSIG; // this is a hack... // determine file name of missing keyring file - index = error.tqfind('\'', index) + 1; - index2 = error.tqfind('\'', index); + index = error.find('\'', index) + 1; + index2 = error.find('\'', index); block.setSignatureUserId( i18n("The keyring file %1 does not exist.\n" "Please check your PGP setup.").tqarg(TQString(error.mid(index, index2-index))) ); } @@ -547,7 +547,7 @@ Base2::doGetPublicKeys( const TQCString & cmd, const TQStringList & patterns ) // put all new keys into a map, remove duplicates while ( !publicKeys.isEmpty() ) { Key * key = publicKeys.take( 0 ); - if ( !map.tqcontains( key->primaryFingerprint() ) ) + if ( !map.contains( key->primaryFingerprint() ) ) map.insert( key->primaryFingerprint(), key ); else delete key; @@ -626,10 +626,10 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) { /* if( secretKeys ) - index = output.tqfind( "\nsec" ); + index = output.find( "\nsec" ); else */ - index = output.tqfind( "\npub" ); + index = output.find( "\npub" ); if( index == -1 ) return 0; else @@ -641,7 +641,7 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) int index2; // search the end of the current line - if( ( index2 = output.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = output.find( '\n', index ) ) == -1 ) break; if( !strncmp( output.data() + index, "pub", 3 ) || @@ -699,19 +699,19 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) pos = index + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( '/', pos ); + pos2 = output.find( '/', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); // Key ID pos = pos2 + 1; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); // Creation Date pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); int year = output.mid( pos, 4 ).toInt(); int month = output.mid( pos+5, 2 ).toInt(); int day = output.mid( pos+8, 2 ).toInt(); @@ -754,8 +754,8 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) TQCString fingerprint = output.mid( pos, index2-pos ); // remove white space from the fingerprint - for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; ) - fingerprint.tqreplace( idx, 1, "" ); + for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) + fingerprint.replace( idx, 1, "" ); subkey->setFingerprint( fingerprint ); } @@ -827,10 +827,10 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the trust data belonging to this key - int index = str.tqfind( '\n' ) + 1; + int index = str.find( '\n' ) + 1; while( ( index > 0 ) && ( strncmp( str.data() + index+2, keyID.data(), 8 ) != 0 ) ) - index = str.tqfind( '\n', index ) + 1; + index = str.find( '\n', index ) + 1; if( index == 0 ) return; @@ -846,7 +846,7 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str ) int index2; // search the end of the current line - if( ( index2 = str.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = str.find( '\n', index ) ) == -1 ) break; // check if trust info for the next key starts @@ -908,9 +908,9 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) else { if( secretKeys ) - index = output.tqfind( "\nsec" ); + index = output.find( "\nsec" ); else - index = output.tqfind( "\npub" ); + index = output.find( "\npub" ); if( index == -1 ) return keys; else @@ -922,7 +922,7 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) int index2; // search the end of the current line - if( ( index2 = output.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = output.find( '\n', index ) ) == -1 ) break; if( !strncmp( output.data() + index, "pub", 3 ) || @@ -979,19 +979,19 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) pos = index + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( '/', pos ); + pos2 = output.find( '/', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); // Key ID pos = pos2 + 1; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); // Creation Date pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); int year = output.mid( pos, 4 ).toInt(); int month = output.mid( pos+5, 2 ).toInt(); int day = output.mid( pos+8, 2 ).toInt(); @@ -1035,8 +1035,8 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) pos2 = pos + 18; TQCString fingerprint = output.mid( pos, index2-pos ); // remove white space from the fingerprint - for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; ) - fingerprint.tqreplace( idx, 1, "" ); + for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) + fingerprint.replace( idx, 1, "" ); subkey->setFingerprint( fingerprint ); } diff --git a/libkpgp/kpgpbase5.cpp b/libkpgp/kpgpbase5.cpp index 46ded2c73..288957399 100644 --- a/libkpgp/kpgpbase5.cpp +++ b/libkpgp/kpgpbase5.cpp @@ -112,7 +112,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, if (signonly) { input.append("\n"); - input.tqreplace(TQRegExp("[ \t]+\n"), "\n"); //strip trailing whitespace + input.replace(TQRegExp("[ \t]+\n"), "\n"); //strip trailing whitespace } //We have to do this otherwise it's all in vain @@ -123,7 +123,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, status = ERROR; // now parse the returned info - if(error.tqfind("Cannot unlock private key") != -1) + if(error.find("Cannot unlock private key") != -1) { errMsg = i18n("The passphrase you entered is invalid."); status |= ERROR; @@ -133,16 +133,16 @@ Base5::encsign( Block& block, const KeyIDList& recipients, //{ TQCString aStr; index = -1; - while((index = error.tqfind("WARNING: The above key",index+1)) != -1) + while((index = error.find("WARNING: The above key",index+1)) != -1) { - int index2 = error.tqfind("But you previously",index); - int index3 = error.tqfind("WARNING: The above key",index+1); + int index2 = error.find("But you previously",index); + int index3 = error.find("WARNING: The above key",index+1); if(index2 == -1 || (index2 > index3 && index3 != -1)) { // the key wasn't valid, no encryption to this person // extract the person - index2 = error.tqfind('\n',index); - index3 = error.tqfind('\n',index2+1); + index2 = error.find('\n',index); + index3 = error.find('\n',index2+1); aStr += error.mid(index2+1, index3-index2-1); aStr += ", "; } @@ -150,7 +150,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, if(!aStr.isEmpty()) { aStr.truncate(aStr.length()-2); - if(error.tqfind("No valid keys found") != -1) + if(error.find("No valid keys found") != -1) errMsg = i18n("The key(s) you want to encrypt your message " "to are not trusted. No encryption done."); else @@ -161,10 +161,10 @@ Base5::encsign( Block& block, const KeyIDList& recipients, status |= BADKEYS; } //} - if((index = error.tqfind("No encryption keys found for")) != -1) + if((index = error.find("No encryption keys found for")) != -1) { - index = error.tqfind(':',index); - int index2 = error.tqfind('\n',index); + index = error.find(':',index); + int index2 = error.find('\n',index); errMsg = i18n("Missing encryption key(s) for:\n%1") .tqarg(TQString(error.mid(index,index2-index))); @@ -178,8 +178,8 @@ Base5::encsign( Block& block, const KeyIDList& recipients, // dash-escape the input if (input[0] == '-') input = "- " + input; - for ( int idx = 0 ; (idx = input.tqfind("\n-", idx)) >= 0 ; idx += 4 ) - input.tqreplace(idx, 2, "\n- -"); + for ( int idx = 0 ; (idx = input.find("\n-", idx)) >= 0 ; idx += 4 ) + input.replace(idx, 2, "\n- -"); output = "-----BEGIN PGP SIGNED MESSAGE-----\n\n" + input + "\n" + output; } @@ -212,7 +212,7 @@ Base5::decrypt( Block& block, const char *passphrase ) // lets parse the returned information. int index; - index = error.tqfind("Cannot decrypt message"); + index = error.find("Cannot decrypt message"); if(index != -1) { //kdDebug(5100) << "message is encrypted" << endl; @@ -220,7 +220,7 @@ Base5::decrypt( Block& block, const char *passphrase ) // ok. we have an encrypted message. Is the passphrase bad, // or do we not have the secret key? - if(error.tqfind("Need a pass phrase") != -1) + if(error.find("Need a pass phrase") != -1) { if(passphrase != 0) { @@ -242,15 +242,15 @@ Base5::decrypt( Block& block, const char *passphrase ) #if 0 // ##### FIXME: This information is anyway currently not used // I'll change it to always determine the recipients. - index = error.tqfind("can only be decrypted by:"); + index = error.find("can only be decrypted by:"); if(index != -1) { - index = error.tqfind('\n',index); - int end = error.tqfind("\n\n",index); + index = error.find('\n',index); + int end = error.find("\n\n",index); mRecipients.clear(); int index2; - while( (index2 = error.tqfind('\n',index+1)) <= end ) + while( (index2 = error.find('\n',index+1)) <= end ) { TQCString item = error.mid(index+1,index2-index-1); item.stripWhiteSpace(); @@ -260,7 +260,7 @@ Base5::decrypt( Block& block, const char *passphrase ) } #endif } - index = error.tqfind("Good signature"); + index = error.find("Good signature"); if(index != -1) { //kdDebug(5100) << "good signature" << endl; @@ -268,18 +268,18 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= GOODSIG; // get key ID of signer - index = error.tqfind("Key ID ", index) + 7; + index = error.find("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.tqfind('"',index) + 1; - int index2 = error.tqfind('"', index); + index = error.find('"',index) + 1; + int index2 = error.find('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.tqfind("BAD signature"); + index = error.find("BAD signature"); if(index != -1) { //kdDebug(5100) << "BAD signature" << endl; @@ -287,21 +287,21 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= ERROR; // get key ID of signer - index = error.tqfind("Key ID ", index) + 7; + index = error.find("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.tqfind('"',index) + 1; - int index2 = error.tqfind('"', index); + index = error.find('"',index) + 1; + int index2 = error.find('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.tqfind("Signature by unknown key"); + index = error.find("Signature by unknown key"); if(index != -1) { - index = error.tqfind("keyid: 0x",index) + 9; + index = error.find("keyid: 0x",index) + 9; block.setSignatureKeyId( error.mid(index, 8) ); block.setSignatureUserId( TQString() ); // FIXME: not a very good solution... @@ -483,7 +483,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) int eol; // search the end of the current line - eol = output.tqfind( '\n', offset ); + eol = output.find( '\n', offset ); if( ( eol == -1 ) || ( eol == offset ) ) break; @@ -525,7 +525,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = offset + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); //kdDebug(5100) << "Key Length: "<<subkey->keyLength()<<endl; @@ -534,7 +534,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) while( output[pos] == ' ' ) pos++; pos += 2; // skip the '0x' - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); //kdDebug(5100) << "Key ID: "<<subkey->keyID()<<endl; @@ -542,7 +542,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); int year = output.mid( pos, 4 ).toInt(); int month = output.mid( pos+5, 2 ).toInt(); int day = output.mid( pos+8, 2 ).toInt(); @@ -561,7 +561,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); if( output[pos] == '-' ) { // key doesn't expire subkey->setExpirationDate( -1 ); @@ -595,7 +595,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); if( !strncmp( output.data() + pos, "RSA", 3 ) ) { sign = true; @@ -653,11 +653,11 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) f20 Fingerprint20 = 226F 4B63 6DA2 7389 91D1 2A49 D58A 3EC1 5214 181E */ - int pos = output.tqfind( '=', offset+3 ) + 2; + int pos = output.find( '=', offset+3 ) + 2; TQCString fingerprint = output.mid( pos, eol-pos ); // remove white space from the fingerprint - for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; ) - fingerprint.tqreplace( idx, 1, "" ); + for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) + fingerprint.replace( idx, 1, "" ); assert( subkey != 0 ); subkey->setFingerprint( fingerprint ); //kdDebug(5100)<<"Fingerprint: "<<fingerprint<<endl; @@ -700,13 +700,13 @@ Base5::parseSingleKey( const TQCString& output, Key* key /* = 0 */ ) offset = 0; else { - offset = output.tqfind( "\nType Bits" ) + 1; + offset = output.find( "\nType Bits" ) + 1; if( offset == 0 ) return 0; } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == -1 ) return 0; @@ -730,13 +730,13 @@ Base5::parseKeyList( const TQCString& output, bool onlySecretKeys ) offset = 0; else { - offset = output.tqfind( "\nType Bits" ) + 1; + offset = output.find( "\nType Bits" ) + 1; if( offset == 0 ) return keys; } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == -1 ) return keys; @@ -770,11 +770,11 @@ Base5::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the start of the trust data - int offset = str.tqfind( "\n\n KeyID" ) + 9; + int offset = str.find( "\n\n KeyID" ) + 9; if( offset == -1 + 9 ) return; - offset = str.tqfind( '\n', offset ) + 1; + offset = str.find( '\n', offset ) + 1; if( offset == -1 + 1 ) return; @@ -788,7 +788,7 @@ Base5::parseTrustDataForKey( Key* key, const TQCString& str ) int eol; // search the end of the current line - if( ( eol = str.tqfind( '\n', offset ) ) == -1 ) + if( ( eol = str.find( '\n', offset ) ) == -1 ) break; if( str[offset+23] != ' ' ) diff --git a/libkpgp/kpgpbase6.cpp b/libkpgp/kpgpbase6.cpp index 440ac6e20..0972a46e1 100644 --- a/libkpgp/kpgpbase6.cpp +++ b/libkpgp/kpgpbase6.cpp @@ -66,15 +66,15 @@ Base6::decrypt( Block& block, const char *passphrase ) } // encrypted message - if( error.tqfind("File is encrypted.") != -1) + if( error.find("File is encrypted.") != -1) { //kdDebug(5100) << "kpgpbase: message is encrypted" << endl; status |= ENCRYPTED; - if((index = error.tqfind("Key for user ID")) != -1) + if((index = error.find("Key for user ID")) != -1) { // Find out the key for which the phrase is needed - index = error.tqfind(':', index) + 2; - index2 = error.tqfind('\n', index); + index = error.find(':', index) + 2; + index2 = error.find('\n', index); block.setRequiredUserId( error.mid(index, index2 - index) ); //kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n"; @@ -90,7 +90,7 @@ Base6::decrypt( Block& block, const char *passphrase ) status |= ERROR; } } - else if( error.tqfind("You do not have the secret key needed to decrypt this file.") != -1) + else if( error.find("You do not have the secret key needed to decrypt this file.") != -1) { errMsg = i18n("You do not have the secret key for this message."); //kdDebug(5100) << "Base: no secret key for this message" << endl; @@ -123,46 +123,46 @@ Base6::decrypt( Block& block, const char *passphrase ) * File is signed. Good signature from user "Joe User <joe@foo.bar>". * Signature made 2001/12/05 13:09 GMT */ - if(((index = error.tqfind("File is signed.")) != -1) - || (error.tqfind("Good signature") != -1 )) + if(((index = error.find("File is signed.")) != -1) + || (error.find("Good signature") != -1 )) { //kdDebug(5100) << "Base: message is signed" << endl; status |= SIGNED; // determine the signature date - if( ( index2 = error.tqfind( "Signature made", index ) ) != -1 ) + if( ( index2 = error.find( "Signature made", index ) ) != -1 ) { index2 += 15; - int eol = error.tqfind( '\n', index2 ); + int eol = error.find( '\n', index2 ); block.setSignatureDate( error.mid( index2, eol-index2 ) ); kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n"; } else block.setSignatureDate( TQCString() ); // determine signature status and signature key - if( error.tqfind("signature not checked") != -1) + if( error.find("signature not checked") != -1) { - index = error.tqfind("KeyID:",index); + index = error.find("KeyID:",index); block.setSignatureKeyId( error.mid(index+9,8) ); block.setSignatureUserId( TQString() ); status |= UNKNOWN_SIG; status |= GOODSIG; } - else if((index = error.tqfind("Good signature")) != -1 ) + else if((index = error.find("Good signature")) != -1 ) { status |= GOODSIG; // get signer - index = error.tqfind('"',index)+1; - index2 = error.tqfind('"', index); + index = error.find('"',index)+1; + index2 = error.find('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); // get key ID of signer - index = error.tqfind("KeyID:",index2); + index = error.find("KeyID:",index2); if (index == -1) block.setSignatureKeyId( TQCString() ); else block.setSignatureKeyId( error.mid(index+9,8) ); } - else if( error.tqfind("Can't find the right public key") != -1 ) + else if( error.find("Can't find the right public key") != -1 ) { // #### fix this hack // #### This doesn't happen with PGP 6.5.8 because it seems to @@ -253,28 +253,28 @@ Base6::pubKeys() if (error.length() > 1) error.truncate(error.length()-1); TQStrList publicKeys; - index = error.tqfind("bits/keyID",1); // skip first to "\n" + index = error.find("bits/keyID",1); // skip first to "\n" if (index ==-1) { - index = error.tqfind("Type bits",1); // skip first to "\n" + index = error.find("Type bits",1); // skip first to "\n" if (index == -1) return 0; else compatibleMode = 0; } - while( (index = error.tqfind("\n",index)) != -1) + while( (index = error.find("\n",index)) != -1) { //parse line TQCString line; - if( (index2 = error.tqfind("\n",index+1)) != -1) + if( (index2 = error.find("\n",index+1)) != -1) // skip last line { int index3; if (compatibleMode) { - int index_pub = error.tqfind("pub ",index); - int index_sec = error.tqfind("sec ",index); + int index_pub = error.find("pub ",index); + int index_sec = error.find("sec ",index); if (index_pub < 0) index3 = index_sec; else if (index_sec < 0) @@ -284,8 +284,8 @@ Base6::pubKeys() } else { - int index_rsa = error.tqfind("RSA ",index); - int index_dss = error.tqfind("DSS ",index); + int index_rsa = error.find("RSA ",index); + int index_dss = error.find("DSS ",index); if (index_rsa < 0) index3 = index_dss; else if (index_dss < 0) @@ -301,14 +301,14 @@ Base6::pubKeys() line = line.stripWhiteSpace(); } else { // line with new key - int index4 = error.tqfind(TQRegExp("/\\d{2}/\\d{2} "), index); + int index4 = error.find(TQRegExp("/\\d{2}/\\d{2} "), index); line = error.mid(index4+7,index2-index4-7); } //kdDebug(5100) << "Base: found key for " << (const char *)line << endl; // don't add PGP's comments to the key list if (strncmp(line.data(),"*** KEY EXPIRED ***",19) && - line.tqfind(TQRegExp("^expires \\d{4}/\\d{2}/\\d{2}")) < 0 && + line.find(TQRegExp("^expires \\d{4}/\\d{2}/\\d{2}")) < 0 && strncmp(line.data(),"*** DEFAULT SIGNING KEY ***",27)) { publicKeys.append(line); } @@ -327,10 +327,10 @@ Base6::pubKeys() } index = 0; - while ( (index = error.tqfind("\n >", index)) != -1 ) { + while ( (index = error.find("\n >", index)) != -1 ) { TQCString line; index += 4; - index2 = error.tqfind(" \"", index); + index2 = error.find(" \"", index); line = error.mid(index, index2-index+1).stripWhiteSpace(); //kdDebug(5100) << "Base6: found key group for " << line << endl; @@ -362,7 +362,7 @@ Base6::isVersion6() return 0; } - if( error.tqfind("Version 6") != -1) + if( error.find("Version 6") != -1) { //kdDebug(5100) << "kpgpbase: pgp version 6.x detected" << endl; return 1; @@ -399,7 +399,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) int eol; // search the end of the current line - if( ( eol = output.tqfind( '\n', offset ) ) == -1 ) + if( ( eol = output.find( '\n', offset ) ) == -1 ) break; //kdDebug(5100) << "Parsing: " << output.mid(offset, eol-offset) << endl; @@ -465,7 +465,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = offset + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); //kdDebug(5100) << "Key Length: "<<subkey->keyLength()<<endl; @@ -474,7 +474,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) while( output[pos] == ' ' ) pos++; pos += 2; // skip the '0x' - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); //kdDebug(5100) << "Key ID: "<<subkey->keyID()<<endl; @@ -482,7 +482,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); int year = output.mid( pos, 4 ).toInt(); int month = output.mid( pos+5, 2 ).toInt(); int day = output.mid( pos+8, 2 ).toInt(); @@ -582,19 +582,19 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = offset + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); // Key ID (ignored as it is anyway equal to the primary key id) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); // Creation Date of secondary key (ignored) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); // User ID or key properties pos = pos2 + 1; @@ -662,8 +662,8 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos += 18; TQCString fingerprint = output.mid( pos, eol-pos ); // remove white space from the fingerprint - for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; ) - fingerprint.tqreplace( idx, 1, "" ); + for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) + fingerprint.replace( idx, 1, "" ); //kdDebug(5100)<<"Fingerprint: "<<fingerprint<<endl; assert( subkey != 0 ); @@ -712,7 +712,7 @@ Base6::parseSingleKey( const TQCString& output, Key* key /* = 0 */ ) offset = 9; else { - offset = output.tqfind( "\nType bits" ); + offset = output.find( "\nType bits" ); if( offset == -1 ) return 0; else @@ -720,7 +720,7 @@ Base6::parseSingleKey( const TQCString& output, Key* key /* = 0 */ ) } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == 0 ) return 0; @@ -745,13 +745,13 @@ Base6::parseKeyList( const TQCString& output, bool secretKeys ) offset = 0; else { - offset = output.tqfind( "\nType bits" ) + 1; + offset = output.find( "\nType bits" ) + 1; if( offset == 0 ) return keys; } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == -1 ) return keys; @@ -782,11 +782,11 @@ Base6::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the start of the trust data - int offset = str.tqfind( "\n\n KeyID" ); + int offset = str.find( "\n\n KeyID" ); if( offset == -1 ) return; - offset = str.tqfind( '\n', offset ) + 1; + offset = str.find( '\n', offset ) + 1; if( offset == 0 ) return; @@ -800,7 +800,7 @@ Base6::parseTrustDataForKey( Key* key, const TQCString& str ) int eol; // search the end of the current line - if( ( eol = str.tqfind( '\n', offset ) ) == -1 ) + if( ( eol = str.find( '\n', offset ) ) == -1 ) break; if( str[offset+23] != ' ' ) diff --git a/libkpgp/kpgpbaseG.cpp b/libkpgp/kpgpbaseG.cpp index b04b31bf2..ecb5af195 100644 --- a/libkpgp/kpgpbaseG.cpp +++ b/libkpgp/kpgpbaseG.cpp @@ -38,9 +38,9 @@ BaseG::BaseG() { // determine the version of gpg (the method is equivalent to gpgme's method) runGpg( "--version", 0 ); - int eol = output.tqfind( '\n' ); + int eol = output.find( '\n' ); if( eol > 0 ) { - int pos = output.tqfindRev( ' ', eol - 1 ); + int pos = output.findRev( ' ', eol - 1 ); if( pos != -1 ) { mVersion = output.mid( pos + 1, eol - pos - 1 ); kdDebug(5100) << "found GnuPG " << mVersion << endl; @@ -138,11 +138,11 @@ BaseG::encsign( Block& block, const KeyIDList& recipients, // (expired or revoked key) // gpg: 23456789: no info to calculate a trust probability // (untrusted key, 23456789 is the key Id of the encryption sub key) - while((index = error.tqfind("skipped: ",index)) != -1) + while((index = error.find("skipped: ",index)) != -1) { bad = TRUE; - index = error.tqfind('\'',index); - int index2 = error.tqfind('\'',index+1); + index = error.find('\'',index); + int index2 = error.find('\'',index+1); badkeys += error.mid(index, index2-index+1) + ", "; num++; } @@ -178,14 +178,14 @@ BaseG::encsign( Block& block, const KeyIDList& recipients, // Example 4 (unusable secret key, sign & encrypt): // gpg: skipped `0xAC0EB35D': unusable secret key // gpg: [stdin]: sign+encrypt failed: unusable secret key - if( error.tqfind("bad passphrase") != -1 ) + if( error.find("bad passphrase") != -1 ) { errMsg = i18n("Signing failed because the passphrase is wrong."); status |= BADPHRASE; status |= ERR_SIGNING; status |= ERROR; } - else if( error.tqfind("unusable secret key") != -1 ) + else if( error.find("unusable secret key") != -1 ) { errMsg = i18n("Signing failed because your secret key is unusable."); status |= ERR_SIGNING; @@ -213,7 +213,7 @@ BaseG::decrypt( Block& block, const char *passphrase ) clear(); input = block.text(); exitqStatus = runGpg("--batch --decrypt", passphrase); - if( !output.isEmpty() && ( error.tqfind( "gpg: quoted printable" ) == -1 ) ) + if( !output.isEmpty() && ( error.find( "gpg: quoted printable" ) == -1 ) ) block.setProcessedText( output ); block.setError( error ); @@ -244,13 +244,13 @@ BaseG::decrypt( Block& block, const char *passphrase ) // gpg: public key decryption failed: bad passphrase // gpg: encrypted with 2048-bit ELG-E key, ID 23456789, created 2000-02-02 // "Foo Bar (home) <foo@bar.xyz>" - if( error.tqfind( "gpg: encrypted with" ) != -1 ) + if( error.find( "gpg: encrypted with" ) != -1 ) { //kdDebug(5100) << "kpgpbase: message is encrypted" << endl; status |= ENCRYPTED; - if( error.tqfind( "\ngpg: decryption failed" ) != -1 ) + if( error.find( "\ngpg: decryption failed" ) != -1 ) { - if( ( index = error.tqfind( "bad passphrase" ) ) != -1 ) + if( ( index = error.find( "bad passphrase" ) ) != -1 ) { if( passphrase != 0 ) { @@ -262,15 +262,15 @@ BaseG::decrypt( Block& block, const char *passphrase ) else { // Search backwards the user ID of the needed key - index2 = error.tqfindRev('"', index) - 1; - index = error.tqfindRev(" \"", index2) + 7; + index2 = error.findRev('"', index) - 1; + index = error.findRev(" \"", index2) + 7; // The conversion from UTF8 is necessary because gpg stores and // prints user IDs in UTF8 block.setRequiredUserId( TQString::fromUtf8( error.mid( index, index2 - index + 1 ) ) ); kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!" << endl; } } - else if( error.tqfind( "secret key not available" ) != -1 ) + else if( error.find( "secret key not available" ) != -1 ) { // no secret key fitting this message status |= NO_SEC_KEY; @@ -283,14 +283,14 @@ BaseG::decrypt( Block& block, const char *passphrase ) #if 0 // ##### FIXME: This information is anyway currently not used // I'll change it to always determine the recipients. - index = error.tqfind("can only be read by:"); + index = error.find("can only be read by:"); if(index != -1) { - index = error.tqfind('\n',index); - int end = error.tqfind("\n\n",index); + index = error.find('\n',index); + int end = error.find("\n\n",index); mRecipients.clear(); - while( (index2 = error.tqfind('\n',index+1)) <= end ) + while( (index2 = error.find('\n',index+1)) <= end ) { TQCString item = error.mid(index+1,index2-index-1); item.stripWhiteSpace(); @@ -304,48 +304,48 @@ BaseG::decrypt( Block& block, const char *passphrase ) // Example 1 (unknown signature key): // gpg: Signature made Wed 02 Jan 2002 11:26:33 AM CET using DSA key ID 2E250C64 // gpg: Can't check signature: public key not found - if((index = error.tqfind("Signature made")) != -1) + if((index = error.find("Signature made")) != -1) { //kdDebug(5100) << "Base: message is signed" << endl; status |= SIGNED; // get signature date and signature key ID // Example: Signature made Sun 06 May 2001 03:49:27 PM CEST using DSA key ID 12345678 - index2 = error.tqfind("using", index+15); + index2 = error.find("using", index+15); block.setSignatureDate( error.mid(index+15, index2-(index+15)-1) ); kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n"; - index2 = error.tqfind("key ID ", index2) + 7; + index2 = error.find("key ID ", index2) + 7; block.setSignatureKeyId( error.mid(index2,8) ); kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n"; // move index to start of next line - index = error.tqfind('\n', index2)+1; + index = error.find('\n', index2)+1; - if ((error.tqfind("Key matching expected", index) != -1) - || (error.tqfind("Can't check signature", index) != -1)) + if ((error.find("Key matching expected", index) != -1) + || (error.find("Can't check signature", index) != -1)) { status |= UNKNOWN_SIG; status |= GOODSIG; block.setSignatureUserId( TQString() ); } - else if( error.tqfind("Good signature", index) != -1 ) + else if( error.find("Good signature", index) != -1 ) { status |= GOODSIG; // get the primary user ID of the signer - index = error.tqfind('"',index); - index2 = error.tqfind('\n',index+1); - index2 = error.tqfindRev('"', index2-1); + index = error.find('"',index); + index2 = error.find('\n',index+1); + index2 = error.findRev('"', index2-1); block.setSignatureUserId( error.mid( index+1, index2-index-1 ) ); } - else if( error.tqfind("BAD signature", index) != -1 ) + else if( error.find("BAD signature", index) != -1 ) { //kdDebug(5100) << "BAD signature" << endl; status |= ERROR; // get the primary user ID of the signer - index = error.tqfind('"',index); - index2 = error.tqfind('\n',index+1); - index2 = error.tqfindRev('"', index2-1); + index = error.find('"',index); + index2 = error.find('\n',index+1); + index2 = error.findRev('"', index2-1); block.setSignatureUserId( error.mid( index+1, index2-index-1 ) ); } - else if( error.tqfind("Can't find the right public key", index) != -1 ) + else if( error.find("Can't find the right public key", index) != -1 ) { // #### fix this hack // I think this can't happen anymore because if the pubring is missing @@ -389,7 +389,7 @@ BaseG::readPublicKey( const KeyID& keyID, if( !strncmp( output.data(), "pub:", 4 ) ) offset = 0; else { - offset = output.tqfind( "\npub:" ); + offset = output.find( "\npub:" ); if( offset == -1 ) return 0; else @@ -536,7 +536,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) { int eol; // search the end of the current line - if( ( eol = output.tqfind( '\n', index ) ) == -1 ) + if( ( eol = output.find( '\n', index ) ) == -1 ) break; bool bIsPublicKey = false; @@ -555,7 +555,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) Subkey *subkey = new Subkey( TQCString(), !bIsPublicKey ); int pos = index + 4; // begin of 2nd field - int pos2 = output.tqfind( ':', pos ); + int pos2 = output.find( ':', pos ); for( int field = 2; field <= 12; field++ ) { switch( field ) @@ -652,7 +652,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) break; } pos = pos2 + 1; - pos2 = output.tqfind( ':', pos ); + pos2 = output.find( ':', pos ); } key->addSubkey( subkey ); } @@ -663,7 +663,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) UserID *userID = new UserID( "" ); int pos = index + 4; // begin of 2nd field - int pos2 = output.tqfind( ':', pos ); + int pos2 = output.find( ':', pos ); for( int field=2; field <= 10; field++ ) { switch( field ) @@ -710,13 +710,13 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) break; case 10: // User-ID TQCString uid = output.mid( pos, pos2-pos ); - // tqreplace "\xXX" with the corresponding character; + // replace "\xXX" with the corresponding character; // other escaped characters, i.e. \n, \r etc., are ignored // because they shouldn't appear in user IDs - for ( int idx = 0 ; (idx = uid.tqfind( "\\x", idx )) >= 0 ; ++idx ) { + for ( int idx = 0 ; (idx = uid.find( "\\x", idx )) >= 0 ; ++idx ) { char str[2] = "x"; str[0] = (char) TQString( uid.mid( idx + 2, 2 ) ).toShort( 0, 16 ); - uid.tqreplace( idx, 4, str ); + uid.replace( idx, 4, str ); } TQString uidString = TQString::fromUtf8( uid.data() ); // check whether uid was utf-8 encoded @@ -785,7 +785,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) break; } pos = pos2 + 1; - pos2 = output.tqfind( ':', pos ); + pos2 = output.find( ':', pos ); } // user IDs are printed in UTF-8 by gpg (if one uses --with-colons) @@ -801,8 +801,8 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) // search the fingerprint (it's in the 10th field) int pos = index + 4; for( int i = 0; i < 8; i++ ) - pos = output.tqfind( ':', pos ) + 1; - int pos2 = output.tqfind( ':', pos ); + pos = output.find( ':', pos ) + 1; + int pos2 = output.find( ':', pos ); key->setFingerprint( keyID, output.mid( pos, pos2-pos ) ); } @@ -830,9 +830,9 @@ BaseG::parseKeyList( const TQCString& output, bool secretKeys ) offset = 0; else { if( secretKeys ) - offset = output.tqfind( "\nsec:" ); + offset = output.find( "\nsec:" ); else - offset = output.tqfind( "\npub:" ); + offset = output.find( "\npub:" ); if( offset == -1 ) return keys; else diff --git a/libkpgp/kpgpkey.cpp b/libkpgp/kpgpkey.cpp index b646fdf1d..8a8ed48b8 100644 --- a/libkpgp/kpgpkey.cpp +++ b/libkpgp/kpgpkey.cpp @@ -209,7 +209,7 @@ bool Key::matchesUserID(const TQString& str, bool cs) return false; for (UserIDListIterator it(mUserIDs); it.current(); ++it) { - if (((*it)->text().tqfind(str, 0, cs)) != -1) + if (((*it)->text().find(str, 0, cs)) != -1) return true; } diff --git a/libkpgp/kpgpui.cpp b/libkpgp/kpgpui.cpp index eccc58e15..cb07abc41 100644 --- a/libkpgp/kpgpui.cpp +++ b/libkpgp/kpgpui.cpp @@ -205,7 +205,7 @@ Config::Config( TQWidget *tqparent, const char *name, bool encrypt ) msg = i18n( "<qt><p>When this option is enabled, the application will " "always show you a list of public keys from which you can " "choose the one it will use for encryption. If it is off, " - "the application will only show the dialog if it cannot tqfind " + "the application will only show the dialog if it cannot find " "the right key or if there are several which could be used. " "</p></qt>" ); TQWhatsThis::add( showKeyApprovalDlg, msg ); @@ -432,7 +432,7 @@ void KeySelectionDialog::initKeylist( const KeyList& keyList, (*it)->primaryUserID() ); // select and open the given key - if( keyIds.tqfindIndex( curKeyId ) != -1 ) { + if( keyIds.findIndex( curKeyId ) != -1 ) { if( 0 == firstSelectedItem ) { firstSelectedItem = primaryUserID; } @@ -920,7 +920,7 @@ void KeySelectionDialog::slotCheckSelection( TQListViewItem* plvi /* = 0 */ ) // extended selection mode a normal left click deselects // the not clicked items. if( 0 < selectedCount ) { - if( -1 == mKeyIds.tqfindIndex( lvi->text(0).local8Bit() ) ) { + if( -1 == mKeyIds.findIndex( lvi->text(0).local8Bit() ) ) { // some items of this key are selected and the key wasn't selected // before => the user selected something kdDebug(5100) << "selectedCount: "<<selectedCount<<"/"<<itemCount @@ -928,7 +928,7 @@ void KeySelectionDialog::slotCheckSelection( TQListViewItem* plvi /* = 0 */ ) userAction = SELECTED; } else if( ( itemCount > selectedCount ) && - ( -1 != mKeyIds.tqfindIndex( lvi->text(0).local8Bit() ) ) ) { + ( -1 != mKeyIds.findIndex( lvi->text(0).local8Bit() ) ) ) { // some items of this key are unselected and the key was selected // before => the user deselected something kdDebug(5100) << "selectedCount: "<<selectedCount<<"/"<<itemCount |