[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [spacebar] app/package/contents/ui: [app] Smarter handling of the Enter key when typing a message
From:       Martin Klapetek <mklapetek () kde ! org>
Date:       2016-05-14 18:35:25
Message-ID: E1b1ePN-0005D3-7m () scm ! kde ! org
[Download RAW message or body]

Git commit 45fdca4c66279509e1cc8d047cca5499832e7b47 by Martin Klapetek.
Committed on 14/05/2016 at 18:31.
Pushed by mklapetek into branch 'master'.

[app] Smarter handling of the Enter key when typing a message

Now pressing Enter will only send the message if no modifier is pressed
and only if the message actually can be send (valid channel), otherwise
shows a toast notification.

M  +13   -2    app/package/contents/ui/ConversationPage.qml

http://commits.kde.org/spacebar/45fdca4c66279509e1cc8d047cca5499832e7b47

diff --git a/app/package/contents/ui/ConversationPage.qml b/app/package/contents/ui/ConversationPage.qml
index b90daa3..27adab0 100644
--- a/app/package/contents/ui/ConversationPage.qml
+++ b/app/package/contents/ui/ConversationPage.qml
@@ -211,8 +211,19 @@ Kirigami.Page {
                     }
 
                     Keys.onReturnPressed: {
-                        view.model.sendNewMessage(text);
-                        text = "";
+                        if (event.modifiers == Qt.NoModifier) {
+                            if (conversation.canSendMessages) {
+                                view.model.sendNewMessage(text);
+                                text = "";
+                            } else {
+                                // TODO better text
+                                showPassiveNotification(i18n("You need to connect first"), 3000);
+                            }
+                        } else if (event.modifiers != Qt.NoModifier) {
+                            event.accepted = false;
+                        }
+                    }
+
                     }
                 }
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic