mirror of
https://github.com/QRouland/UTPass.git
synced 2025-06-25 06:52:28 +00:00
Add support for ssh clone
This commit is contained in:
149
qml/components/GitCloneSshKey.qml
Normal file
149
qml/components/GitCloneSshKey.qml
Normal file
@ -0,0 +1,149 @@
|
||||
import Git 1.0
|
||||
import Lomiri.Components 1.3
|
||||
import Pass 1.0
|
||||
import Utils 1.0
|
||||
import QtQuick 2.4
|
||||
|
||||
Column {
|
||||
|
||||
|
||||
property alias importSshPrivKeyButton : repoImportPrivKeyButton
|
||||
property alias importSshPubKeyButton : repoImportPubKeyButton
|
||||
property alias deleteSshPrivKeyButton : repoDeletePrivKeyButton
|
||||
property alias deleteSshPubKeyButton : repoDeletePubKeyButton
|
||||
property bool __sshPrivKeyAvailable : false
|
||||
property bool __sshPubKeyAvailable : false
|
||||
|
||||
signal repoUrlChanged(string url)
|
||||
|
||||
function setRepoUrl(url) {
|
||||
repoUrlInput.text = url;
|
||||
}
|
||||
|
||||
function update() {
|
||||
__sshPrivKeyAvailable = Utils.fileExists(Git.privKey);
|
||||
__sshPubKeyAvailable = Utils.fileExists(Git.pubKey);
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
update();
|
||||
}
|
||||
|
||||
anchors.top: parent.fill
|
||||
spacing: units.gu(1)
|
||||
|
||||
Text {
|
||||
id: repoUrlLabel
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
text: i18n.tr('Repo Url')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: repoUrlInput
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
placeholderText: "<username>@<hostname>"
|
||||
onTextChanged: repoUrlChanged(repoUrlInput.text)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: repoPrivKeyLabel
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
text: i18n.tr('SSH private key')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
Button {
|
||||
id: repoImportPrivKeyButton
|
||||
|
||||
width: parent.width
|
||||
color: theme.palette.normal.positive
|
||||
text: i18n.tr('Import SSH private key')
|
||||
visible: !__sshPrivKeyAvailable
|
||||
}
|
||||
|
||||
Button {
|
||||
id: repoDeletePrivKeyButton
|
||||
|
||||
width: parent.width
|
||||
color: theme.palette.normal.negative
|
||||
text: i18n.tr('Delete SSH private key')
|
||||
visible: __sshPrivKeyAvailable
|
||||
}
|
||||
|
||||
Text {
|
||||
id: repoPubKeyLabel
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
text: i18n.tr('SSH public key')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
Button {
|
||||
id: repoDeletePubKeyButton
|
||||
|
||||
width: parent.width
|
||||
color: theme.palette.normal.negative
|
||||
text: i18n.tr('Delete SSH public key')
|
||||
visible: __sshPrivKeyAvailable
|
||||
}
|
||||
|
||||
Button {
|
||||
id: repoImportPubKeyButton
|
||||
|
||||
width: parent.width
|
||||
color: theme.palette.normal.positive
|
||||
text: i18n.tr('Import SSH public key')
|
||||
visible: !__sshPrivKeyAvailable
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
id: repoPassphraseLabel
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
text: i18n.tr('Passphrase')
|
||||
color: theme.palette.normal.backgroundText
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: repoPassphraseInput
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width
|
||||
echoMode: TextInput.Password
|
||||
placeholderText: i18n.tr('Passphrase')
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: units.gu(1)
|
||||
color: theme.palette.normal.background
|
||||
}
|
||||
|
||||
Button {
|
||||
id: buttonClone
|
||||
|
||||
width: parent.width
|
||||
color: theme.palette.normal.positive
|
||||
text: i18n.tr('Clone')
|
||||
onClicked: {
|
||||
Git.cloneSSHKey(repoUrlInput.text, Pass.Passphrase_store, repoPassphraseInput.text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
71
qml/components/ImportFile.qml
Normal file
71
qml/components/ImportFile.qml
Normal file
@ -0,0 +1,71 @@
|
||||
import "../dialogs"
|
||||
import "../pages/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
|
||||
property alias contentPicker : contentPicker
|
||||
property alias dialogImportKeyPageError : dialogImportKeyPageError
|
||||
property alias dialogImportKeyPageSucess : dialogImportKeyPageSucess
|
||||
|
||||
property string headerTitle : i18n.tr("Import succeeded !")
|
||||
property string dialogErrorTxt : i18n.tr("Import failed !")
|
||||
property string dialogSuccessTxt : i18n.tr("File Import")
|
||||
|
||||
ContentPeerPicker {
|
||||
id: contentPicker
|
||||
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
|
||||
onCancelPressed: {
|
||||
pageStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
ContentTransferHint {
|
||||
id: transferHint
|
||||
|
||||
anchors.fill: parent
|
||||
activeTransfer: importKeyFilePage.activeTransfer
|
||||
}
|
||||
|
||||
Component {
|
||||
id: dialogImportKeyPageError
|
||||
|
||||
ErrorDialog {
|
||||
textError: importKeyFilePage.dialogErrorTxt
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
id: dialogImportKeyPageSucess
|
||||
|
||||
SuccessDialog {
|
||||
textSuccess: importKeyFilePage.dialogSuccessTxt
|
||||
onDialogClosed: {
|
||||
pageStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header: StackHeader {
|
||||
id: importKeyHeader
|
||||
|
||||
title: importKeyFilePage.headerTitle
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user