Warning, /frameworks/purpose/src/plugins/phabricator/phabricatorplugin_config.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2017 René J.V. Bertin <rjvbertin@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 import QtQuick 2.2
0008 import QtQuick.Controls 2.15
0009 import QtQuick.Layouts 1.1
0010 import org.kde.purpose.phabricator 1.0
0011 
0012 ColumnLayout {
0013     id: root
0014     enabled: true
0015     property string updateDR: ""
0016     property string drTitle: ""
0017     property string localBaseDir
0018     property alias updateComment: updateCommentField.text
0019     // This is a workaround for installs where the result dialog doesn't always appear
0020     // or doesn't always show the revision URL.
0021     property alias doBrowse: doBrowseCheck.checked
0022     property variant urls
0023     property variant mimeType
0024 
0025     function labelText()
0026     {
0027         if (updateDRCombo.currentIndex>=0 && updateOld.checked) {
0028             return updateDR.length > 0 ? i18nd("purpose6_phabricator", "Update differential revision %1", updateDR) : i18nd("purpose6_phabricator", "Update differential revision")
0029         } else if (createNew.checked) {
0030             return i18nd("purpose6_phabricator", "Create new \"differential diff\"")
0031         } else {
0032             return i18nd("purpose6_phabricator", "Create or update?")
0033         }
0034     }
0035     Label {
0036         id: label
0037         text: root.labelText()
0038     }
0039 
0040     PhabricatorRC {
0041         id: json
0042         path: root.localBaseDir + "/.arcconfig"
0043     }
0044 
0045     function refreshUpdateDR()
0046     {
0047         if (updateDRCombo.currentIndex>=0 && updateOld.checked) {
0048             root.updateDR = diffList.get(updateDRCombo.currentIndex, "toolTip")
0049             root.drTitle = diffList.get(updateDRCombo.currentIndex, "display")
0050         } else {
0051             if (createNew.checked) {
0052                 root.updateDR = ""
0053                 root.drTitle = ""
0054             } else {
0055                 root.updateDR = i18nd("purpose6_phabricator", "unknown")
0056                 root.drTitle = ""
0057             }
0058         }
0059     }
0060 
0061     RowLayout {
0062         Layout.alignment: Qt.AlignHCenter
0063         RadioButton {
0064             id: createNew
0065             text: i18nd("purpose6_phabricator", "New Diff")
0066             ToolTip.text: i18nd("purpose6_phabricator", "tick this to create a new \"differential diff\" which can\nbe converted online to a new differential revision")
0067             onCheckedChanged: {
0068                 root.refreshUpdateDR();
0069             }
0070         }
0071         RadioButton {
0072             id: updateOld
0073             text: i18nd("purpose6_phabricator", "Update Diff")
0074             ToolTip.text: i18nd("purpose6_phabricator", "tick this to update an existing revision,\nselect one from the list below.")
0075             onCheckedChanged: {
0076                 root.refreshUpdateDR();
0077             }
0078         }
0079     }
0080 
0081     ComboBox {
0082         id: updateDRCombo
0083         Layout.fillWidth: true
0084         enabled: updateOld.checked
0085         textRole: "display"
0086         model: DiffListModel {
0087             id: diffList
0088             status: "pending"
0089         }
0090         onCurrentIndexChanged: {
0091             root.refreshUpdateDR();
0092         }
0093     }
0094 
0095     Item {
0096         Layout.fillWidth: true
0097         height: doBrowseCheck.height
0098 
0099         CheckBox {
0100             id: doBrowseCheck
0101             anchors.centerIn: parent
0102             text: i18nd("purpose6_phabricator", "Open Diff in browser")
0103             enabled: updateOld.checked
0104         }
0105     }
0106 
0107     Label {
0108         // use i18nd("purpose6_phabricator", ).arg() to avoid showing the "%1" when inactive
0109         text: updateDR != "unknown" && updateDR.length > 0 ? i18nd("purpose6_phabricator", "Summary of the update to %1:", updateDR) : i18nd("purpose6_phabricator", "Summary of the update")
0110         enabled: updateOld.checked
0111     }
0112 
0113     TextArea {
0114         id: updateCommentField
0115         Layout.fillWidth: true
0116         Layout.fillHeight: true
0117         text: i18nd("purpose6_phabricator", "patch updated through %1 and the Purpose/Phabricator plugin", Qt.application.name)
0118         wrapMode: TextEdit.Wrap
0119         enabled: updateOld.checked
0120     }
0121 
0122     Item {
0123         Layout.fillHeight: true
0124         Layout.fillWidth: true
0125     }
0126 }