[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:05:34 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=b7d5788
The following commit has been merged in the master branch:
commit b7d57889bf7decdcf8e0db06d83e1fcc4811ff6e
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Fri Mar 11 20:36:39 2011 +0100
Remove the AccountsModel::contactForIndex method, which we can replace by accessing AccountsModel::data(index, ItemRole) as suggested by David Edmundson
---
account-button.cpp | 9 ++++-----
accounts-model.cpp | 11 -----------
accounts-model.h | 1 -
main-widget.cpp | 5 ++++-
4 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/account-button.cpp b/account-button.cpp
index 79dc50b..f631180 100644
--- a/account-button.cpp
+++ b/account-button.cpp
@@ -135,11 +135,10 @@ void AccountButton::setAccountStatus(QAction *action)
void AccountButton::updateToolTip()
{
//check if the custom status message has been set
- if(m_account->currentPresence().statusMessage().isEmpty()) {
+ if (m_account->currentPresence().statusMessage().isEmpty()) {
setToolTip(QString("%1
%2").arg(m_account->displayName())
.arg(presenceDisplayString(m_account->currentPresence())));
- }
- else {
+ } else {
setToolTip(QString("%1
%2
%3").arg(m_account->displayName())
.arg(presenceDisplayString(m_account->currentPresence()))
.arg(m_account->currentPresence().statusMessage()));
@@ -173,7 +172,7 @@ void AccountButton::hideBusyIndicator()
void AccountButton::preseneceChanged(Tp::Presence presence)
{
- foreach(QAction *a, actions()) {
+ foreach (QAction *a, actions()) {
if (m_account->currentPresence().status() == qVariantValue<Tp::Presence>(a->data()).status()) {
a->setChecked(true);
updateToolTip();
@@ -187,7 +186,7 @@ void AccountButton::preseneceChanged(Tp::Presence presence)
This will also get us i18n strings for free. */
QString AccountButton::presenceDisplayString(const Tp::Presence)
{
- foreach(QAction *a, actions()) {
+ foreach (QAction *a, actions()) {
if (m_account->currentPresence().status() == qVariantValue<Tp::Presence>(a->data()).status()) {
return a->text();
}
diff --git a/accounts-model.cpp b/accounts-model.cpp
index b1f8e03..dacb5a7 100644
--- a/accounts-model.cpp
+++ b/accounts-model.cpp
@@ -233,17 +233,6 @@ Tp::AccountPtr AccountsModel::accountForIndex(const QModelIndex &index) const
}
}
-Tp::ContactPtr AccountsModel::contactForIndex(const QModelIndex& index) const
-{
- TreeNode *contactNode = mPriv->node(index);
- ContactModelItem *item = qobject_cast<ContactModelItem *>(contactNode);
- if (item) {
- return item->contact();
- } else {
- return Tp::ContactPtr();
- }
-}
-
Tp::AccountPtr AccountsModel::accountForContactIndex(const QModelIndex& index) const
{
TreeNode *contactNode = mPriv->node(index);
diff --git a/accounts-model.h b/accounts-model.h
index c503c60..319d537 100644
--- a/accounts-model.h
+++ b/accounts-model.h
@@ -94,7 +94,6 @@ public:
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role) const;
Tp::AccountPtr accountForIndex(const QModelIndex &index) const;
- Tp::ContactPtr contactForIndex(const QModelIndex &index) const;
Tp::AccountPtr accountForContactIndex(const QModelIndex &index) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
diff --git a/main-widget.cpp b/main-widget.cpp
index 65c0885..7930440 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -44,6 +44,7 @@
#include "accounts-model.h"
#include "account-filter-model.h"
#include "contact-delegate.h"
+#include "contact-model-item.h"
#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDEChatHandler"
@@ -296,7 +297,9 @@ void MainWidget::startTextChannel(const QModelIndex &index)
}
QModelIndex realIndex = m_modelFilter->mapToSource(index);
- Tp::ContactPtr contact = m_model->contactForIndex(realIndex);
+ Tp::ContactPtr contact = static_cast<ContactModelItem*>(
+ qVariantValue<QObject *>(m_model->data(realIndex, AccountsModel::ItemRole)))->contact();
+
kDebug() << "Requesting chat for contact" << contact->alias();
Tp::AccountPtr account = m_model->accountForContactIndex(realIndex);
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list