Add unimplemented auth popup for deleting devices
This commit is contained in:
parent
088462c4f9
commit
213867750d
|
@ -16,6 +16,7 @@ HTile {
|
||||||
signal verified()
|
signal verified()
|
||||||
signal blacklisted()
|
signal blacklisted()
|
||||||
signal renameRequest(string name)
|
signal renameRequest(string name)
|
||||||
|
signal deleteRequest()
|
||||||
|
|
||||||
|
|
||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
|
@ -89,7 +90,7 @@ HTile {
|
||||||
defaultText: model.display_name
|
defaultText: model.display_name
|
||||||
maximumLength: 255
|
maximumLength: 255
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
onAccepted: renameRequest(text)
|
onAccepted: deviceTile.renameRequest(text)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
@ -97,7 +98,7 @@ HTile {
|
||||||
HButton {
|
HButton {
|
||||||
icon.name: "apply"
|
icon.name: "apply"
|
||||||
icon.color: theme.colors.positiveBackground
|
icon.color: theme.colors.positiveBackground
|
||||||
onClicked: renameRequest(nameField.text)
|
onClicked: deviceTile.renameRequest(nameField.text)
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
@ -167,6 +168,7 @@ HTile {
|
||||||
CancelButton {
|
CancelButton {
|
||||||
text: qsTr("Sign out")
|
text: qsTr("Sign out")
|
||||||
icon.name: "device-delete"
|
icon.name: "device-delete"
|
||||||
|
onClicked: deviceTile.deleteRequest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,8 @@ HColumnPage {
|
||||||
|
|
||||||
property Future loadFuture: null
|
property Future loadFuture: null
|
||||||
|
|
||||||
// property var pr: column.childrenRect.height
|
|
||||||
// onPrChanged: print("pr changed:", pr, deviceList.implicitHeight)
|
|
||||||
|
|
||||||
|
function takeFocus() {} // TODO
|
||||||
function takeFocus() {} // XXX
|
|
||||||
|
|
||||||
function loadDevices() {
|
function loadDevices() {
|
||||||
loadFuture = py.callClientCoro(userId, "devices_info", [], devices => {
|
loadFuture = py.callClientCoro(userId, "devices_info", [], devices => {
|
||||||
|
@ -55,6 +52,22 @@ HColumnPage {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteDevices(...indice) {
|
||||||
|
const deviceIds = []
|
||||||
|
|
||||||
|
for (const i of indice.sort())
|
||||||
|
deviceIds.push(deviceList.model.get(i).id)
|
||||||
|
|
||||||
|
utils.makePopup(
|
||||||
|
"Popups/AuthentificationPopup.qml",
|
||||||
|
page,
|
||||||
|
{
|
||||||
|
userId: page.userId,
|
||||||
|
deviceIds,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function getSectionItemCounts() {
|
function getSectionItemCounts() {
|
||||||
const counts = {}
|
const counts = {}
|
||||||
|
|
||||||
|
@ -71,10 +84,11 @@ HColumnPage {
|
||||||
OtherButton {
|
OtherButton {
|
||||||
text: qsTr("Refresh")
|
text: qsTr("Refresh")
|
||||||
icon.name: "device-refresh-list"
|
icon.name: "device-refresh-list"
|
||||||
onClicked: loadDevices()
|
onClicked: page.loadDevices()
|
||||||
}
|
}
|
||||||
|
|
||||||
OtherButton {
|
OtherButton {
|
||||||
|
enabled: deviceList.model.count > 0
|
||||||
text:
|
text:
|
||||||
deviceList.selectedCount === 0 ?
|
deviceList.selectedCount === 0 ?
|
||||||
qsTr("Sign out all") :
|
qsTr("Sign out all") :
|
||||||
|
@ -84,6 +98,10 @@ HColumnPage {
|
||||||
|
|
||||||
icon.name: "device-delete-checked"
|
icon.name: "device-delete-checked"
|
||||||
icon.color: theme.colors.negativeBackground
|
icon.color: theme.colors.negativeBackground
|
||||||
|
onClicked:
|
||||||
|
deviceList.selectedCount ?
|
||||||
|
page.deleteDevices(...deviceList.checkedIndice) :
|
||||||
|
page.deleteDevices(...utils.range(1, deviceList.count - 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +121,8 @@ HColumnPage {
|
||||||
userId: page.userId
|
userId: page.userId
|
||||||
onVerified: page.loadDevices()
|
onVerified: page.loadDevices()
|
||||||
onBlacklisted: page.loadDevices()
|
onBlacklisted: page.loadDevices()
|
||||||
onRenameRequest: name => renameDevice(model.index, name)
|
onRenameRequest: name => page.renameDevice(model.index, name)
|
||||||
|
onDeleteRequest: page.deleteDevices(model.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
section.property: "type"
|
section.property: "type"
|
||||||
|
|
25
src/gui/Popups/AuthentificationPopup.qml
Normal file
25
src/gui/Popups/AuthentificationPopup.qml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
import "../Base"
|
||||||
|
import "../Base/ButtonLayout"
|
||||||
|
|
||||||
|
HFlickableColumnPopup {
|
||||||
|
id: popup
|
||||||
|
|
||||||
|
|
||||||
|
property string userId
|
||||||
|
property string deviceIds
|
||||||
|
|
||||||
|
|
||||||
|
page.footer: ButtonLayout {
|
||||||
|
CancelButton {
|
||||||
|
id: cancelButton
|
||||||
|
onClicked: popup.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpened: cancelButton.forceActiveFocus()
|
||||||
|
|
||||||
|
SummaryLabel { text: qsTr("Not implemented yet") }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user