From de82b132907110a884239709dea43e08867501d8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 9 Apr 2018 10:02:43 +0200 Subject: A help view to list shortcuts --- framework/qml/HelpPopup.qml | 49 +++++++++++++++++++++++++++++++++++++++++ framework/qmldir | 1 + views/conversation/qml/View.qml | 24 +++++++++++++++++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 framework/qml/HelpPopup.qml diff --git a/framework/qml/HelpPopup.qml b/framework/qml/HelpPopup.qml new file mode 100644 index 00000000..b1fe75a6 --- /dev/null +++ b/framework/qml/HelpPopup.qml @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +import QtQuick 2.9 +import QtQuick.Controls 2 +import QtQuick.Layouts 1.1 + +import org.kube.framework 1.0 as Kube + + +Kube.Popup { + id: debugPopup + + default property alias entries: view.model + + modal: true + parent: ApplicationWindow.overlay + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + x: (parent.width - width)/2 + y: Kube.Units.largeSpacing + width: parent.width / 2 + height: parent.height - Kube.Units.largeSpacing * 2 + clip: true + + ListView { + id: view + anchors.fill: parent + delegate: Kube.Label { + text: description + " " + shortcut + } + } +} diff --git a/framework/qmldir b/framework/qmldir index c62444c9..808563c9 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -10,6 +10,7 @@ NewAccountDialog 1.0 NewAccountDialog.qml EditAccount 1.0 EditAccount.qml LoginAccount 1.0 LoginAccount.qml Outbox 1.0 Outbox.qml +HelpPopup 1.0 HelpPopup.qml NotificationPopup 1.0 NotificationPopup.qml Icon 1.0 Icon.qml IconButton 1.0 IconButton.qml diff --git a/views/conversation/qml/View.qml b/views/conversation/qml/View.qml index c965b4c7..4cfac3df 100644 --- a/views/conversation/qml/View.qml +++ b/views/conversation/qml/View.qml @@ -20,12 +20,13 @@ import QtQuick 2.9 import QtQuick.Controls 1.3 as Controls1 -import QtQuick.Controls 2.0 as Controls2 +import QtQuick.Controls 2 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube FocusScope { + id: root property alias currentAccount: accountFolderview.currentAccount Shortcut { @@ -56,6 +57,10 @@ FocusScope { sequences: ['c'] onActivated: Kube.Fabric.postMessage(Kube.Messages.compose, {}) } + Shortcut { + sequence: "?" + onActivated: helpViewComponent.createObject(root).open() + } Controls1.SplitView { @@ -179,4 +184,21 @@ FocusScope { } } + + 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("Show this help text:"); shortcut: "?" } + } + } + } + } -- cgit v1.2.3