summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2016-09-27 12:44:03 (GMT)
committerKai Uwe Broulik <kde@privat.broulik.de>2016-09-27 12:44:03 (GMT)
commitd9c85361b248d36f4fafaf054e332871e47eb49c (patch)
tree5ac8a74d1623a026735d9ef56bf72bf4a8012585
parent2da2d251e26be335afd4df1877aaf503c24518dd (diff)
[Quick Chat] Allow cycling through chats with Ctrl+(Shift)+Tab
This makes switching between conversations possible without using the mouse. REVIEW: 128138
-rw-r--r--chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml14
-rw-r--r--chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml10
2 files changed, 23 insertions, 1 deletions
diff --git a/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml b/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
index 1485c4c..7e41910 100644
--- a/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
+++ b/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
@@ -29,6 +29,8 @@ FocusScope {
property Conversation conv
signal closeRequested
+ signal previousConversationRequested
+ signal nextConversationRequested
RowLayout {
id: titleArea
@@ -173,5 +175,17 @@ FocusScope {
chatWidget.closeRequested()
}
}
+
+ Keys.onPressed: {
+ if (event.modifiers & Qt.ControlModifier) {
+ if (event.key === Qt.Key_Tab) {
+ nextConversationRequested()
+ event.accepted = true
+ } else if (event.key === Qt.Key_Backtab) {
+ previousConversationRequested()
+ event.accepted = true
+ }
+ }
+ }
}
}
diff --git a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
index 701f721..a089fbc 100644
--- a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
+++ b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
@@ -43,7 +43,13 @@ ConversationDelegateButton {
base.currentIndex = -1
}
}
-
+ function openPreviousConversation() {
+ base.currentIndex = (base.currentIndex + conversationsView.count - 1) % conversationsView.count
+ }
+ function openNextConversation() {
+ base.currentIndex = (base.currentIndex + 1) % conversationsView.count
+ }
+
Component.onCompleted: setVisible(model.conversation.messages.shouldStartOpened)
PlasmaCore.Dialog {
@@ -59,6 +65,8 @@ ConversationDelegateButton {
conv: model.conversation
onCloseRequested: closeConversation()
+ onPreviousConversationRequested: openPreviousConversation()
+ onNextConversationRequested: openNextConversation()
}
//if we are opening the dialog right away (e.g. started chat from pinned)