diff options
Diffstat (limited to 'kodereviewer/qml/FilesChangedPage.qml')
-rw-r--r-- | kodereviewer/qml/FilesChangedPage.qml | 48 |
1 files changed, 48 insertions, 0 deletions
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() + } + } + } + } } } |