[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:01 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=b501e51
The following commit has been merged in the master branch:
commit b501e512cdc66e6025211d1af6fc7c29049e6091
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Thu Mar 10 03:11:28 2011 +0000
Track for window activation events, and use these to clear the unread
message count.
---
lib/chat-widget.cpp | 35 +++++++++++++++++++++++++++++++++--
lib/chat-widget.h | 1 +
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 88cdd1c..6ea639b 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -69,6 +69,24 @@ Q_SIGNALS:
void returnKeyPressed();
};
+class WindowEventFilter : public QObject
+{
+ Q_OBJECT
+public:
+ WindowEventFilter(QObject* parent = 0) : QObject(parent) {}
+
+protected:
+ virtual bool eventFilter(QObject *obj, QEvent *event)
+ {
+ if (event->type() == QEvent::ActivationChange) {
+ Q_EMIT windowActivated();
+ }
+ return QObject::eventFilter(obj, event);
+ }
+
+Q_SIGNALS:
+ void windowActivated();
+};
class ChatWidgetPrivate
{
@@ -107,7 +125,6 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, QWidget *parent)
{
d->channel = channel;
-
d->chatviewlInitialised = false;
d->showFormatToolbarAction = new QAction(i18n("Show format options"), this);
d->isGroupChat = false;
@@ -203,6 +220,11 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, QWidget *parent)
d->ui.sendMessageBox->installEventFilter(messageBoxEventFilter);
connect(messageBoxEventFilter, SIGNAL(returnKeyPressed()), SLOT(sendMessage()));
connect(d->ui.sendButton, SIGNAL(clicked()), SLOT(sendMessage()));
+
+ WindowEventFilter *windowEventFilter = new WindowEventFilter(this);
+ this->window()->installEventFilter(windowEventFilter);
+ connect(windowEventFilter, SIGNAL(windowActivated()), SLOT(windowActivated()));
+
}
ChatWidget::~ChatWidget()
@@ -248,6 +270,7 @@ void ChatWidget::showEvent(QShowEvent* e)
QWidget::showEvent(e);
}
+
QString ChatWidget::title() const
{
return d->title;
@@ -286,7 +309,7 @@ QColor ChatWidget::titleColor() const
return scheme.foreground(KColorScheme::PositiveText).color();
}
- if (d->unreadMessages > 0) {
+ if (d->unreadMessages > 0 && !isOnTop()) {
kDebug() << "unread messages";
return scheme.foreground(KColorScheme::ActiveText).color();
}
@@ -324,6 +347,14 @@ void ChatWidget::incrementUnreadMessageCount()
Q_EMIT unreadMessagesChanged(d->unreadMessages);
}
+void ChatWidget::windowActivated()
+{
+ kDebug();
+ if (isOnTop()) {
+ resetUnreadMessageCount();
+ }
+}
+
void ChatWidget::resetUnreadMessageCount()
{
kDebug();
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 5659662..dfdef64 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -105,6 +105,7 @@ signals:
private slots:
void onFormatColorReleased();
+ void windowActivated();
private:
void resetUnreadMessageCount();
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list