[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:06:18 UTC 2016


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

The following commit has been merged in the master branch:
commit 3db767e848c923444ea4e5f7d3a04ad21d8f21e9
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Feb 1 10:06:44 2013 +0000

    Port ContactsListModel to new enum
---
 KTp/Models/contacts-list-model.cpp | 140 +++++++++++++++----------------------
 1 file changed, 56 insertions(+), 84 deletions(-)

diff --git a/KTp/Models/contacts-list-model.cpp b/KTp/Models/contacts-list-model.cpp
index 4f132af..f05b5de 100644
--- a/KTp/Models/contacts-list-model.cpp
+++ b/KTp/Models/contacts-list-model.cpp
@@ -17,7 +17,6 @@
 */
 
 #include "contacts-list-model.h"
-#include "contact.h"
 
 #include <TelepathyQt/Account>
 #include <TelepathyQt/Contact>
@@ -25,8 +24,9 @@
 #include <TelepathyQt/Connection>
 #include <TelepathyQt/ContactManager>
 
-#include <KTp/Models/contacts-model.h>
-#include <KTp/presence.h>
+#include "contact.h"
+#include "presence.h"
+#include "types.h"
 
 class KTp::ContactsListModel::Private
 {
@@ -43,51 +43,26 @@ KTp::ContactsListModel::ContactsListModel(QObject *parent) :
     d->contactManager = 0;
 
     QHash<int, QByteArray> roles;
-    roles[ContactsModel::IdRole] = "id";
-    roles[ContactsModel::AccountRole] = "account";
-    roles[ContactsModel::ContactRole] = "contact";
-    roles[ContactsModel::ValidRole] = "valid";
-    roles[ContactsModel::EnabledRole] = "enabled";
-    roles[ContactsModel::ConnectionManagerNameRole] = "connectionManager";
-    roles[ContactsModel::ProtocolNameRole] = "protocol";
-    roles[ContactsModel::DisplayNameRole] = "displayName";
-    roles[ContactsModel::IconRole] = "icon";
-    roles[ContactsModel::NicknameRole] = "nickname";
-    roles[ContactsModel::ConnectsAutomaticallyRole] = "connectsAutomatically";
-    roles[ContactsModel::ChangingPresenceRole] = "changingPresence";
-    roles[ContactsModel::AutomaticPresenceRole] = "automaticPresence";
-    roles[ContactsModel::AutomaticPresenceTypeRole] = "automaticPresenceType";
-    roles[ContactsModel::AutomaticPresenceStatusRole] = "automaticPresenceStatus";
-    roles[ContactsModel::AutomaticPresenceStatusMessageRole] = "automaticPresenceStatusMessage";
-    roles[ContactsModel::CurrentPresenceRole] = "currentPresence";
-    roles[ContactsModel::CurrentPresenceTypeRole] = "currentPresenceType";
-    roles[ContactsModel::CurrentPresenceStatusRole] = "currentPresenceStatus";
-    roles[ContactsModel::CurrentPresenceStatusMessageRole] = "currentPresenceStatusMessage";
-    roles[ContactsModel::RequestedPresenceRole] = "requestedPresence";
-    roles[ContactsModel::RequestedPresenceTypeRole] = "requestedPresenceType";
-    roles[ContactsModel::RequestedPresenceStatusRole] = "requestedPresenceStatus";
-    roles[ContactsModel::RequestedPresenceStatusMessageRole] = "requestedPresenceStatusMessage";
-    roles[ContactsModel::ConnectionStatusRole] = "connectionStatus";
-    roles[ContactsModel::ConnectionStatusReasonRole] = "connectionStatusReason";
-    roles[ContactsModel::AliasRole] = "aliasName";
-    roles[ContactsModel::AvatarRole] = "avatar";
-    roles[ContactsModel::PresenceRole] = "presence";
-    roles[ContactsModel::PresenceIconRole] = "presenceIcon";
-    roles[ContactsModel::PresenceStatusRole] = "presenceStatus";
-    roles[ContactsModel::PresenceTypeRole] = "presenceType";
-    roles[ContactsModel::PresenceMessageRole] = "presenceMessage";
-    roles[ContactsModel::SubscriptionStateRole] = "subscriptionState";
-    roles[ContactsModel::PublishStateRole] = "publishState";
-    roles[ContactsModel::BlockedRole] = "blocked";
-    roles[ContactsModel::GroupsRole] = "groups";
-    roles[ContactsModel::TextChatCapabilityRole] = "textChat";
-    roles[ContactsModel::MediaCallCapabilityRole] = "mediaCall";
-    roles[ContactsModel::AudioCallCapabilityRole] = "audioCall";
-    roles[ContactsModel::VideoCallCapabilityRole] = "videoCall";
-    roles[ContactsModel::UpgradeCallCapabilityRole] = "upgradeCall";
-    roles[ContactsModel::FileTransferCapabilityRole] = "fileTransfer";
-    roles[ContactsModel::DesktopSharingCapabilityRole] = "desktopSharing";
-    roles[ContactsModel::SSHContactCapabilityRole] = "sshContact";
+    roles[KTp::RowTypeRole]= "type";
+    roles[KTp::IdRole]= "id";
+
+    roles[KTp::ContactRole]= "contact";
+    roles[KTp::AccountRole]= "account";
+
+    roles[KTp::ContactClientTypesRole]= "clientTypes";
+    roles[KTp::ContactAvatarPathRole]= "avatar";
+    roles[KTp::ContactGroupsRole]= "groups";
+    roles[KTp::ContactPresenceMessageRole]= "presenceMessage";
+    roles[KTp::ContactPresenceTypeRole]= "presenceType";
+    roles[KTp::ContactPresenceIconRole]= "presenceIcon";
+    roles[KTp::ContactSubscriptionStateRole]= "subscriptionState";
+    roles[KTp::ContactPublishStateRole]= "publishState";
+    roles[KTp::ContactIsBlockedRole]= "blocked";
+    roles[KTp::ContactCanTextChatRole]= "textChat";
+    roles[KTp::ContactCanFileTransferRole]= "fileTransfer";
+    roles[KTp::ContactCanAudioCallRole]= "audioCall";
+    roles[KTp::ContactCanVideoCallRole]= "videoCall";
+    roles[KTp::ContactTubesRole]= "tubes";
     setRoleNames(roles);
 }
 
@@ -119,54 +94,51 @@ QVariant KTp::ContactsListModel::data(const QModelIndex &index, int role) const
                    "Failed to cast Tp::ContactPtr to KTp::ContactPtr. Are you using KTp::ContactFactory?");
 
         switch (role) {
-        case ContactsModel::IdRole:
-            return contact->id();
-        case ContactsModel::TypeRole:
+        case KTp::RowTypeRole:
             return ContactsModel::ContactRowType;
-        case ContactsModel::ContactRole:
-            return QVariant::fromValue(d->contacts[row]); //Tp::ContactPtr and NOT KTp::ContactPtr
-        case ContactsModel::AccountRole:
+       case KTp::IdRole:
+            return contact->id();
+
+        case KTp::ContactRole:
+            return QVariant::fromValue(contact);
+        case KTp::AccountRole:
             return QVariant::fromValue(d->contactManager->accountForContact(contact));
-        case Qt::DisplayRole:
-            return contact->alias();
-        case ContactsModel::AliasRole:
-            return contact->alias();
-        case ContactsModel::PresenceRole:
-            return QVariant::fromValue(contact->presence());
-        case ContactsModel::PresenceIconRole:
-            return QIcon(contact->presence().icon());
-        case ContactsModel::PresenceStatusRole:
-            return contact->presence().status();
-        case ContactsModel::PresenceTypeRole:
-            return contact->presence().type();
-        case ContactsModel::PresenceMessageRole:
+
+        case KTp::ContactClientTypesRole:
+            return contact->clientTypes();
+        case KTp::ContactAvatarPathRole:
+            return contact->avatarData().fileName;
+        case KTp::ContactGroupsRole:
+            return contact->groups();
+        case KTp::ContactPresenceMessageRole:
             return contact->presence().statusMessage();
-        case ContactsModel::SubscriptionStateRole:
+        case KTp::ContactPresenceTypeRole:
+            return contact->presence().type();
+        case KTp::ContactPresenceIconRole:
+            return contact->presence().iconName();
+        case KTp::ContactSubscriptionStateRole:
             return contact->subscriptionState();
-        case ContactsModel::PublishStateRole:
+          case KTp::ContactPublishStateRole:
             return contact->publishState();
-        case ContactsModel::BlockedRole:
+        case KTp::ContactIsBlockedRole:
             return contact->isBlocked();
-        case ContactsModel::GroupsRole:
-            return contact->groups();
-        case ContactsModel::AvatarRole:
-            return contact->avatarData().fileName;
-        case Qt::DecorationRole:
-            return QImage(contact->avatarData().fileName);
-        case ContactsModel::TextChatCapabilityRole:
-            return contact->capabilities().textChats();
-        case ContactsModel::ClientTypesRole:
-            return contact->clientTypes();
-        case ContactsModel::FileTransferCapabilityRole:
+
+        case KTp::ContactCanTextChatRole:
+            return true; //FIXME
+          case KTp::ContactCanFileTransferRole:
             return contact->fileTransferCapability();
-        case ContactsModel::AudioCallCapabilityRole:
+        case KTp::ContactCanAudioCallRole:
             return contact->audioCallCapability();
-        case ContactsModel::VideoCallCapabilityRole:
+        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();
+
         default:
             break;
         }
-
     }
     return QVariant();
 }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list