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

108 lines
2.6 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
model: Pass.gpgGetAllKeysModel()
delegate: Grid {
columns: 1
width: parent.width
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
Rectangle {
width: parent.width
height: units.gu(1)
}
Text {
id: uidKey
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n.tr('Key id : %1').arg(model.modelData.uid)
}
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: LomiriColors.red
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)
}
2025-01-10 15:28:42 +01:00
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: infoKeysPageDeleteValidation
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
DoubleValidationDialog {
2025-01-10 15:28:42 +01:00
text1: i18n.tr("You're are about to delete<br>%1<br>Continue ?").arg(infoKeysPage.currentKey)
text2: i18n.tr("%1<br>will be definitively removed.<br>Continue ?").arg(infoKeysPage.currentKey)
2019-09-20 21:29:39 +02:00
onDoubleValidated: {
2025-01-10 15:28:42 +01:00
var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey);
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-10 15:28:42 +01:00
infoKeysListView.model = Pass.gpgGetAllKeysModel();
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
}