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

Initial git clone feature

This commit is contained in:
2025-01-10 13:48:38 +01:00
parent d33932be6d
commit 5e5a092da1
22 changed files with 334 additions and 91 deletions

View File

@ -67,6 +67,6 @@ Page {
}
Component.onCompleted: {
passwordStorePath = "file:" + Pass.getPasswordStore()
passwordStorePath = "file:" + Pass.password_store
}
}

View File

@ -0,0 +1,85 @@
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"
Page {
id: importGitClonePage
header: StackHeader {
id: importGitCloneHeader
title: i18n.tr('Git Clone Import')
}
Flow {
anchors.top: importGitCloneHeader.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.leftMargin: units.gu(2)
anchors.rightMargin: units.gu(2)
spacing: units.gu(1)
Rectangle {
width: parent.width
height: units.gu(1)
}
Text {
id: repoUrlLabe
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
text: i18n.tr('Repo Url')
}
TextField {
id: textFieldInput
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
placeholderText: i18n.tr('Git repo url')
}
Button {
id: buttonAdd
width: parent.width
text: i18n.tr('Clone')
onClicked: {
var ret = Git.clone(textFieldInput.text, Pass.password_store)
if(ret) {
pageStack.pop()
} 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()
}
}
}
Component {
id: importGitCloneError
ErrorDialog {
textError: i18n.tr("An error occured during git clone !")
}
}
Component.onCompleted: {
PopupUtils.open(importGitCloneValidation, importGitClonePage)
}
}

View File

@ -42,6 +42,10 @@ 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')