[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:07:36 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=8127242

The following commit has been merged in the master branch:
commit 812724298a2eaebe1c3f3f9957d4e3844e4df696
Author: George Kiagiadakis <george.kiagiadakis at collabora.com>
Date:   Mon Sep 19 20:43:56 2011 +0300

    Add button and context menu action to start desktop sharing.
---
 contact-overlays.cpp | 13 +++++++++++++
 contact-overlays.h   | 10 ++++++++++
 main-widget.cpp      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 main-widget.h        |  2 ++
 4 files changed, 77 insertions(+)

diff --git a/contact-overlays.cpp b/contact-overlays.cpp
index 026e3d3..6b13a93 100644
--- a/contact-overlays.cpp
+++ b/contact-overlays.cpp
@@ -173,4 +173,17 @@ FileTransferContactOverlay::FileTransferContactOverlay(QObject* parent)
 {
 }
 
+// -------------------------------------------------------------------------
+
+DesktopSharingContactOverlay::DesktopSharingContactOverlay(QObject* parent)
+    : StartChannelContactOverlay(
+        parent,
+        KGuiItem(i18n("Share my desktop"), "krfb",
+                 i18n("Share my desktop"), i18n("Share desktop using RFB")),
+        AccountsModel::DesktopSharingCapabilityRole,
+        152)
+{
+}
+
+
 #include "contact-overlays.moc"
diff --git a/contact-overlays.h b/contact-overlays.h
index 43bcf23..f232c5c 100644
--- a/contact-overlays.h
+++ b/contact-overlays.h
@@ -101,4 +101,14 @@ public:
     FileTransferContactOverlay(QObject* parent);
 };
 
+// ---------------------------------------------------------------------
+
+class DesktopSharingContactOverlay : public StartChannelContactOverlay
+{
+    Q_OBJECT
+
+public:
+    DesktopSharingContactOverlay(QObject* parent);
+};
+
 #endif // VERSIONSOVERLAYS_H
diff --git a/main-widget.cpp b/main-widget.cpp
index 98abf29..77bed26 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -80,6 +80,7 @@
 #define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
 #define PREFERRED_FILETRANSFER_HANDLER "org.freedesktop.Telepathy.Client.KDE.FileTransfer"
 #define PREFERRED_AUDIO_VIDEO_HANDLER "org.freedesktop.Telepathy.Client.KDE.CallUi"
+#define PREFERRED_RFB_HANDLER "org.freedesktop.Telepathy.Client.krfb_rfb_handler"
 
 bool kde_tp_filter_contacts_by_publication_status(const Tp::ContactPtr &contact)
 {
@@ -543,6 +544,21 @@ void MainWidget::startVideoChannel(ContactModelItem *contactItem)
             this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
 }
 
+void MainWidget::startDesktopSharing(ContactModelItem* contactItem)
+{
+    Q_ASSERT(contactItem);
+    Tp::ContactPtr contact = contactItem->contact();
+
+    kDebug() << "Requesting desktop sharing for contact" << contact->alias();
+
+    Tp::AccountPtr account = m_model->accountForContactItem(contactItem);
+
+    Tp::PendingChannelRequest* channelRequest = account->createStreamTube(contact,
+            QLatin1String("rfb"), QDateTime::currentDateTime(), PREFERRED_RFB_HANDLER);
+
+    connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)),
+            this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
 
 void MainWidget::startFileTransferChannel(ContactModelItem *contactItem)
 {
@@ -602,11 +618,13 @@ void MainWidget::addOverlayButtons()
     VideoChannelContactOverlay* videoOverlay = new VideoChannelContactOverlay(this);
 
     FileTransferContactOverlay* fileOverlay  = new FileTransferContactOverlay(this);
+    DesktopSharingContactOverlay *desktopOverlay = new DesktopSharingContactOverlay(this);
 
     m_delegate->installOverlay(textOverlay);
     m_delegate->installOverlay(audioOverlay);
     m_delegate->installOverlay(videoOverlay);
     m_delegate->installOverlay(fileOverlay);
+    m_delegate->installOverlay(desktopOverlay);
 
     textOverlay->setView(m_contactsListView);
     textOverlay->setActive(true);
@@ -620,12 +638,16 @@ void MainWidget::addOverlayButtons()
     fileOverlay->setView(m_contactsListView);
     fileOverlay->setActive(true);
 
+    desktopOverlay->setView(m_contactsListView);
+    desktopOverlay->setActive(true);
+
     connect(textOverlay, SIGNAL(overlayActivated(QModelIndex)),
             m_delegate, SLOT(hideStatusMessageSlot(QModelIndex)));
 
     connect(textOverlay, SIGNAL(overlayHidden()),
             m_delegate, SLOT(reshowStatusMessageSlot()));
 
+
     connect(textOverlay, SIGNAL(activated(ContactModelItem*)),
             this, SLOT(startTextChannel(ContactModelItem*)));
 
@@ -638,6 +660,10 @@ void MainWidget::addOverlayButtons()
     connect(videoOverlay, SIGNAL(activated(ContactModelItem*)),
             this, SLOT(startVideoChannel(ContactModelItem*)));
 
+    connect(desktopOverlay, SIGNAL(activated(ContactModelItem*)),
+            this, SLOT(startDesktopSharing(ContactModelItem*)));
+
+
     connect(this, SIGNAL(enableOverlays(bool)),
             textOverlay, SLOT(setActive(bool)));
 
@@ -650,6 +676,8 @@ void MainWidget::addOverlayButtons()
     connect(this, SIGNAL(enableOverlays(bool)),
             fileOverlay, SLOT(setActive(bool)));
 
+    connect(this, SIGNAL(enableOverlays(bool)),
+            desktopOverlay, SLOT(setActive(bool)));
 }
 
 void MainWidget::toggleSearchWidget(bool show)
@@ -793,6 +821,16 @@ KMenu* MainWidget::contactContextMenu(const QModelIndex &index)
         action->setEnabled(true);
     }
 
+    action = menu->addAction(i18n("Share my desktop..."));
+    action->setIcon(KIcon("krfb"));
+    action->setDisabled(true);
+    connect(action, SIGNAL(triggered(bool)),
+            SLOT(onStartDesktopSharingTriggered()));
+
+    if (index.data(AccountsModel::DesktopSharingCapabilityRole).toBool()) {
+        action->setEnabled(true);
+    }
+
     // add "goto" submenu for navigating to links the contact has in presence message
     // first check to see if there are any links in the contact's presence message
     QStringList contactLinks = extractLinksFromIndex(index);
@@ -1129,6 +1167,20 @@ void MainWidget::onStartFileTransferTriggered()
     }
 }
 
+void MainWidget::onStartDesktopSharingTriggered()
+{
+    QModelIndex index = m_contactsListView->currentIndex();
+    if (!index.isValid()) {
+        kDebug() << "Invalid index provided.";
+        return;
+    }
+
+    ContactModelItem* item = index.data(AccountsModel::ItemRole).value<ContactModelItem*>();
+    if (item) {
+        startDesktopSharing(item);
+    }
+}
+
 void MainWidget::onUnblockContactTriggered()
 {
     QModelIndex index = m_contactsListView->currentIndex();
diff --git a/main-widget.h b/main-widget.h
index 6843af5..65f076d 100644
--- a/main-widget.h
+++ b/main-widget.h
@@ -84,6 +84,7 @@ public Q_SLOTS:
     void startFileTransferChannel(ContactModelItem *contactItem);
     void startAudioChannel(ContactModelItem *contactItem);
     void startVideoChannel(ContactModelItem *contactItem);
+    void startDesktopSharing(ContactModelItem *contactItem);
 
     void goOffline();
 
@@ -94,6 +95,7 @@ private Q_SLOTS:
     void onStartAudioChatTriggered();
     void onStartVideoChatTriggered();
     void onStartFileTransferTriggered();
+    void onStartDesktopSharingTriggered();
     void onUnblockContactTriggered();
     void onCreateNewGroupTriggered();
     void onRenameGroupTriggered();

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list