From dc50471a72c9310db3dd9149be1311e9502bdd9f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 23 Jul 2017 20:01:57 +0200 Subject: TextEditor escaping --- components/kube/contents/ui/ComposerView.qml | 244 ++++++++++++++------------- 1 file changed, 127 insertions(+), 117 deletions(-) (limited to 'components') diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml index 35ae5255..24a2bf16 100644 --- a/components/kube/contents/ui/ComposerView.qml +++ b/components/kube/contents/ui/ComposerView.qml @@ -335,160 +335,170 @@ Kube.View { onActiveFocusChanged: closeFirstSplitIfNecessary() text: composerController.body onTextChanged: composerController.body = text; + Keys.onEscapePressed: recipients.forceActiveFocus() } } } //Recepients - Rectangle { + FocusScope { + id: recipients anchors { top: parent.top bottom: parent.bottom } - color: Kube.Colors.backgroundColor + activeFocusOnTab: true width: Kube.Units.gridUnit * 15 - Rectangle { - height: parent.height - width: 1 - color: Kube.Colors.buttonColor - } + anchors.fill: parent + color: Kube.Colors.backgroundColor - //Content - Item { - anchors.right: parent.right - width: parent.width - height: parent.height + Rectangle { + height: parent.height + width: 1 + color: Kube.Colors.buttonColor + } - ColumnLayout { - anchors { - top: parent.top - bottom: bottomButtons.top - left: parent.left - right: parent.right - margins: Kube.Units.largeSpacing - } + //Content + Item { + anchors.right: parent.right + width: parent.width + height: parent.height + + ColumnLayout { + anchors { + top: parent.top + bottom: bottomButtons.top + left: parent.left + right: parent.right + margins: Kube.Units.largeSpacing + } - Kube.Label { - text: qsTr("Sending Email to:") - } + Kube.Label { + text: qsTr("Sending Email to:") + } - AddresseeListEditor { - id: to - Layout.preferredHeight: to.implicitHeight - Layout.fillWidth: true - completer: composerController.recipientCompleter - model: composerController.toModel - onAdded: composerController.addTo(text) - onRemoved: composerController.removeTo(text) - } + AddresseeListEditor { + id: to + Layout.preferredHeight: to.implicitHeight + Layout.fillWidth: true + focus: true + activeFocusOnTab: true + completer: composerController.recipientCompleter + model: composerController.toModel + onAdded: composerController.addTo(text) + onRemoved: composerController.removeTo(text) + } - Kube.Label { - text: qsTr("Sending Copy to (CC):") - } - AddresseeListEditor { - id: cc - Layout.preferredHeight: cc.implicitHeight - Layout.fillWidth: true - completer: composerController.recipientCompleter - model: composerController.ccModel - onAdded: composerController.addCc(text) - onRemoved: composerController.removeCc(text) - } + Kube.Label { + text: qsTr("Sending Copy to (CC):") + } + AddresseeListEditor { + id: cc + Layout.preferredHeight: cc.implicitHeight + Layout.fillWidth: true + activeFocusOnTab: true + completer: composerController.recipientCompleter + model: composerController.ccModel + onAdded: composerController.addCc(text) + onRemoved: composerController.removeCc(text) + } - Kube.Label { - text: qsTr("Sending Secret Copy to (Bcc):") - } - AddresseeListEditor { - id: bcc - Layout.preferredHeight: bcc.implicitHeight - Layout.fillWidth: true - completer: composerController.recipientCompleter - model: composerController.bccModel - onAdded: composerController.addBcc(text) - onRemoved: composerController.removeBcc(text) - } + Kube.Label { + text: qsTr("Sending Secret Copy to (Bcc):") + } + AddresseeListEditor { + id: bcc + Layout.preferredHeight: bcc.implicitHeight + Layout.fillWidth: true + activeFocusOnTab: true + completer: composerController.recipientCompleter + model: composerController.bccModel + onAdded: composerController.addBcc(text) + onRemoved: composerController.removeBcc(text) + } - Item { - width: parent.width - Layout.fillHeight: true + Item { + width: parent.width + Layout.fillHeight: true + } } - } - Item { - id: bottomButtons - anchors { - bottom: fromLabel.top - bottomMargin: Kube.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } - width: parent.width - Kube.Units.largeSpacing * 2 - height: Kube.Units.gridUnit + Item { + id: bottomButtons + anchors { + bottom: fromLabel.top + bottomMargin: Kube.Units.largeSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width - Kube.Units.largeSpacing * 2 + height: Kube.Units.gridUnit - Kube.Button { - id: saveDraftButton + Kube.Button { + id: saveDraftButton - anchors.right: parent.right + anchors.right: parent.right - text: qsTr("Save as Draft") - //TODO enabled: saveAsDraftAction.enabled - onClicked: { - saveAsDraftAction.execute() + text: qsTr("Save as Draft") + //TODO enabled: saveAsDraftAction.enabled + onClicked: { + saveAsDraftAction.execute() + } } - } - Kube.Button { - anchors.left: parent.left + Kube.Button { + anchors.left: parent.left - text: qsTr("Discard") - onClicked: Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) + text: qsTr("Discard") + onClicked: Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) + } } - } - Kube.Label { - id: fromLabel - anchors { - bottom: identityCombo.top - bottomMargin: Kube.Units.smallSpacing - left: identityCombo.left + Kube.Label { + id: fromLabel + anchors { + bottom: identityCombo.top + bottomMargin: Kube.Units.smallSpacing + left: identityCombo.left + } + text: qsTr("You are sending this from:") } - text: qsTr("You are sending this from:") - } - Kube.ComboBox { - id: identityCombo + Kube.ComboBox { + id: identityCombo - anchors { - bottom: sendButton.top - bottomMargin: Kube.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } - width: parent.width - Kube.Units.largeSpacing * 2 + anchors { + bottom: sendButton.top + bottomMargin: Kube.Units.largeSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width - Kube.Units.largeSpacing * 2 - model: composerController.identitySelector.model - textRole: "address" - Layout.fillWidth: true - onCurrentIndexChanged: { - composerController.identitySelector.currentIndex = currentIndex + model: composerController.identitySelector.model + textRole: "address" + Layout.fillWidth: true + onCurrentIndexChanged: { + composerController.identitySelector.currentIndex = currentIndex + } } - } - Kube.PositiveButton { - id: sendButton + Kube.PositiveButton { + id: sendButton - anchors { - bottom: parent.bottom - bottomMargin: Kube.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } - width: parent.width - Kube.Units.largeSpacing * 2 + anchors { + bottom: parent.bottom + bottomMargin: Kube.Units.largeSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width - Kube.Units.largeSpacing * 2 - text: qsTr("Send") - enabled: sendAction.enabled - onClicked: { - sendAction.execute() + text: qsTr("Send") + enabled: sendAction.enabled + onClicked: { + sendAction.execute() + } } } } - } + } //FocusScope } -- cgit v1.2.3