Bug 122605 - KPDF should remember document passwords in kwallet
Summary: KPDF should remember document passwords in kwallet
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Solaris
: NOR wishlist
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 01:55 UTC by Aaron Williams
Modified: 2006-10-28 12:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Williams 2006-02-24 01:55:59 UTC
Version:           unknown (using KDE 3.5.1, compiled sources)
Compiler:          gcc version 3.3.6
OS:                SunOS (sun4u) release 5.8

It would be nice of kpdf could remember document passwords in kwallet.
Comment 1 Albert Astals Cid 2006-02-24 09:15:12 UTC
It is curious you ask this as we already do it. 

Isn't it happening for you?

Are you sure you have kwallet installed and correctly configured?
Comment 2 Aaron Williams 2006-02-24 22:09:35 UTC
Ah, my mistake.  It looks like it does do this, but I did not see an 
option asking if I would like to remember the password or not.  In some 
cases one might not want to remember it.  I'm so used to seeing the 
password dialogs asking if you want to remember the password or not that 
I assumed that since I didn't see it that it wasn't using the wallet.

-Aaron
Comment 3 Pino Toscano 2006-10-28 12:47:06 UTC
SVN commit 599720 by pino:

Show a 'keep password' checkbox when using a wallet so the user can decide if he wants the password saved in the wallet.

BUG: 122605


 M  +4 -3      generator_pdf.cpp  


--- branches/KDE/3.5/kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp #599719:599720
@@ -109,6 +109,7 @@
     bool firstInput = true;
     bool triedWallet = false;
     KWallet::Wallet * wallet = 0;
+    int keep = 1;
     while ( !pdfdoc->isOk() && pdfdoc->getErrorCode() == errEncrypted )
     {
         QCString password;
@@ -144,7 +145,7 @@
             firstInput = false;
 
             // if the user presses cancel, abort opening
-            if ( KPasswordDialog::getPassword( password, prompt ) != KPasswordDialog::Accepted )
+            if ( KPasswordDialog::getPassword( password, prompt, wallet ? &keep : 0 ) != KPasswordDialog::Accepted )
             break;
         }
 
@@ -154,8 +155,8 @@
         pdfdoc = new PDFDoc( new GString( QFile::encodeName( filePath ) ), pwd2, pwd2 );
             delete pwd2;
 
-        // 3. if the password is correct, store it to the wallet
-        if ( pdfdoc->isOk() && wallet && /*safety check*/ wallet->isOpen() )
+        // 3. if the password is correct and the user chose to remember it, store it to the wallet
+        if ( pdfdoc->isOk() && wallet && /*safety check*/ wallet->isOpen() && keep > 0 )
         {
             QString goodPass = QString::fromLocal8Bit( password.data() );
             wallet->writePassword( filePath.section('/', -1, -1), goodPass );