[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:21:11 UTC 2016


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

The following commit has been merged in the master branch:
commit f46e8c5798f02e632192f2af8b9b436e3affea3e
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Wed Feb 8 23:11:23 2012 +0000

    targetContact() can be null, so check before trying to use it.
    
    CCBUG: 293487
---
 .../declarative-plugin/conversation-target.cpp     | 31 +++++++++++++++++-----
 plasmoid/declarative-plugin/conversation-target.h  |  2 +-
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/plasmoid/declarative-plugin/conversation-target.cpp b/plasmoid/declarative-plugin/conversation-target.cpp
index 1388613..53280d0 100644
--- a/plasmoid/declarative-plugin/conversation-target.cpp
+++ b/plasmoid/declarative-plugin/conversation-target.cpp
@@ -28,7 +28,7 @@ public:
     KIcon avatar;
 };
 
-ConversationTarget::ConversationTarget(Tp::ContactPtr contact, QObject *parent) :
+ConversationTarget::ConversationTarget(const Tp::ContactPtr &contact, QObject *parent) :
     QObject(parent),
     d(new ConversationTargetPrivate)
 {
@@ -51,22 +51,38 @@ void ConversationTarget::setupContactSignals(Tp::ContactPtr contact)
 
 QIcon ConversationTarget::avatar() const
 {
-    return d->avatar;
+    if (d->contact) {
+        return d->avatar;
+    } else {
+        return QIcon();
+    }
 }
 
 QString ConversationTarget::id() const
 {
-    return d->contact->id();
+    if (d->contact) {
+        return d->contact->id();
+    } else {
+        return QString();
+    }
 }
 
 QString ConversationTarget::nick() const
 {
-    return d->contact->alias();
+    if (d->contact) {
+        return d->contact->alias();
+    } else {
+        return QString();
+    }
 }
 
 QIcon ConversationTarget::presenceIcon() const
 {
-    return KTp::Presence(d->contact->presence()).icon();
+    if (d->contact) {
+        return KTp::Presence(d->contact->presence()).icon();
+    } else {
+        return QIcon();
+    }
 }
 
 void ConversationTarget::onPresenceChanged(const Tp::Presence&)
@@ -82,7 +98,10 @@ void ConversationTarget::onAvatarDataChanged(const Tp::AvatarData&)
 
 void ConversationTarget::updateAvatar()
 {
-    QString path = d->contact->avatarData().fileName;
+    QString path;
+    if (d->contact) {
+        path = d->contact->avatarData().fileName;
+    }
 
     if(path.isEmpty()) {
         path = QLatin1String("im-user");
diff --git a/plasmoid/declarative-plugin/conversation-target.h b/plasmoid/declarative-plugin/conversation-target.h
index f2fee63..7acde40 100644
--- a/plasmoid/declarative-plugin/conversation-target.h
+++ b/plasmoid/declarative-plugin/conversation-target.h
@@ -38,7 +38,7 @@ class KDE_TELEPATHY_CHAT_EXPORT ConversationTarget : public QObject
     Q_PROPERTY(QString id READ id)
 
 public:
-    ConversationTarget(Tp::ContactPtr contact, QObject *parent = 0);
+    ConversationTarget(const Tp::ContactPtr &contact, QObject *parent = 0);
     virtual ~ConversationTarget();
 
     QIcon   avatar() const;

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list