Purpose

phabricatorplugin_config.qml
1/*
2 SPDX-FileCopyrightText: 2017 René J.V. Bertin <rjvbertin@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7import QtQuick
8import QtQuick.Controls
9import QtQuick.Layouts
10import org.kde.purpose.phabricator
11
12ColumnLayout {
13 id: root
14
15 property string updateDR
16 property string drTitle
17 property string localBaseDir
18 property alias updateComment: updateCommentField.text
19 // This is a workaround for installs where the result dialog doesn't always appear
20 // or doesn't always show the revision URL.
21 property alias doBrowse: doBrowseCheck.checked
22 property var urls
23 property var mimeType
24
25 function labelText() {
26 if (updateDRCombo.currentIndex >= 0 && updateOld.checked) {
27 if (updateDR !== "") {
28 return i18nd("purpose6_phabricator", "Update differential revision %1", updateDR);
29 } else {
30 return i18nd("purpose6_phabricator", "Update differential revision");
31 }
32 } else if (createNew.checked) {
33 return i18nd("purpose6_phabricator", "Create new \"differential diff\"")
34 } else {
35 return i18nd("purpose6_phabricator", "Create or update?")
36 }
37 }
38
39 Label {
40 id: label
41 Layout.fillWidth: true
42 text: root.labelText()
43 wrapMode: Text.Wrap
44 }
45
46 PhabricatorRC {
47 id: json
48 path: root.localBaseDir + "/.arcconfig"
49 }
50
51 function refreshUpdateDR() {
52 if (updateDRCombo.currentIndex >= 0 && updateOld.checked) {
53 root.updateDR = diffList.get(updateDRCombo.currentIndex, "toolTip")
54 root.drTitle = diffList.get(updateDRCombo.currentIndex, "display")
55 } else {
56 if (createNew.checked) {
57 root.updateDR = ""
58 root.drTitle = ""
59 } else {
60 root.updateDR = i18nd("purpose6_phabricator", "unknown")
61 root.drTitle = ""
62 }
63 }
64 }
65
66 RowLayout {
67 Layout.alignment: Qt.AlignHCenter
68 RadioButton {
69 id: createNew
70 text: i18nd("purpose6_phabricator", "New Diff")
71 ToolTip.text: i18nd("purpose6_phabricator", "tick this to create a new \"differential diff\" which can\nbe converted online to a new differential revision")
72 onCheckedChanged: {
73 root.refreshUpdateDR();
74 }
75 }
76 RadioButton {
77 id: updateOld
78 text: i18nd("purpose6_phabricator", "Update Diff")
79 ToolTip.text: i18nd("purpose6_phabricator", "tick this to update an existing revision,\nselect one from the list below.")
80 onCheckedChanged: {
81 root.refreshUpdateDR();
82 }
83 }
84 }
85
86 ComboBox {
87 id: updateDRCombo
88 Layout.fillWidth: true
89 enabled: updateOld.checked
90 textRole: "display"
91 model: DiffListModel {
92 id: diffList
93 status: "pending"
94 }
95 onCurrentIndexChanged: {
96 root.refreshUpdateDR();
97 }
98 }
99
100 Item {
101 Layout.fillWidth: true
102 height: doBrowseCheck.height
103
104 CheckBox {
105 id: doBrowseCheck
106 anchors.centerIn: parent
107 text: i18nd("purpose6_phabricator", "Open Diff in browser")
108 enabled: updateOld.checked
109 }
110 }
111
112 Label {
113 Layout.fillWidth: true
114 // use i18nd("purpose6_phabricator", ).arg() to avoid showing the "%1" when inactive
115 text: root.updateDR !== "unknown" && root.updateDR !== ""
116 ? i18nd("purpose6_phabricator", "Summary of the update to %1:", root.updateDR)
117 : i18nd("purpose6_phabricator", "Summary of the update")
118 enabled: updateOld.checked
119 wrapMode: Text.Wrap
120 }
121
122 TextArea {
123 id: updateCommentField
124 Layout.fillWidth: true
125 Layout.fillHeight: true
126 text: i18nd("purpose6_phabricator", "patch updated through %1 and the Purpose/Phabricator plugin", Qt.application.name)
127 wrapMode: TextEdit.Wrap
128 enabled: updateOld.checked
129 }
130
131 Item {
132 Layout.fillHeight: true
133 Layout.fillWidth: true
134 }
135}
Q_SCRIPTABLE CaptureState status()
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
QString path(const QString &relativePath)
QString name(StandardAction id)
QString label(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.