[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:23 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=cb7113f

The following commit has been merged in the master branch:
commit cb7113f10b0d60a0d843be8c6569fec8f962a550
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Sat Jun 18 12:15:24 2011 +0200

    Part 3of3 - ADD new action buttons to chat handler
    
    Buttons are activated according to both self and contact capabilities.
    REVIEW: 101645
    Reviewed By: David Edmundson
---
 app/chat-window.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 app/chat-window.h   |  6 ++++++
 lib/chat-widget.h   |  1 +
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index b5b8b7a..e550c83 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -1,6 +1,7 @@
 /*
     Copyright (C) 2010  David Edmundson <kde at davidedmundson.co.uk>
     Copyright (C) 2011  Dominik Schmidt <dev at dominik-schmidt.de>
+    Copyright (C) 2011  Francesco Nwokeka <francesco.nwokeka at gmail.com>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -40,6 +41,7 @@
 #include <KLineEdit>
 
 #include <TelepathyQt4/Account>
+#include <TelepathyQt4/ContactCapabilities>
 #include <TelepathyQt4/PendingChannelRequest>
 #include <TelepathyQt4/TextChannel>
 
@@ -186,7 +188,7 @@ void ChatWindow::onCurrentIndexChanged(int index)
 {
     kDebug() << index;
 
-    if(index == -1) {
+    if (index == -1) {
         close();
         return;
     }
@@ -201,6 +203,17 @@ void ChatWindow::onCurrentIndexChanged(int index)
     } else {
         onEnableSearchActions(true);
     }
+
+    // check which capabilities the contact and user supports
+    Tp::ContactCapabilities contactCapabilites = currentChatTab->textChannel()->targetContact()->capabilities();
+    Tp::ContactCapabilities selfCapabilities = currentChatTab->account()->connection()->selfContact()->capabilities();
+
+    setAudioCallEnabled(selfCapabilities.streamedMediaAudioCalls() && contactCapabilites.streamedMediaAudioCalls());
+    setFileTransferEnabled(selfCapabilities.fileTransfers() && contactCapabilites.fileTransfers());
+    setVideoCallEnabled(selfCapabilities.streamedMediaVideoCalls() && contactCapabilites.streamedMediaVideoCalls());
+
+    /// TODO re-activate check when invitation to chat has been sorted out
+    setInviteToChatEnabled(false);
 }
 
 void ChatWindow::onEnableSearchActions(bool enable)
@@ -423,6 +436,43 @@ void ChatWindow::setupCustomActions()
     actionCollection()->addAction("invite-to-chat", inviteToChat);
 }
 
+void ChatWindow::setAudioCallEnabled(bool enable)
+{
+    QAction *action = actionCollection()->action("audio-call");
+
+    // don't want to segfault. Should never happen
+    if (action) {
+        action->setEnabled(enable);
+    }
+}
+
+void ChatWindow::setFileTransferEnabled(bool enable)
+{
+    QAction *action = actionCollection()->action("send-file");
+
+    if (action) {
+        action->setEnabled(enable);
+    }
+}
+
+void ChatWindow::setInviteToChatEnabled(bool enable)
+{
+    QAction *action = actionCollection()->action("invite-to-chat");
+
+    if (action) {
+        action->setEnabled(enable);
+    }
+}
+
+void ChatWindow::setVideoCallEnabled(bool enable)
+{
+    QAction *action = actionCollection()->action("video-call");
+
+    if (action) {
+        action->setEnabled(enable);
+    }
+}
+
 void ChatWindow::startAudioCall(const Tp::AccountPtr& account, const Tp::ContactPtr& contact)
 {
     Tp::PendingChannelRequest* channelRequest = account->ensureStreamedMediaAudioCall(contact,
diff --git a/app/chat-window.h b/app/chat-window.h
index 661cbea..3a14401 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -97,6 +97,12 @@ private:
     /** creates and adds custom actions for the chat window */
     void setupCustomActions();
 
+    /** setters for chat actions */
+    void setAudioCallEnabled(bool enable);
+    void setFileTransferEnabled(bool enable);
+    void setInviteToChatEnabled(bool enable);
+    void setVideoCallEnabled(bool enable);
+
     /** starts audio call with given contact
      * @param account account sending the audio call request
      * @param contact contact with whom to start audio call
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index feacc7b..0255beb 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -1,5 +1,6 @@
 /***************************************************************************
  *   Copyright (C) 2010 by David Edmundson <kde at davidedmundson.co.uk>      *
+ *   Copyright (C) 2011 by Francesco Nwokeka <francesco.nwokeka at gmail.com> *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list