From 651f1623ac39bc12b8ba141c62349a75e27e545a Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 14 Sep 2021 18:37:23 +0200 Subject: [PATCH 1/5] Can now set tags through incidence editor --- src/contents/ui/IncidenceEditor.qml | 207 ++++++++++++++++------------ 1 file changed, 116 insertions(+), 91 deletions(-) diff --git a/src/contents/ui/IncidenceEditor.qml b/src/contents/ui/IncidenceEditor.qml index ce084728..ae099b35 100644 --- a/src/contents/ui/IncidenceEditor.qml +++ b/src/contents/ui/IncidenceEditor.qml @@ -150,97 +150,6 @@ Kirigami.ScrollablePage { text: root.incidenceWrapper.summary onTextChanged: root.incidenceWrapper.summary = text } - RowLayout { - Kirigami.FormData.label: i18n("Location:") - Layout.fillWidth: true - - QQC2.TextField { - id: locationField - - property bool typed: false - - Layout.fillWidth: true - placeholderText: i18n("Optional") - text: root.incidenceWrapper.location - onTextChanged: root.incidenceWrapper.location = text - Keys.onPressed: locationsMenu.open() - - QQC2.BusyIndicator { - height: parent.height - anchors.right: parent.right - running: locationsModel.status === GeocodeModel.Loading - visible: locationsModel.status === GeocodeModel.Loading - } - - QQC2.Menu { - id: locationsMenu - width: parent.width - y: parent.height // Y is relative to parent - focus: false - - Repeater { - model: GeocodeModel { - id: locationsModel - plugin: locationPlugin - query: root.incidenceWrapper.location - autoUpdate: true - } - delegate: QQC2.MenuItem { - text: locationData.address.text - onClicked: root.incidenceWrapper.location = locationData.address.text - } - } - - Plugin { - id: locationPlugin - name: "osm" - } - } - } - QQC2.CheckBox { - id: mapVisibleCheckBox - text: i18n("Show map") - visible: Config.enableMaps - } - } - - ColumnLayout { - id: mapLayout - Layout.fillWidth: true - visible: Config.enableMaps && mapVisibleCheckBox.checked - - Loader { - id: mapLoader - - Layout.fillWidth: true - height: Kirigami.Units.gridUnit * 16 - asynchronous: true - active: visible - - sourceComponent: LocationMap { - id: map - selectMode: true - query: root.incidenceWrapper.location - onSelectedLocationAddress: root.incidenceWrapper.location = address - } - } - } - - // Restrain the descriptionTextArea from getting too chonky - ColumnLayout { - Layout.fillWidth: true - Layout.maximumWidth: incidenceForm.wideMode ? Kirigami.Units.gridUnit * 25 : -1 - Kirigami.FormData.label: i18n("Description:") - - QQC2.TextArea { - id: descriptionTextArea - - Layout.fillWidth: true - placeholderText: i18n("Optional") - text: root.incidenceWrapper.description - onTextChanged: root.incidenceWrapper.description = text - } - } Kirigami.Separator { Kirigami.FormData.isSection: true @@ -740,6 +649,122 @@ Kirigami.ScrollablePage { Kirigami.FormData.isSection: true } + RowLayout { + Kirigami.FormData.label: i18n("Location:") + Layout.fillWidth: true + + QQC2.TextField { + id: locationField + + property bool typed: false + + Layout.fillWidth: true + placeholderText: i18n("Optional") + text: root.incidenceWrapper.location + onTextChanged: root.incidenceWrapper.location = text + Keys.onPressed: locationsMenu.open() + + QQC2.BusyIndicator { + height: parent.height + anchors.right: parent.right + running: locationsModel.status === GeocodeModel.Loading + visible: locationsModel.status === GeocodeModel.Loading + } + + QQC2.Menu { + id: locationsMenu + width: parent.width + y: parent.height // Y is relative to parent + focus: false + + Repeater { + model: GeocodeModel { + id: locationsModel + plugin: locationPlugin + query: root.incidenceWrapper.location + autoUpdate: true + } + delegate: QQC2.MenuItem { + text: locationData.address.text + onClicked: root.incidenceWrapper.location = locationData.address.text + } + } + + Plugin { + id: locationPlugin + name: "osm" + } + } + } + QQC2.CheckBox { + id: mapVisibleCheckBox + text: i18n("Show map") + visible: Config.enableMaps + } + } + + ColumnLayout { + id: mapLayout + Layout.fillWidth: true + visible: Config.enableMaps && mapVisibleCheckBox.checked + + Loader { + id: mapLoader + + Layout.fillWidth: true + height: Kirigami.Units.gridUnit * 16 + asynchronous: true + active: visible + + sourceComponent: LocationMap { + id: map + selectMode: true + query: root.incidenceWrapper.location + onSelectedLocationAddress: root.incidenceWrapper.location = address + } + } + } + + // Restrain the descriptionTextArea from getting too chonky + ColumnLayout { + Layout.fillWidth: true + Layout.maximumWidth: incidenceForm.wideMode ? Kirigami.Units.gridUnit * 25 : -1 + Kirigami.FormData.label: i18n("Description:") + + QQC2.TextArea { + id: descriptionTextArea + + Layout.fillWidth: true + placeholderText: i18n("Optional") + text: root.incidenceWrapper.description + onTextChanged: root.incidenceWrapper.description = text + } + } + + QQC2.ComboBox { + Kirigami.FormData.label: i18n("Tags:") + Layout.fillWidth: true + + model: TagManager.tagModel + displayText: root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) + + delegate: Kirigami.CheckableListItem { + label: model.display + checked: root.incidenceWrapper.categories.includes(model.display) + action: QQC2.Action { + onTriggered: { + checked = !checked; + root.incidenceWrapper.categories.includes(model.display) ? + root.incidenceWrapper.categories = root.incidenceWrapper.categories.filter(tag => tag !== model.display) : + root.incidenceWrapper.categories = [...root.incidenceWrapper.categories, model.display] + } + } + } + } + + Kirigami.Separator { + Kirigami.FormData.isSection: true + } ColumnLayout { id: remindersColumn -- GitLab From b45c53af368c9628b4c2a65eca04236bbf8eae48 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 14 Sep 2021 19:24:26 +0200 Subject: [PATCH 2/5] Added placeholder message for tag combo --- src/contents/ui/IncidenceEditor.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contents/ui/IncidenceEditor.qml b/src/contents/ui/IncidenceEditor.qml index ae099b35..ae567eaa 100644 --- a/src/contents/ui/IncidenceEditor.qml +++ b/src/contents/ui/IncidenceEditor.qml @@ -746,7 +746,8 @@ Kirigami.ScrollablePage { Layout.fillWidth: true model: TagManager.tagModel - displayText: root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) + displayText: root.incidenceWrapper.categories.length > 0 ? + root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) : i18n("Click to set tags...") delegate: Kirigami.CheckableListItem { label: model.display -- GitLab From 7f01d29c035e3b473f88768a97e78f89c3bbbdd8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 14 Sep 2021 19:26:27 +0200 Subject: [PATCH 3/5] Placeholder message adapts to mobile --- src/contents/ui/IncidenceEditor.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contents/ui/IncidenceEditor.qml b/src/contents/ui/IncidenceEditor.qml index ae567eaa..3cc0db81 100644 --- a/src/contents/ui/IncidenceEditor.qml +++ b/src/contents/ui/IncidenceEditor.qml @@ -747,7 +747,8 @@ Kirigami.ScrollablePage { model: TagManager.tagModel displayText: root.incidenceWrapper.categories.length > 0 ? - root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) : i18n("Click to set tags...") + root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) : + Kirigami.Settings.isMobile ? i18n("Tap to set tags...") : i18n("Click to set tags...") delegate: Kirigami.CheckableListItem { label: model.display -- GitLab From 7175ad414256d779efdd934d08a9c530a2ebcf6a Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 14 Sep 2021 17:39:14 +0000 Subject: [PATCH 4/5] Apply 1 suggestion(s) to 1 file(s) --- src/contents/ui/IncidenceEditor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contents/ui/IncidenceEditor.qml b/src/contents/ui/IncidenceEditor.qml index 3cc0db81..86a6be61 100644 --- a/src/contents/ui/IncidenceEditor.qml +++ b/src/contents/ui/IncidenceEditor.qml @@ -748,7 +748,7 @@ Kirigami.ScrollablePage { model: TagManager.tagModel displayText: root.incidenceWrapper.categories.length > 0 ? root.incidenceWrapper.categories.join(i18nc("List separator", ", ")) : - Kirigami.Settings.isMobile ? i18n("Tap to set tags...") : i18n("Click to set tags...") + Kirigami.Settings.tabletMode ? i18n("Tap to set tags...") : i18n("Click to set tags...") delegate: Kirigami.CheckableListItem { label: model.display -- GitLab From 5251589ce454c30a11e1f17a9548703c519b5e40 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 16 Sep 2021 19:55:28 +0200 Subject: [PATCH 5/5] Fixed big gap in checkable list items for tags --- src/contents/ui/IncidenceEditor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/contents/ui/IncidenceEditor.qml b/src/contents/ui/IncidenceEditor.qml index 86a6be61..9f8149f9 100644 --- a/src/contents/ui/IncidenceEditor.qml +++ b/src/contents/ui/IncidenceEditor.qml @@ -752,6 +752,7 @@ Kirigami.ScrollablePage { delegate: Kirigami.CheckableListItem { label: model.display + reserveSpaceForIcon: false checked: root.incidenceWrapper.categories.includes(model.display) action: QQC2.Action { onTriggered: { -- GitLab