[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:02:27 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=0915ca3
The following commit has been merged in the master branch:
commit 0915ca3a06a2b2e0f2753434a00af585e6fb71ec
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Wed Aug 8 14:33:19 2012 +0100
Async wallet usage, using wallet-utils from common internals
Also fix some pointless code when deleting accounts which used to proxy via a model.
This should hopefully fix the crash when removing accounts
REVIEW: 105926
BUG: 303060
BUG: 293716
---
src/account-item.cpp | 27 +++++++++------------------
src/account-item.h | 3 +--
src/accounts-list-model.cpp | 13 -------------
src/accounts-list-model.h | 1 -
src/add-account-assistant.cpp | 4 ++--
src/edit-account-dialog.cpp | 33 +++++++++++++++++++++++----------
src/edit-account-dialog.h | 1 +
src/kcm-telepathy-accounts.cpp | 7 ++-----
8 files changed, 38 insertions(+), 51 deletions(-)
diff --git a/src/account-item.cpp b/src/account-item.cpp
index 0cac63f..8efc78f 100644
--- a/src/account-item.cpp
+++ b/src/account-item.cpp
@@ -24,18 +24,21 @@
#include "edit-account-dialog.h"
#include <KTp/error-dictionary.h>
+#include <KTp/wallet-utils.h>
#include <KApplication>
#include <KDebug>
#include <KIcon>
#include <KLocalizedString>
+#include <KPixmapSequence>
#include <QtCore/QTimer>
#include <QtGui/QPainter>
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/PendingReady>
-#include <KPixmapSequence>
+#include <TelepathyQt/PendingComposite>
+
AccountItem::AccountItem(const Tp::AccountPtr &account, AccountsListModel *parent)
: QObject(parent),
@@ -75,14 +78,12 @@ Tp::AccountPtr AccountItem::account() const
return m_account;
}
-void AccountItem::remove()
+Tp::PendingOperation* AccountItem::remove()
{
- kDebug() << "Account about to be removed";
-
- Tp::PendingOperation *op = m_account->remove();
- connect(op,
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(onAccountRemoved(Tp::PendingOperation*)));
+ QList<Tp::PendingOperation*> ops;
+ ops.append(KTp::WalletUtils::removeAccountPassword(m_account));
+ ops.append(m_account->remove());
+ return new Tp::PendingComposite(ops, m_account);
}
const KIcon& AccountItem::icon() const
@@ -176,16 +177,6 @@ void AccountItem::generateIcon()
Q_EMIT(updated());
}
-void AccountItem::onAccountRemoved(Tp::PendingOperation *op)
-{
- if (op->isError()) {
- kDebug() << "An error occurred removing the Account."
- << op->errorName()
- << op->errorMessage();
- return;
- }
-}
-
void AccountItem::onTitleForCustomPages(QString mandatoryPage, QList<QString> optionalPage)
{
Q_EMIT setTitleForCustomPages(mandatoryPage, optionalPage);
diff --git a/src/account-item.h b/src/account-item.h
index aba7e0e..a2fee83 100644
--- a/src/account-item.h
+++ b/src/account-item.h
@@ -42,7 +42,7 @@ public:
explicit AccountItem(const Tp::AccountPtr &account, AccountsListModel *parent = 0);
virtual ~AccountItem();
Tp::AccountPtr account() const;
- void remove();
+ Tp::PendingOperation* remove();
const KIcon& icon() const;
Tp::ConnectionStatus connectionStatus() const;
const QString connectionStateString() const;
@@ -62,7 +62,6 @@ Q_SIGNALS:
private Q_SLOTS:
void generateIcon();
- void onAccountRemoved(Tp::PendingOperation *op);
private:
Tp::AccountPtr m_account;
diff --git a/src/accounts-list-model.cpp b/src/accounts-list-model.cpp
index c7837bc..4a015fa 100644
--- a/src/accounts-list-model.cpp
+++ b/src/accounts-list-model.cpp
@@ -186,19 +186,6 @@ void AccountsListModel::addAccount(const Tp::AccountPtr &account)
}
}
-void AccountsListModel::removeAccount(const QModelIndex &index)
-{
- if (!index.isValid()) {
- kDebug() << "Can't remove Account: Invalid index";
- return;
- }
- AccountItem *accountItem = m_accounts.at(index.row());
-
- Q_ASSERT(accountItem);
-
- accountItem->remove();
-}
-
void AccountsListModel::onAccountItemRemoved()
{
AccountItem *item = qobject_cast<AccountItem*>(sender());
diff --git a/src/accounts-list-model.h b/src/accounts-list-model.h
index 1791e67..1078667 100644
--- a/src/accounts-list-model.h
+++ b/src/accounts-list-model.h
@@ -51,7 +51,6 @@ public:
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
void addAccount(const Tp::AccountPtr &account);
- void removeAccount(const QModelIndex &index);
Q_SIGNALS:
void setTitleForCustomPages(QString, QList<QString>);
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index abf181e..07eae58 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -22,7 +22,7 @@
#include "add-account-assistant.h"
-#include <KTp/wallet-interface.h>
+#include <KTp/wallet-utils.h>
#include "KCMTelepathyAccounts/abstract-account-parameters-widget.h"
#include "KCMTelepathyAccounts/abstract-account-ui.h"
@@ -280,7 +280,7 @@ void AddAccountAssistant::onAccountCreated(Tp::PendingOperation *op)
//save password to KWallet if needed
QVariantMap values = d->accountEditWidget->parametersSet();
if (values.contains(QLatin1String("password"))) {
- KTp::WalletInterface::setPassword(account, values[QLatin1String("password")].toString());
+ KTp::WalletUtils::setAccountPassword(account, values[QLatin1String("password")].toString());
}
if (d->accountEditWidget->connectOnAdd()) {
diff --git a/src/edit-account-dialog.cpp b/src/edit-account-dialog.cpp
index 91eeccf..a747242 100644
--- a/src/edit-account-dialog.cpp
+++ b/src/edit-account-dialog.cpp
@@ -22,6 +22,8 @@
#include "edit-account-dialog.h"
#include <KTp/wallet-interface.h>
+#include <KTp/pending-wallet.h>
+#include <KTp/wallet-utils.h>
#include "KCMTelepathyAccounts/dictionary.h"
#include "KCMTelepathyAccounts/abstract-account-parameters-widget.h"
@@ -59,6 +61,23 @@ EditAccountDialog::EditAccountDialog(AccountItem *item, QWidget *parent)
{
d->item = item;
+ connect(KTp::WalletInterface::openWallet(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onWalletOpened(Tp::PendingOperation*)));
+
+ setMinimumWidth(400);
+}
+
+EditAccountDialog::~EditAccountDialog()
+{
+ delete d;
+}
+
+void EditAccountDialog::onWalletOpened(Tp::PendingOperation *op)
+{
+ KTp::PendingWallet *walletOp = qobject_cast<KTp::PendingWallet*>(op);
+ Q_ASSERT(walletOp);
+
+ KTp::WalletInterface *walletInterface = walletOp->walletInterface();
+
// Get the protocol's parameters and values.
Tp::ProtocolInfo protocolInfo = d->item->account()->protocolInfo();
Tp::ProtocolParameterList parameters = protocolInfo.parameters();
@@ -71,9 +90,9 @@ EditAccountDialog::EditAccountDialog(AccountItem *item, QWidget *parent)
//update the parameter model with the password from kwallet (if applicable)
Tp::ProtocolParameter passwordParameter = parameterModel->parameter(QLatin1String("password"));
- if (passwordParameter.isValid() && KTp::WalletInterface::hasPassword(d->item->account())) {
+ if (passwordParameter.isValid() && walletInterface->hasPassword(d->item->account())) {
QModelIndex index = parameterModel->indexForParameter(passwordParameter);
- QString password = KTp::WalletInterface::password(d->item->account());
+ QString password = walletInterface->password(d->item->account());
parameterModel->setData(index, password, Qt::EditRole);
}
@@ -84,12 +103,6 @@ EditAccountDialog::EditAccountDialog(AccountItem *item, QWidget *parent)
doNotConnectOnAdd,
this);
setMainWidget(d->widget);
- setMinimumWidth(400);
-}
-
-EditAccountDialog::~EditAccountDialog()
-{
- delete d;
}
void EditAccountDialog::accept()
@@ -139,9 +152,9 @@ void EditAccountDialog::onParametersUpdated(Tp::PendingOperation *op)
QVariantMap values = d->widget->parametersSet();
if (values.contains(QLatin1String("password"))) {
- KTp::WalletInterface::setPassword(d->item->account(), values[QLatin1String("password")].toString());
+ KTp::WalletUtils::setAccountPassword(d->item->account(), values[QLatin1String("password")].toString());
} else {
- KTp::WalletInterface::removePassword(d->item->account());
+ KTp::WalletUtils::setAccountPassword(d->item->account(), QString());
}
diff --git a/src/edit-account-dialog.h b/src/edit-account-dialog.h
index 6fdf98d..08a3481 100644
--- a/src/edit-account-dialog.h
+++ b/src/edit-account-dialog.h
@@ -34,6 +34,7 @@ public:
virtual ~EditAccountDialog();
private Q_SLOTS:
+ void onWalletOpened(Tp::PendingOperation *op);
void onParametersUpdated(Tp::PendingOperation *op);
void onDisplayNameUpdated(Tp::PendingOperation *op);
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index ca37ad1..c0d8423 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -29,8 +29,6 @@
#include "accounts-list-delegate.h"
#include "account-identity-dialog.h"
-#include <KTp/wallet-interface.h>
-
#include <QtGui/QLabel>
#include <QtGui/QSortFilterProxyModel>
@@ -341,9 +339,8 @@ void KCMTelepathyAccounts::onRemoveAccountClicked()
QString(), KMessageBox::Notify | KMessageBox::Dangerous) == KMessageBox::Continue)
{
AccountItem *item = index.data(AccountsListModel::AccountItemRole).value<AccountItem*>();
- KTp::WalletInterface::removeAccount(item->account());
- m_accountsListModel->removeAccount(m_currentModel->mapToSource(index));
- }
+ item->remove();
+ }
}
void KCMTelepathyAccounts::onModelDataChanged()
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list