Add unimplemented auth popup for deleting devices
This commit is contained in:
		@@ -16,6 +16,7 @@ HTile {
 | 
			
		||||
    signal verified()
 | 
			
		||||
    signal blacklisted()
 | 
			
		||||
    signal renameRequest(string name)
 | 
			
		||||
    signal deleteRequest()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    backgroundColor: "transparent"
 | 
			
		||||
@@ -89,7 +90,7 @@ HTile {
 | 
			
		||||
                    defaultText: model.display_name
 | 
			
		||||
                    maximumLength: 255
 | 
			
		||||
                    horizontalAlignment: Qt.AlignHCenter
 | 
			
		||||
                    onAccepted: renameRequest(text)
 | 
			
		||||
                    onAccepted: deviceTile.renameRequest(text)
 | 
			
		||||
 | 
			
		||||
                    Layout.fillWidth: true
 | 
			
		||||
                }
 | 
			
		||||
@@ -97,7 +98,7 @@ HTile {
 | 
			
		||||
                HButton {
 | 
			
		||||
                    icon.name: "apply"
 | 
			
		||||
                    icon.color: theme.colors.positiveBackground
 | 
			
		||||
                    onClicked: renameRequest(nameField.text)
 | 
			
		||||
                    onClicked: deviceTile.renameRequest(nameField.text)
 | 
			
		||||
 | 
			
		||||
                    Layout.fillHeight: true
 | 
			
		||||
                }
 | 
			
		||||
@@ -167,6 +168,7 @@ HTile {
 | 
			
		||||
                CancelButton {
 | 
			
		||||
                    text: qsTr("Sign out")
 | 
			
		||||
                    icon.name: "device-delete"
 | 
			
		||||
                    onClicked: deviceTile.deleteRequest()
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,11 +26,8 @@ HColumnPage {
 | 
			
		||||
 | 
			
		||||
    property Future loadFuture: null
 | 
			
		||||
 | 
			
		||||
    // property var pr: column.childrenRect.height
 | 
			
		||||
    // onPrChanged: print("pr changed:", pr, deviceList.implicitHeight)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    function takeFocus() {} // XXX
 | 
			
		||||
    function takeFocus() {} // TODO
 | 
			
		||||
 | 
			
		||||
    function loadDevices() {
 | 
			
		||||
        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() {
 | 
			
		||||
        const counts = {}
 | 
			
		||||
 | 
			
		||||
@@ -71,10 +84,11 @@ HColumnPage {
 | 
			
		||||
        OtherButton {
 | 
			
		||||
            text: qsTr("Refresh")
 | 
			
		||||
            icon.name: "device-refresh-list"
 | 
			
		||||
            onClicked: loadDevices()
 | 
			
		||||
            onClicked: page.loadDevices()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        OtherButton {
 | 
			
		||||
            enabled: deviceList.model.count > 0
 | 
			
		||||
            text:
 | 
			
		||||
                deviceList.selectedCount === 0 ?
 | 
			
		||||
                qsTr("Sign out all") :
 | 
			
		||||
@@ -84,6 +98,10 @@ HColumnPage {
 | 
			
		||||
 | 
			
		||||
            icon.name: "device-delete-checked"
 | 
			
		||||
            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
 | 
			
		||||
            onVerified: 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"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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") }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user