aboutsummaryrefslogtreecommitdiffstats
path: root/context.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-08-28 11:20:27 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-08-28 11:20:27 +0000
commit8440a4703c00ee362374730cad41c7d5acf81042 (patch)
tree125e247319f8fcc9f391d79db0bcba2850fb989d /context.cpp
parentcreate attachments dir if not existing (diff)
downloadgpg4usb-8440a4703c00ee362374730cad41c7d5acf81042.tar.gz
gpg4usb-8440a4703c00ee362374730cad41c7d5acf81042.zip
try to fix decrpyt-cancel on windows
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@373 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/context.cpp b/context.cpp
index 614a7ad..d31f868 100644
--- a/context.cpp
+++ b/context.cpp
@@ -377,7 +377,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
const char * /*passphrase_info*/,
int last_was_bad, int fd)
{
- gpgme_error_t returnValue = GPG_ERR_CANCELED;
+ gpgme_error_t returnValue; // = GPG_ERR_CANCELED;
QString s;
QString gpg_hint = uid_hint;
bool result;
@@ -394,17 +394,23 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
s += "<b>Enter Password for</b><br>\n" + gpg_hint + "\n";
}
+ // password saved? if yes, do'nt ask and take from buffer
if (mPasswordCache.isEmpty()) {
QString password = QInputDialog::getText(0, "Enter Password",
s, QLineEdit::Password,
"", &result, Qt::Window);
- if (result) mPasswordCache = password.toAscii();
- } else {
- result = true;
- }
+ // user canceld password entry?
+ if (result) {
+ mPasswordCache = password.toAscii();
+ } else {
+ return GPG_ERR_CANCELED;
+ }
+ } //else {
+ // result = true;
+ //}
- if (result) {
+ //if (result) {
#ifndef _WIN32
if (write(fd, mPasswordCache.data(), mPasswordCache.length()) == -1) {
@@ -415,8 +421,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
WriteFile((HANDLE) fd, mPasswordCache.data(), mPasswordCache.length(), &written, 0);
#endif
- returnValue = 0;
- }
+ returnValue = GPG_ERR_NO_ERROR;
#ifndef _WIN32
if (write(fd, "\n", 1) == -1) {
@@ -427,6 +432,8 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
WriteFile((HANDLE) fd, "\n", 1, &written, 0);
#endif
+ //}
+
return returnValue;
}