[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeutils/kgpg
From:       Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date:       2011-02-22 18:37:48
Message-ID: 20110222183748.092C1AC8C2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1222306 by dakon:

transactions: give password entry dialog the correct parent if possible

CCBUG:258509

 M  +14 -9     kgpginterface.cpp  
 M  +2 -1      kgpginterface.h  
 M  +2 -1      transactions/kgpgtransaction.cpp  


--- trunk/KDE/kdeutils/kgpg/kgpginterface.cpp #1222305:1222306
@@ -16,6 +16,7 @@
 #include <QDir>
 #include <QFile>
 #include <QPixmap>
+#include <QPointer>
 #include <QString>
 #include <QTextStream>
 
@@ -397,20 +398,24 @@
 	}
 }
 
-int KgpgInterface::sendPassphrase(const QString &text, KProcess *process, const bool \
isnew) +int KgpgInterface::sendPassphrase(const QString &text, KProcess *process, \
const bool isnew, QWidget *widget)  {
 	QByteArray passphrase;
 	int code;
 	if (isnew) {
-		KNewPasswordDialog dlg;
-		dlg.setPrompt(text);
-		code = dlg.exec();
-		passphrase = dlg.password().toUtf8();
+		QPointer<KNewPasswordDialog> dlg = new KNewPasswordDialog(widget);
+		dlg->setPrompt(text);
+		code = dlg->exec();
+		if (!dlg.isNull())
+			passphrase = dlg->password().toUtf8();
+		delete dlg;
 	} else {
-		KPasswordDialog dlg;
-		dlg.setPrompt(text);
-		code = dlg.exec();
-		passphrase = dlg.password().toUtf8();
+		QPointer<KPasswordDialog> dlg = new KPasswordDialog(widget);
+		dlg->setPrompt(text);
+		code = dlg->exec();
+		if (!dlg.isNull())
+			passphrase = dlg->password().toUtf8();
+		delete dlg;
 	}
 
 	if (code != KPasswordDialog::Accepted)
--- trunk/KDE/kdeutils/kgpg/kgpginterface.h #1222305:1222306
@@ -114,10 +114,11 @@
      * @param text text is the message that must be displayed in the MessageBox
      * @param process GnuPG process
      * @param isnew if the password is a \e new password that must be confirmed. \
Default is true +     * @param widget parent widget of this dialog or NULL
      * @return 0 if there is no error
      * @return 1 if there is an error
      */
-    static int sendPassphrase(const QString &text, KProcess *process, const bool \
isnew = true); +    static int sendPassphrase(const QString &text, KProcess *process, \
const bool isnew = true, QWidget *widget = NULL);  
 private:
     static QString getGpgProcessHome(const QString &binary);
--- trunk/KDE/kdeutils/kgpg/transactions/kgpgtransaction.cpp #1222305:1222306
@@ -15,6 +15,7 @@
 
 #include <QByteArray>
 #include <QStringList>
+#include <QWidget>
 
 #include <KDebug>
 #include <KLocale>
@@ -234,7 +235,7 @@
 KGpgTransaction::sendPassphrase(const QString &text, const bool isnew)
 {
 	emit statusMessage(i18n("Requesting Passphrase"));
-	return KgpgInterface::sendPassphrase(text, d->m_process, isnew);
+	return KgpgInterface::sendPassphrase(text, d->m_process, isnew, \
qobject_cast<QWidget *>(parent()));  }
 
 int


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic