1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-06-29 08:42:29 +00:00

Fix style command

This commit is contained in:
2025-01-10 15:28:42 +01:00
parent 365e530efc
commit 399173b776
30 changed files with 462 additions and 402 deletions

View File

@ -1,18 +1,17 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Git 1.0
import Pass 1.0
import "../headers"
import "../../components"
import "../../dialogs"
import "../headers"
import Git 1.0
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
import QtQuick 2.4
Page {
id: importGitClonePage
header: StackHeader {
id: importGitCloneHeader
title: i18n.tr('Git Clone Import')
Component.onCompleted: {
PopupUtils.open(importGitCloneValidation, importGitClonePage);
}
Flow {
@ -30,6 +29,7 @@ Page {
Text {
id: repoUrlLabe
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
@ -38,6 +38,7 @@ Page {
TextField {
id: textFieldInput
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
@ -46,51 +47,58 @@ Page {
Button {
id: buttonAdd
width: parent.width
text: i18n.tr('Clone')
onClicked: {
var ret = Git.clone(textFieldInput.text, Pass.password_store)
if(ret) {
PopupUtils.open(dialogImportGitCloneSuccess)
} else {
PopupUtils.open(importGitCloneError, importGitClonePage)
}
var ret = Git.clone(textFieldInput.text, Pass.password_store);
if (ret)
PopupUtils.open(dialogImportGitCloneSuccess);
else
PopupUtils.open(importGitCloneError, importGitClonePage);
}
}
}
Component {
id: importGitCloneValidation
SimpleValidationDialog {
text: i18n.tr(
"Importing a git repo will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop()
}
}
id: importGitCloneValidation
SimpleValidationDialog {
text: i18n.tr("Importing a git repo will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop();
}
}
}
Component {
id: importGitCloneError
id: importGitCloneError
ErrorDialog {
textError: i18n.tr("An error occured during git clone !")
}
}
Component {
id: dialogImportGitCloneSuccess
SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: {
pageStack.pop()
pageStack.pop()
pageStack.pop();
pageStack.pop();
}
}
}
Component.onCompleted: {
PopupUtils.open(importGitCloneValidation, importGitClonePage)
header: StackHeader {
id: importGitCloneHeader
title: i18n.tr('Git Clone Import')
}
}

View File

@ -1,82 +1,80 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import Lomiri.Content 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../headers"
import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Lomiri.Content 1.3
import Pass 1.0
import QtQuick 2.4
import Utils 1.0
Page {
id: importKeyFilePage
property var activeTransfer
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
ContentPeerPicker {
anchors.top: importKeyHeader.bottom
anchors.bottom: parent.bottom
anchors.topMargin: importKeyFilePage.header.height
width: parent.width
visible: parent.visible
showTitle: false
contentType: ContentType.Text
handler: ContentHandler.Source
onPeerSelected: {
peer.selectionType = ContentTransfer.Single
importKeyFilePage.activeTransfer = peer.request()
importKeyFilePage.activeTransfer.stateChanged.connect(function () {
peer.selectionType = ContentTransfer.Single;
importKeyFilePage.activeTransfer = peer.request();
importKeyFilePage.activeTransfer.stateChanged.connect(function() {
if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged")
console.log(importKeyFilePage.activeTransfer.items[0].url)
var status = Pass.gpgImportKeyFromFile(
importKeyFilePage.activeTransfer.items[0].url)
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url)
if (status) {
PopupUtils.open(dialogImportKeyPageSucess)
} else {
PopupUtils.open(dialogImportKeyPageError)
}
importKeyFilePage.activeTransfer = null
console.log("Charged");
console.log(importKeyFilePage.activeTransfer.items[0].url);
var status = Pass.gpgImportKeyFromFile(importKeyFilePage.activeTransfer.items[0].url);
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
if (status)
PopupUtils.open(dialogImportKeyPageSucess);
else
PopupUtils.open(dialogImportKeyPageError);
importKeyFilePage.activeTransfer = null;
}
})
});
}
onCancelPressed: {
pageStack.pop()
pageStack.pop();
}
}
ContentTransferHint {
id: transferHint
anchors.fill: parent
activeTransfer: importKeyFilePage.activeTransfer
}
Component {
id: dialogImportKeyPageError
ErrorDialog {
textError: i18n.tr("Key import failed !")
}
}
Component {
id: dialogImportKeyPageSucess
SuccessDialog {
textSuccess: i18n.tr("Key successfully imported !")
onDialogClosed: {
pageStack.pop()
pageStack.pop();
}
}
}
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
}

View File

@ -1,100 +1,97 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import Lomiri.Content 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../headers"
import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Lomiri.Content 1.3
import Pass 1.0
import QtQuick 2.4
import Utils 1.0
Page {
id: importZipPage
property var activeTransfer
header: StackHeader {
id: importZipHeader
title: i18n.tr("Zip Password Store Import")
Component.onCompleted: {
PopupUtils.open(importZipPageImportValidation, importZipPage);
}
ContentPeerPicker {
anchors.top: importZipHeader.bottom
anchors.bottom: parent.bottom
anchors.topMargin: importZipPage.header.height
width: parent.width
visible: parent.visible
showTitle: false
contentType: ContentType.Text
handler: ContentHandler.Source
onPeerSelected: {
peer.selectionType = ContentTransfer.Single
importZipPage.activeTransfer = peer.request()
importZipPage.activeTransfer.stateChanged.connect(function () {
peer.selectionType = ContentTransfer.Single;
importZipPage.activeTransfer = peer.request();
importZipPage.activeTransfer.stateChanged.connect(function() {
if (importZipPage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged")
console.log(importZipPage.activeTransfer.items[0].url)
var status = Utils.unzip(
importZipPage.activeTransfer.items[0].url,
Pass.getPasswordStore())
Utils.rmFile(importZipPage.activeTransfer.items[0].url)
if (status) {
PopupUtils.open(dialogImportZipPageSuccess)
} else {
PopupUtils.open(dialogImportZipPageError)
}
importZipPage.activeTransfer = null
console.log("Charged");
console.log(importZipPage.activeTransfer.items[0].url);
var status = Utils.unzip(importZipPage.activeTransfer.items[0].url, Pass.getPasswordStore());
Utils.rmFile(importZipPage.activeTransfer.items[0].url);
if (status)
PopupUtils.open(dialogImportZipPageSuccess);
else
PopupUtils.open(dialogImportZipPageError);
importZipPage.activeTransfer = null;
}
})
});
}
onCancelPressed: {
pageStack.pop()
pageStack.pop();
}
}
ContentTransferHint {
id: transferHint
anchors.fill: parent
activeTransfer: importZipPage.activeTransfer
}
Component {
id: importZipPageImportValidation
SimpleValidationDialog {
text: i18n.tr(
"Importing a new zip will delete<br>any existing password store!<br>Continue ?")
text: i18n.tr("Importing a new zip will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop()
pageStack.pop();
}
}
}
Component {
id: dialogImportZipPageError
ErrorDialog {
textError: i18n.tr("Password store import failed !")
}
}
Component {
id: dialogImportZipPageSuccess
SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: {
pageStack.pop()
pageStack.pop()
pageStack.pop();
pageStack.pop();
}
}
}
Component.onCompleted: {
PopupUtils.open(importZipPageImportValidation, importZipPage)
header: StackHeader {
id: importZipHeader
title: i18n.tr("Zip Password Store Import")
}
}

View File

@ -1,28 +1,23 @@
import QtQuick 2.4
import "../../components"
import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
import "../headers"
import "../../components"
import "../../dialogs"
import QtQuick 2.4
Page {
id: infoKeysPage
property string currentKey
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
}
ListView {
id: infoKeysListView
anchors.top: infoKeysHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
model: Pass.gpgGetAllKeysModel()
delegate: Grid {
@ -38,6 +33,7 @@ Page {
Text {
id: uidKey
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -46,11 +42,12 @@ Page {
Button {
id: buttonDeleteKey
text: i18n.tr("Delete this key")
color: LomiriColors.red
onClicked: {
infoKeysPage.currentKey = model.modelData.uid
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage)
infoKeysPage.currentKey = model.modelData.uid;
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage);
}
}
@ -58,43 +55,53 @@ Page {
width: parent.width
height: units.gu(1)
}
}
}
Component {
id: infoKeysPageDeleteValidation
DoubleValidationDialog {
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)
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)
onDoubleValidated: {
var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey)
if (status) {
PopupUtils.open(infoKeysPageDeleteSuccess)
} else {
PopupUtils.open(infoKeysPageDeleteError)
}
var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey);
if (status)
PopupUtils.open(infoKeysPageDeleteSuccess);
else
PopupUtils.open(infoKeysPageDeleteError);
}
}
}
Component {
id: infoKeysPageDeleteError
ErrorDialog {
textError: i18n.tr("Key removal failed !")
}
}
Component {
id: infoKeysPageDeleteSuccess
SuccessDialog {
textSuccess: i18n.tr("Key successfully deleted !")
onDialogClosed: {
infoKeysListView.model = Pass.gpgGetAllKeysModel()
infoKeysListView.model = Pass.gpgGetAllKeysModel();
}
}
}
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
}
}

View File

@ -1,19 +1,14 @@
import QtQuick 2.4
import "../../components"
import "../headers"
import Lomiri.Components 1.3
import Pass 1.0
import "../headers"
import "../../components"
import QtQuick 2.4
Page {
id: settingsPage
property string gpgKeyId: ""
header: StackHeader {
id: settingsHeader
title: i18n.tr('Settings')
}
Flow {
anchors.top: settingsHeader.bottom
anchors.bottom: parent.bottom
@ -27,14 +22,17 @@ Page {
height: units.gu(4)
text: i18n.tr('GPG')
}
PageStackLink {
page: Qt.resolvedUrl("ImportKeyFile.qml")
text: i18n.tr('Import a GPG key file')
}
PageStackLink {
page: Qt.resolvedUrl("InfoKeys.qml")
text: i18n.tr('Show GPG keys')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -42,22 +40,32 @@ Page {
height: units.gu(4)
text: i18n.tr('Password Store')
}
PageStackLink {
page: Qt.resolvedUrl("ImportGitClone.qml")
text: i18n.tr('Import a Password Store using Git')
}
PageStackLink {
page: Qt.resolvedUrl("ImportZip.qml")
text: i18n.tr('Import a Password Store Zip')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(4)
color: LomiriColors.red
text: i18n.tr(
'Warning: importing delete any exiting Password Store')
text: i18n.tr('Warning: importing delete any exiting Password Store')
}
}
header: StackHeader {
id: settingsHeader
title: i18n.tr('Settings')
}
}