From 8fc5808b5f0dfab59e93d46ef581eebe66a1ffd1 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 21 Jul 2017 05:19:54 +0200 Subject: Fixed mailview focus handling --- components/kube/contents/ui/MailView.qml | 140 ++++++++++++++++--------------- framework/qml/InlineAccountSwitcher.qml | 1 + 2 files changed, 72 insertions(+), 69 deletions(-) diff --git a/components/kube/contents/ui/MailView.qml b/components/kube/contents/ui/MailView.qml index 23d09b1f..ef790b70 100644 --- a/components/kube/contents/ui/MailView.qml +++ b/components/kube/contents/ui/MailView.qml @@ -25,89 +25,91 @@ import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube -SplitView { - Rectangle { - width: Kube.Units.gridUnit * 10 - Layout.minimumWidth: Kube.Units.gridUnit * 5 +FocusScope { + SplitView { + anchors.fill: parent + Rectangle { + width: Kube.Units.gridUnit * 10 + Layout.minimumWidth: Kube.Units.gridUnit * 5 - color: Kube.Colors.textColor - focus: true + color: Kube.Colors.textColor - Kube.PositiveButton { - id: newMailButton + Kube.PositiveButton { + id: newMailButton - anchors { - top: parent.top - left: parent.left - right: parent.right - margins: Kube.Units.largeSpacing - } - - text: qsTr("New Email") - - onClicked: { - Kube.Fabric.postMessage(Kube.Messages.compose, {}) - } - } - - Kube.InlineAccountSwitcher { - id: accountFolderview - - activeFocusOnTab: true - anchors { - top: newMailButton.bottom - topMargin: Kube.Units.largeSpacing - bottom: statusBarContainer.top - left: newMailButton.left - right: parent.right - } - } - - Item { - id: statusBarContainer - anchors { - topMargin: Kube.Units.smallSpacing - bottom: parent.bottom - left: parent.left - right: parent.right + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: Kube.Units.largeSpacing + } + focus: true + text: qsTr("New Email") + onClicked: Kube.Fabric.postMessage(Kube.Messages.compose, {}) } - height: childrenRect.height - Rectangle { - id: border - visible: statusBar.visible + Kube.InlineAccountSwitcher { + id: accountFolderview + activeFocusOnTab: true anchors { + top: newMailButton.bottom + topMargin: Kube.Units.largeSpacing + bottom: statusBarContainer.top + left: newMailButton.left right: parent.right - left: parent.left - margins: Kube.Units.smallSpacing } - height: 1 - color: Kube.Colors.viewBackgroundColor - opacity: 0.3 } - Kube.StatusBar { - id: statusBar - accountId: accountFolderview.currentAccount - height: Kube.Units.gridUnit * 2 + + Item { + id: statusBarContainer anchors { - top: border.bottom - left: statusBarContainer.left - right: statusBarContainer.right + topMargin: Kube.Units.smallSpacing + bottom: parent.bottom + left: parent.left + right: parent.right + } + height: childrenRect.height + + Rectangle { + id: border + visible: statusBar.visible + anchors { + right: parent.right + left: parent.left + margins: Kube.Units.smallSpacing + } + height: 1 + color: Kube.Colors.viewBackgroundColor + opacity: 0.3 + } + Kube.StatusBar { + id: statusBar + accountId: accountFolderview.currentAccount + height: Kube.Units.gridUnit * 2 + anchors { + top: border.bottom + left: statusBarContainer.left + right: statusBarContainer.right + } } } } - } - Kube.MailListView { - id: mailListView - width: Kube.Units.gridUnit * 20 - height: parent.height - Layout.minimumWidth: Kube.Units.gridUnit * 10 - } + Kube.MailListView { + id: mailListView + width: Kube.Units.gridUnit * 20 + height: parent.height + activeFocusOnTab: true + onActiveFocusChanged: console.warn("maillist active focus", activeFocus) + Layout.minimumWidth: Kube.Units.gridUnit * 10 + } - Kube.ConversationView { - id: mailView - Layout.fillWidth: true - Layout.minimumWidth: Kube.Units.gridUnit * 5 + Kube.ConversationView { + id: mailView + Layout.fillWidth: true + Layout.minimumWidth: Kube.Units.gridUnit * 5 + activeFocusOnTab: true + onActiveFocusChanged: console.warn("conversation active focus", activeFocus) + } } } diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml index c3929b9e..45001500 100644 --- a/framework/qml/InlineAccountSwitcher.qml +++ b/framework/qml/InlineAccountSwitcher.qml @@ -89,6 +89,7 @@ FocusScope { right: parent.right bottom: parent.bottom } + focus: isCurrent activeFocusOnTab: true accountId: currentData.accountId -- cgit v1.2.3