Improved previous commit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/12/head
Slávek Banko 6 years ago
parent 2e5de46030
commit 6492b716b3
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -100,7 +100,7 @@ Kleo::PassphraseDialog::~PassphraseDialog() {
delete d; d = 0;
}
const TQString Kleo::PassphraseDialog::passphrase() const {
TQString Kleo::PassphraseDialog::passphrase() const {
return d->lineedit->password();
}

@ -63,13 +63,13 @@ namespace Kleo {
bool modal=true );
~PassphraseDialog();
const TQString passphrase() const;
TQString passphrase() const;
signals:
/** emitted when the user clicks Ok. \a pass is never NULL.
\c pass only valid inside slots connected to this signal.
*/
void finished( const TQString pass );
void finished( const TQString &pass );
/** emitted when the user clicks Cancel. */
void canceled();

@ -55,7 +55,7 @@ Module::Module()
mPublicKeysCached(false),
mSecretKeys(),
mSecretKeysCached(false),
passphrase(0), havePassPhrase(false)
passphrase(TQString::null), havePassPhrase(false)
{
if (!kpgpObject) {
kdDebug(5100) << "creating new pgp object" << endl;
@ -230,8 +230,8 @@ Module::wipePassPhrase(bool freeMem)
if (!passphrase.isEmpty()) {
passphrase.fill(' ');
}
if (freeMem && !passphrase.isNull()) {
passphrase = TQString();
if (freeMem) {
passphrase.truncate(0);
}
havePassPhrase = false;
}
@ -836,7 +836,7 @@ bool Module::setPassPhrase(const TQString& aPass)
// aPass isn't properly null-terminated, we don't leak secret data.
wipePassPhrase();
if (!aPass.isNull())
if (!aPass.isEmpty())
{
if (aPass.length() >= 1024) {
// rediculously long passphrase.

@ -74,7 +74,7 @@ Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP )
struct pollfd pollin, pollout, pollerr;
int pollstatus;
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
if (pipe(ppass) < 0) {
// An error occurred
@ -369,7 +369,7 @@ Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP )
close(perr[0]);
unsetenv("PGPPASSFD");
if (!passphrase.isNull())
if (!passphrase.isEmpty())
close(ppass[0]);
// Did the child exit normally?
@ -418,7 +418,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP
const int STD_IN = 2;
int pollstatus;
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
if (pipe(ppass) < 0) {
// An error occurred
@ -461,7 +461,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP
printf("Something went wrong in libkpgp/kpgpbase.cpp\n");
}
if (!passphrase.isNull()) {
if (!passphrase.isEmpty()) {
if( mVersion >= "1.0.7" ) {
// GnuPG >= 1.0.7 supports the gpg-agent, so we look for it.
if( 0 == getenv("GPG_AGENT_INFO") ) {
@ -506,7 +506,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP
//#warning FIXME: there has to be a better way to do this
/* this is nasty nasty nasty (but it works) */
if (!passphrase.isNull()) {
if (!passphrase.isEmpty()) {
if( mVersion >= "1.0.7" ) {
// GnuPG >= 1.0.7 supports the gpg-agent, so we look for it.
if( 0 == getenv("GPG_AGENT_INFO") ) {
@ -684,7 +684,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP
close(pout[0]);
close(perr[0]);
if (!passphrase.isNull())
if (!passphrase.isEmpty())
close(ppass[0]);
// Did the child exit normally?

@ -45,10 +45,10 @@ public:
/** Encrypts and signs the message with the given keys. */
virtual int encsign( Block& , const KeyIDList& ,
const TQString& = 0) { return OK; }
const TQString& = TQString::null) { return OK; }
/** Decrypts the message. */
virtual int decrypt( Block& , const TQString& = 0) { return OK; }
virtual int decrypt( Block& , const TQString& = TQString::null) { return OK; }
/** Verifies the message. */
virtual int verify( Block& block ) { return decrypt( block, 0 ); }
@ -86,9 +86,9 @@ public:
protected:
virtual int run( const char *cmd, const TQString& passphrase = 0,
virtual int run( const char *cmd, const TQString &passphrase = TQString::null,
bool onlyReadFromPGP = false );
virtual int runGpg( const char *cmd, const TQString& passphrase = 0,
virtual int runGpg( const char *cmd, const TQString &passphrase = TQString::null,
bool onlyReadFromGnuPG = false );
virtual void clear();
@ -117,8 +117,8 @@ public:
virtual int encrypt( Block& block, const KeyIDList& recipients );
virtual int clearsign( Block& block, const TQString &passphrase );
virtual int encsign( Block& block, const KeyIDList& recipients,
const TQString& passphrase = 0 );
virtual int decrypt( Block& block, const TQString& passphrase = 0 );
const TQString &passphrase = TQString::null );
virtual int decrypt( Block& block, const TQString &passphrase = TQString::null );
virtual int verify( Block& block ) { return decrypt( block, 0 ); }
virtual Key* readPublicKey( const KeyID& keyID,
@ -149,8 +149,8 @@ public:
virtual int encrypt( Block& block, const KeyIDList& recipients );
virtual int clearsign( Block& block, const TQString &passphrase );
virtual int encsign( Block& block, const KeyIDList& recipients,
const TQString& passphrase = 0 );
virtual int decrypt( Block& block, const TQString& passphrase = 0 );
const TQString &passphrase = TQString::null );
virtual int decrypt( Block& block, const TQString &passphrase = TQString::null );
virtual int verify( Block& block ) { return decrypt( block, 0 ); }
virtual Key* readPublicKey( const KeyID& keyID,
@ -177,8 +177,8 @@ public:
virtual int encrypt( Block& block, const KeyIDList& recipients );
virtual int clearsign( Block& block, const TQString &passphrase );
virtual int encsign( Block& block, const KeyIDList& recipients,
const TQString& passphrase = 0 );
virtual int decrypt( Block& block, const TQString& passphrase = 0 );
const TQString &passphrase = TQString::null );
virtual int decrypt( Block& block, const TQString &passphrase = TQString::null );
virtual int verify( Block& block ) { return decrypt( block, 0 ); }
virtual Key* readPublicKey( const KeyID& keyID,
@ -204,7 +204,7 @@ public:
Base6();
virtual ~Base6();
virtual int decrypt( Block& block, const TQString& passphrase = 0 );
virtual int decrypt( Block& block, const TQString &passphrase = TQString::null );
virtual int verify( Block& block ) { return decrypt( block, 0 ); }
virtual Key* readPublicKey( const KeyID& keyID,

@ -68,11 +68,11 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
TQCString cmd;
int exitStatus = 0;
if (!recipients.isEmpty() && !passphrase.isNull())
if (!recipients.isEmpty() && !passphrase.isEmpty())
cmd = PGP2 " +batchmode +language=en +verbose=1 -seat";
else if(!recipients.isEmpty())
cmd = PGP2 " +batchmode +language=en +verbose=1 -eat";
else if (!passphrase.isNull())
else if (!passphrase.isEmpty())
cmd = PGP2 " +batchmode +language=en +verbose=1 -sat";
else
{
@ -80,7 +80,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
return OK;
}
if (!passphrase.isNull())
if (!passphrase.isEmpty())
cmd += addUserId();
if(!recipients.isEmpty()) {
@ -185,7 +185,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
}
}
#endif
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
if(error.find("Pass phrase is good") != -1)
{
@ -294,7 +294,7 @@ Base2::decrypt( Block& block, const TQString& passphrase )
block.setRequiredUserId( error.mid(index, index2 - index) );
//kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n";
if ((!passphrase.isNull()) && (error.find("Bad pass phrase") != -1))
if ((!passphrase.isEmpty()) && (error.find("Bad pass phrase") != -1))
{
errMsg = i18n("Bad passphrase; could not decrypt.");
kdDebug(5100) << "Base: passphrase is bad" << endl;

@ -73,11 +73,11 @@ Base5::encsign( Block& block, const KeyIDList& recipients,
// we want a clear signature
bool signonly = false;
if (!recipients.isEmpty() && !passphrase.isNull())
if (!recipients.isEmpty() && !passphrase.isEmpty())
cmd = "pgpe +batchmode -afts ";
else if(!recipients.isEmpty())
cmd = "pgpe +batchmode -aft ";
else if (!passphrase.isNull())
else if (!passphrase.isEmpty())
{
cmd = "pgps +batchmode -abft ";
signonly = true;
@ -88,7 +88,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients,
return OK;
}
if (!passphrase.isNull())
if (!passphrase.isEmpty())
cmd += addUserId();
if(!recipients.isEmpty())
@ -222,7 +222,7 @@ Base5::decrypt( Block& block, const TQString& passphrase )
// or do we not have the secret key?
if(error.find("Need a pass phrase") != -1)
{
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
errMsg = i18n("Bad passphrase; could not decrypt.");
kdDebug(5100) << "Base: passphrase is bad" << endl;
@ -438,7 +438,7 @@ Base5::signKey(const KeyID& keyID, const TQString& passphrase)
TQCString cmd;
int exitStatus = 0;
if (passphrase.isNull()) return false;
if (passphrase.isEmpty()) return false;
cmd = "pgpk -s -f +batchmode=1 0x";
cmd += keyID;

@ -75,11 +75,11 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
TQCString cmd;
int exitStatus = 0;
if (!recipients.isEmpty() && !passphrase.isNull())
if (!recipients.isEmpty() && !passphrase.isEmpty())
cmd = "--batch --armor --sign --encrypt --textmode";
else if(!recipients.isEmpty())
cmd = "--batch --armor --encrypt --textmode";
else if (!passphrase.isNull())
else if (!passphrase.isEmpty())
cmd = "--batch --escape-from --clearsign";
else
{
@ -87,7 +87,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
return OK;
}
if (!passphrase.isNull())
if (!passphrase.isEmpty())
cmd += addUserId();
if(!recipients.isEmpty())
@ -164,7 +164,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
}
}
#endif
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
// Example 1 (bad passphrase, clearsign only):
// gpg: skipped `0x12345678': bad passphrase
@ -252,7 +252,7 @@ BaseG::decrypt( Block& block, const TQString& passphrase )
{
if( ( index = error.find( "bad passphrase" ) ) != -1 )
{
if (!passphrase.isNull())
if (!passphrase.isEmpty())
{
errMsg = i18n( "Bad passphrase; could not decrypt." );
kdDebug(5100) << "Base: passphrase is bad" << endl;

@ -95,7 +95,7 @@ PassphraseDialog::~PassphraseDialog()
{
}
const TQString PassphraseDialog::passphrase()
TQString PassphraseDialog::passphrase()
{
return lineedit->password();
}

@ -62,7 +62,7 @@ class KDE_EXPORT PassphraseDialog : public KDialogBase
bool modal=true, const TQString &keyID=TQString());
virtual ~PassphraseDialog();
const TQString passphrase();
TQString passphrase();
private:
KPasswordEdit *lineedit;

Loading…
Cancel
Save