1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-01-27 17:06:39 +00:00
UTPass/qml/pages/settings/InfoKeys.qml

158 lines
4.2 KiB
QML
Raw Normal View History

2025-01-10 15:28:42 +01:00
import "../../components"
import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
2019-09-20 21:29:39 +02:00
import Pass 1.0
2025-01-10 15:28:42 +01:00
import QtQuick 2.4
2019-09-20 21:29:39 +02:00
Page {
id: infoKeysPage
property string currentKey
ListView {
id: infoKeysListView
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
anchors.top: infoKeysHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
2025-01-14 08:15:03 +01:00
model: Pass.getAllGPGKeys()
2019-09-20 21:29:39 +02:00
delegate: Grid {
columns: 1
width: parent.width
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
Rectangle {
width: parent.width
height: units.gu(1)
color: theme.palette.normal.background
2019-09-20 21:29:39 +02:00
}
Text {
2025-01-14 12:20:55 +01:00
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n.tr('Key ID :')
color: theme.palette.normal.backgroundText
}
2025-01-10 15:28:42 +01:00
2025-01-14 12:20:55 +01:00
Text {
2019-09-20 21:29:39 +02:00
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
2025-01-14 12:20:55 +01:00
text: model.modelData.uid
color: theme.palette.normal.backgroundText
}
2025-01-14 12:20:55 +01:00
Rectangle {
width: parent.width
height: units.gu(1)
color: theme.palette.normal.background
}
ListModel {
id: userIdsModel
Component.onCompleted: {
for(var i=0; i< model.modelData.userIds.length; ++i){
userIdsModel.append({"model": model.modelData.userIds[i]})
}
}
}
Text {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n.tr('Users IDs : ')
color: theme.palette.normal.backgroundText
}
Repeater {
model: userIdsModel
Text {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: modelData.uid
color: theme.palette.normal.backgroundText
}
}
Rectangle {
width: parent.width
height: units.gu(1)
color: theme.palette.normal.background
2019-09-20 21:29:39 +02:00
}
Button {
id: buttonDeleteKey
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
text: i18n.tr("Delete this key")
color: theme.palette.normal.negative
2019-09-20 21:29:39 +02:00
onClicked: {
2025-01-10 15:28:42 +01:00
infoKeysPage.currentKey = model.modelData.uid;
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage);
2019-09-20 21:29:39 +02:00
}
}
Rectangle {
width: parent.width
height: units.gu(1)
color: theme.palette.normal.background
2019-09-20 21:29:39 +02:00
}
}
}
Component {
id: infoKeysPageDeleteValidation
2025-01-10 15:28:42 +01:00
SimpleValidationDialog {
text: i18n.tr("You're are about to delete<br>%1<br>Continue ?").arg(infoKeysPage.currentKey)
continueText: i18n.tr("Yes")
continueColor: theme.palette.normal.negative
onValidated: {
2025-01-14 08:15:03 +01:00
var status = Pass.deleteGPGKey(infoKeysPage.currentKey);
2025-01-10 15:28:42 +01:00
if (status)
PopupUtils.open(infoKeysPageDeleteSuccess);
else
PopupUtils.open(infoKeysPageDeleteError);
2019-09-20 21:29:39 +02:00
}
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}
Component {
id: infoKeysPageDeleteError
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
ErrorDialog {
textError: i18n.tr("Key removal failed !")
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}
Component {
id: infoKeysPageDeleteSuccess
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
SuccessDialog {
textSuccess: i18n.tr("Key successfully deleted !")
onDialogClosed: {
2025-01-14 08:15:03 +01:00
infoKeysListView.model = Pass.getAllGPGKeys();
2019-09-20 21:29:39 +02:00
}
}
2025-01-10 15:28:42 +01:00
}
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
2019-09-20 21:29:39 +02:00
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}