[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:07:54 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=0480f7d

The following commit has been merged in the master branch:
commit 0480f7d0c64da66e29ce84e1c87deb0588bdbaf3
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Tue Nov 26 10:39:10 2013 +0100

    KTp/Contact: Implemented stream and dbus tubeServicesCapability.
    
    Fixed ContactTubesRole in Models/ContactsListModel::data().
    
    REVIEW: 114109
---
 KTp/Models/contacts-list-model.cpp |  6 ++----
 KTp/contact.cpp                    | 33 +++++++++++++++++++++++++++++++++
 KTp/contact.h                      | 32 +++++++++++++++++++-------------
 3 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/KTp/Models/contacts-list-model.cpp b/KTp/Models/contacts-list-model.cpp
index dd35f94..d5d01c2 100644
--- a/KTp/Models/contacts-list-model.cpp
+++ b/KTp/Models/contacts-list-model.cpp
@@ -144,10 +144,8 @@ QVariant KTp::ContactsListModel::data(const QModelIndex &index, int role) const
         case KTp::ContactCanVideoCallRole:
             return contact->videoCallCapability();
         case KTp::ContactTubesRole:
-            //FIXME this does not check own selfContact caps.
-            return QStringList() << contact->capabilities().streamTubeServices()
-                                 << contact->capabilities().dbusTubeServices();
-
+            return QStringList() << contact->streamTubeServicesCapability()
+                                 << contact->dbusTubeServicesCapability();
         default:
             break;
         }
diff --git a/KTp/contact.cpp b/KTp/contact.cpp
index e94c963..f3cae7b 100644
--- a/KTp/contact.cpp
+++ b/KTp/contact.cpp
@@ -108,6 +108,26 @@ bool KTp::Contact::collaborativeEditingCapability() const
     return selfCanShare && otherCanShare;
 }
 
+QStringList KTp::Contact::dbusTubeServicesCapability() const
+{
+    if (!manager()->connection()) {
+        return QStringList();
+    }
+
+    return getCommonElements(capabilities().dbusTubeServices(),
+                             manager()->connection()->selfContact()->capabilities().dbusTubeServices());
+}
+
+QStringList KTp::Contact::streamTubeServicesCapability() const
+{
+    if (!manager()->connection()) {
+        return QStringList();
+    }
+
+    return getCommonElements(capabilities().streamTubeServices(),
+                             manager()->connection()->selfContact()->capabilities().streamTubeServices());
+}
+
 QStringList KTp::Contact::clientTypes() const
 {
     /* Temporary workaround for upstream bug https://bugs.freedesktop.org/show_bug.cgi?id=55883)
@@ -210,3 +230,16 @@ void KTp::Contact::invalidateAvatarCache()
     QPixmapCache::remove(id() + QLatin1String("-offline"));
     QPixmapCache::remove(id() + QLatin1String("-online"));
 }
+
+QStringList KTp::Contact::getCommonElements(const QStringList &list1, const QStringList &list2)
+{
+    /* QStringList::contains(QString) perform iterative comparsion, so there is no reason
+     * to select smaller list as base for this cycle. */
+    QStringList commonElements;
+    Q_FOREACH(const QString &i, list1) {
+        if (list2.contains(i)) {
+            commonElements << i;
+        }
+    }
+    return commonElements;
+}
diff --git a/KTp/contact.h b/KTp/contact.h
index a0a1da8..de224e5 100644
--- a/KTp/contact.h
+++ b/KTp/contact.h
@@ -37,19 +37,24 @@ public:
 
     /** Returns true if text chats can be started with this contact*/
     bool textChatCapability() const;
-     /** Returns true if audio calls can be started with this contact*/
-     bool audioCallCapability() const;
-     /** Returns true if video calls can be started with this contact*/
-     bool videoCallCapability() const;
-     /** Returns true if file transfers can be started with this contact*/
-     bool fileTransferCapability() const;
-     /** Returns true if this contact supports collaborative editing*/
-     bool collaborativeEditingCapability() const;
-
-     //Overridden as a workaround for upstream bug https://bugs.freedesktop.org/show_bug.cgi?id=55883
-     QStringList clientTypes() const;
-     /** Returns the pixmap of an avatar coloured to gray if contact online*/
-     QPixmap avatarPixmap();
+    /** Returns true if audio calls can be started with this contact*/
+    bool audioCallCapability() const;
+    /** Returns true if video calls can be started with this contact*/
+    bool videoCallCapability() const;
+    /** Returns true if file transfers can be started with this contact*/
+    bool fileTransferCapability() const;
+    /** Returns true if this contact supports collaborative editing*/
+    bool collaborativeEditingCapability() const;
+
+    /** Returns list of available dbus tube services*/
+    QStringList dbusTubeServicesCapability() const;
+    /** Returns list of available stream tube services*/
+    QStringList streamTubeServicesCapability() const;
+
+    //Overridden as a workaround for upstream bug https://bugs.freedesktop.org/show_bug.cgi?id=55883
+    QStringList clientTypes() const;
+    /** Returns the pixmap of an avatar coloured to gray if contact online*/
+    QPixmap avatarPixmap();
 
 Q_SIGNALS:
     void invalidated();
@@ -58,6 +63,7 @@ private Q_SLOTS:
     void invalidateAvatarCache();
 
 private:
+    static QStringList getCommonElements(const QStringList &list1, const QStringList &list2);
     void avatarToGray(QPixmap &avatar);
     QString keyCache() const;
     QString buildAvatarPath(const QString &avatarToken);

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list