[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:11:29 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=c02cd91

The following commit has been merged in the master branch:
commit c02cd91ca34c533504be0572fc1b737cd3d9b607
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Sat Aug 20 11:35:40 2011 +0200

    Prepared signals for default actions (chat, mail, call)
    
    Had to pass the Tp::AccountPtr related to the contact as well to obtain the possibility to start chats.
---
 src/config.cpp                               |  6 +++++-
 src/config.h                                 |  5 ++---
 src/contactWrapper.cpp                       | 20 +++++++++++++++++++-
 src/contactWrapper.h                         | 10 +++++++++-
 src/declarative/contents/ui/DropDownMenu.qml | 12 ++++++++++++
 src/telepathyContact.cpp                     |  6 +++---
 src/telepathyContact.h                       |  3 ++-
 7 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/src/config.cpp b/src/config.cpp
index a8c0369..7ca6056 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -157,7 +157,11 @@ void Config::slotButtonClicked(int button)
     if (button == KDialog::Ok && selectedItem.isValid()) {
         if (selectedItem.data(AccountsModel::ItemRole).userType() == qMetaTypeId<ContactModelItem*>()) {
             ContactModelItem *item = selectedItem.data(AccountsModel::ItemRole).value<ContactModelItem*>();
-            setNewContact(item->contact());
+
+            // retrieve account related to the contact
+            Tp::AccountPtr account = m_model->accountForContactItem(item);
+
+            setNewContact(item->contact(), account);
             accept();
         }
     }
diff --git a/src/config.h b/src/config.h
index 63357f0..f977afd 100644
--- a/src/config.h
+++ b/src/config.h
@@ -42,7 +42,7 @@ public:
     ~Config();
 
 signals:
-    void setNewContact(const Tp::ContactPtr &newContact);
+    void setNewContact(const Tp::ContactPtr &newContact, const Tp::AccountPtr &relatedAccount);
 
 protected slots:
     void slotButtonClicked(int button);
@@ -54,8 +54,7 @@ private slots:
     void onAccountManagerReady(Tp::PendingOperation* op);
 
 private:
-    /** prepare the contacts to be show in the list */
-    void setupContactsList();
+    void setupContactsList();                               /** prepare the contacts to be show in the list */
 
     AccountsModel *m_model;
     AccountsFilterModel *m_modelFilter;
diff --git a/src/contactWrapper.cpp b/src/contactWrapper.cpp
index 1c725ef..bf513c0 100644
--- a/src/contactWrapper.cpp
+++ b/src/contactWrapper.cpp
@@ -25,6 +25,7 @@
 ContactWrapper::ContactWrapper(QObject* parent)
     : QObject(parent)
     , m_contact(0)
+    , m_account(0)
 {
 }
 
@@ -75,13 +76,30 @@ void ContactWrapper::setupConnects()
     connect(m_contact.data(), SIGNAL(presenceChanged(Tp::Presence)), this, SIGNAL(presenceChanged()));
 }
 
-void ContactWrapper::setContact(const Tp::ContactPtr& newContact)
+void ContactWrapper::sendMail()
+{
+    qDebug("ContactWrapper::sendMail");
+}
+
+void ContactWrapper::startAudioCall()
+{
+    qDebug("ContactWrapper::startAudioCall");
+}
+
+void ContactWrapper::startTextChat()
+{
+    qDebug("ContactWrapper::startTextChat");
+}
+
+void ContactWrapper::setContact(const Tp::ContactPtr& newContact, const Tp::AccountPtr &relatedAccount)
 {
     qDebug() << "setting new contact to: " << newContact->id();
+    qDebug() << "with account " << relatedAccount->displayName();
 
     // disconnect signals
     undoConnects();
     m_contact = newContact;
+    m_account = relatedAccount;
 
     // establish new signals
     setupConnects();
diff --git a/src/contactWrapper.h b/src/contactWrapper.h
index 1847891..6474555 100644
--- a/src/contactWrapper.h
+++ b/src/contactWrapper.h
@@ -22,6 +22,7 @@
 
 #include <QtCore/QObject>
 
+#include <TelepathyQt4/Account>
 #include <TelepathyQt4/Contact>
 
 class ContactWrapper : public QObject
@@ -49,8 +50,14 @@ public:
 
     /** set new contact to rappresent
      * @param newContact the contact to rappresent
+     * @param relatedAccoutn the account related to the contact to set
      */
-    void setContact(const Tp::ContactPtr &newContact);
+    void setContact(const Tp::ContactPtr &newContact, const Tp::AccountPtr &relatedAccount);
+
+public slots:
+    void sendMail();
+    void startAudioCall();
+    void startTextChat();
 
 signals:
     void avatarChanged();
@@ -61,6 +68,7 @@ private:
     void setupConnects();
     void undoConnects();
 
+    Tp::AccountPtr m_account;
     Tp::ContactPtr m_contact;
 };
 
diff --git a/src/declarative/contents/ui/DropDownMenu.qml b/src/declarative/contents/ui/DropDownMenu.qml
index 48f0b5f..ca22aaf 100644
--- a/src/declarative/contents/ui/DropDownMenu.qml
+++ b/src/declarative/contents/ui/DropDownMenu.qml
@@ -33,6 +33,10 @@ Item {
             icon: QIcon("call-start");
             width: 22;
             height: 22
+
+            onClicked: {
+                TelepathyContact.startAudioCall();
+            }
         }
 
         PlasmaWidgets.IconWidget {
@@ -40,6 +44,10 @@ Item {
             icon: QIcon("mail-flag");
             width: 22;
             height: 22
+
+            onClicked: {
+                TelepathyContact.sendMail();
+            }
         }
 
         PlasmaWidgets.IconWidget {
@@ -47,6 +55,10 @@ Item {
             icon: QIcon("document-edit");
             width: 22;
             height: 22;
+
+            onClicked: {
+                TelepathyContact.startTextChat();
+            }
         }
     }
 
diff --git a/src/telepathyContact.cpp b/src/telepathyContact.cpp
index d605ca2..9e2426d 100644
--- a/src/telepathyContact.cpp
+++ b/src/telepathyContact.cpp
@@ -44,7 +44,7 @@ TelepathyContact::TelepathyContact(QObject* parent, const QVariantList& args)
     // user shouldn't be able to resize the plasmoid
     setAspectRatioMode(Plasma::FixedSize);
 
-    connect(m_config, SIGNAL(setNewContact(Tp::ContactPtr)), this, SLOT(setContact(Tp::ContactPtr)));
+    connect(m_config, SIGNAL(setNewContact(Tp::ContactPtr, Tp::AccountPtr)), this, SLOT(setContact(Tp::ContactPtr, Tp::AccountPtr)));
 }
 
 TelepathyContact::~TelepathyContact()
@@ -80,12 +80,12 @@ void TelepathyContact::paintInterface(QPainter* p, const QStyleOptionGraphicsIte
     Plasma::Applet::paintInterface(p, option, contentsRect);
 }
 
-void TelepathyContact::setContact(const Tp::ContactPtr& newContact)
+void TelepathyContact::setContact(const Tp::ContactPtr& newContact, const Tp::AccountPtr &relatedAccount)
 {
     Q_ASSERT(newContact);
 
     if (!m_contact->contact() || m_contact->contact()->id() != newContact->id()) {
-        m_contact->setContact(newContact);
+        m_contact->setContact(newContact, relatedAccount);
     }
 }
 
diff --git a/src/telepathyContact.h b/src/telepathyContact.h
index 354dae2..f7871c4 100644
--- a/src/telepathyContact.h
+++ b/src/telepathyContact.h
@@ -46,8 +46,9 @@ public:
 public slots:
     /** called from config dialog to set new contact
      * @param newContact Tp::ContactPtr to the new contact to use
+     * @param relatedAccount Tp:AccountPtr to the account related to the contact
      */
-    void setContact(const Tp::ContactPtr &newContact);
+    void setContact(const Tp::ContactPtr &newContact, const Tp::AccountPtr &relatedAccount);
 
 private:
     Config *m_config;

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list