summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/ReviewDialog.qml
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2024-10-05 10:43:00 -0300
committerMatias Linares <matias@deprecated.org>2024-10-05 10:43:00 -0300
commit39349a7e1e4fbb16e4a71d7f741b0725e73caeb7 (patch)
tree72dc36cca5c3feca1afa3594999b5d44b1cf0483 /kodereviewer/qml/ReviewDialog.qml
parentb31efe70f22cd0535dbcb7ef596a365ad44c3dc3 (diff)
downloadkodereviewer-39349a7e1e4fbb16e4a71d7f741b0725e73caeb7.tar.gz
Add review changes functionality!
Diffstat (limited to 'kodereviewer/qml/ReviewDialog.qml')
-rw-r--r--kodereviewer/qml/ReviewDialog.qml69
1 files changed, 69 insertions, 0 deletions
diff --git a/kodereviewer/qml/ReviewDialog.qml b/kodereviewer/qml/ReviewDialog.qml
new file mode 100644
index 0000000..7dcaf9c
--- /dev/null
+++ b/kodereviewer/qml/ReviewDialog.qml
@@ -0,0 +1,69 @@
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtCore
+import QtQuick.Controls as QQC2
+import QtQuick.Layouts
+
+import org.kde.kirigami as Kirigami
+import org.kde.kirigamiaddons.formcard as FormCard
+
+import org.deprecated.kodereviewer 1.0
+
+
+Kirigami.Dialog {
+ id: root
+ standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
+ title: i18nc("@title:window", "Review changes")
+ padding: Kirigami.Units.largeSpacing
+ preferredWidth: Kirigami.Units.gridUnit * 20
+ property string event: ''
+ property alias reviewBodyText: reviewBody.text
+ ColumnLayout {
+ MarkdownTextArea {
+ id: reviewBody
+ Layout.fillWidth: true
+ }
+ Kirigami.Separator {
+ Kirigami.FormData.isSection: true
+ Layout.fillWidth: true
+ }
+ QQC2.RadioButton {
+ id: approveRadioButton
+ text: "Approve"
+ onCheckedChanged: if(checked) {
+ root.event = 'APPROVE'
+ }
+ }
+ QQC2.RadioButton {
+ id: commentRadioButton
+ text: "Comment"
+ onCheckedChanged: if(checked) {
+ root.event = 'COMMENT'
+ }
+ }
+ QQC2.RadioButton {
+ id: requestChangesRadioButton
+ text: "Request changes"
+ onCheckedChanged: if(checked) {
+ root.event = 'REQUEST_CHANGES'
+ }
+ }
+ }
+
+ function requiredFieldsFilled() {
+ return event != '' && reviewBodyText != ''
+ }
+
+ function clearForm() {
+ reviewBodyText = ''
+ approveRadioButton.checked = false
+ commentRadioButton.checked = false
+ requestChangesRadioButton = false
+ event = ''
+ }
+
+ Component.onCompleted: {
+ const button = standardButton(Kirigami.Dialog.Ok);
+ button.enabled = Qt.binding( () => requiredFieldsFilled() );
+ }
+}