------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=132637
charles connells org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From charles connells org 2007-07-17 04:55 -------
SVN commit 688860 by cconnell:
If there are more than one password dialogs, have one propagate input to the
others.
This doesn't fix the backwards message display order.
BUG:132637
M +28 -13 gpginterface.cpp
--- trunk/KDE/kdenetwork/kopete/plugins/cryptography/gpginterface.cpp
#688859:688860
@ -31,6 +31,8 @
#include <ktemporaryfile.h>
#include "gpginterface.h"
+#include "kopeteuiglobal.h"
+
QString GpgInterface::encryptText ( QString text, QString userIDs, QString
options, bool signAlso, QString privateKey )
{
int counter = 0;
@ -54,7 +56,7 @
while ( ( counter < 3 ) && ( encResult.isEmpty() ) )
{
counter++;
- password = getPassword(password, privateKey, counter);
+ password = getPassword ( password, privateKey, counter
);
gpgcmd = "gpg --no-secmem-warning --no-tty " +
options.toLocal8Bit() + " -e " + dests.toLocal8Bit(); gpgcmd += " --passphrase
" + password + " -s ";
QProcess fp;
@ -87,7 +89,6 @
QString gpgcmd, encResult;
int counter = 0;
QString password = CryptographyPlugin::cachedPass();
- bool passphraseHandling = CryptographyPlugin::passphraseHandling();
while ( ( counter<3 ) && ( encResult.isEmpty() ) )
{
counter++;
@ -113,7 +114,6 @
int counter = 0;
QString password = CryptographyPlugin::cachedPass();
- bool passphraseHandling = CryptographyPlugin::passphraseHandling();
// give them three tries on passphrase
while ( ( counter<3 ) && ( encResult.isEmpty() ) )
@ -135,20 +135,20 @
fp.closeWriteChannel();
fp.waitForFinished();
encResult = fp.readAll();
-
+
status = tempfile.readAll();
- if (status.contains ("GOODSIG") )
+ if ( status.contains ( "GOODSIG" ) )
opState = GoodSig;
- else if (status.contains ("BADSIG") )
+ else if ( status.contains ( "BADSIG" ) )
opState = BadSig;
- else if (status.contains ("ERRSIG") )
+ else if ( status.contains ( "ERRSIG" ) )
opState = ErrorSig;
else
opState = NoSig;
-
- if (status.contains ("DECRYPTION_OKAY") )
- opState = (opState | Decrypted);
-
+
+ if ( status.contains ( "DECRYPTION_OKAY" ) )
+ opState = ( opState | Decrypted );
+
status.clear();
password.clear();
gpgcmd.clear();
@ -189,20 +189,35 @
return QString::fromUtf8 ( QString::fromUtf8 ( txt.ascii()
).ascii() ); // perform Utf8 twice, or some keys display badly
}
+class CryptographyPasswordDialog : public KPasswordDialog
+{
+ Q_OBJECT
+ public:
+ CryptographyPasswordDialog ( QWidget *parent=0L, const
KPasswordDialogFlags &flags=0, const KDialog::ButtonCodes otherButtons=0 ) :
KPasswordDialog ( parent, flags, otherButtons ) {}};
+
QString GpgInterface::getPassword ( QString password, QString userID, int
counter )
{
- if (!password.isEmpty() && counter <= 1)
+ if ( !password.isEmpty() && counter <= 1 )
return password;
bool passphraseHandling = CryptographyPlugin::passphraseHandling();
QString passdlg=i18n ( "Enter passphrase for secret key %1:", "0x" +
userID.right ( 8 ) );
if ( counter>1 )
passdlg.prepend ( i18n ( "<b>Bad passphrase</b><br> You have %1
tries left.<br>", 4-counter ) );
- KPasswordDialog dlg ( 0L, KPasswordDialog::NoFlags );
+ CryptographyPasswordDialog dlg ( Kopete::UI::Global::mainWidget(),
KPasswordDialog::NoFlags );
dlg.setPrompt ( passdlg );
if ( !dlg.exec() )
return QString(); //the user canceled
if ( passphraseHandling )
CryptographyPlugin::setCachedPass (
dlg.password().toLocal8Bit() );
+
+ // if there is already a password dialog open, get password and send it
to that
+ QList<CryptographyPasswordDialog*> otherDialogs =
Kopete::UI::Global::mainWidget()->findChildren <CryptographyPasswordDialog *>
();
+ if ( otherDialogs.size() > 1){
+ foreach ( CryptographyPasswordDialog *otherDialog, otherDialogs
){
+ otherDialog->setPassword ( dlg.password());
+ otherDialog->accept();
+ }
+ }
return dlg.password();
}
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel