[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:04:38 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=bafcc04

The following commit has been merged in the master branch:
commit bafcc04dd706a55158e863c8bbad190c3d9e4bdb
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Thu Oct 27 01:51:05 2011 +0200

    Const methods are now const
    
    Also fix some style, comments and simplify a little
---
 wallet-interface.cpp | 28 +++++++++-------------------
 wallet-interface.h   | 12 ++++++------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/wallet-interface.cpp b/wallet-interface.cpp
index 73a086e..71c8f95 100644
--- a/wallet-interface.cpp
+++ b/wallet-interface.cpp
@@ -36,31 +36,24 @@ WalletInterface::~WalletInterface()
 {
 }
 
-bool WalletInterface::hasPassword(const Tp::AccountPtr &account)
+bool WalletInterface::hasPassword(const Tp::AccountPtr &account) const
 {
-    if (m_wallet.isNull()) {
+    if (m_wallet.isNull() || !m_wallet->hasFolder(s_folderName)) {
         return false;
     }
 
-    if (m_wallet->hasFolder(s_folderName)) {
-        m_wallet->setFolder(s_folderName);
-        if (m_wallet->hasEntry(account->uniqueIdentifier())) {
-            return true;
-        }
-    }
-    return false;
+    m_wallet->setFolder(s_folderName);
+    return m_wallet->hasEntry(account->uniqueIdentifier());
 }
 
-QString WalletInterface::password(const Tp::AccountPtr &account)
+QString WalletInterface::password(const Tp::AccountPtr &account) const
 {
-    if (m_wallet.isNull()) {
+    if (m_wallet.isNull() || !m_wallet->hasFolder(s_folderName)) {
         return QString();
     }
 
     m_wallet->setFolder(s_folderName);
-
     QString password;
-
     if (m_wallet->hasEntry(account->uniqueIdentifier())) {
         int rc = m_wallet->readPassword(account->uniqueIdentifier(), password);
         if (rc != 0) {
@@ -77,7 +70,7 @@ void WalletInterface::setPassword(const Tp::AccountPtr &account, const QString &
         return;
     }
 
-    if (! m_wallet->hasFolder(s_folderName)) {
+    if (!m_wallet->hasFolder(s_folderName)) {
         m_wallet->createFolder(s_folderName);
     }
 
@@ -89,14 +82,11 @@ void WalletInterface::setPassword(const Tp::AccountPtr &account, const QString &
 
 void WalletInterface::removePassword(const Tp::AccountPtr &account)
 {
-    if (m_wallet.isNull()) {
-        return;
-    }
-
-    if (! m_wallet->hasFolder(s_folderName)) {
+    if (m_wallet.isNull() || !m_wallet->hasFolder(s_folderName)) {
         return;
     }
 
     m_wallet->setFolder(s_folderName);
     m_wallet->removeEntry(account->uniqueIdentifier());
+    m_wallet->sync();
 }
diff --git a/wallet-interface.h b/wallet-interface.h
index cd762f3..1758e0b 100644
--- a/wallet-interface.h
+++ b/wallet-interface.h
@@ -37,16 +37,16 @@ public:
     WalletInterface(WId winId);
     virtual ~WalletInterface();
 
-    /** Returns true if a password is stored for this acount*/
-    bool hasPassword(const Tp::AccountPtr &account);
+    /** Returns true if a password is stored for the given account */
+    bool hasPassword(const Tp::AccountPtr &account) const;
 
-    /** Returns the stored password*/
-    QString password(const Tp::AccountPtr &account);
+    /** Returns the stored password for the given account */
+    QString password(const Tp::AccountPtr &account) const;
 
-    /** Set the password entry for the given account to a new password*/
+    /** Set the password for the given account to a new password */
     void setPassword(const Tp::AccountPtr &account, const QString &password);
 
-    /** Remove the entry from kwallet*/
+    /** Remove the password for the given account from kwallet */
     void removePassword(const Tp::AccountPtr &account);
 
 private:

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list