[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:58:55 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=5ca907d
The following commit has been merged in the master branch:
commit 5ca907dad822a6de8c6f01028a2f288d47b4c4b6
Author: Thomas Richard <thomas9999 at gmail.com>
Date: Sun Jan 16 16:54:59 2011 +0100
Fix icons in ProfileListModel
---
src/KCMTelepathyAccounts/profile-item.cpp | 23 +++++++++++++++++++++--
src/KCMTelepathyAccounts/profile-item.h | 5 +++++
src/KCMTelepathyAccounts/profile-list-model.cpp | 8 +-------
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/KCMTelepathyAccounts/profile-item.cpp b/src/KCMTelepathyAccounts/profile-item.cpp
index 99ff61f..8e42a36 100644
--- a/src/KCMTelepathyAccounts/profile-item.cpp
+++ b/src/KCMTelepathyAccounts/profile-item.cpp
@@ -26,23 +26,27 @@
#include <TelepathyQt4/Profile>
#include <KDebug>
+#include <KIcon>
ProfileItem::ProfileItem(const Tp::ProfilePtr &profile, ProfileListModel *parent)
: QObject(parent),
- m_profile(profile)
+ m_profile(profile),
+ m_icon(0)
{
//FIXME: Dictionary should not be needed anymore when distros ship profiles
m_localizedName = Dictionary::instance()->string(profile->name());
if(m_localizedName.isEmpty()) {
m_localizedName = profile->name();
}
+
+ generateIcon();
}
ProfileItem::~ProfileItem()
{
kDebug();
- // TODO: Implement me...
+ delete m_icon;
}
QString ProfileItem::serviceName() const
@@ -80,5 +84,20 @@ Tp::ProfilePtr ProfileItem::profile() const
return m_profile;
}
+const KIcon& ProfileItem::icon() const
+{
+ Q_ASSERT(m_icon != 0);
+
+ return *m_icon;
+}
+
+void ProfileItem::generateIcon()
+{
+ QString iconPath = profile()->iconName();
+
+ delete m_icon;
+ m_icon = new KIcon(iconPath);
+}
+
#include "profile-item.moc"
diff --git a/src/KCMTelepathyAccounts/profile-item.h b/src/KCMTelepathyAccounts/profile-item.h
index 31c1e18..41a030f 100644
--- a/src/KCMTelepathyAccounts/profile-item.h
+++ b/src/KCMTelepathyAccounts/profile-item.h
@@ -29,6 +29,7 @@
#include <TelepathyQt4/Profile>
class ProfileListModel;
+class KIcon;
class KDE_EXPORT ProfileItem : public QObject
{
@@ -46,10 +47,14 @@ public:
QString cmName() const;
QString protocolName() const;
Tp::ProfilePtr profile() const;
+ const KIcon& icon() const;
private:
+ void generateIcon();
+
Tp::ProfilePtr m_profile;
QString m_localizedName;
+ KIcon* m_icon;
};
diff --git a/src/KCMTelepathyAccounts/profile-list-model.cpp b/src/KCMTelepathyAccounts/profile-list-model.cpp
index bb68338..eee1187 100644
--- a/src/KCMTelepathyAccounts/profile-list-model.cpp
+++ b/src/KCMTelepathyAccounts/profile-list-model.cpp
@@ -38,8 +38,6 @@ ProfileListModel::ProfileListModel(QObject *parent)
ProfileListModel::~ProfileListModel()
{
kDebug();
-
- // TODO: Implement me!
}
int ProfileListModel::rowCount(const QModelIndex &index) const
@@ -66,8 +64,7 @@ QVariant ProfileListModel::data(const QModelIndex &index, int role) const
data = QVariant(m_profileItems.at(index.row())->localizedName());
break;
case Qt::DecorationRole:
- // Look for an icon named im-<iconname>
- data = QVariant(KIcon((QString("im-%1").arg(m_profileItems.at(index.row())->iconName()))));
+ data = QVariant(m_profileItems.at(index.row())->icon());
break;
default:
break;
@@ -90,9 +87,6 @@ void ProfileListModel::setProfileManager(Tp::ProfileManagerPtr profileManager)
foreach(Tp::ProfilePtr ptr, profileManager->profiles()) {
m_profileItems.append(new ProfileItem(ptr, this));
}
-
-
-
endInsertRows();
}
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list