summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/FilesChangedPage.qml
diff options
context:
space:
mode:
authorMatias Linares <matias.linares@comprandoengrupo.net>2024-11-04 09:31:26 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2024-11-24 11:21:41 -0300
commit2ef76e8acee23c344335b0118aadd5de96a7dfff (patch)
tree1eb1fa059ddf07d00834f569611f1ca2e33a961a /kodereviewer/qml/FilesChangedPage.qml
parent45f03bfb30ea29dd62c0aba3fbe0c002dcdc807a (diff)
downloadkodereviewer-translations.tar.gz
[WIP] Add review functionalitytranslationsmain
Diffstat (limited to 'kodereviewer/qml/FilesChangedPage.qml')
-rw-r--r--kodereviewer/qml/FilesChangedPage.qml48
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()
+ }
+ }
+ }
+ }
}
}