From 2ef76e8acee23c344335b0118aadd5de96a7dfff Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 4 Nov 2024 09:31:26 -0300 Subject: [WIP] Add review functionality --- kodereviewer/qml/FilesChangedPage.qml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'kodereviewer/qml/FilesChangedPage.qml') diff --git a/kodereviewer/qml/FilesChangedPage.qml b/kodereviewer/qml/FilesChangedPage.qml index 9f55add..fe2aaf6 100644 --- a/kodereviewer/qml/FilesChangedPage.qml +++ b/kodereviewer/qml/FilesChangedPage.qml @@ -21,6 +21,9 @@ Kirigami.ScrollablePage { title: pullRequest ? `#${pullRequest.number}` : "" + property ReviewHelper reviewHelper: applicationWindow().reviewHelper + + property string currentFile: "" property string currentText: "" @@ -49,6 +52,25 @@ Kirigami.ScrollablePage { } ] + Kirigami.Dialog { + id: popup + popupType: QQC2.Popup.Window + focus: true + title: i18n("Add review to " + root.currentFile) + showCloseButton: false + preferredWidth: Kirigami.Units.gridUnit * 20 + preferredHeight: Kirigami.Units.gridUnit * 20 + padding: Kirigami.Units.largeSpacing + MarkdownTextArea { + id: reviewTextArea + } + standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel + + onAccepted: { + root.reviewHelper.addFileReview(root.currentFile, reviewTextArea.text, editor.selectionEndLine()) + } + } + Kirigami.PlaceholderMessage { visible: root.currentFile == '' anchors.centerIn: parent @@ -65,6 +87,32 @@ Kirigami.ScrollablePage { Layout.fillHeight: true file: root.currentFile text: root.currentText + + MouseArea { + anchors.fill: parent + //propagateComposedEvents: true + acceptedButtons: Qt.RightButton + cursorShape: Qt.IBeamCursor + + onClicked: event => { + if (event.button === Qt.RightButton) { // 'mouse' is a MouseEvent argument passed into the onClicked signal handler + editorMenu.popup() + } + } + + QQC2.Menu { + id: editorMenu + QQC2.MenuItem { + text: "Add review" + icon.name: "preview-symbolic" + onTriggered: { + console.log("triggered review") + console.log(`start line: ${editor.selectionStartLine()} to ${editor.selectionEndLine()}`) + popup.open() + } + } + } + } } } -- cgit v1.2.3-70-g09d2