1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-07-05 03:22:27 +00:00

Refactor gpg for more clean job handling

This commit is contained in:
2025-01-15 23:15:00 +01:00
parent 00116aea8c
commit e589abd10c
11 changed files with 381 additions and 242 deletions

View File

@ -10,8 +10,6 @@ MainView {
id: root
signal responsePassphraseDialog(bool canceled, string passphrase)
function initPass(rootView) {
Pass.initialize(rootView);
pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml"));
@ -19,30 +17,36 @@ MainView {
function callPassphraseDialog(useridHint, description, previousWasBad) {
//TODO use parameters to impove passphrase dialog
var passphraseDialog = PopupUtils.open(Qt.resolvedUrl("dialogs/PassphraseDialog.qml"));
passphraseDialog.activateFocus();
var validated = function validated(passphrase) {
responsePassphraseDialog(false, passphrase);
};
var canceled = function canceled() {
responsePassphraseDialog(true, "");
};
passphraseDialog.validated.connect(validated);
passphraseDialog.canceled.connect(canceled);
var pop = PopupUtils.open(passphraseDialog);
pop.activateFocus();
}
objectName: "mainView"
applicationName: "utpass.qrouland"
automaticOrientation: false
width: units.gu(48)
height: units.gu(80)
automaticOrientation: true
width: units.gu(45)
height: units.gu(75)
PageStack {
id: pageStack
anchors.fill: parent
Component.onCompleted: {
}
}
Component {
id: passphraseDialog
PassphraseDialog {
onValidated: {
console.info("valided");
Pass.responsePassphraseDialog(false, passphrase);
}
onCanceled: {
console.info("canceled");
Pass.responsePassphraseDialog(true, "");
}
}
}
}

View File

@ -33,12 +33,14 @@ Component {
MouseArea {
anchors.fill: parent
onClicked: {
if (fileIsDir) {
folderModel.folder = folderModel.folder + "/" + fileName;
var path = folderModel.folder + "/" + fileName;
if (fileIsDir) {
folderModel.folder = path;
backAction.visible = true;
passwordListHeader.title = fileName;
} else {
Pass.show(folderModel.folder + "/" + fileName);
console.debug("pass show %1".arg(path))
Pass.show(path);
}
}
}
@ -52,15 +54,6 @@ Component {
borderColor: LomiriColors.warmGrey
}
Component {
id: passwordPageDecryptError
ErrorDialog {
textError: i18n.tr("Decryption failed !")
}
}
}
}

View File

@ -49,11 +49,11 @@ Page {
iconName: "back"
text: "Back"
onTriggered: {
// passwordPage.plainText = "";
// for (var object in objects) {
// object.text = "";
// object.destroy();
// }
passwordPage.plainText = null;
for (var object in objects) {
object.text = null;
object.destroy();
}
pageStack.pop();
}
}

View File

@ -1,9 +1,11 @@
import "headers"
import "../components"
import "../dialogs"
import Lomiri.Components 1.3
import Pass 1.0
import Qt.labs.folderlistmodel 2.1
import QtQuick 2.4
import "headers"
import Lomiri.Components.Popups 1.3
Page {
id: passwordListPage
@ -13,13 +15,13 @@ Page {
anchors.fill: parent
Component.onCompleted: {
passwordStorePath = "file:" + Pass.password_store;
Pass.onDecrypted.connect(function(filename, text) {
Pass.onShowSucceed.connect(function(filename, text) {
pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), {
"plainText": text,
"title": filename
});
});
Pass.onDecryptFailed.connect(function() {
Pass.onShowFailed.connect(function(message) {
PopupUtils.open(passwordPageDecryptError);
});
}
@ -87,4 +89,13 @@ Page {
]
}
Component {
id: passwordPageDecryptError
ErrorDialog {
textError: i18n.tr("Decryption failed !")
}
}
}