[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5
Maximiliano Curia
maxy at moszumanska.debian.org
Fri May 27 23:57:47 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=ff310ba
The following commit has been merged in the master branch:
commit ff310ba66476edb7246689a9425baabf37575e43
Author: Matteo Nardi <91.matteo at gmail.com>
Date: Fri Jul 31 17:42:39 2009 +0000
Show a warning icon over invalid accounts in the account list.
BUG: 201399
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1005262
---
src/account-item.cpp | 43 +++++++++++++++++++++++++++++++++++++++++--
src/account-item.h | 5 +++++
src/accounts-list-model.cpp | 3 +--
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/account-item.cpp b/src/account-item.cpp
index 6395481..ef382fc 100644
--- a/src/account-item.cpp
+++ b/src/account-item.cpp
@@ -23,15 +23,18 @@
#include "accounts-list-model.h"
#include <KDebug>
+#include <KIcon>
#include <QtCore/QTimer>
+#include <QtGui/QPainter>
#include <TelepathyQt4/PendingOperation>
#include <TelepathyQt4/PendingReady>
AccountItem::AccountItem(const Tp::AccountPtr &account, AccountsListModel *parent)
: QObject(parent),
- m_account(account)
+ m_account(account),
+ m_icon(new KIcon())
{
kDebug();
@@ -43,6 +46,9 @@ AccountItem::AccountItem(const Tp::AccountPtr &account, AccountsListModel *paren
SIGNAL(displayNameChanged(const QString&)),
SIGNAL(updated()));
+ //initialize icon only when the account is ready
+ connect(this, SIGNAL(ready()), SLOT(generateIcon()));
+
// We should look to see if the "account" instance we are passed is ready
// yet. If not, we should get it ready now.
// FIXME: What features should we check are ready?
@@ -60,7 +66,7 @@ AccountItem::~AccountItem()
{
kDebug();
- // TODO: Implement me...
+ delete m_icon;
}
Tp::AccountPtr AccountItem::account() const
@@ -78,6 +84,39 @@ void AccountItem::remove()
SLOT(onAccountRemoved(Tp::PendingOperation*)));
}
+const KIcon& AccountItem::icon() const
+{
+ Q_ASSERT(m_icon != 0);
+
+ return *m_icon;
+}
+
+void AccountItem::generateIcon()
+{
+ kDebug();
+
+ QString iconPath = account()->icon();
+ //if the icon has not been setted, we use the protocol icon
+ if(iconPath.isEmpty()) {
+ iconPath = QString("im-%1").arg(account()->protocol());
+ }
+
+ delete m_icon;
+ m_icon = new KIcon(iconPath);
+
+ if(!account()->isValid()) {
+ //we paint a warning symbol in the right-bottom corner
+ QPixmap pixmap = m_icon->pixmap(32, 32);
+ QPainter painter(&pixmap);
+ KIcon("dialog-error").paint(&painter, 15, 15, 16, 16);
+
+ delete m_icon;
+ m_icon = new KIcon(pixmap);
+ }
+
+ Q_EMIT(updated());
+}
+
void AccountItem::onAccountReady(Tp::PendingOperation *op)
{
kDebug();
diff --git a/src/account-item.h b/src/account-item.h
index 3fe1c58..e812e5a 100644
--- a/src/account-item.h
+++ b/src/account-item.h
@@ -25,6 +25,8 @@
#include <TelepathyQt4/Account>
+class KIcon;
+
class AccountsListModel;
namespace Tp {
@@ -41,8 +43,10 @@ public:
virtual ~AccountItem();
Tp::AccountPtr account() const;
void remove();
+ const KIcon& icon() const;
private Q_SLOTS:
+ void generateIcon();
void onAccountReady(Tp::PendingOperation *op);
void onAccountRemoved(Tp::PendingOperation *op);
@@ -53,6 +57,7 @@ Q_SIGNALS:
private:
Tp::AccountPtr m_account;
+ KIcon* m_icon;
};
diff --git a/src/accounts-list-model.cpp b/src/accounts-list-model.cpp
index 54fc370..1b37825 100644
--- a/src/accounts-list-model.cpp
+++ b/src/accounts-list-model.cpp
@@ -67,8 +67,7 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
break;
case Qt::DecorationRole:
- //FIXME: we need to move kopete protocol icons to oxygen..
- data = QVariant(KIcon(account->icon()));
+ data = QVariant(m_readyAccounts.at(index.row())->icon());
break;
case Qt::CheckStateRole:
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list