mirror of
https://github.com/QRouland/UTPass.git
synced 2025-02-10 14:47:14 +00:00
Save last git clone settings (urls,types)
This commit is contained in:
parent
2409f33f59
commit
6fe50d2c90
@ -48,6 +48,10 @@ endif()
|
|||||||
|
|
||||||
qt5_use_modules(${PROJECT_NAME} Gui Qml Quick QuickTest)
|
qt5_use_modules(${PROJECT_NAME} Gui Qml Quick QuickTest)
|
||||||
|
|
||||||
|
set_source_files_properties(qml/singletons/GitSettings.qml PROPERTIES
|
||||||
|
QT_QML_SINGLETON_TYPE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
if(TESTS_RUNNER)
|
if(TESTS_RUNNER)
|
||||||
qt5_use_modules(${PROJECT_NAME} QuickTest)
|
qt5_use_modules(${PROJECT_NAME} QuickTest)
|
||||||
endif()
|
endif()
|
||||||
|
@ -4,6 +4,12 @@ import Pass 1.0
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
signal repoUrlChanged(string url)
|
||||||
|
|
||||||
|
function setRepoUrl(url) {
|
||||||
|
repoUrlInput.text = url;
|
||||||
|
}
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
@ -24,6 +30,7 @@ Column {
|
|||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
width: parent.width
|
width: parent.width
|
||||||
placeholderText: "http(s)://<hostname>"
|
placeholderText: "http(s)://<hostname>"
|
||||||
|
onContentWidthChanged: repoUrlChanged(repoUrlInput.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
@ -4,6 +4,12 @@ import Pass 1.0
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
signal repoUrlChanged(string url)
|
||||||
|
|
||||||
|
function setRepoUrl(url) {
|
||||||
|
repoUrlInput.text = url;
|
||||||
|
}
|
||||||
|
|
||||||
anchors.top: parent.fill
|
anchors.top: parent.fill
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
@ -24,6 +30,7 @@ Column {
|
|||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
width: parent.width
|
width: parent.width
|
||||||
placeholderText: "http(s)://<username>@<hostname>"
|
placeholderText: "http(s)://<username>@<hostname>"
|
||||||
|
onContentWidthChanged: repoUrlChanged(repoUrlInput.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
@ -31,15 +31,15 @@ Page {
|
|||||||
for (var i = 0; i < ret.length; i++) {
|
for (var i = 0; i < ret.length; i++) {
|
||||||
if (ret[i])
|
if (ret[i])
|
||||||
passwordListSearch.model.append({
|
passwordListSearch.model.append({
|
||||||
"fileName": ret[i]
|
"fileName": ret[i]
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
__passwordStorePath = "file:" + Pass.password_store;
|
passwordListPage.__passwordStorePath = "file:" + Pass.password_store;
|
||||||
Pass.onShowSucceed.connect(function(filename, text) {
|
Pass.onShowSucceed.connect(function(filename, text) {
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), {
|
pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), {
|
||||||
"plainText": text,
|
"plainText": text,
|
||||||
@ -50,7 +50,7 @@ Page {
|
|||||||
PopupUtils.open(passwordPageDecryptError);
|
PopupUtils.open(passwordPageDecryptError);
|
||||||
});
|
});
|
||||||
Pass.onLsSucceed.connect(function(passwords) {
|
Pass.onLsSucceed.connect(function(passwords) {
|
||||||
__passwords = passwords;
|
passwordListPage.__passwords = passwords;
|
||||||
});
|
});
|
||||||
Pass.ls();
|
Pass.ls();
|
||||||
}
|
}
|
||||||
@ -113,8 +113,8 @@ Page {
|
|||||||
|
|
||||||
model: FolderListModel {
|
model: FolderListModel {
|
||||||
nameFilters: ["*.gpg"]
|
nameFilters: ["*.gpg"]
|
||||||
rootFolder: __passwordStorePath
|
rootFolder: passwordListPage.__passwordStorePath
|
||||||
folder: __passwordStorePath
|
folder: passwordListPage.__passwordStorePath
|
||||||
showDirs: true
|
showDirs: true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ Page {
|
|||||||
fName: fileName
|
fName: fileName
|
||||||
fIsDir: false
|
fIsDir: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var path = __passwordStorePath + "/" + fileName;
|
var path = passwordListPage.__passwordStorePath + "/" + fileName;
|
||||||
console.debug("pass show %1".arg(path));
|
console.debug("pass show %1".arg(path));
|
||||||
Pass.show(path);
|
Pass.show(path);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "../../components"
|
import "../../components"
|
||||||
import "../../dialogs"
|
import "../../dialogs"
|
||||||
|
import "../../settings"
|
||||||
import "../headers"
|
import "../headers"
|
||||||
import Lomiri.Components 1.3
|
import Lomiri.Components 1.3
|
||||||
import Lomiri.Components.Popups 1.3
|
import Lomiri.Components.Popups 1.3
|
||||||
@ -77,6 +78,8 @@ Page {
|
|||||||
SuccessDialog {
|
SuccessDialog {
|
||||||
textSuccess: i18n.tr("Password Store deleted !")
|
textSuccess: i18n.tr("Password Store deleted !")
|
||||||
onDialogClosed: {
|
onDialogClosed: {
|
||||||
|
GitSettings.type = 0;
|
||||||
|
GitSettings.repoUrl = null;
|
||||||
pageStack.clear();
|
pageStack.clear();
|
||||||
pageStack.push(Qt.resolvedUrl("../PasswordList.qml"));
|
pageStack.push(Qt.resolvedUrl("../PasswordList.qml"));
|
||||||
}
|
}
|
||||||
|
149
qml/pages/settings/ImportGitClone.qml
Normal file
149
qml/pages/settings/ImportGitClone.qml
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
import "../../components"
|
||||||
|
import "../../dialogs"
|
||||||
|
import "../../settings"
|
||||||
|
import "../headers"
|
||||||
|
import Git 1.0
|
||||||
|
import Lomiri.Components 1.3
|
||||||
|
import Lomiri.Components.Pickers 1.3
|
||||||
|
import Lomiri.Components.Popups 1.3
|
||||||
|
import Pass 1.0
|
||||||
|
import QtQuick 2.4
|
||||||
|
|
||||||
|
Page {
|
||||||
|
id: importGitClonePage
|
||||||
|
|
||||||
|
property string __repoUrl
|
||||||
|
|
||||||
|
function __loadForm() {
|
||||||
|
console.debug("yo");
|
||||||
|
switch (combo.selectedIndex) {
|
||||||
|
case 0:
|
||||||
|
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttp.qml");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttpAuth.qml");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
Git.cloneSucceed.connect(function() {
|
||||||
|
GitSettings.type = combo.selectedIndex;
|
||||||
|
GitSettings.repoUrl = importGitClonePage.__repoUrl;
|
||||||
|
PopupUtils.open(dialogGitCloneSuccess);
|
||||||
|
});
|
||||||
|
Git.cloneFailed.connect(function() {
|
||||||
|
PopupUtils.open(dialogGitCloneError);
|
||||||
|
});
|
||||||
|
if (GitSettings.repoUrl)
|
||||||
|
__repoUrl = GitSettings.repoUrl;
|
||||||
|
|
||||||
|
if (GitSettings.type < combo.count && GitSettings.type > 0)
|
||||||
|
combo.selectedIndex = GitSettings.type;
|
||||||
|
else
|
||||||
|
combo.selectedIndex = 0;
|
||||||
|
__loadForm();
|
||||||
|
PopupUtils.open(importGitCloneValidation, importGitClonePage);
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.top: importGitCloneHeader.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.leftMargin: units.gu(2)
|
||||||
|
anchors.rightMargin: units.gu(2)
|
||||||
|
spacing: units.gu(1)
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: units.gu(1)
|
||||||
|
color: theme.palette.normal.background
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionSelector {
|
||||||
|
id: combo
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
model: ["HTTP", "HTTP AUTH"]
|
||||||
|
onDelegateClicked: function(i) {
|
||||||
|
timer.setTimeout(function() {
|
||||||
|
__loadForm();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
|
||||||
|
function setTimeout(cb, delayTime) {
|
||||||
|
timer.interval = delayTime;
|
||||||
|
timer.repeat = false;
|
||||||
|
timer.triggered.connect(cb);
|
||||||
|
timer.triggered.connect(function release() {
|
||||||
|
timer.triggered.disconnect(cb); // This is important
|
||||||
|
timer.triggered.disconnect(release); // This is important as well
|
||||||
|
});
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: importGitCloneForm
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
onLoaded: {
|
||||||
|
importGitCloneForm.item.repoUrlChanged.connect(function(url) {
|
||||||
|
importGitClonePage.__repoUrl = url;
|
||||||
|
});
|
||||||
|
importGitCloneForm.item.setRepoUrl(importGitClonePage.__repoUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: importGitCloneValidation
|
||||||
|
|
||||||
|
SimpleValidationDialog {
|
||||||
|
text: i18n.tr("Importing a git repo will delete<br>any existing password store!<br>Continue ?")
|
||||||
|
continueText: i18n.tr("Yes")
|
||||||
|
continueColor: theme.palette.normal.negative
|
||||||
|
onCanceled: {
|
||||||
|
pageStack.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: dialogGitCloneError
|
||||||
|
|
||||||
|
ErrorDialog {
|
||||||
|
textError: i18n.tr("An error occured during git clone !")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: dialogGitCloneSuccess
|
||||||
|
|
||||||
|
SuccessDialog {
|
||||||
|
textSuccess: i18n.tr("Password store sucessfully imported !")
|
||||||
|
onDialogClosed: {
|
||||||
|
pageStack.clear();
|
||||||
|
pageStack.push(Qt.resolvedUrl("../PasswordList.qml"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
header: StackHeader {
|
||||||
|
id: importGitCloneHeader
|
||||||
|
|
||||||
|
title: i18n.tr('Git Clone Import')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,8 +7,6 @@ import QtQuick 2.4
|
|||||||
Page {
|
Page {
|
||||||
id: settingsPage
|
id: settingsPage
|
||||||
|
|
||||||
property string gpgKeyId: ""
|
|
||||||
|
|
||||||
Flow {
|
Flow {
|
||||||
anchors.top: settingsHeader.bottom
|
anchors.top: settingsHeader.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
@ -44,7 +42,7 @@ Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageStackLink {
|
PageStackLink {
|
||||||
page: Qt.resolvedUrl("git/ImportGitClone.qml")
|
page: Qt.resolvedUrl("ImportGitClone.qml")
|
||||||
text: i18n.tr('Import a Password Store using Git')
|
text: i18n.tr('Import a Password Store using Git')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
import Git 1.0
|
|
||||||
import Lomiri.Components 1.3
|
|
||||||
import Lomiri.Components.Pickers 1.3
|
|
||||||
import QtQuick 2.4
|
|
||||||
|
|
||||||
OptionSelector {
|
|
||||||
id: combo
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
model: ["HTTP", "HTTP AUTH"]
|
|
||||||
onDelegateClicked: function(i) {
|
|
||||||
if (i === 0)
|
|
||||||
timer.setTimeout(function() {
|
|
||||||
importGitCloneForm.source = Qt.resolvedUrl("GitCloneHttp.qml");
|
|
||||||
}, 500);
|
|
||||||
else if (i === 1)
|
|
||||||
timer.setTimeout(function() {
|
|
||||||
importGitCloneForm.source = Qt.resolvedUrl("GitCloneHttpAuth.qml");
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: timer
|
|
||||||
|
|
||||||
function setTimeout(cb, delayTime) {
|
|
||||||
timer.interval = delayTime;
|
|
||||||
timer.repeat = false;
|
|
||||||
timer.triggered.connect(cb);
|
|
||||||
timer.triggered.connect(function release() {
|
|
||||||
timer.triggered.disconnect(cb); // This is important
|
|
||||||
timer.triggered.disconnect(release); // This is important as well
|
|
||||||
});
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
Git.cloneSucceed.connect(function() {
|
|
||||||
PopupUtils.open(dialogGitCloneSuccess);
|
|
||||||
});
|
|
||||||
Git.cloneFailed.connect(function() {
|
|
||||||
PopupUtils.open(dialogGitCloneError);
|
|
||||||
});
|
|
||||||
PopupUtils.open(importGitCloneValidation, importGitClonePage);
|
|
||||||
importGitCloneForm.source = Qt.resolvedUrl("GitCloneHttp.qml");
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.top: importGitCloneHeader.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: units.gu(2)
|
|
||||||
anchors.rightMargin: units.gu(2)
|
|
||||||
spacing: units.gu(1)
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: units.gu(1)
|
|
||||||
color: theme.palette.normal.background
|
|
||||||
}
|
|
||||||
|
|
||||||
GitModeOptionSelector {
|
|
||||||
id: combo
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: importGitCloneForm
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: importGitCloneValidation
|
|
||||||
|
|
||||||
SimpleValidationDialog {
|
|
||||||
text: i18n.tr("Importing a git repo will delete<br>any existing password store!<br>Continue ?")
|
|
||||||
continueText: i18n.tr("Yes")
|
|
||||||
continueColor: theme.palette.normal.negative
|
|
||||||
onCanceled: {
|
|
||||||
pageStack.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: dialogGitCloneError
|
|
||||||
|
|
||||||
ErrorDialog {
|
|
||||||
textError: i18n.tr("An error occured during git clone !")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: dialogGitCloneSuccess
|
|
||||||
|
|
||||||
SuccessDialog {
|
|
||||||
textSuccess: i18n.tr("Password store sucessfully imported !")
|
|
||||||
onDialogClosed: {
|
|
||||||
pageStack.clear();
|
|
||||||
pageStack.push(Qt.resolvedUrl("../../PasswordList.qml"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
header: StackHeader {
|
|
||||||
id: importGitCloneHeader
|
|
||||||
|
|
||||||
title: i18n.tr('Git Clone Import')
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
7
qml/settings/GitSettings.qml
Normal file
7
qml/settings/GitSettings.qml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import Qt.labs.settings 1.0
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
property int type: 0
|
||||||
|
property string repoUrl: null
|
||||||
|
}
|
2
qml/settings/qmldir
Normal file
2
qml/settings/qmldir
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
module settings
|
||||||
|
singleton GitSettings 1.0 GitSettings.qml
|
Loading…
x
Reference in New Issue
Block a user