2020-10-04 23:03:37 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-06 09:16:39 +00:00
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
|
2020-10-04 23:03:37 +00:00
|
|
|
import "./"
|
2021-10-06 09:16:39 +00:00
|
|
|
import "../panels"
|
2020-10-04 23:03:37 +00:00
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
// TODO: replace with StatusModal
|
2020-10-04 23:03:37 +00:00
|
|
|
ModalPopup {
|
|
|
|
property string dapp: ""
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
id: root
|
2020-10-04 23:03:37 +00:00
|
|
|
title: dapp
|
|
|
|
|
|
|
|
width: 400
|
|
|
|
height: 400
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
property var store
|
|
|
|
|
|
|
|
Component.onCompleted: store.initPermissionList(dapp)
|
|
|
|
Component.onDestruction: store.clearPermissionList()
|
2020-10-04 23:03:37 +00:00
|
|
|
|
|
|
|
signal accessRevoked(string dapp)
|
|
|
|
|
|
|
|
Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
anchors.fill: parent
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.vertical.policy: permissionListView.contentHeight > permissionListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 0
|
|
|
|
clip: true
|
|
|
|
id: permissionListView
|
2021-10-06 09:16:39 +00:00
|
|
|
model: root.store.permissionList
|
2020-10-04 23:03:37 +00:00
|
|
|
delegate: Permission {
|
|
|
|
name: model.name
|
|
|
|
onRemoveBtnClicked: {
|
2021-10-06 09:16:39 +00:00
|
|
|
root.store.revokePermission(model.name);
|
2020-10-04 23:03:37 +00:00
|
|
|
if(permissionListView.count === 1){
|
|
|
|
accessRevoked(dapp);
|
|
|
|
close();
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
root.store.initPermissionList(dapp)
|
2020-10-04 23:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
// TODO: replace with StatusQ component
|
2021-01-28 11:04:10 +00:00
|
|
|
footer: StatusButton {
|
2020-10-04 23:03:37 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-01-28 11:04:10 +00:00
|
|
|
type: "warn"
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Revoke all access"
|
|
|
|
text: qsTrId("revoke-all-access")
|
2020-10-04 23:03:37 +00:00
|
|
|
onClicked: {
|
2021-10-06 09:16:39 +00:00
|
|
|
root.store.revokeAllPermissionAccess()
|
2020-10-04 23:03:37 +00:00
|
|
|
accessRevoked(dapp);
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;height:300;width:300}
|
|
|
|
}
|
|
|
|
##^##*/
|