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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Dialogs 1.2 as Dialogs
import QtGraphicalEffects 1.12
import org.kde.kirigami 2.19 as Kirigami
import org.kde.plasma.workspace.dialogs 1.0
Kirigami.AbstractApplicationWindow {
id: root
width: 600
height: 600
SystemDialog {
id: simple
mainText: "Reset Data"
subtitle: "This will reset all of your data."
iconName: "documentinfo"
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
}
SystemDialog {
id: simpleList
mainText: "Reset Data"
subtitle: "This will reset all of your data."
iconName: "documentinfo"
ListView {
Layout.fillWidth: true
implicitHeight: 300
model: ListModel {
ListElement {
display: "banana"
}
ListElement {
display: "banana1"
}
ListElement {
display: "banana2"
}
ListElement {
display: "banana3"
}
}
delegate: Kirigami.BasicListItem {
icon: "kate"
label: display
highlighted: false
checkable: true
}
}
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
}
SystemDialog {
id: desktopPolkit
mainText: "Authentication Required"
subtitle: "Authentication is needed to run `/usr/bin/ls` as the super user."
iconName: "im-user-online"
Kirigami.PasswordField {}
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
actions: [
Kirigami.Action {
text: "Details"
iconName: "documentinfo"
onTriggered: desktopPolkit.close()
}
]
}
SystemDialog {
id: xdgDialog
mainText: "Wallet access"
subtitle: "Share your wallet with 'Somebody'."
iconName: "kwallet"
acceptable: false
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
Component.onCompleted: {
dialogButtonBox.standardButton(DialogButtonBox.Ok).text = "Share"
}
actions: [
Kirigami.Action {
text: "Something Happens"
iconName: "documentinfo"
onTriggered: xdgDialog.acceptable = true
}
]
}
SystemDialog {
id: appchooser
title: "Open with..."
iconName: "applications-all"
ColumnLayout {
Text {
text: "height: " + parent.height + " / " + xdgDialog.height
}
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
maximumLineCount: 3
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris at viverra mi. Maecenas volutpat et nisi ac scelerisque. Mauris pulvinar blandit dapibus. Nulla facilisi. Donec congue imperdiet maximus. Aliquam gravida velit sed mattis convallis. Nam id nisi egestas nibh ultrices varius quis at sapien."
wrapMode: Text.WordWrap
onLinkActivated: {
AppChooserData.openDiscover()
}
}
Frame {
id: viewBackground
Layout.fillWidth: true
Layout.fillHeight: true
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View
background: Rectangle {
color: Kirigami.Theme.backgroundColor
property color borderColor: Kirigami.Theme.textColor
border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3)
}
ScrollView {
anchors.fill: parent
implicitHeight: grid.cellHeight * 3
GridView {
id: grid
cellHeight: Kirigami.Units.iconSizes.huge + 50
cellWidth: Kirigami.Units.iconSizes.huge + 80
model: ListModel {
ListElement {
display: "banana"
}
ListElement {
display: "banana1"
}
ListElement {
display: "banana2"
}
ListElement {
display: "banana3"
}
}
delegate: Rectangle {
color: "blue"
height: grid.cellHeight
width: grid.cellWidth
Kirigami.Icon {
source: "kalgebra"
}
}
}
}
}
Button {
id: showAllAppsButton
Layout.alignment: Qt.AlignHCenter
icon.name: "view-more-symbolic"
text: "Show More"
onClicked: {
visible = false
}
}
Kirigami.SearchField {
id: searchField
Layout.fillWidth: true
visible: !showAllAppsButton.visible
opacity: visible
}
}
}
SystemDialog {
id: mobilePolkit
mainText: "Authentication Required"
subtitle: "Authentication is needed to run `/usr/bin/ls` as the super user."
ColumnLayout {
width: Kirigami.Units.gridUnit * 20
Kirigami.Avatar {
implicitHeight: Kirigami.Units.iconSizes.medium
implicitWidth: Kirigami.Units.iconSizes.medium
Layout.alignment: Qt.AlignHCenter
}
Kirigami.PasswordField {
Layout.fillWidth: true
}
}
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
actions: [
Kirigami.Action {
text: "Details"
iconName: "documentinfo"
onTriggered: mobilePolkit.close()
}
]
}
SystemDialog {
id: sim
mainText: "SIM Locked"
subtitle: "Please enter your SIM PIN in order to unlock it."
width: Kirigami.Units.gridUnit * 20
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
Kirigami.PasswordField {
Layout.fillWidth: true
}
}
SystemDialog {
id: device
mainText: "Device Request"
subtitle: "Allow <b>PureMaps</b> to access your location?"
layout: Qt.Vertical
actions: [
Kirigami.Action {
text: "Allow all the time"
onTriggered: device.accept()
},
Kirigami.Action {
text: "Allow only while the app is in use"
onTriggered: device.accept()
},
Kirigami.Action {
text: "Deny"
onTriggered: device.accept()
}
]
}
SystemDialog {
id: wifi
mainText: "eduroam"
Kirigami.FormLayout {
ComboBox {
model: ["PEAP"]
Layout.fillWidth: true
Kirigami.FormData.label: "EAP method:"
currentIndex: 0
}
ComboBox {
model: ["MSCHAPV2"]
Layout.fillWidth: true
Kirigami.FormData.label: "Phase 2 authentication:"
currentIndex: 0
}
TextField {
Kirigami.FormData.label: "Domain:"
Layout.fillWidth: true
text: ""
}
TextField {
Kirigami.FormData.label: "Identity:"
Layout.fillWidth: true
}
TextField {
Kirigami.FormData.label: "Username:"
Layout.fillWidth: true
}
Kirigami.PasswordField {
Kirigami.FormData.label: "Password:"
Layout.fillWidth: true
}
}
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
Component.onCompleted: {
dialogButtonBox.standardButton(DialogButtonBox.Ok).text = "Save"
}
}
ColumnLayout {
anchors.fill: parent
Button {
text: "Simple dialog (Desktop)"
onClicked: {
simple.present()
}
}
Button {
text: "Simple List"
onClicked: {
simpleList.present()
}
}
Button {
text: "Polkit dialog (Desktop)"
onClicked: {
desktopPolkit.present()
}
}
Button {
text: "App Chooser(-ish)"
onClicked: {
appchooser.present()
}
}
Button {
text: "XDG dialog (Desktop)"
onClicked: {
xdgDialog.present()
}
}
Button {
text: "Polkit dialog (Mobile)"
onClicked: {
mobilePolkit.present()
}
}
Button {
text: "SIM PIN dialog (Mobile)"
onClicked: {
sim.present()
}
}
Button {
text: "Device request dialog (Mobile)"
onClicked: {
device.present()
}
}
Button {
text: "Wifi Dialog (Mobile)"
onClicked: {
wifi.present()
}
}
}
}
|