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 2.2
8import QtQuick.Controls 2.15
9import QtQuick.Layouts 1.1
10import org.kde.purpose.phabricator 1.0
11
12ColumnLayout {
13 id: root
14 enabled: true
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 variant urls
23 property variant mimeType
24
25 function labelText()
26 {
27 if (updateDRCombo.currentIndex>=0 && updateOld.checked) {
28 return updateDR.length > 0 ? i18nd("purpose6_phabricator", "Update differential revision %1", updateDR) : i18nd("purpose6_phabricator", "Update differential revision")
29 } else if (createNew.checked) {
30 return i18nd("purpose6_phabricator", "Create new \"differential diff\"")
31 } else {
32 return i18nd("purpose6_phabricator", "Create or update?")
33 }
34 }
35 Label {
36 id: label
37 text: root.labelText()
38 }
39
40 PhabricatorRC {
41 id: json
42 path: root.localBaseDir + "/.arcconfig"
43 }
44
45 function refreshUpdateDR()
46 {
47 if (updateDRCombo.currentIndex>=0 && updateOld.checked) {
48 root.updateDR = diffList.get(updateDRCombo.currentIndex, "toolTip")
49 root.drTitle = diffList.get(updateDRCombo.currentIndex, "display")
50 } else {
51 if (createNew.checked) {
52 root.updateDR = ""
53 root.drTitle = ""
54 } else {
55 root.updateDR = i18nd("purpose6_phabricator", "unknown")
56 root.drTitle = ""
57 }
58 }
59 }
60
61 RowLayout {
62 Layout.alignment: Qt.AlignHCenter
63 RadioButton {
64 id: createNew
65 text: i18nd("purpose6_phabricator", "New Diff")
66 ToolTip.text: i18nd("purpose6_phabricator", "tick this to create a new \"differential diff\" which can\nbe converted online to a new differential revision")
67 onCheckedChanged: {
68 root.refreshUpdateDR();
69 }
70 }
71 RadioButton {
72 id: updateOld
73 text: i18nd("purpose6_phabricator", "Update Diff")
74 ToolTip.text: i18nd("purpose6_phabricator", "tick this to update an existing revision,\nselect one from the list below.")
75 onCheckedChanged: {
76 root.refreshUpdateDR();
77 }
78 }
79 }
80
81 ComboBox {
82 id: updateDRCombo
83 Layout.fillWidth: true
84 enabled: updateOld.checked
85 textRole: "display"
86 model: DiffListModel {
87 id: diffList
88 status: "pending"
89 }
90 onCurrentIndexChanged: {
91 root.refreshUpdateDR();
92 }
93 }
94
95 Item {
96 Layout.fillWidth: true
97 height: doBrowseCheck.height
98
99 CheckBox {
100 id: doBrowseCheck
101 anchors.centerIn: parent
102 text: i18nd("purpose6_phabricator", "Open Diff in browser")
103 enabled: updateOld.checked
104 }
105 }
106
107 Label {
108 // use i18nd("purpose6_phabricator", ).arg() to avoid showing the "%1" when inactive
109 text: updateDR != "unknown" && updateDR.length > 0 ? i18nd("purpose6_phabricator", "Summary of the update to %1:", updateDR) : i18nd("purpose6_phabricator", "Summary of the update")
110 enabled: updateOld.checked
111 }
112
113 TextArea {
114 id: updateCommentField
115 Layout.fillWidth: true
116 Layout.fillHeight: true
117 text: i18nd("purpose6_phabricator", "patch updated through %1 and the Purpose/Phabricator plugin", Qt.application.name)
118 wrapMode: TextEdit.Wrap
119 enabled: updateOld.checked
120 }
121
122 Item {
123 Layout.fillHeight: true
124 Layout.fillWidth: true
125 }
126}
Q_SCRIPTABLE CaptureState status()
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
QString path(const QString &relativePath)
QString label(StandardShortcut id)
QString name(StandardShortcut id)
qsizetype length() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.