diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/plugins/cryptography/kgpginterface.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/cryptography/kgpginterface.cpp')
-rw-r--r-- | kopete/plugins/cryptography/kgpginterface.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/kopete/plugins/cryptography/kgpginterface.cpp b/kopete/plugins/cryptography/kgpginterface.cpp index 51b35a63..e41e246d 100644 --- a/kopete/plugins/cryptography/kgpginterface.cpp +++ b/kopete/plugins/cryptography/kgpginterface.cpp @@ -26,7 +26,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> -#include <qfile.h> +#include <tqfile.h> #include <kprocio.h> @@ -40,10 +40,10 @@ KgpgInterface::KgpgInterface() KgpgInterface::~KgpgInterface() {} -QString KgpgInterface::KgpgEncryptText(QString text,QString userIDs, QString Options) +TQString KgpgInterface::KgpgEncryptText(TQString text,TQString userIDs, TQString Options) { FILE *fp; - QString dests,encResult; + TQString dests,encResult; char buffer[200]; userIDs=userIDs.stripWhiteSpace(); @@ -59,7 +59,7 @@ QString KgpgInterface::KgpgEncryptText(QString text,QString userIDs, QString Opt } dests+=" --recipient "+userIDs; - QCString gpgcmd = "echo -n "; + TQCString gpgcmd = "echo -n "; gpgcmd += KShellProcess::quote( text ).utf8(); gpgcmd += " | gpg --no-secmem-warning --no-tty "; gpgcmd += Options.local8Bit(); @@ -75,17 +75,17 @@ QString KgpgInterface::KgpgEncryptText(QString text,QString userIDs, QString Opt if( !encResult.isEmpty() ) return encResult; else - return QString::null; + return TQString::null; } -QString KgpgInterface::KgpgDecryptText(QString text,QString userID) +TQString KgpgInterface::KgpgDecryptText(TQString text,TQString userID) { FILE *fp,*pass; - QString encResult; + TQString encResult; char buffer[200]; int counter=0,ppass[2]; - QCString password = CryptographyPlugin::cachedPass(); + TQCString password = CryptographyPlugin::cachedPass(); bool passphraseHandling=CryptographyPlugin::passphraseHandling(); while ((counter<3) && (encResult.isEmpty())) @@ -94,16 +94,16 @@ QString KgpgInterface::KgpgDecryptText(QString text,QString userID) if(passphraseHandling && password.isNull()) { /// pipe for passphrase - //userID=QString::fromUtf8(userID); + //userID=TQString::fromUtf8(userID); userID.replace('<',"<"); - QString passdlg=i18n("Enter passphrase for <b>%1</b>:").arg(userID); + TQString passdlg=i18n("Enter passphrase for <b>%1</b>:").arg(userID); if (counter>1) - passdlg.prepend(i18n("<b>Bad passphrase</b><br> You have %1 tries left.<br>").arg(QString::number(4-counter))); + passdlg.prepend(i18n("<b>Bad passphrase</b><br> You have %1 tries left.<br>").arg(TQString::number(4-counter))); /// pipe for passphrase int code=KPasswordDialog::getPassword(password,passdlg); - if (code!=QDialog::Accepted) - return QString::null; + if (code!=TQDialog::Accepted) + return TQString::null; CryptographyPlugin::setCachedPass(password); } @@ -116,29 +116,29 @@ QString KgpgInterface::KgpgDecryptText(QString text,QString userID) fclose(pass); } - QCString gpgcmd="echo "; + TQCString gpgcmd="echo "; gpgcmd += KShellProcess::quote(text).utf8(); gpgcmd += " | gpg --no-secmem-warning --no-tty "; if(passphraseHandling) - gpgcmd += "--passphrase-fd " + QString::number(ppass[0]).local8Bit(); + gpgcmd += "--passphrase-fd " + TQString::number(ppass[0]).local8Bit(); gpgcmd += " -d "; ////////// encode with untrusted keys or armor if checked by user fp = popen(gpgcmd, "r"); while ( fgets( buffer, sizeof(buffer), fp)) - encResult += QString::fromUtf8(buffer); + encResult += TQString::fromUtf8(buffer); pclose(fp); - password = QCString(); + password = TQCString(); } if( !encResult.isEmpty() ) return encResult; else - return QString::null; + return TQString::null; } -QString KgpgInterface::checkForUtf8(QString txt) +TQString KgpgInterface::checkForUtf8(TQString txt) { // code borrowed from gpa @@ -147,7 +147,7 @@ QString KgpgInterface::checkForUtf8(QString txt) /* Make sure the encoding is UTF-8. * Test structure suggested by Werner Koch */ if (txt.isEmpty()) - return QString::null; + return TQString::null; for (s = txt.ascii(); *s && !(*s & 0x80); s++) ; @@ -157,17 +157,17 @@ QString KgpgInterface::checkForUtf8(QString txt) /* The string is not in UTF-8 */ //if (strchr (txt.ascii(), 0xc3)) return (txt+" +++"); if (txt.find("\\x")==-1) - return QString::fromUtf8(txt.ascii()); + return TQString::fromUtf8(txt.ascii()); // if (!strchr (txt.ascii(), 0xc3) || (txt.find("\\x")!=-1)) { for ( int idx = 0 ; (idx = txt.find( "\\x", idx )) >= 0 ; ++idx ) { char str[2] = "x"; - str[0] = (char) QString( txt.mid( idx + 2, 2 ) ).toShort( 0, 16 ); + str[0] = (char) TQString( txt.mid( idx + 2, 2 ) ).toShort( 0, 16 ); txt.replace( idx, 4, str ); } if (!strchr (txt.ascii(), 0xc3)) - return QString::fromUtf8(txt.ascii()); + return TQString::fromUtf8(txt.ascii()); else - return QString::fromUtf8(QString::fromUtf8(txt.ascii()).ascii()); // perform Utf8 twice, or some keys display badly + return TQString::fromUtf8(TQString::fromUtf8(txt.ascii()).ascii()); // perform Utf8 twice, or some keys display badly } |