[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:08:30 UTC 2016


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

The following commit has been merged in the master branch:
commit 307f51e8eca9be957f73ac8f7be04db6c7c30dec
Author: Aleix Pol <aleixpol at kde.org>
Date:   Fri Nov 7 17:12:55 2014 +0100

    Port KAbc -> KContacts
---
 KTp/CMakeLists.txt                                 |  1 -
 KTp/Models/kpeopletranslationproxy.cpp             | 26 ++++++++--------------
 KTp/global-contact-manager.cpp                     |  7 ++++++
 KTp/types.h                                        |  2 +-
 kpeople/actionsplugin/kpeople-actions-plugin.cpp   |  4 ++--
 kpeople/actionsplugin/kpeople-actions-plugin.h     |  4 ++--
 kpeople/datasourceplugin/CMakeLists.txt            |  2 +-
 .../datasourceplugin/im-persons-data-source.cpp    | 24 ++++++++++----------
 .../uiplugins/chatplugin/kpeople_chat_plugin.cpp   |  4 ++--
 kpeople/uiplugins/chatplugin/kpeople_chat_plugin.h |  2 +-
 kpeople/uiplugins/imdetailswidget.cpp              |  6 ++---
 kpeople/uiplugins/imdetailswidget.h                |  2 +-
 12 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/KTp/CMakeLists.txt b/KTp/CMakeLists.txt
index cd94aef..1f94d62 100644
--- a/KTp/CMakeLists.txt
+++ b/KTp/CMakeLists.txt
@@ -100,7 +100,6 @@ target_link_libraries (KTpCommonInternals
                     KF5::KIOWidgets
                     KF5::KDELibs4Support
 )
-target_include_directories(KTpCommonInternals PUBLIC ${TELEPATHY_QT5_INCLUDE_DIR}) # TODO: Remove when TelepathyQt exports include paths properly
 
 install (TARGETS KTpCommonInternals
          EXPORT KTpTargets
diff --git a/KTp/Models/kpeopletranslationproxy.cpp b/KTp/Models/kpeopletranslationproxy.cpp
index ce19ad0..7a108cf 100644
--- a/KTp/Models/kpeopletranslationproxy.cpp
+++ b/KTp/Models/kpeopletranslationproxy.cpp
@@ -28,7 +28,7 @@
 
 #include <KDebug>
 #include <KIconLoader>
-#include <KABC/Addressee>
+#include <KContacts/Addressee>
 
 #include <QPixmapCache>
 
@@ -58,7 +58,7 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
 //         return QVariant();
 //     }
 //
-    const KABC::Addressee &contact = mapToSource(proxyIndex).data(KPeople::PersonsModel::PersonVCardRole).value<KABC::Addressee>();
+    const KContacts::Addressee &contact = mapToSource(proxyIndex).data(KPeople::PersonsModel::PersonVCardRole).value<KContacts::Addressee>();
 
     switch (role) {
         case KTp::ContactPresenceTypeRole:
@@ -97,7 +97,7 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
             return mapToSource(proxyIndex).data(KPeople::PersonsModel::PersonVCardRole);
     }
 
-    const KABC::AddresseeList &contacts = mapToSource(proxyIndex).data(PersonsModel::ContactsVCardRole).value<KABC::AddresseeList>();
+    const KContacts::AddresseeList &contacts = mapToSource(proxyIndex).data(PersonsModel::ContactsVCardRole).value<KContacts::AddresseeList>();
 
     int mostOnlineIndex = 0;
 
@@ -130,13 +130,13 @@ QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role)
 
 QVariant KPeopleTranslationProxy::dataForKTpContact(const QString &accountPath, const QString &contactId, int role) const
 {
-    KTp::ContactPtr ktpContact = KTp::contactManager()->contactForContactId(accountPath, contactId);
+    if (role == KTp::AccountRole) {
+        return QVariant::fromValue<Tp::AccountPtr>(KTp::contactManager()->accountForAccountPath(accountPath));
+    }
 
+    KTp::ContactPtr ktpContact = KTp::contactManager()->contactForContactId(accountPath, contactId);
     if (!ktpContact.isNull()) {
         switch (role) {
-        case KTp::AccountRole:
-            return QVariant::fromValue<Tp::AccountPtr>(KTp::contactManager()->accountForContact(ktpContact));
-            break;
         case KTp::ContactRole:
             return QVariant::fromValue<KTp::ContactPtr>(ktpContact);
             break;
@@ -163,15 +163,7 @@ QVariant KPeopleTranslationProxy::dataForKTpContact(const QString &accountPath,
             break;
         }
     }
-    //     } else if (ktpContact.isNull() && role == KTp::AccountRole) {
-    //         QVariant accountPath = mapToSource(proxyIndex).data(PersonsModel::UserRole);
-    //         if (accountPath.type() == QVariant::List) {
-    //             return QVariant::fromValue<Tp::AccountPtr>(imPlugin->accountManager()->accountForObjectPath(accountPath.toList().first().toString()));
-    //         } else {
-    //             return QVariant::fromValue<Tp::AccountPtr>(imPlugin->accountManager()->accountForObjectPath(accountPath.toString()));
-    //         }
-    //     }
-    // //     }
+
     return QVariant();
 }
 
@@ -180,7 +172,7 @@ bool KPeopleTranslationProxy::filterAcceptsRow(int source_row, const QModelIndex
     QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
 
     //if no valid presence (not even "offline") .. reject the contact
-    return !sourceIndex.data(KPeople::PersonsModel::PersonVCardRole).value<KABC::Addressee>().custom(QLatin1String("telepathy"), QLatin1String("presence")).isEmpty();
+    return !sourceIndex.data(KPeople::PersonsModel::PersonVCardRole).value<KContacts::Addressee>().custom(QLatin1String("telepathy"), QLatin1String("presence")).isEmpty();
 }
 
 QVariant KPeopleTranslationProxy::translatePresence(const QVariant &presenceName) const
diff --git a/KTp/global-contact-manager.cpp b/KTp/global-contact-manager.cpp
index e2533e9..07e93f6 100644
--- a/KTp/global-contact-manager.cpp
+++ b/KTp/global-contact-manager.cpp
@@ -186,11 +186,17 @@ Tp::AccountPtr GlobalContactManager::accountForAccountPath(const QString &accoun
 
 KTp::ContactPtr GlobalContactManager::contactForContactId(const QString &accountPath, const QString &contactId)
 {
+    Q_ASSERT(!accountPath.isEmpty());
     if (!d->accountManager || accountPath.isEmpty()) {
+        qWarning() << "Account manager unavailable";
         return KTp::ContactPtr();
     }
 
     Tp::AccountPtr account = d->accountManager->accountForObjectPath(accountPath);
+    if (!account) {
+        qWarning() << "account not found" << accountPath;
+    }
+
     if (account && account->connection() && account->connection()->contactManager()) {
         Tp::Contacts contactSet = account->connection()->contactManager()->allKnownContacts();
         Q_FOREACH (const Tp::ContactPtr &contact, contactSet) {
@@ -199,6 +205,7 @@ KTp::ContactPtr GlobalContactManager::contactForContactId(const QString &account
             }
         }
     }
+    qWarning() << "Couldn't find a contact for" << contactId;
 
     return KTp::ContactPtr();
 }
diff --git a/KTp/types.h b/KTp/types.h
index 1509772..63c2ded 100644
--- a/KTp/types.h
+++ b/KTp/types.h
@@ -81,7 +81,7 @@ namespace KTp
         ContactCanVideoCallRole, ///< bool. You and contact can both video call
         ContactTubesRole, ///< stringlist. common supported dbus + stream services between you and contact
 
-        ContactVCardRole, ///< VCard of the contact in KABC::Addresse format; KPeople only at the moment
+        ContactVCardRole, ///< VCard of the contact in KContacts::Addresse format; KPeople only at the moment
 
         //heading roles
         HeaderTotalUsersRole = Qt::UserRole  + 3000,
diff --git a/kpeople/actionsplugin/kpeople-actions-plugin.cpp b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
index cf775b5..4159498 100644
--- a/kpeople/actionsplugin/kpeople-actions-plugin.cpp
+++ b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
@@ -106,8 +106,8 @@ KPeopleActionsPlugin::KPeopleActionsPlugin(QObject *parent, const QVariantList &
     Q_UNUSED(args);
 }
 
-QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &person,
-                                                       const KABC::AddresseeList &contacts,
+QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KContacts::Addressee &person,
+                                                       const KContacts::AddresseeList &contacts,
                                                        QObject *parent) const
 {
     QList<QAction*> actions;
diff --git a/kpeople/actionsplugin/kpeople-actions-plugin.h b/kpeople/actionsplugin/kpeople-actions-plugin.h
index 7f57c39..c42ff93 100644
--- a/kpeople/actionsplugin/kpeople-actions-plugin.h
+++ b/kpeople/actionsplugin/kpeople-actions-plugin.h
@@ -26,8 +26,8 @@ class KPeopleActionsPlugin : public KPeople::AbstractPersonAction
     Q_OBJECT
 public:
     KPeopleActionsPlugin(QObject *parent, const QVariantList &args);
-    virtual QList<QAction*> actionsForPerson(const KABC::Addressee &person,
-                                             const KABC::AddresseeList &contacts,
+    virtual QList<QAction*> actionsForPerson(const KContacts::Addressee &person,
+                                             const KContacts::AddresseeList &contacts,
                                              QObject *parent) const;
 
 private Q_SLOTS:
diff --git a/kpeople/datasourceplugin/CMakeLists.txt b/kpeople/datasourceplugin/CMakeLists.txt
index cfde0d2..7e3872c 100644
--- a/kpeople/datasourceplugin/CMakeLists.txt
+++ b/kpeople/datasourceplugin/CMakeLists.txt
@@ -5,7 +5,7 @@ add_library (im_persons_data_source_plugin MODULE im-persons-data-source.cpp)
 target_link_libraries (im_persons_data_source_plugin
     Qt5::Sql
     KF5::People
-    KF5::Abc
+    KF5::Contacts
     KF5::KDELibs4Support
     KTp::CommonInternals
 )
diff --git a/kpeople/datasourceplugin/im-persons-data-source.cpp b/kpeople/datasourceplugin/im-persons-data-source.cpp
index e389e59..a948ba9 100644
--- a/kpeople/datasourceplugin/im-persons-data-source.cpp
+++ b/kpeople/datasourceplugin/im-persons-data-source.cpp
@@ -33,7 +33,7 @@
 #include "KTp/types.h"
 
 #include <KPeople/AllContactsMonitor>
-#include <KABC/Addressee>
+#include <KContacts/Addressee>
 
 #include <KDebug>
 #include <KPluginFactory>
@@ -51,7 +51,7 @@ class KTpAllContacts : public AllContactsMonitor
 public:
     KTpAllContacts();
     ~KTpAllContacts();
-    virtual KABC::Addressee::Map contacts();
+    virtual KContacts::Addressee::Map contacts();
 
 private Q_SLOTS:
     void loadCache();
@@ -62,12 +62,12 @@ private Q_SLOTS:
 
 private:
     QString createUri(const KTp::ContactPtr &contact) const;
-    KABC::Addressee contactToAddressee(const Tp::ContactPtr &contact) const;
+    KContacts::Addressee contactToAddressee(const Tp::ContactPtr &contact) const;
 
     //presence names indexed by ConnectionPresenceType
     QVector<QString> m_presenceStrings;
     QHash<QString, KTp::ContactPtr> m_contacts;
-    KABC::Addressee::Map m_contactVCards;
+    KContacts::Addressee::Map m_contactVCards;
 };
 
 static const QString S_KABC_PRODUCT = QString::fromLatin1("telepathy");
@@ -122,12 +122,12 @@ void KTpAllContacts::loadCache()
     }
 
     while (query.next()) {
-        KABC::Addressee addressee;
+        KContacts::Addressee addressee;
 
         const QString accountId =  query.value(0).toString();
         const QString contactId =  query.value(1).toString();
         addressee.setFormattedName(query.value(2).toString());
-        addressee.setPhoto(KABC::Picture(query.value(3).toString()));
+        addressee.setPhoto(KContacts::Picture(query.value(3).toString()));
 
         if (!groupsList.isEmpty()) {
             QStringList contactGroups;
@@ -202,7 +202,7 @@ void KTpAllContacts::onAllKnownContactsChanged(const Tp::Contacts &contactsAdded
         KTp::ContactPtr ktpContact = KTp::ContactPtr::qObjectCast(contact);
         const QString uri = createUri(ktpContact);
 
-        const KABC::Addressee vcard = contactToAddressee(contact);
+        const KContacts::Addressee vcard = contactToAddressee(contact);
 
         m_contacts.insert(uri, ktpContact);
 
@@ -251,19 +251,19 @@ void KTpAllContacts::onContactInvalidated()
     m_contacts.remove(uri);
 
     //set to offline and emit changed
-    KABC::Addressee &vcard = m_contactVCards[uri];
+    KContacts::Addressee &vcard = m_contactVCards[uri];
     vcard.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_PRESENCE, QLatin1String("offline"));
     Q_EMIT contactChanged(uri, vcard);
 }
 
-KABC::Addressee::Map KTpAllContacts::contacts()
+KContacts::Addressee::Map KTpAllContacts::contacts()
 {
     return m_contactVCards;
 }
 
-KABC::Addressee KTpAllContacts::contactToAddressee(const Tp::ContactPtr &contact) const
+KContacts::Addressee KTpAllContacts::contactToAddressee(const Tp::ContactPtr &contact) const
 {
-    KABC::Addressee vcard;
+    KContacts::Addressee vcard;
     Tp::AccountPtr account = KTp::contactManager()->accountForContact(contact);
     if (contact && account) {
         vcard.setFormattedName(contact->alias());
@@ -273,7 +273,7 @@ KABC::Addressee KTpAllContacts::contactToAddressee(const Tp::ContactPtr &contact
         vcard.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_ACCOUNT_PATH, account->objectPath());
         vcard.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_PRESENCE, m_presenceStrings.at(contact->presence().type()));
         if (!contact->avatarData().fileName.isEmpty()) {
-            vcard.setPhoto(KABC::Picture(contact->avatarData().fileName));
+            vcard.setPhoto(KContacts::Picture(contact->avatarData().fileName));
         }
     }
     return vcard;
diff --git a/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.cpp b/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.cpp
index 49716e6..050bb38 100644
--- a/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.cpp
+++ b/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.cpp
@@ -26,7 +26,7 @@
 #include <QVBoxLayout>
 #include <QScrollArea>
 #include <KLocalizedString>
-#include <KABC/Addressee>
+#include <KContacts/Addressee>
 #include <KPluginFactory>
 #include <KLocalizedString>
 
@@ -51,7 +51,7 @@ ChatWidgetFactory::ChatWidgetFactory(QObject *parent, const QVariantList &args):
     m_model = new QStandardItemModel();
 }
 
-QWidget *ChatWidgetFactory::createDetailsWidget(const KABC::Addressee &person, const KABC::AddresseeList &contacts, QWidget *parent) const
+QWidget *ChatWidgetFactory::createDetailsWidget(const KContacts::Addressee &person, const KContacts::AddresseeList &contacts, QWidget *parent) const
 {
     Q_UNUSED(contacts);
     QWidget *widget = new QWidget(parent);
diff --git a/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.h b/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.h
index 9cdb9dc..9a73610 100644
--- a/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.h
+++ b/kpeople/uiplugins/chatplugin/kpeople_chat_plugin.h
@@ -34,7 +34,7 @@ public:
     explicit ChatWidgetFactory(QObject *parent, const QVariantList &args);
     virtual QString label() const;
     virtual int sortWeight() const;
-    virtual QWidget *createDetailsWidget(const KABC::Addressee &person, const KABC::AddresseeList &contacts, QWidget *parent) const;
+    virtual QWidget *createDetailsWidget(const KContacts::Addressee &person, const KContacts::AddresseeList &contacts, QWidget *parent) const;
 
 private Q_SLOTS:
     void onPendingDates(KTp::PendingLoggerOperation *);
diff --git a/kpeople/uiplugins/imdetailswidget.cpp b/kpeople/uiplugins/imdetailswidget.cpp
index 47406db..e98bf14 100644
--- a/kpeople/uiplugins/imdetailswidget.cpp
+++ b/kpeople/uiplugins/imdetailswidget.cpp
@@ -26,7 +26,7 @@
 
 #include <KLocalizedString>
 #include <KPluginFactory>
-#include <KABC/Addressee>
+#include <KContacts/Addressee>
 
 #include <KPeople/PersonData>
 #include <TelepathyQt/AccountManager>
@@ -48,7 +48,7 @@ QString ImDetailsWidget::label() const
     return i18n("IM");
 }
 
-QWidget* ImDetailsWidget::createDetailsWidget(const KABC::Addressee& person, const KABC::AddresseeList &contacts, QWidget* parent) const
+QWidget* ImDetailsWidget::createDetailsWidget(const KContacts::Addressee& person, const KContacts::AddresseeList &contacts, QWidget* parent) const
 {
     Q_UNUSED(person);
     QWidget *root = new QWidget(parent);
@@ -56,7 +56,7 @@ QWidget* ImDetailsWidget::createDetailsWidget(const KABC::Addressee& person, con
     root->setLayout(layout);
 
     int row = 0;
-    Q_FOREACH(const KABC::Addressee &contact, contacts) {
+    Q_FOREACH(const KContacts::Addressee &contact, contacts) {
         const QString contactId = contact.custom(QLatin1String("telepathy"), QLatin1String("contactId"));
         const QString accountPath = contact.custom(QLatin1String("telepathy"), QLatin1String("accountPath")); //probably unused till we fix everything properly
 
diff --git a/kpeople/uiplugins/imdetailswidget.h b/kpeople/uiplugins/imdetailswidget.h
index f361e03..0020eb9 100644
--- a/kpeople/uiplugins/imdetailswidget.h
+++ b/kpeople/uiplugins/imdetailswidget.h
@@ -31,7 +31,7 @@ class ImDetailsWidget : public KPeople::AbstractFieldWidgetFactory
 public:
     explicit ImDetailsWidget(QObject *parent, const QVariantList &args);
     QString label() const;
-    virtual QWidget* createDetailsWidget(const KABC::Addressee& person, const KABC::AddresseeList &contacts, QWidget* parent) const;
+    virtual QWidget* createDetailsWidget(const KContacts::Addressee& person, const KContacts::AddresseeList &contacts, QWidget* parent) const;
 };
 
 #endif // IM_DETAILS_WIDGET_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list