mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-09 19:16:57 +00:00
Foramtting
This commit is contained in:
@@ -22,7 +22,8 @@ enum class GitCloneErrorCode {
|
|||||||
* @param error A pointer to the git_error structure
|
* @param error A pointer to the git_error structure
|
||||||
* @return Corresponding GitCloneErrorCode integer value
|
* @return Corresponding GitCloneErrorCode integer value
|
||||||
*/
|
*/
|
||||||
inline GitCloneErrorCode gitErrorToGitCloneErrorCode(const git_error* error) {
|
inline GitCloneErrorCode gitErrorToGitCloneErrorCode(const git_error* error)
|
||||||
|
{
|
||||||
if (error == nullptr) {
|
if (error == nullptr) {
|
||||||
return GitCloneErrorCode::Successful; ///< Default error if null
|
return GitCloneErrorCode::Successful; ///< Default error if null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ void Git::cloneResult(const int err_code, const QString message)
|
|||||||
this->m_sem->release();
|
this->m_sem->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Git::importSshKey(QUrl source_path, bool is_private){
|
bool Git::importSshKey(QUrl source_path, bool is_private)
|
||||||
|
{
|
||||||
auto destination_path = is_private ? this->privKeyPath() : this->pubKeyPath();
|
auto destination_path = is_private ? this->privKeyPath() : this->pubKeyPath();
|
||||||
|
|
||||||
QFile source_file(source_path.toLocalFile());
|
QFile source_file(source_path.toLocalFile());
|
||||||
|
|||||||
@@ -62,14 +62,16 @@ bool CloneJob::moveToDestination(QDir tmp_dir, const QString& path)
|
|||||||
qDebug() << "[CloneJob] Moving cloned content to destination dir";
|
qDebug() << "[CloneJob] Moving cloned content to destination dir";
|
||||||
|
|
||||||
if (!QDir().rename(tmp_dir.absolutePath(), destination_dir.absolutePath())) {
|
if (!QDir().rename(tmp_dir.absolutePath(), destination_dir.absolutePath())) {
|
||||||
qWarning() << "[CloneJob] Failed to move directory from" << tmp_dir.absolutePath() << "to" << destination_dir.absolutePath();
|
qWarning() << "[CloneJob] Failed to move directory from" << tmp_dir.absolutePath() << "to" <<
|
||||||
|
destination_dir.absolutePath();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPair<GitCloneErrorCode, QString> CloneJob::clone(QString url, QString path, cred_type cred, git_cred_acquire_cb cb)
|
const QPair<GitCloneErrorCode, QString> CloneJob::clone(QString url, QString path, cred_type cred,
|
||||||
|
git_cred_acquire_cb cb)
|
||||||
{
|
{
|
||||||
git_repository *repo = nullptr; // Use nullptr for type safety
|
git_repository *repo = nullptr; // Use nullptr for type safety
|
||||||
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
||||||
@@ -82,11 +84,11 @@ const QPair<GitCloneErrorCode, QString> CloneJob::clone(QString url, QString pat
|
|||||||
|
|
||||||
// Map the application specific cb errors if any
|
// Map the application specific cb errors if any
|
||||||
if (ret == GIT_EUSER) {
|
if (ret == GIT_EUSER) {
|
||||||
if(payload.err == ErrorCodeCB::NoUsername)
|
if (payload.err == ErrorCodeCB::NoUsername)
|
||||||
return {GitCloneErrorCode::NoUsername, "no username provided in URL"};
|
return {GitCloneErrorCode::NoUsername, "no username provided in URL"};
|
||||||
if(payload.err == ErrorCodeCB::InvalidCreds)
|
if (payload.err == ErrorCodeCB::InvalidCreds)
|
||||||
return {GitCloneErrorCode::AuthentificationError, "authentification error"};
|
return {GitCloneErrorCode::AuthentificationError, "authentification error"};
|
||||||
if(payload.err == ErrorCodeCB::UrlTypeDoNotMatchCreds)
|
if (payload.err == ErrorCodeCB::UrlTypeDoNotMatchCreds)
|
||||||
return {GitCloneErrorCode::UrlTypeDoNotMatchCreds, "invalid creds types for provided url"};
|
return {GitCloneErrorCode::UrlTypeDoNotMatchCreds, "invalid creds types for provided url"};
|
||||||
return {GitCloneErrorCode::UnexpectedError, "unexcepted error occured"};
|
return {GitCloneErrorCode::UnexpectedError, "unexcepted error occured"};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_
|
|||||||
}
|
}
|
||||||
return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData());
|
return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData());
|
||||||
},
|
},
|
||||||
[allowed_types, &out, &username_from_url , &p](const SSHKey & x)
|
[allowed_types, &out, &username_from_url, &p](const SSHKey & x)
|
||||||
{
|
{
|
||||||
qDebug() << "[GitJob] credentialsCB : SSHKey ";
|
qDebug() << "[GitJob] credentialsCB : SSHKey ";
|
||||||
if (!(allowed_types & GIT_CREDTYPE_SSH_KEY)) {
|
if (!(allowed_types & GIT_CREDTYPE_SSH_KEY)) {
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ enum class ErrorCodeCB {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct PayloadCB
|
struct PayloadCB {
|
||||||
{
|
|
||||||
bool called;
|
bool called;
|
||||||
cred_type creds;
|
cred_type creds;
|
||||||
ErrorCodeCB err;
|
ErrorCodeCB err;
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ enum class ErrorCodeShow {
|
|||||||
* @param rnpErrorCode The RNP error code
|
* @param rnpErrorCode The RNP error code
|
||||||
* @return Corresponding ErrorCodeShow integer value
|
* @return Corresponding ErrorCodeShow integer value
|
||||||
*/
|
*/
|
||||||
inline ErrorCodeShow rnpErrorToErrorCodeShow(int rnpErrorCode) {
|
inline ErrorCodeShow rnpErrorToErrorCodeShow(int rnpErrorCode)
|
||||||
|
{
|
||||||
switch (rnpErrorCode) {
|
switch (rnpErrorCode) {
|
||||||
case RNP_ERROR_BAD_PASSWORD:
|
case RNP_ERROR_BAD_PASSWORD:
|
||||||
return ErrorCodeShow::BadPassphrase; ///< Bad passphrase error
|
return ErrorCodeShow::BadPassphrase; ///< Bad passphrase error
|
||||||
@@ -49,7 +50,8 @@ enum class ErrorCodeImportKeyFile {
|
|||||||
* @param rnpErrorCode The RNP error code
|
* @param rnpErrorCode The RNP error code
|
||||||
* @return Corresponding ErrorCodeImportKeyFile integer value
|
* @return Corresponding ErrorCodeImportKeyFile integer value
|
||||||
*/
|
*/
|
||||||
inline ErrorCodeImportKeyFile rnpErrorToErrorCodeImportKeyFile(int rnpErrorCode) {
|
inline ErrorCodeImportKeyFile rnpErrorToErrorCodeImportKeyFile(int rnpErrorCode)
|
||||||
|
{
|
||||||
switch (rnpErrorCode) {
|
switch (rnpErrorCode) {
|
||||||
case RNP_ERROR_BAD_FORMAT:
|
case RNP_ERROR_BAD_FORMAT:
|
||||||
return ErrorCodeImportKeyFile::BadFormat; ///< Bad format error
|
return ErrorCodeImportKeyFile::BadFormat; ///< Bad format error
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
import Git 1.0
|
import Git 1.0
|
||||||
import Lomiri.Components 1.3
|
import Lomiri.Components 1.3
|
||||||
import Pass 1.0
|
import Pass 1.0
|
||||||
import Utils 1.0
|
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
import Utils 1.0
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
property alias importSshPrivKeyButton: repoImportPrivKeyButton
|
||||||
|
property alias importSshPubKeyButton: repoImportPubKeyButton
|
||||||
property alias importSshPrivKeyButton : repoImportPrivKeyButton
|
property alias deleteSshPrivKeyButton: repoDeletePrivKeyButton
|
||||||
property alias importSshPubKeyButton : repoImportPubKeyButton
|
property alias deleteSshPubKeyButton: repoDeletePubKeyButton
|
||||||
property alias deleteSshPrivKeyButton : repoDeletePrivKeyButton
|
property bool __sshPrivKeyAvailable: false
|
||||||
property alias deleteSshPubKeyButton : repoDeletePubKeyButton
|
property bool __sshPubKeyAvailable: false
|
||||||
property bool __sshPrivKeyAvailable : false
|
|
||||||
property bool __sshPubKeyAvailable : false
|
|
||||||
|
|
||||||
signal repoUrlChanged(string url)
|
signal repoUrlChanged(string url)
|
||||||
|
|
||||||
@@ -28,7 +26,6 @@ Column {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.top: parent.fill
|
anchors.top: parent.fill
|
||||||
spacing: units.gu(1)
|
spacing: units.gu(1)
|
||||||
|
|
||||||
@@ -108,7 +105,6 @@ Column {
|
|||||||
visible: !__sshPrivKeyAvailable
|
visible: !__sshPrivKeyAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: repoPassphraseLabel
|
id: repoPassphraseLabel
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ Page {
|
|||||||
id: importKeyFilePage
|
id: importKeyFilePage
|
||||||
|
|
||||||
property var activeTransfer
|
property var activeTransfer
|
||||||
property alias contentPicker : contentPicker
|
property alias contentPicker: contentPicker
|
||||||
|
property string headerTitle: i18n.tr("Import succeeded !")
|
||||||
property string headerTitle : i18n.tr("Import succeeded !")
|
property string dialogErrorTxt: i18n.tr("Import failed !")
|
||||||
property string dialogErrorTxt : i18n.tr("Import failed !")
|
property string dialogErrorDescriptionTxt: null
|
||||||
property string dialogErrorDescriptionTxt : null
|
property string dialogSuccessTxt: i18n.tr("File Imported")
|
||||||
property string dialogSuccessTxt : i18n.tr("File Imported")
|
|
||||||
|
|
||||||
ContentPeerPicker {
|
ContentPeerPicker {
|
||||||
id: contentPicker
|
id: contentPicker
|
||||||
|
|
||||||
anchors.top: importKeyHeader.bottom
|
anchors.top: importKeyHeader.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.topMargin: importKeyFilePage.header.height
|
anchors.topMargin: importKeyFilePage.header.height
|
||||||
@@ -39,7 +39,6 @@ Page {
|
|||||||
activeTransfer: importKeyFilePage.activeTransfer
|
activeTransfer: importKeyFilePage.activeTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
header: StackHeader {
|
header: StackHeader {
|
||||||
id: importKeyHeader
|
id: importKeyHeader
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Dialog {
|
|||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
property string textError
|
property string textError
|
||||||
property string textErrorDescription : null
|
property string textErrorDescription: null
|
||||||
|
|
||||||
signal dialogClosed()
|
signal dialogClosed()
|
||||||
|
|
||||||
|
|||||||
@@ -51,16 +51,20 @@ Page {
|
|||||||
});
|
});
|
||||||
Pass.onShowFailed.connect(function(code, message) {
|
Pass.onShowFailed.connect(function(code, message) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1: // UnexceptedError -> use the default (not translate) rnp error
|
case 1:
|
||||||
|
// UnexceptedError -> use the default (not translate) rnp error
|
||||||
__text_error_description = message;
|
__text_error_description = message;
|
||||||
break;
|
break;
|
||||||
case 2: // BadPassphrase
|
case 2:
|
||||||
|
// BadPassphrase
|
||||||
__text_error_description = i18n.tr("Bad passphrase");
|
__text_error_description = i18n.tr("Bad passphrase");
|
||||||
break;
|
break;
|
||||||
case 3: // NoKeyFound
|
case 3:
|
||||||
|
// NoKeyFound
|
||||||
__text_error_description = i18n.tr("No valid key found");
|
__text_error_description = i18n.tr("No valid key found");
|
||||||
break;
|
break;
|
||||||
case 3: // DecryptFailed
|
case 3:
|
||||||
|
// DecryptFailed
|
||||||
__text_error_description = i18n.tr("Decryption failed");
|
__text_error_description = i18n.tr("Decryption failed");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -195,10 +199,9 @@ Page {
|
|||||||
textError: i18n.tr("Decryption failed !")
|
textError: i18n.tr("Decryption failed !")
|
||||||
textErrorDescription: __text_error_description
|
textErrorDescription: __text_error_description
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: searchTimer
|
id: searchTimer
|
||||||
|
|
||||||
|
|||||||
@@ -9,24 +9,28 @@ import Lomiri.Components.Popups 1.3
|
|||||||
import Pass 1.0
|
import Pass 1.0
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import Utils 1.0
|
import Utils 1.0
|
||||||
Page {
|
|
||||||
id: importGitClonePage
|
|
||||||
|
|
||||||
property int __gitModeHTTP : 0
|
Page {
|
||||||
property int __gitModeHTTP_AUTH : 1
|
|
||||||
// property int __gitModeSSH_KEY : 2
|
// property int __gitModeSSH_KEY : 2
|
||||||
|
|
||||||
property int __gitCloneErrorCodeSuccessful : 0
|
id: importGitClonePage
|
||||||
property int __gitCloneErrorCodeUnexpectedError : 1
|
|
||||||
property int __gitCloneErrorCodeInvalidUrl : 2
|
|
||||||
property int __gitCloneErrorCodeNoUsername : 3
|
|
||||||
property int __gitCloneErrorCodeAuthentificationError : 4
|
|
||||||
property int __gitCloneErrorCodeUrlTypeDoNotMatchCreds : 5
|
|
||||||
|
|
||||||
|
property int __gitModeHTTP: 0
|
||||||
|
property int __gitModeHTTP_AUTH: 1
|
||||||
|
property int __gitCloneErrorCodeSuccessful: 0
|
||||||
|
property int __gitCloneErrorCodeUnexpectedError: 1
|
||||||
|
property int __gitCloneErrorCodeInvalidUrl: 2
|
||||||
|
property int __gitCloneErrorCodeNoUsername: 3
|
||||||
|
property int __gitCloneErrorCodeAuthentificationError: 4
|
||||||
|
property int __gitCloneErrorCodeUrlTypeDoNotMatchCreds: 5
|
||||||
property string __repoUrl
|
property string __repoUrl
|
||||||
property string __err_message : null
|
property string __err_message: null
|
||||||
|
|
||||||
function __loadForm() {
|
function __loadForm() {
|
||||||
|
// case __gitModeSSH_KEY:
|
||||||
|
// importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneSshKey.qml");
|
||||||
|
// break;
|
||||||
|
|
||||||
switch (combo.selectedIndex) {
|
switch (combo.selectedIndex) {
|
||||||
case __gitModeHTTP:
|
case __gitModeHTTP:
|
||||||
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttp.qml");
|
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttp.qml");
|
||||||
@@ -34,9 +38,6 @@ Page {
|
|||||||
case __gitModeHTTP_AUTH:
|
case __gitModeHTTP_AUTH:
|
||||||
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttpAuth.qml");
|
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttpAuth.qml");
|
||||||
break;
|
break;
|
||||||
// case __gitModeSSH_KEY:
|
|
||||||
// importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneSshKey.qml");
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +45,8 @@ Page {
|
|||||||
Git.cloneSucceed.connect(function() {
|
Git.cloneSucceed.connect(function() {
|
||||||
GitSettings.type = combo.selectedIndex;
|
GitSettings.type = combo.selectedIndex;
|
||||||
GitSettings.repoUrl = importGitClonePage.__repoUrl;
|
GitSettings.repoUrl = importGitClonePage.__repoUrl;
|
||||||
if(GitSettings.type != __gitModeSSH_KEY) { // ensure there no ssh key is kept if swicthing to another git mode
|
if (GitSettings.type != __gitModeSSH_KEY) {
|
||||||
|
// ensure there no ssh key is kept if swicthing to another git mode
|
||||||
Utils.rmFile(Git.privKey);
|
Utils.rmFile(Git.privKey);
|
||||||
Utils.rmFile(Git.pubKey);
|
Utils.rmFile(Git.pubKey);
|
||||||
}
|
}
|
||||||
@@ -103,7 +105,7 @@ Page {
|
|||||||
id: combo
|
id: combo
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
model: ["HTTP", "HTTP AUTH" ] //, "SSH KEY"]
|
model: ["HTTP", "HTTP AUTH"] //, "SSH KEY"]
|
||||||
onDelegateClicked: function(i) {
|
onDelegateClicked: function(i) {
|
||||||
timer.setTimeout(function() {
|
timer.setTimeout(function() {
|
||||||
__loadForm();
|
__loadForm();
|
||||||
@@ -133,16 +135,6 @@ Page {
|
|||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
importGitCloneForm.item.repoUrlChanged.connect(function(url) {
|
|
||||||
importGitClonePage.__repoUrl = url;
|
|
||||||
});
|
|
||||||
importGitCloneForm.item.setRepoUrl(importGitClonePage.__repoUrl);
|
|
||||||
|
|
||||||
switch (combo.selectedIndex) {
|
|
||||||
case __gitModeHTTP:
|
|
||||||
break;
|
|
||||||
case __gitModeHTTP_AUTH:
|
|
||||||
break;
|
|
||||||
// case __gitModeSSH_KEY:
|
// case __gitModeSSH_KEY:
|
||||||
// importGitCloneForm.item.importSshPrivKeyButton.clicked.connect(function() {
|
// importGitCloneForm.item.importSshPrivKeyButton.clicked.connect(function() {
|
||||||
// pageStack.push(Qt.resolvedUrl("ImportSSHkey.qml"), {
|
// pageStack.push(Qt.resolvedUrl("ImportSSHkey.qml"), {
|
||||||
@@ -155,6 +147,16 @@ Page {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
|
importGitCloneForm.item.repoUrlChanged.connect(function(url) {
|
||||||
|
importGitClonePage.__repoUrl = url;
|
||||||
|
});
|
||||||
|
importGitCloneForm.item.setRepoUrl(importGitClonePage.__repoUrl);
|
||||||
|
switch (combo.selectedIndex) {
|
||||||
|
case __gitModeHTTP:
|
||||||
|
break;
|
||||||
|
case __gitModeHTTP_AUTH:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,16 @@ import Pass 1.0
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import Utils 1.0
|
import Utils 1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: importKeyFilePage
|
id: importKeyFilePage
|
||||||
|
|
||||||
property var activeTransfer
|
property var activeTransfer
|
||||||
property alias contentPicker : contentPicker
|
property alias contentPicker: contentPicker
|
||||||
|
property string __text_error_description: null
|
||||||
property string __text_error_description : null
|
|
||||||
|
|
||||||
|
|
||||||
ContentPeerPicker {
|
ContentPeerPicker {
|
||||||
id: contentPicker
|
id: contentPicker
|
||||||
|
|
||||||
anchors.top: importKeyHeader.bottom
|
anchors.top: importKeyHeader.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.topMargin: importKeyFilePage.header.height
|
anchors.topMargin: importKeyFilePage.header.height
|
||||||
@@ -28,7 +25,6 @@ Page {
|
|||||||
showTitle: false
|
showTitle: false
|
||||||
contentType: ContentType.Text
|
contentType: ContentType.Text
|
||||||
handler: ContentHandler.Source
|
handler: ContentHandler.Source
|
||||||
|
|
||||||
onPeerSelected: {
|
onPeerSelected: {
|
||||||
{
|
{
|
||||||
importKeyFilePage.contentPicker.peer.selectionType = ContentTransfer.Single;
|
importKeyFilePage.contentPicker.peer.selectionType = ContentTransfer.Single;
|
||||||
@@ -47,10 +43,12 @@ Page {
|
|||||||
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
|
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
|
||||||
importKeyFilePage.activeTransfer = null;
|
importKeyFilePage.activeTransfer = null;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1: // UnexceptedError -> use the default (not translate) rnp error
|
case 1:
|
||||||
|
// UnexceptedError -> use the default (not translate) rnp error
|
||||||
__text_error_description = message;
|
__text_error_description = message;
|
||||||
break;
|
break;
|
||||||
case 2: // BadFormat
|
case 2:
|
||||||
|
// BadFormat
|
||||||
__text_error_description = i18n.tr("The file is not in a valid key format");
|
__text_error_description = i18n.tr("The file is not in a valid key format");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -62,9 +60,8 @@ Page {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onCancelPressed: {
|
onCancelPressed: {
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
}
|
}
|
||||||
@@ -77,13 +74,6 @@ Page {
|
|||||||
activeTransfer: importKeyFilePage.activeTransfer
|
activeTransfer: importKeyFilePage.activeTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
header: StackHeader {
|
|
||||||
id: importKeyHeader
|
|
||||||
|
|
||||||
title: i18n.tr("GPG Key Import")
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: dialogImportKeyPageError
|
id: dialogImportKeyPageError
|
||||||
|
|
||||||
@@ -105,4 +95,11 @@ Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header: StackHeader {
|
||||||
|
id: importKeyHeader
|
||||||
|
|
||||||
|
title: i18n.tr("GPG Key Import")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import "../../components"
|
import "../../components"
|
||||||
import Utils 1.0
|
|
||||||
import Git 1.0
|
import Git 1.0
|
||||||
|
|
||||||
import Lomiri.Components 1.3
|
import Lomiri.Components 1.3
|
||||||
import Lomiri.Components.Popups 1.3
|
import Lomiri.Components.Popups 1.3
|
||||||
import Lomiri.Content 1.3
|
import Lomiri.Content 1.3
|
||||||
|
import Utils 1.0
|
||||||
|
|
||||||
ImportFile {
|
ImportFile {
|
||||||
id: importSSHKeyPage
|
id: importSSHKeyPage
|
||||||
@@ -12,9 +11,8 @@ ImportFile {
|
|||||||
property bool isPrivateKey
|
property bool isPrivateKey
|
||||||
|
|
||||||
headerTitle: i18n.tr("SSH Key Import")
|
headerTitle: i18n.tr("SSH Key Import")
|
||||||
dialogSuccessTxt : i18n.tr("SSH Key successfully imported !")
|
dialogSuccessTxt: i18n.tr("SSH Key successfully imported !")
|
||||||
dialogErrorTxt : i18n.tr("SSH Key import failed !")
|
dialogErrorTxt: i18n.tr("SSH Key import failed !")
|
||||||
|
|
||||||
contentPicker.onPeerSelected: {
|
contentPicker.onPeerSelected: {
|
||||||
{
|
{
|
||||||
importSSHKeyPage.contentPicker.peer.selectionType = ContentTransfer.Single;
|
importSSHKeyPage.contentPicker.peer.selectionType = ContentTransfer.Single;
|
||||||
@@ -26,13 +24,12 @@ ImportFile {
|
|||||||
var ret = Git.importSshKey(importSSHKeyPage.activeTransfer.items[0].url, isPrivateKey);
|
var ret = Git.importSshKey(importSSHKeyPage.activeTransfer.items[0].url, isPrivateKey);
|
||||||
Utils.rmFile(importSSHKeyPage.activeTransfer.items[0].url);
|
Utils.rmFile(importSSHKeyPage.activeTransfer.items[0].url);
|
||||||
importSSHKeyPage.activeTransfer = null;
|
importSSHKeyPage.activeTransfer = null;
|
||||||
if(ret) {
|
if (ret)
|
||||||
PopupUtils.open(importSSHKeyPage.dialogImportKeyPageSucess);
|
PopupUtils.open(importSSHKeyPage.dialogImportKeyPageSucess);
|
||||||
} else {
|
else
|
||||||
PopupUtils.open(importSSHKeyPage.dialogImportKeyPageError);
|
PopupUtils.open(importSSHKeyPage.dialogImportKeyPageError);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user