From 7692547fa0471175893b38fa5d6ed2faee460298 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 12 Jul 2018 16:07:54 +0200 Subject: Handle help via View.qml --- framework/qml/View.qml | 34 ++++++++++++++++++++++------------ views/conversation/qml/View.qml | 34 ++++++++++++++++------------------ 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/framework/qml/View.qml b/framework/qml/View.qml index 88cc3f10..29798f35 100644 --- a/framework/qml/View.qml +++ b/framework/qml/View.qml @@ -24,26 +24,36 @@ import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube FocusScope { - id: container - - property int visibleViews: 2 - property int currentIndex: 0 - property int count: contentItems.length - default property alias contentItems: content.data + id: root + //Search property rect searchArea: null property string filter: "" property var searchObject: null function triggerSearch() { - root.searchObject = searchComponent.createObject(root) + searchObject = searchComponent.createObject(root) } function clearSearch() { - if (root.searchObject) { - root.searchObject.close() - root.searchObject = null + if (searchObject) { + searchObject.close() + searchObject = null } } + //Help + property Component helpViewComponent: null + function showHelp() { + if (helpViewComponent) { + helpViewComponent.createObject(root).open() + } + } + + //View columns + property int visibleViews: 2 + property int currentIndex: 0 + property int count: contentItems.length + default property alias contentItems: content.data + property bool __aborted: false //This signal will be emitted once all initial properties have been set and the view is ready to load @@ -97,8 +107,8 @@ FocusScope { Kube.IconButton { anchors { - top: container.top - left: container.left + top: root.top + left: root.left } z: 1 color: Kube.Colors.darkBackgroundColor diff --git a/views/conversation/qml/View.qml b/views/conversation/qml/View.qml index 2a5e3d0c..7463d5e2 100644 --- a/views/conversation/qml/View.qml +++ b/views/conversation/qml/View.qml @@ -41,6 +41,21 @@ Kube.View { onMessageReceived: root.triggerSearch() } + helpViewComponent: Kube.HelpPopup { + ListModel { + ListElement { description: qsTr("Jump to next thread:"); shortcut: "j" } + ListElement { description: qsTr("Jump to previous thread:"); shortcut: "k" } + ListElement { description: qsTr("Jump to next message:"); shortcut: "n" } + ListElement { description: qsTr("Jump to previous message:"); shortcut: "p" } + ListElement { description: qsTr("Jump to next folder:"); shortcut: "f,n" } + ListElement { description: qsTr("Jump to previous previous folder:"); shortcut: "f,p" } + ListElement { description: qsTr("Compose new message:"); shortcut: "c" } + ListElement { description: qsTr("Reply to the currently focused message:"); shortcut: "r" } + ListElement { description: qsTr("Delete the currently focused message:"); shortcut: "d" } + ListElement { description: qsTr("Show this help text:"); shortcut: "?" } + } + } + Shortcut { sequences: ['j'] onActivated: Kube.Fabric.postMessage(Kube.Messages.selectNextConversation, {}) @@ -79,7 +94,7 @@ Kube.View { } Shortcut { sequence: "?" - onActivated: helpViewComponent.createObject(root).open() + onActivated: root.showHelp() } @@ -203,21 +218,4 @@ Kube.View { } } - Component { - id: helpViewComponent - Kube.HelpPopup { - ListModel { - ListElement { description: qsTr("Jump to next thread:"); shortcut: "j" } - ListElement { description: qsTr("Jump to previous thread:"); shortcut: "k" } - ListElement { description: qsTr("Jump to next message:"); shortcut: "n" } - ListElement { description: qsTr("Jump to previous message:"); shortcut: "p" } - ListElement { description: qsTr("Jump to next folder:"); shortcut: "f,n" } - ListElement { description: qsTr("Jump to previous previous folder:"); shortcut: "f,p" } - ListElement { description: qsTr("Compose new message:"); shortcut: "c" } - ListElement { description: qsTr("Reply to the currently focused message:"); shortcut: "r" } - ListElement { description: qsTr("Delete the currently focused message:"); shortcut: "d" } - ListElement { description: qsTr("Show this help text:"); shortcut: "?" } - } - } - } } -- cgit v1.2.3