[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:49 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=f9af356
The following commit has been merged in the master branch:
commit f9af356ba9c7b7fff2ce4f40cabb1cd6cab20dbd
Author: Martin Klapetek <mklapetek at kde.org>
Date: Fri Apr 3 13:44:48 2015 +0200
Add KTp::Contact::uri() method
More and more places require/use the uri() (especially with the
KActivities now involved) and so the uri() should become shared
somewhere. As it always needs contact ID anyway, I made it a new
method of KTp::Contact.
REVIEW: 123230
---
KTp/contact.cpp | 8 ++++++++
KTp/contact.h | 6 ++++++
kpeople/datasourceplugin/im-persons-data-source.cpp | 18 ++++--------------
3 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/KTp/contact.cpp b/KTp/contact.cpp
index f5ffa5a..f849428 100644
--- a/KTp/contact.cpp
+++ b/KTp/contact.cpp
@@ -59,6 +59,14 @@ QString KTp::Contact::accountUniqueIdentifier() const
return m_accountUniqueIdentifier;
}
+QString KTp::Contact::uri() const
+{
+ // so real ID will look like
+ // ktp://gabble/jabber/blah/asdfjwer?foo@bar.com
+ // ? is used as it is not a valid character in the dbus path that makes up the account UID
+ return QStringLiteral("ktp://") + m_accountUniqueIdentifier + QLatin1Char('?') + id();
+}
+
KTp::Presence KTp::Contact::presence() const
{
if (!manager() || !manager()->connection()) {
diff --git a/KTp/contact.h b/KTp/contact.h
index 3505765..b336faf 100644
--- a/KTp/contact.h
+++ b/KTp/contact.h
@@ -58,6 +58,12 @@ public:
QString accountUniqueIdentifier() const;
+ /**
+ * Returns unique identifier for this contact in the form of
+ * ktp:// + account unique ID + ? + contact ID
+ */
+ QString uri() const;
+
Q_SIGNALS:
void invalidated();
diff --git a/kpeople/datasourceplugin/im-persons-data-source.cpp b/kpeople/datasourceplugin/im-persons-data-source.cpp
index 81bb90a..be65f2e 100644
--- a/kpeople/datasourceplugin/im-persons-data-source.cpp
+++ b/kpeople/datasourceplugin/im-persons-data-source.cpp
@@ -64,8 +64,6 @@ private Q_SLOTS:
void onAccountCurrentPresenceChanged(const Tp::Presence ¤tPresence);
private:
- QString createUri(const KTp::ContactPtr &contact) const;
-
//presence names indexed by ConnectionPresenceType
QMap<QString, AbstractContact::Ptr> m_contactVCards;
};
@@ -240,14 +238,6 @@ void KTpAllContacts::loadCache(const QString &accountId)
emitInitialFetchComplete(true);
}
-QString KTpAllContacts::createUri(const KTp::ContactPtr &contact) const
-{
- // so real ID will look like
- // ktp://gabble/jabber/blah/asdfjwer?foo@bar.com
- // ? is used as it is not a valid character in the dbus path that makes up the account UID
- return QLatin1String("ktp://") + contact->accountUniqueIdentifier() + QLatin1Char('?') + contact->id();
-}
-
void KTpAllContacts::onAccountManagerReady(Tp::PendingOperation *op)
{
if (op->isError()) {
@@ -286,7 +276,7 @@ void KTpAllContacts::onAllKnownContactsChanged(const Tp::Contacts &contactsAdded
if (!m_contactVCards.isEmpty()) {
Q_FOREACH (const Tp::ContactPtr &c, contactsRemoved) {
const KTp::ContactPtr &contact = KTp::ContactPtr::qObjectCast(c);
- const QString uri = createUri(contact);
+ const QString uri = contact->uri();
m_contactVCards.remove(uri);
Q_EMIT contactRemoved(uri);
}
@@ -294,7 +284,7 @@ void KTpAllContacts::onAllKnownContactsChanged(const Tp::Contacts &contactsAdded
Q_FOREACH (const Tp::ContactPtr &contact, contactsAdded) {
KTp::ContactPtr ktpContact = KTp::ContactPtr::qObjectCast(contact);
- const QString uri = createUri(ktpContact);
+ const QString uri = ktpContact->uri();
AbstractContact::Ptr vcard = m_contactVCards.value(uri);
bool added = false;
@@ -337,14 +327,14 @@ void KTpAllContacts::onAllKnownContactsChanged(const Tp::Contacts &contactsAdded
void KTpAllContacts::onContactChanged()
{
const KTp::ContactPtr contact(qobject_cast<KTp::Contact*>(sender()));
- const QString uri = createUri(contact);
+ const QString uri = contact->uri();
Q_EMIT contactChanged(uri, m_contactVCards.value(uri));
}
void KTpAllContacts::onContactInvalidated()
{
const KTp::ContactPtr contact(qobject_cast<KTp::Contact*>(sender()));
- const QString uri = createUri(contact);
+ const QString uri = contact->uri();
//set to offline and emit changed
AbstractContact::Ptr vcard = m_contactVCards.value(uri);
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list