From 10d04e65085712fe9206c08ac9600109a4bcfc8e Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 30 Oct 2024 16:27:05 -0300 Subject: Add review changes dialog to new structure --- kodereviewer/qml/Main.qml | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'kodereviewer/qml/Main.qml') diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml index dc807fe..6c13d1e 100644 --- a/kodereviewer/qml/Main.qml +++ b/kodereviewer/qml/Main.qml @@ -28,6 +28,8 @@ Kirigami.ApplicationWindow { project: root.project } + property PullRequest pullRequest + Settings { id: settings property alias width: root.width @@ -37,6 +39,28 @@ Kirigami.ApplicationWindow { pageStack.initialPage: initPage + property list commonActions: [ + Kirigami.Action { + id: reviewChangesAction + text: "Review changes" + icon.name: "preview-symbolic" + enabled: !!root.pullRequest + onTriggered: reviewChangesDialog.open() + } + ] + + + ReviewDialog { + id: reviewChangesDialog + onAccepted: { + root.connection.createReview( + root.pullRequest.number, root.pullRequest.last_commit, + reviewBodyText, event + ) + clearForm() + } + } + Component { id: initPage WelcomePage { @@ -50,7 +74,7 @@ Kirigami.ApplicationWindow { Loader { id: treeFileModelLoader active: !!pullRequest - property var pullRequest: undefined + property var pullRequest: root.pullRequest sourceComponent: TreeFileModel { pullRequest: treeFileModelLoader.pullRequest @@ -66,10 +90,6 @@ Kirigami.ApplicationWindow { id: contextDrawer enabled: treeFileModelLoader.active model: treeFileModelLoader.item - - onEnabledChanged: { - print("Enabled? " + enabled) - } } @@ -83,10 +103,7 @@ Kirigami.ApplicationWindow { onPullRequestSelected: number => { const pullRequest = project.pullRequest(number) - pullRequestPageLoader.item.pullRequest = pullRequest - commentsPageLoader.item.pullRequest = pullRequest - reviewListPageLoader.item.pullRequest = pullRequest - filesChangedPageLoader.item.pullRequest = pullRequest + root.pullRequest = pullRequest treeFileModelLoader.pullRequest = pullRequest } } @@ -102,6 +119,7 @@ Kirigami.ApplicationWindow { active: root.isProjectSelected sourceComponent: CommentPage { connection: root.connection + pullRequest: root.pullRequest } } @@ -110,6 +128,7 @@ Kirigami.ApplicationWindow { active: root.isProjectSelected sourceComponent: PullRequestDescriptionPage { connection: root.connection + pullRequest: root.pullRequest } } @@ -118,6 +137,7 @@ Kirigami.ApplicationWindow { active: root.isProjectSelected sourceComponent: ReviewListPage { connection: root.connection + pullRequest: root.pullRequest } } @@ -126,6 +146,7 @@ Kirigami.ApplicationWindow { active: root.isProjectSelected sourceComponent: FilesChangedPage { connection: root.connection + pullRequest: root.pullRequest } } -- cgit v1.2.3-70-g09d2