blob: 2bd26fef5b89d0bf65f0766eef0165ac398985b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
import QtCore
import QtQuick 6.7
import QtQuick.Controls 6 as QQC2
import QtQuick.Layouts 6.7
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
FormCard.FormCardPage {
id: root
title: "Add a new repository"
signal accepted(string url, string name, string owner, string displayName)
FormCard.FormHeader {
title: "Github information"
}
FormCard.FormCard {
FormCard.FormTextFieldDelegate {
id: urlField
label: "URL"
onTextChanged: root.fillDataFromUrl(text)
}
FormCard.FormDelegateSeparator {}
FormCard.FormTextFieldDelegate {
id: nameField
label: "Name"
}
FormCard.FormDelegateSeparator {}
FormCard.FormTextFieldDelegate {
id: ownerField
label: "Owner"
}
FormCard.FormDelegateSeparator {}
}
FormCard.FormHeader {
title: "General information"
}
FormCard.FormCard {
FormCard.FormTextFieldDelegate {
id: displayNameField
label: "Display name"
}
}
FormCard.FormHeader {
title: "Git"
}
FormCard.FormCard {
FormCard.FormCheckDelegate {
id: cloneCheck
text: "Clone repository"
checked: false
}
FormCard.FormDelegateSeparator {}
FormCard.FormTextFieldDelegate {
id: cloneDirectory
label: "Clone directory"
enabled: cloneCheck.checked
}
}
footer: QQC2.ToolBar {
contentItem: QQC2.DialogButtonBox {
standardButtons: QQC2.Dialog.Ok | QQC2.Dialog.Cancel
onAccepted: root.accepted(
urlField.text,
nameField.text,
ownerField.text,
displayNameField.text
)
onRejected: applicationWindow().pageStack.pop()
}
}
function fillDataFromUrl(text) {
const s = text.split("/")
if (s.length > 2) {
nameField.text = s[s.length -1]
ownerField.text = s[s.length - 2]
displayNameField.text = s[s.length -1]
}
}
}
|