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

List:       kde-commits
Subject:    kdelibs/kio/misc/kwalletd
From:       George Staikos <staikos () kde ! org>
Date:       2003-08-29 23:50:20
[Download RAW message or body]

CVS commit by staikos: 

implement sync() and add error detection to isOpen()
I would still like to remove isOpen(int) altogether... hmmmm.


  M +23 -1     kwalletd.cpp   1.37
  M +3 -0      kwalletd.h   1.25


--- kdelibs/kio/misc/kwalletd/kwalletd.cpp  #1.36:1.37
@@ -389,5 +389,14 @@ return false;
 
 bool KWalletD::isOpen(int handle) const {
-return _wallets.find(handle) != 0;
+int rc = _wallets.find(handle);
+
+        if (rc == 0 && ++_failed > 5) {
+                KMessageBox::information(0, i18n("There have been repeated failed \
attempts to gain access to a wallet. An application may be misbehaving."), i18n("KDE \
Wallet Service")); +                _failed = 0;
+        } else if (rc != 0) {
+                _failed = 0;
+        }
+
+return rc != 0;
 }
 
@@ -412,4 +421,17 @@ QStringList rc;
         }
 return rc;
+}
+
+
+void KWalletD::sync(int handle) {
+KWallet::Backend *b;
+
+        if ((b = getWallet(handle))) {
+                QByteArray p;
+                QString wallet = b->walletName();
+                p.duplicate(_passwords[wallet].data(), _passwords[wallet].length());
+                b->sync(p);
+                p.fill(0);
+        }
 }
 

--- kdelibs/kio/misc/kwalletd/kwalletd.h  #1.24:1.25
@@ -58,4 +58,7 @@ class KWalletD : public KDEDModule {
                 virtual int close(int handle, bool force);
 
+                // Save to disk but leave open
+                virtual ASYNC sync(int handle);
+
                 // Physically deletes the wallet from disk.
                 virtual int deleteWallet(const QString& wallet);


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

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