[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:00:04 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=1060f20

The following commit has been merged in the master branch:
commit 1060f20a25f8d1dfef2fa4a59176de4321e7900a
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Oct 4 11:09:31 2011 +0100

    Added review comments
    
    REVIEW: 102741
    
    BUG: 282197
---
 src/add-account-assistant.cpp  | 20 +++++++++++---------
 src/kcm-telepathy-accounts.cpp |  5 +++++
 src/wallet-interface.cpp       | 18 +++++++++++++++++-
 src/wallet-interface.h         |  4 ++++
 4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 0ddf1ff..80ed055 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -35,7 +35,6 @@
 #include <KLocale>
 #include <KMessageBox>
 #include <KPageWidgetItem>
-#include <KWallet/Wallet>
 
 #include <QtCore/QList>
 #include <QtGui/QHBoxLayout>
@@ -178,10 +177,13 @@ void AddAccountAssistant::accept()
         displayName = d->currentProfileItem->protocolName();
     }
 
-    //remove password values from being sent. These are stored by MC instead
+    //remove password values from being sent. These are stored by KWallet instead
 
-    //FIXME: This breaks jabber registration - see Telepathy ML thread "Storing passwords in MC and regsitering new accounts"
-    values.remove("password");
+    //FIXME: This is a hack for jabber registration, we don't remove passwords - see Telepathy ML thread "Storing passwords in MC and regsitering new accounts"
+    //http://lists.freedesktop.org/archives/telepathy/2011-September/005747.html
+    if (!values.contains(QLatin1String("register"))) {
+        values.remove(QLatin1String("password"));
+    }
 
     Tp::PendingAccount *pa = d->accountManager->createAccount(d->currentProfileItem->cmName(),
                                                               d->currentProfileItem->protocolName(),
@@ -229,11 +231,6 @@ void AddAccountAssistant::onAccountCreated(Tp::PendingOperation *op)
 
     Tp::AccountPtr account = pendingAccount->account();
 
-    if(d->accountEditWidget->connectOnAdd()){
-        account->setRequestedPresence(Tp::Presence::available(QString("Online")));
-    }
-    account->setServiceName(d->currentProfileItem->serviceName());
-
     //save password to KWallet if needed
     QVariantMap values  = d->accountEditWidget->parametersSet();
     if (values.contains(QLatin1String("password"))) {
@@ -241,6 +238,11 @@ void AddAccountAssistant::onAccountCreated(Tp::PendingOperation *op)
         wallet.setPassword(account, values["password"].toString());
     }
 
+    if(d->accountEditWidget->connectOnAdd()){
+        account->setRequestedPresence(Tp::Presence::available(QString("Online")));
+    }
+    account->setServiceName(d->currentProfileItem->serviceName());
+
     KAssistantDialog::accept();
 }
 
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index a1d3172..44cd5af 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -28,6 +28,7 @@
 #include "edit-account-dialog.h"
 #include "salut-enable-dialog.h"
 #include "accounts-list-delegate.h"
+#include "wallet-interface.h"
 
 #include <QLabel>
 #include <QSortFilterProxyModel>
@@ -309,6 +310,10 @@ void KCMTelepathyAccounts::onRemoveAccountClicked()
                                         QString(), KMessageBox::Notify | KMessageBox::Dangerous) == KMessageBox::Continue)
     {
         m_accountsListModel->removeAccount(m_currentModel->mapToSource(index));
+
+        AccountItem *item = m_accountsListModel->itemForIndex(m_currentModel->mapToSource(index));
+        WalletInterface wallet(this->effectiveWinId());
+        wallet.removePassword(item->account());
     }
 }
 
diff --git a/src/wallet-interface.cpp b/src/wallet-interface.cpp
index 9be45fc..70ff92c 100644
--- a/src/wallet-interface.cpp
+++ b/src/wallet-interface.cpp
@@ -23,7 +23,7 @@
 #include <KDebug>
 
 
-const QLatin1String WalletInterface::s_folderName = QLatin1String("kde-telepathy");
+const QLatin1String WalletInterface::s_folderName = QLatin1String("telepathy-kde");
 
 
 WalletInterface::WalletInterface(WId winId):
@@ -82,4 +82,20 @@ void WalletInterface::setPassword(const Tp::AccountPtr &account, const QString &
 
     m_wallet->setFolder(s_folderName);
     m_wallet->writePassword(account->uniqueIdentifier(), password);
+    //sync normally happens on close, but in this case we need it to happen /now/ as it needs to be synced before the auth-client starts
+    m_wallet->sync();
+}
+
+void WalletInterface::removePassword(const Tp::AccountPtr &account)
+{
+    if (m_wallet.isNull()) {
+        return;
+    }
+
+    if (! m_wallet->hasFolder(s_folderName)) {
+        return;
+    }
+
+    m_wallet->setFolder(s_folderName);
+    m_wallet->removeEntry(account->uniqueIdentifier());
 }
diff --git a/src/wallet-interface.h b/src/wallet-interface.h
index 4807a03..f5b0cf6 100644
--- a/src/wallet-interface.h
+++ b/src/wallet-interface.h
@@ -42,6 +42,10 @@ public:
 
     /** Set the password entry for the given account to a new password*/
     void setPassword(const Tp::AccountPtr &account, const QString &password);
+
+    /** Remove the entry from kwallet*/
+    void removePassword(const Tp::AccountPtr &account);
+
 private:
     static const QLatin1String s_folderName;
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list