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


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

The following commit has been merged in the master branch:
commit 9b54830b83583b9feca72f72b10ac542de1d4fc6
Author: Jan Stourac <stourac.jan at gmail.com>
Date:   Wed Apr 2 16:47:34 2014 +0200

    Add support for refresh of publish and subscription state
    
    dialog does not show correct icon indicating publish/subscription state due to missing roster feature of connection...
    
    REVIEW: 115844
---
 KTp/contact-info-dialog.cpp | 31 ++++++++++++++++++++++++++++---
 KTp/contact-info-dialog.h   |  1 +
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/KTp/contact-info-dialog.cpp b/KTp/contact-info-dialog.cpp
index 1e7087e..7cc53d3 100644
--- a/KTp/contact-info-dialog.cpp
+++ b/KTp/contact-info-dialog.cpp
@@ -34,6 +34,7 @@
 #include <TelepathyQt/Connection>
 #include <TelepathyQt/Account>
 #include <TelepathyQt/PendingContacts>
+#include <TelepathyQt/PendingReady>
 
 #include <KDebug>
 #include <KTitleWidget>
@@ -93,9 +94,11 @@ class ContactInfoDialog::Private
     void onChangeAvatarButtonClicked();
     void onClearAvatarButtonClicked();
     void onInfoDataChanged();
+    void onFeatureRosterReady(Tp::PendingOperation *op);
 
     void addInfoRow(InfoRowIndex index, const QString &value);
     void addStateRow(const QString &description, Tp::Contact::PresenceState state);
+    void loadStateRows();
 
     Tp::AccountPtr account;
     KTp::ContactPtr contact;
@@ -170,6 +173,11 @@ void ContactInfoDialog::Private::onContactUpgraded(Tp::PendingOperation* op)
     }
 }
 
+void ContactInfoDialog::Private::onFeatureRosterReady(Tp::PendingOperation *op)
+{
+    loadStateRows();
+}
+
 void ContactInfoDialog::Private::onContactInfoReceived(Tp::PendingOperation* op)
 {
     Tp::PendingContactInfo *ci = qobject_cast<Tp::PendingContactInfo*>(op);
@@ -314,6 +322,15 @@ void ContactInfoDialog::Private::addStateRow(const QString& description, Tp::Con
     stateLayout->addRow(descriptionLabel, stateLabel);
 }
 
+void ContactInfoDialog::Private::loadStateRows()
+{
+    if(stateLayout) {
+        addStateRow(i18n("Contact can see when you are online:"), contact->publishState());
+        addStateRow(i18n("You can see when the contact is online:"), contact->subscriptionState());
+        addStateRow(i18n("Contact is blocked:"), contact->isBlocked() ? Tp::Contact::PresenceStateYes : Tp::Contact::PresenceStateNo);
+    }
+}
+
 ContactInfoDialog::ContactInfoDialog(const Tp::AccountPtr& account, const Tp::ContactPtr& contact, QWidget* parent)
     : KDialog(parent)
     , d(new Private(this))
@@ -364,9 +381,17 @@ ContactInfoDialog::ContactInfoDialog(const Tp::AccountPtr& account, const Tp::Co
         d->stateLayout = new QFormLayout();
         d->stateLayout->setSpacing(10);
         layout->addLayout(d->stateLayout);
-        d->addStateRow(i18n("Contact can see when you are online:"), contact->publishState());
-        d->addStateRow(i18n("You can see when the contact is online:"), contact->subscriptionState());
-        d->addStateRow(i18n("Contact is blocked:"), contact->isBlocked() ? Tp::Contact::PresenceStateYes : Tp::Contact::PresenceStateNo);
+
+        // Fetch roster feature, if it is supported, but not loaded
+        Tp::ConnectionPtr conn = contact->manager()->connection();
+        if(!conn->actualFeatures().contains(Tp::Connection::FeatureRoster) && !conn->missingFeatures().contains(Tp::Connection::FeatureRoster)) {
+            Tp::PendingReady *pr = conn->becomeReady(Tp::Features() << Tp::Connection::FeatureRoster);
+
+            connect(pr, SIGNAL(finished(Tp::PendingOperation*)),
+                    SLOT(onFeatureRosterReady(Tp::PendingOperation*)));
+        } else {
+            d->loadStateRows();
+        }
     }
 }
 
diff --git a/KTp/contact-info-dialog.h b/KTp/contact-info-dialog.h
index 2bf8a57..36dc9af 100644
--- a/KTp/contact-info-dialog.h
+++ b/KTp/contact-info-dialog.h
@@ -52,6 +52,7 @@ class KTP_EXPORT ContactInfoDialog : public KDialog
     Q_PRIVATE_SLOT(d, void onChangeAvatarButtonClicked())
     Q_PRIVATE_SLOT(d, void onClearAvatarButtonClicked())
     Q_PRIVATE_SLOT(d, void onInfoDataChanged())
+    Q_PRIVATE_SLOT(d, void onFeatureRosterReady(Tp::PendingOperation *op))
 
 };
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list