[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

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


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=2152607

The following commit has been merged in the master branch:
commit 2152607d890e28ba683aec0d24c15bb57b3b1785
Author: Lasath Fernando <kde at lasath.org>
Date:   Tue Jan 10 19:38:05 2012 +1100

    Keep copy of the Avatar in ConversationTarget, so it can be returned more quickly.
---
 lib/conversation-target.cpp | 23 ++++++++++++++++-------
 lib/conversation-target.h   |  1 +
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/lib/conversation-target.cpp b/lib/conversation-target.cpp
index 6befd38..ddb22a4 100644
--- a/lib/conversation-target.cpp
+++ b/lib/conversation-target.cpp
@@ -26,6 +26,7 @@ class  ConversationTarget::ConversationTargetPrivate
 {
 public:
     Tp::ContactPtr contact;
+    KIcon avatar;
 };
 
 ConversationTarget::ConversationTarget(Tp::ContactPtr contact, QObject* parent) :
@@ -39,6 +40,7 @@ ConversationTarget::ConversationTarget(Tp::ContactPtr contact, QObject* parent)
     }
 
     d->contact = contact;
+    updateAvatar();
 }
 
 void ConversationTarget::setupContactSignals(Tp::ContactPtr contact)
@@ -50,14 +52,9 @@ void ConversationTarget::setupContactSignals(Tp::ContactPtr contact)
 
 QIcon ConversationTarget::avatar() const
 {
-    QString path = d->contact->avatarData().fileName;
-
-    if (path.isEmpty()) {
-        return KIcon(QLatin1String("im-user"));
-    } else {
-        return QIcon(path);
-    }
+    return d->avatar;
 }
+
 QString ConversationTarget::id() const
 {
     return d->contact->id();
@@ -115,9 +112,21 @@ void ConversationTarget::onPresenceChanged(const Tp::Presence&)
 
 void ConversationTarget::onAvatarDataChanged(const Tp::AvatarData&)
 {
+    updateAvatar();
     Q_EMIT avatarChanged(avatar());
 }
 
+void ConversationTarget::updateAvatar()
+{
+    QString path = d->contact->avatarData().fileName;
+
+    if(path.isEmpty()) {
+        path = QLatin1String("im-user");
+    }
+
+    d->avatar = KIcon(path);
+}
+
 Tp::ContactPtr ConversationTarget::contact() const
 {
     return d->contact;
diff --git a/lib/conversation-target.h b/lib/conversation-target.h
index 864296d..3357d00 100644
--- a/lib/conversation-target.h
+++ b/lib/conversation-target.h
@@ -68,6 +68,7 @@ private Q_SLOTS:
 private:
     void setupContactSignals(Tp::ContactPtr contact);
     void removeContactSignals(Tp::ContactPtr contact);
+    void updateAvatar();
 
     class ConversationTargetPrivate;
     ConversationTargetPrivate *d;

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list