1
0
mirror of https://github.com/QRouland/UTPass.git synced 2026-01-10 19:36:57 +00:00

Foramtting

This commit is contained in:
2026-01-06 15:42:10 +01:00
parent 083750f429
commit fbfd276b00
15 changed files with 185 additions and 186 deletions

View File

@@ -7,19 +7,16 @@ import Pass 1.0
import QtQuick 2.4
import Utils 1.0
Page {
id: importKeyFilePage
property var activeTransfer
property alias contentPicker : contentPicker
property string __text_error_description : null
property alias contentPicker: contentPicker
property string __text_error_description: null
ContentPeerPicker {
id: contentPicker
anchors.top: importKeyHeader.bottom
anchors.bottom: parent.bottom
anchors.topMargin: importKeyFilePage.header.height
@@ -28,43 +25,43 @@ Page {
showTitle: false
contentType: ContentType.Text
handler: ContentHandler.Source
onPeerSelected: {
{
importKeyFilePage.contentPicker.peer.selectionType = ContentTransfer.Single;
importKeyFilePage.activeTransfer = importKeyFilePage.contentPicker.peer.request();
importKeyFilePage.activeTransfer.stateChanged.connect(function() {
if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged");
console.log(importKeyFilePage.activeTransfer.items[0].url);
Pass.importGPGKey(importKeyFilePage.activeTransfer.items[0].url);
Pass.importGPGKeySucceed.connect(function() {
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
importKeyFilePage.activeTransfer = null;
PopupUtils.open(dialogImportKeyPageSucess);
});
Pass.importGPGKeyFailed.connect(function(err, message) {
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
importKeyFilePage.activeTransfer = null;
switch (code) {
case 1: // UnexceptedError -> use the default (not translate) rnp error
__text_error_description = message;
break;
case 2: // BadFormat
__text_error_description = i18n.tr("The file is not in a valid key format");
break;
default:
console.warn("Unhandled error code");
__text_error_description = message;
break;
}
PopupUtils.open(dialogImportKeyPageError);
});
}
});
}
{
importKeyFilePage.contentPicker.peer.selectionType = ContentTransfer.Single;
importKeyFilePage.activeTransfer = importKeyFilePage.contentPicker.peer.request();
importKeyFilePage.activeTransfer.stateChanged.connect(function() {
if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged");
console.log(importKeyFilePage.activeTransfer.items[0].url);
Pass.importGPGKey(importKeyFilePage.activeTransfer.items[0].url);
Pass.importGPGKeySucceed.connect(function() {
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
importKeyFilePage.activeTransfer = null;
PopupUtils.open(dialogImportKeyPageSucess);
});
Pass.importGPGKeyFailed.connect(function(err, message) {
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
importKeyFilePage.activeTransfer = null;
switch (code) {
case 1:
// UnexceptedError -> use the default (not translate) rnp error
__text_error_description = message;
break;
case 2:
// BadFormat
__text_error_description = i18n.tr("The file is not in a valid key format");
break;
default:
console.warn("Unhandled error code");
__text_error_description = message;
break;
}
PopupUtils.open(dialogImportKeyPageError);
});
}
});
};
}
onCancelPressed: {
pageStack.pop();
}
@@ -77,13 +74,6 @@ Page {
activeTransfer: importKeyFilePage.activeTransfer
}
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
Component {
id: dialogImportKeyPageError
@@ -105,4 +95,11 @@ Page {
}
}
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
}