From 1491bf832e06d0c1c3f6c9ced236c090263002d3 Mon Sep 17 00:00:00 2001 From: ubbo Date: Fri, 27 Aug 2010 14:22:39 +0000 Subject: implement remember password functionality git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@367 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- context.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'context.cpp') diff --git a/context.cpp b/context.cpp index 2630ee1..614a7ad 100644 --- a/context.cpp +++ b/context.cpp @@ -315,9 +315,11 @@ bool Context::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer) if (err != GPG_ERR_NO_ERROR && err != GPG_ERR_CANCELED) { QMessageBox::critical(0, "Error decrypting:", gpgme_strerror(err)); } + //if (err != GPG_ERR_NO_ERROR) - // always clear password cache. TODO: implement passwort save - clearCache(); + if (! settings.value("general/rememberPassword").toBool()) { + clearPasswordCache(); + } if (in) { gpgme_data_release(in); @@ -382,7 +384,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint, if (last_was_bad) { s += "Wrong password.

\n\n"; - clearCache(); + clearPasswordCache(); } /** if uid provided */ @@ -429,7 +431,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint, } /** also from kgpgme.cpp, seems to clear password from mem */ -void Context::clearCache() +void Context::clearPasswordCache() { if (mPasswordCache.size() > 0) { mPasswordCache.fill('\0'); -- cgit