diff options
Diffstat (limited to 'kodereviewer/qml')
-rw-r--r-- | kodereviewer/qml/.CommentPage.qml.kate-swp | bin | 0 -> 232 bytes | |||
-rw-r--r-- | kodereviewer/qml/CommentPage.qml | 3 | ||||
-rw-r--r-- | kodereviewer/qml/FilesChangedPage.qml | 48 | ||||
-rw-r--r-- | kodereviewer/qml/Main.qml | 4 | ||||
-rw-r--r-- | kodereviewer/qml/ReviewList.qml | 22 |
5 files changed, 74 insertions, 3 deletions
diff --git a/kodereviewer/qml/.CommentPage.qml.kate-swp b/kodereviewer/qml/.CommentPage.qml.kate-swp Binary files differnew file mode 100644 index 0000000..a72cf10 --- /dev/null +++ b/kodereviewer/qml/.CommentPage.qml.kate-swp diff --git a/kodereviewer/qml/CommentPage.qml b/kodereviewer/qml/CommentPage.qml index 8c297bc..756f5da 100644 --- a/kodereviewer/qml/CommentPage.qml +++ b/kodereviewer/qml/CommentPage.qml @@ -57,6 +57,7 @@ Kirigami.ScrollablePage { delegate: CommentDelegate {} footerPositioning: ListView.InlineFooter footer: Item { + id: rootFooter anchors.left: parent.left anchors.right: parent.right height: footerLayout.implicitHeight @@ -64,6 +65,7 @@ Kirigami.ScrollablePage { id: footerLayout anchors.fill: parent anchors.topMargin: Kirigami.Units.largeSpacing * 2 + MarkdownTextArea { id: newCommentTextArea Layout.fillWidth: true @@ -71,6 +73,7 @@ Kirigami.ScrollablePage { QQC2.Button { icon.name: "document-send-symbolic" enabled: newCommentTextArea.text != '' + Layout.fillHeight: true onClicked: { if (newCommentTextArea.text == '') { 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() + } + } + } + } } } diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml index 6c13d1e..855b14b 100644 --- a/kodereviewer/qml/Main.qml +++ b/kodereviewer/qml/Main.qml @@ -30,6 +30,10 @@ Kirigami.ApplicationWindow { property PullRequest pullRequest + property ReviewHelper reviewHelper: ReviewHelper { + pullRequest: root.pullRequest + } + Settings { id: settings property alias width: root.width diff --git a/kodereviewer/qml/ReviewList.qml b/kodereviewer/qml/ReviewList.qml index 275e433..77a00e0 100644 --- a/kodereviewer/qml/ReviewList.qml +++ b/kodereviewer/qml/ReviewList.qml @@ -73,9 +73,25 @@ Kirigami.CardsListView { } } - MarkdownTextArea { - id: addComment - Layout.fillWidth: true + RowLayout { + MarkdownTextArea { + id: addComment + Layout.fillWidth: true + } + QQC2.Button { + icon.name: "document-send-symbolic" + enabled: addComment.text != '' + + onClicked: { + if (addComment.text == '') { + return + } + + root.connection.createComment(root.pullRequest.number, newCommentTextArea.text) + newCommentTextArea.text == '' + getCommentsTimer.restart() + } + } } } } |