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


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

The following commit has been merged in the master branch:
commit 1ad2e89d499a0c549773c15dfd6c3cd1b0eb28f6
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Oct 18 00:54:18 2011 +0100

    simplify return key pressed code.
    
    Remove event filter. Emit from TextEdit itself
---
 lib/chat-text-edit.cpp | 23 ++++++++++++-----------
 lib/chat-text-edit.h   |  1 +
 lib/chat-widget.cpp    | 34 +++-------------------------------
 3 files changed, 16 insertions(+), 42 deletions(-)

diff --git a/lib/chat-text-edit.cpp b/lib/chat-text-edit.cpp
index 1f19d9d..a81f828 100644
--- a/lib/chat-text-edit.cpp
+++ b/lib/chat-text-edit.cpp
@@ -70,16 +70,17 @@ QSize ChatTextEdit::sizeHint() const
 
 void ChatTextEdit::keyPressEvent(QKeyEvent* e)
 {
-    switch (e->key()) {
-        case Qt::Key_PageUp :
-        case Qt::Key_PageDown :
-            Q_EMIT scrollEventRecieved(e);
-            break;
-
-        default :
-            if (e->matches(QKeySequence::Find)) {
-                Q_EMIT findTextShortcutPressed();
-            }
+    if (e->key()==Qt::Key_Enter && !e->modifiers()) {
+        Q_EMIT returnKeyPressed();
+    }
+
+    if (e->key() == Qt::Key_PageUp ||
+        e->key() == Qt::Key_PageDown) {
+        Q_EMIT scrollEventRecieved(e);
+    }
+
+    if (e->matches(QKeySequence::Find)) {
+        Q_EMIT findTextShortcutPressed();
     }
 
     KTextEdit::keyPressEvent(e);
@@ -88,7 +89,7 @@ void ChatTextEdit::keyPressEvent(QKeyEvent* e)
 void ChatTextEdit::resizeEvent(QResizeEvent* e)
 {
     KTextEdit::resizeEvent(e);
-    QTimer::singleShot(0, this, SLOT(updateScrollBar()));
+    QTimer::singleShot(0, this, SLOT(updmessageBoxEventFilterateScrollBar()));
 }
 
 void ChatTextEdit::recalculateSize()
diff --git a/lib/chat-text-edit.h b/lib/chat-text-edit.h
index 350f5d2..31bdf97 100644
--- a/lib/chat-text-edit.h
+++ b/lib/chat-text-edit.h
@@ -44,6 +44,7 @@ private Q_SLOTS:
     void updateScrollBar();
 
 Q_SIGNALS:
+    void returnKeyPressed();
     void findTextShortcutPressed();
     void scrollEventRecieved(QKeyEvent*);
 
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 5fedbd4..393f6a0 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -45,33 +45,6 @@
 #include <TelepathyQt4/Connection>
 #include <TelepathyQt4/Presence>
 
-
-class MessageBoxEventFilter : public QObject
-{
-    Q_OBJECT
-public:
-    MessageBoxEventFilter(QObject* parent = 0) : QObject(parent) {}
-
-protected:
-    virtual bool eventFilter(QObject *obj, QEvent *event)
-    {
-        if (event->type() == QEvent::KeyPress) {
-            QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
-            if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
-                if (!keyEvent->modifiers()) {
-                    Q_EMIT returnKeyPressed();
-                    return true;
-                }
-            }
-        }
-        // standard event processing
-        return QObject::eventFilter(obj, event);
-    }
-
-Q_SIGNALS:
-    void returnKeyPressed();
-};
-
 class ChatWidgetPrivate
 {
 public:
@@ -194,9 +167,7 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
     // make the sendMessageBox a focus proxy for the chatview
     d->ui.chatArea->setFocusProxy(d->ui.sendMessageBox);
 
-    MessageBoxEventFilter *messageBoxEventFilter = new MessageBoxEventFilter(this);
-    d->ui.sendMessageBox->installEventFilter(messageBoxEventFilter);
-    connect(messageBoxEventFilter, SIGNAL(returnKeyPressed()), SLOT(sendMessage()));
+    connect(d->ui.sendMessageBox, SIGNAL(returnKeyPressed()), SLOT(sendMessage()));
     connect(d->ui.sendButton, SIGNAL(clicked()), SLOT(sendMessage()));
 
     // find text in chat
@@ -320,7 +291,8 @@ void ChatWidget::keyPressEvent(QKeyEvent* e)
 {
     if (e->key() == Qt::Key_Escape && d->ui.searchBar->isVisible()) {
         d->ui.searchBar->toggleView(false);
-    } else {
+    }
+    else {
         QWidget::keyPressEvent(e);
     }
 }

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list