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


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

The following commit has been merged in the master branch:
commit b2e1a0236437872920d2a54eb4d72281a25d66cf
Author: George Kiagiadakis <george.kiagiadakis at collabora.co.uk>
Date:   Sun Jan 30 20:16:45 2011 +0200

    Do not show notifications about messages that have already been shown by the approver.
    
    This patch actually splits the handleIncomingMessage() function into
    two functions, one that shows the message on the window and one that
    shows a notification, and connects them independently on the incoming
    message signal. This way, while the chat is initializing, new incoming
    messages are shown in the notification area, but not on the chat view.
    When the chat view is ready, it processes all the queued messages, which
    include the ones that were shown earlier on the approver and the ones that
    were shown while the view was initializing.
---
 lib/chatwindow.cpp | 74 ++++++++++++++++++++++++++++--------------------------
 lib/chatwindow.h   |  3 +++
 2 files changed, 42 insertions(+), 35 deletions(-)

diff --git a/lib/chatwindow.cpp b/lib/chatwindow.cpp
index 32268e4..a8fea03 100644
--- a/lib/chatwindow.cpp
+++ b/lib/chatwindow.cpp
@@ -181,6 +181,8 @@ void ChatWindow::init()
 
     connect(d->channel.data(), SIGNAL(messageReceived(Tp::ReceivedMessage)),
             SLOT(handleIncomingMessage(Tp::ReceivedMessage)));
+    connect(d->channel.data(), SIGNAL(messageReceived(Tp::ReceivedMessage)),
+            SLOT(notifyAboutIncomingMessage(Tp::ReceivedMessage)));
     connect(d->channel.data(), SIGNAL(messageSent(Tp::Message,Tp::MessageSendingFlags,QString)),
             SLOT(handleMessageSent(Tp::Message,Tp::MessageSendingFlags,QString)));
     connect(d->channel.data(), SIGNAL(chatStateChanged(Tp::ContactPtr,Tp::ChannelChatState)),
@@ -256,49 +258,51 @@ void ChatWindow::handleIncomingMessage(const Tp::ReceivedMessage &message)
         d->channel->acknowledge(QList<Tp::ReceivedMessage>() << message);
 
         emit messageReceived();
+    }
 
+    //if the window isn't ready, we don't acknowledge the mesage. We process them as soon as we are ready.
+}
 
-        //send the correct notification:
-        QString notificationType;
-        //choose the correct notification type:
-        //options are:
-        // kde_telepathy_contact_incoming
-        // kde_telepathy_contact_incoming_active_window - TODO - requires information not available yet.
-        // kde_telepathy_contact_highlight (contains your name)
-        // kde_telepathy_info_event
-
-        //if the message text contains sender name, it's a "highlighted message"
-        //TODO DrDanz suggested this could be a configurable list of words that make it highlighted.(seems like a good idea to me)
-        if(message.text().contains(d->channel->connection()->selfContact()->alias())) {
-            notificationType = QLatin1String("kde_telepathy_contact_highlight");
-        } else if(message.messageType() == Tp::ChannelTextMessageTypeNotice) {
-            notificationType = QLatin1String("kde_telepathy_info_event");
-        } else {
-            notificationType = QLatin1String("kde_telepathy_contact_incoming");
-        }
-
+void ChatWindow::notifyAboutIncomingMessage(const Tp::ReceivedMessage & message)
+{
+    //send the correct notification:
+    QString notificationType;
+    //choose the correct notification type:
+    //options are:
+    // kde_telepathy_contact_incoming
+    // kde_telepathy_contact_incoming_active_window - TODO - requires information not available yet.
+    // kde_telepathy_contact_highlight (contains your name)
+    // kde_telepathy_info_event
+
+    //if the message text contains sender name, it's a "highlighted message"
+    //TODO DrDanz suggested this could be a configurable list of words that make it highlighted.(seems like a good idea to me)
+    if(message.text().contains(d->channel->connection()->selfContact()->alias())) {
+        notificationType = QLatin1String("kde_telepathy_contact_highlight");
+    } else if(message.messageType() == Tp::ChannelTextMessageTypeNotice) {
+        notificationType = QLatin1String("kde_telepathy_info_event");
+    } else {
+        notificationType = QLatin1String("kde_telepathy_contact_incoming");
+    }
 
-        KNotification *notification = new KNotification(notificationType, this);
-        notification->setComponentData(d->telepathyComponentData());
-        notification->setTitle(i18n("%1 has sent you a message", message.sender()->alias()));
 
-        QPixmap notificationPixmap;
-        if (notificationPixmap.load(message.sender()->avatarData().fileName)) {
-            notification->setPixmap(notificationPixmap);
-        }
+    KNotification *notification = new KNotification(notificationType, this);
+    notification->setComponentData(d->telepathyComponentData());
+    notification->setTitle(i18n("%1 has sent you a message", message.sender()->alias()));
 
-        notification->setText(message.text());
-        //allows per contact notifications
-        notification->addContext("contact", message.sender()->id());
-        //TODO notification->addContext("group",... Requires KDE Telepathy Contact to work out which group they are in.
+    QPixmap notificationPixmap;
+    if (notificationPixmap.load(message.sender()->avatarData().fileName)) {
+        notification->setPixmap(notificationPixmap);
+    }
 
-        notification->setActions(QStringList(i18n("View")));
-        connect(notification, SIGNAL(activated(unsigned int)), notification, SLOT(raiseWidget()));
+    notification->setText(message.text());
+    //allows per contact notifications
+    notification->addContext("contact", message.sender()->id());
+    //TODO notification->addContext("group",... Requires KDE Telepathy Contact to work out which group they are in.
 
-        notification->sendEvent();
-    }
+    notification->setActions(QStringList(i18n("View")));
+    connect(notification, SIGNAL(activated(unsigned int)), notification, SLOT(raiseWidget()));
 
-    //if the window isn't ready, we don't acknowledge the mesage. We process them as soon as we are ready.
+    notification->sendEvent();
 }
 
 void ChatWindow::handleMessageSent(const Tp::Message &message, Tp::MessageSendingFlags, const QString&) /*Not sure what these other args are for*/
diff --git a/lib/chatwindow.h b/lib/chatwindow.h
index f7b812c..11bc023 100644
--- a/lib/chatwindow.h
+++ b/lib/chatwindow.h
@@ -49,6 +49,9 @@ protected slots:
     /** Show the received message in the chat window*/
     void handleIncomingMessage(const Tp::ReceivedMessage & message);
 
+    /** Show notification about a received message */
+    void notifyAboutIncomingMessage(const Tp::ReceivedMessage & message);
+
     /** Show the message sent in the chat window*/
     void handleMessageSent(const Tp::Message & message,
                            Tp::MessageSendingFlags flags,

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list