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


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

The following commit has been merged in the master branch:
commit 3e314aa7cbd13ade4867ab8855b237112259c195
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sat May 3 01:59:24 2014 +0200

    Share the same QString for all KABC Custom fields
    
    We should have a theoretically smaller memory footprint.
    
    REVIEW: 117968
---
 kpeople/datasourceplugin/im-persons-data-source.cpp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/kpeople/datasourceplugin/im-persons-data-source.cpp b/kpeople/datasourceplugin/im-persons-data-source.cpp
index ee85760..2c4c2cb 100644
--- a/kpeople/datasourceplugin/im-persons-data-source.cpp
+++ b/kpeople/datasourceplugin/im-persons-data-source.cpp
@@ -72,6 +72,11 @@ private:
     KABC::Addressee::Map m_contactVCards;
 };
 
+static const QString S_KABC_PRODUCT = QString::fromLatin1("telepathy");
+static const QString S_KABC_FIELD_ACCOUNT_PATH = QString::fromLatin1("accountPath");
+static const QString S_KABC_FIELD_CONTACT_ID = QString::fromLatin1("contactId");
+static const QString S_KABC_FIELD_PRESENCE = QString::fromLatin1("presence");
+
 KTpAllContacts::KTpAllContacts()
 {
     Tp::registerTypes();
@@ -137,9 +142,9 @@ void KTpAllContacts::loadCache()
             addressee.setCategories(contactGroups);
         }
 
-        addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("contactId"), contactId);
-        addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("accountPath"), accountId);
-        addressee.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), QLatin1String("offline"));
+        addressee.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_CONTACT_ID, contactId);
+        addressee.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_ACCOUNT_PATH, accountId);
+        addressee.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_PRESENCE, m_presenceStrings.at(Tp::ConnectionPresenceTypeOffline));
 
         const QString uri = QLatin1String("ktp://") + accountId + QLatin1Char('?') + contactId;
 
@@ -245,7 +250,7 @@ void KTpAllContacts::onContactInvalidated()
 
     //set to offline and emit changed
     KABC::Addressee &vcard = m_contactVCards[uri];
-    vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), QLatin1String("offline"));
+    vcard.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_PRESENCE, QLatin1String("offline"));
     Q_EMIT contactChanged(uri, vcard);
 }
 
@@ -262,10 +267,9 @@ KABC::Addressee KTpAllContacts::contactToAddressee(const Tp::ContactPtr &contact
         vcard.setFormattedName(contact->alias());
         vcard.setCategories(contact->groups());
 
-        //TODO make "telepathy" a member variable string so that we ref count the same object instead of making new strings
-        vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("contactId"), contact->id());
-        vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("accountPath"), account->objectPath());
-        vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), m_presenceStrings.at(contact->presence().type()));
+        vcard.insertCustom(S_KABC_PRODUCT, S_KABC_FIELD_CONTACT_ID, contact->id());
+        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));
         }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list