1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-01-27 08:56:39 +00:00
UTPass/qml/pages/settings/ImportGitClone.qml

126 lines
3.0 KiB
QML
Raw Normal View History

2025-01-10 15:28:42 +01:00
import "../../components"
import "../../dialogs"
import "../headers"
import Git 1.0
2025-01-10 13:48:38 +01:00
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
2025-01-10 15:28:42 +01:00
import QtQuick 2.4
2025-01-10 13:48:38 +01:00
Page {
id: importGitClonePage
2025-01-10 15:28:42 +01:00
Component.onCompleted: {
PopupUtils.open(importGitCloneValidation, importGitClonePage);
2025-01-10 13:48:38 +01:00
}
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: repoUrlLabel
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
text: i18n.tr('Repo Url')
}
TextField {
id: repoUrlInput
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
}
Text {
id: repoPasswordLabel
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
text: i18n.tr('Password')
}
TextField {
id: repoPasswordInput
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
echoMode: TextInput.Password
2025-01-10 13:48:38 +01:00
}
Button {
id: buttonAdd
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
width: parent.width
text: i18n.tr('Clone')
onClicked: {
var ret = false;
2025-01-13 18:11:16 +01:00
if (repoPasswordInput.text === "")
ret = Git.clone_http(repoUrlInput.text, Pass.password_store);
2025-01-13 18:11:16 +01:00
else
ret = Git.clone_http_pass(repoUrlInput.text, Pass.password_store, repoPasswordInput.text);
2025-01-10 15:28:42 +01:00
if (ret)
PopupUtils.open(dialogImportGitCloneSuccess);
else
PopupUtils.open(importGitCloneError, importGitClonePage);
2025-01-10 13:48:38 +01:00
}
}
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
}
Component {
2025-01-10 15:28:42 +01:00
id: importGitCloneValidation
SimpleValidationDialog {
text: i18n.tr("Importing a git repo will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop();
}
}
2025-01-10 13:48:38 +01:00
}
Component {
2025-01-10 15:28:42 +01:00
id: importGitCloneError
2025-01-10 13:48:38 +01:00
ErrorDialog {
textError: i18n.tr("An error occured during git clone !")
}
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
}
Component {
id: dialogImportGitCloneSuccess
2025-01-10 15:28:42 +01:00
SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: {
2025-01-10 15:28:42 +01:00
pageStack.pop();
pageStack.pop();
}
}
2025-01-10 15:28:42 +01:00
}
2025-01-10 15:28:42 +01:00
header: StackHeader {
id: importGitCloneHeader
title: i18n.tr('Git Clone Import')
2025-01-10 13:48:38 +01:00
}
2025-01-10 15:28:42 +01:00
2025-01-10 13:48:38 +01:00
}