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


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

The following commit has been merged in the master branch:
commit 1f90687315497b0c1b0e6d8bfe30b2102f35d5f2
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Mon Aug 29 20:58:04 2011 +0100

    Force window to be raised if a special hint is set in the channel request.
---
 app/telepathy-chat-ui.cpp | 50 ++++++++++++++++++++++++++++++++++++++---------
 app/telepathy-chat-ui.h   | 12 ++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/app/telepathy-chat-ui.cpp b/app/telepathy-chat-ui.cpp
index 71c2503..b5e99d7 100644
--- a/app/telepathy-chat-ui.cpp
+++ b/app/telepathy-chat-ui.cpp
@@ -22,9 +22,14 @@
 #include "chat-window.h"
 
 #include <KDebug>
+#include <KConfigGroup>
+#include <KWindowSystem>
+
 #include <TelepathyQt4/ChannelClassSpec>
 #include <TelepathyQt4/TextChannel>
-#include <KConfigGroup>
+#include <TelepathyQt4/ChannelRequest>
+#include <TelepathyQt4/ChannelRequestHints>
+
 
 inline Tp::ChannelClassSpecList channelClassList()
 {
@@ -83,16 +88,15 @@ TelepathyChatUi::~TelepathyChatUi()
 }
 
 void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & context,
-        const Tp::AccountPtr & account,
-        const Tp::ConnectionPtr & connection,
-        const QList<Tp::ChannelPtr> & channels,
-        const QList<Tp::ChannelRequestPtr> & requestsSatisfied,
-        const QDateTime & userActionTime,
-        const Tp::AbstractClientHandler::HandlerInfo & handlerInfo)
+        const Tp::AccountPtr &account,
+        const Tp::ConnectionPtr &connection,
+        const QList<Tp::ChannelPtr> &channels,
+        const QList<Tp::ChannelRequestPtr> &channelRequests,
+        const QDateTime &userActionTime,
+        const Tp::AbstractClientHandler::HandlerInfo &handlerInfo)
 {
     kDebug();
     Q_UNUSED(connection);
-    Q_UNUSED(requestsSatisfied);
     Q_UNUSED(userActionTime);
     Q_UNUSED(handlerInfo);
 
@@ -106,8 +110,24 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
 
     Q_ASSERT(textChannel);
 
+    /*this works round a "bug" in which kwin will _deliberately_ stop the TextUi claiming focus
+     * because it thinks the user is busy interacting with the contact list.
+     * If the special hint org.kde.telepathy forceRaiseWindow is set to true, then we use KWindowSystem::forceActiveWindow
+     * to claim focus.
+     */
+    bool forceRaiseWindowHint = false;
+
+    //find the relevant channelRequest
+    foreach(const Tp::ChannelRequestPtr channelRequest, channelRequests) {
+        kDebug() << channelRequest->hints().allHints();
+        forceRaiseWindowHint = channelRequest->hints().hint("org.kde.telepathy", "forceRaiseWindow").toBool();
+    }
+
+    kDebug() << "force raise window hint set to: " << forceRaiseWindowHint;
+
     bool tabFound = false;
 
+    //search for any tabs which are already handling this channel.
     for (int i = 0; i < m_chatWindows.count() && !tabFound; ++i) {
         ChatWindow *window = m_chatWindows.at(i);
         ChatTab* tab = window->getTab(textChannel);
@@ -123,10 +143,16 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
                 tab->setChatEnabled(true);           // re-enable chat
             }
         }
+
+        if (forceRaiseWindowHint) {
+            KWindowSystem::forceActiveWindow(window->winId());
+        }
+
     }
 
+    //if there is currently no tab containing the incoming channel.
     if (!tabFound) {
-        ChatWindow* window;
+        ChatWindow* window = 0;
         switch (m_openMode) {
             case FirstWindow:
                 window = m_chatWindows.count()?m_chatWindows[0]:createWindow();
@@ -137,9 +163,15 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
                 break;
         }
 
+        Q_ASSERT(window);
+
         ChatTab* tab = new ChatTab(textChannel, account);
         tab->setChatWindow(window);
         window->show();
+
+        if (forceRaiseWindowHint) {
+            KWindowSystem::forceActiveWindow(window->winId());
+        }
     }
 
     context->setFinished();
diff --git a/app/telepathy-chat-ui.h b/app/telepathy-chat-ui.h
index 34075bb..42f522c 100644
--- a/app/telepathy-chat-ui.h
+++ b/app/telepathy-chat-ui.h
@@ -42,12 +42,12 @@ public:
 
 
     virtual void handleChannels(const Tp::MethodInvocationContextPtr<> & context,
-            const Tp::AccountPtr & account,
-            const Tp::ConnectionPtr & connection,
-            const QList<Tp::ChannelPtr> & channels,
-            const QList<Tp::ChannelRequestPtr> & requestsSatisfied,
-            const QDateTime & userActionTime,
-            const Tp::AbstractClientHandler::HandlerInfo & handlerInfo);
+            const Tp::AccountPtr &account,
+            const Tp::ConnectionPtr &connection,
+            const QList<Tp::ChannelPtr> &channels,
+            const QList<Tp::ChannelRequestPtr> &channelRequests,
+            const QDateTime &userActionTime,
+            const Tp::AbstractClientHandler::HandlerInfo &handlerInfo);
 
     virtual bool bypassApproval() const;
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list