aboutsummaryrefslogtreecommitdiffstats
path: root/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/context.cpp b/context.cpp
index d31f868..bb26ee9 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,23 +394,17 @@ 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);
- // user canceld password entry?
- if (result) {
- mPasswordCache = password.toAscii();
- } else {
- return GPG_ERR_CANCELED;
- }
- } //else {
- // result = true;
- //}
+ if (result) mPasswordCache = password.toAscii();
+ } else {
+ result = true;
+ }
- //if (result) {
+ if (result) {
#ifndef _WIN32
if (write(fd, mPasswordCache.data(), mPasswordCache.length()) == -1) {
@@ -421,19 +415,18 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
WriteFile((HANDLE) fd, mPasswordCache.data(), mPasswordCache.length(), &written, 0);
#endif
- returnValue = GPG_ERR_NO_ERROR;
+ returnValue = 0;
+ }
#ifndef _WIN32
if (write(fd, "\n", 1) == -1) {
qDebug() << "something is terribly broken";
}
#else
- DWORD written;
+ // DWORD written;
WriteFile((HANDLE) fd, "\n", 1, &written, 0);
#endif
- //}
-
return returnValue;
}