Compare commits

..

26 Commits

Author SHA1 Message Date
Reda
7400a9517f
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-10-05 19:01:59 +02:00
Reda
ef5774110d
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 11:24:56 +02:00
4e17efd44c
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 11:24:56 +02:00
Reda
d7881a5def
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 11:19:06 +02:00
8acb3b4adf
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 11:19:05 +02:00
e173e98702 Update headers translation files 2019-09-30 11:07:43 +02:00
Joan CiberSheep
6beeed2748
Translated using Weblate (Catalan)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/ca/
2019-09-30 10:53:18 +02:00
Advocatux
aabb974780
Translated using Weblate (Spanish)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:53:18 +02:00
Reda
9bd85db18e
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 10:53:18 +02:00
Richard Lee
e3803c16c2
Translated using Weblate (French)
Currently translated at 100.0% (40 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/fr/
2019-09-30 10:53:17 +02:00
Reda
55269d531e
Translated using Weblate (Spanish)
Currently translated at 92.5% (37 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:50:59 +02:00
Advocatux
a39f76961c
Translated using Weblate (Spanish)
Currently translated at 92.5% (37 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:50:59 +02:00
Reda
d8f26001ac
Translated using Weblate (Spanish)
Currently translated at 85.0% (34 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:36:41 +02:00
Advocatux
d66dc0b25b
Translated using Weblate (Spanish)
Currently translated at 85.0% (34 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:36:40 +02:00
Reda
43ef5e0410
Translated using Weblate (Spanish)
Currently translated at 77.5% (31 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:35:59 +02:00
Advocatux
7f2969b55c
Translated using Weblate (Spanish)
Currently translated at 77.5% (31 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:35:59 +02:00
Reda
6fda9ad2e1
Translated using Weblate (Spanish)
Currently translated at 65.0% (26 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:33:28 +02:00
Advocatux
ecfc5d5c78
Translated using Weblate (Spanish)
Currently translated at 65.0% (26 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:33:28 +02:00
Reda
c433bd3449
Translated using Weblate (Spanish)
Currently translated at 50.0% (20 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:27:52 +02:00
Advocatux
52db2a7a40
Translated using Weblate (Spanish)
Currently translated at 50.0% (20 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:27:51 +02:00
Reda
6c13c6947b
Translated using Weblate (Spanish)
Currently translated at 0.0% (0 of 40 strings)

Translation: UTPass/UTPass
Translate-URL: https://translate-ut.org/projects/utpass/utpass/es/
2019-09-30 10:19:22 +02:00
Joan CiberSheep
462aa1b46d
Added translation using Weblate (Catalan) 2019-09-29 23:26:50 +02:00
Advocatux
c3fdff426b
Added translation using Weblate (Spanish) 2019-09-28 14:11:09 +02:00
abda1d75aa Add git plugin TG-41 closed 2019-09-22 22:19:16 +02:00
5c9a15ef73 Add libgit2 as third dependencies TG-40 2019-09-22 22:19:16 +02:00
fb177d0682 bump version 2019-09-22 22:19:16 +02:00
19 changed files with 54 additions and 403 deletions

3
.gitmodules vendored
View File

@ -16,6 +16,3 @@
[submodule "libs/libgit2"]
path = libs/libgit2
url = https://github.com/libgit2/libgit2
[submodule "libs/git/openssl"]
path = libs/git/openssl
url = https://github.com/openssl/openssl

View File

@ -55,8 +55,6 @@ install(
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION ${BIN_DIR}
)
install(FILES /usr/lib/${ARCH_TRIPLET}/libssl.so DESTINATION /lib/${ARCH_TRIPLET})
install(FILES /usr/lib/${ARCH_TRIPLET}/libcrypto.so DESTINATION /lib/${ARCH_TRIPLET})
# Translations
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js)

View File

@ -21,10 +21,7 @@
"libgit2": {
"template": "cmake",
"make_jobs": 4,
"build_args": "-DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC"
"build_args": "-DBUILD_SHARED_LIBS=OFF"
}
},
"dependencies_target": [
"libssl-dev"
]
}
}

View File

@ -1,35 +0,0 @@
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process (
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/clean.sh ${ARCH_TRIPLET}
)
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
set(OPENSSL_PATH "${THIRD_PATH}/libgit2")
set(LIBGIT2_PATH "${THIRD_PATH}/openssl/")
ExternalProject_Add(
OPENSSL_PATH
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${OPENSSL_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/configure
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
LIBGIT2_PATH
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGIT2_PATH}
)

@ -1 +0,0 @@
Subproject commit 894da2fb7ed5d314ee5c2fc9fd2d9b8b74111596

View File

@ -10,7 +10,7 @@
"content-hub": "UTPass.contenthub"
}
},
"version": "0.0.3-dev",
"version": "0.0.2-dev",
"maintainer": "Quentin Rouland <quentin@qrouland.com>",
"framework" : "ubuntu-sdk-16.04"
}

View File

@ -30,9 +30,7 @@ INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
add_library(libgit2 STATIC IMPORTED)
set_property(TARGET libgit2 PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgit2.a")
find_package(OpenSSL REQUIRED)
target_link_libraries(${PLUGIN} libgit2 ${OPENSSL_LIBRARIES})
target_link_libraries(${PLUGIN} libgit2)
set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")

View File

@ -1,68 +1,10 @@
#include <QDebug>
#include <QUrl>
#include <QStandardPaths>
#include <QDir>
extern "C" {
#include <git2.h>
}
#include "git.h"
#include "passphraseprovider.h"
Git::Git() {
git_libgit2_init();
};
Git::Git() {};
Git::~Git() {
git_libgit2_shutdown();
};
bool Git::clone(QUrl url, QString dir_out_path) {
auto ret = false;
auto tmp_dir_path = QStandardPaths::writableLocation(
QStandardPaths::CacheLocation).append("/clone");
auto gitCred = new UTGitCredProvider();
pt2cred_acquire_cb = gitCred->cred_acquire_cb;
QDir tmp_dir(tmp_dir_path);
tmp_dir.removeRecursively();
git_repository *cloned_repo = NULL;
git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
clone_opts.checkout_opts = checkout_opts;
clone_opts.fetch_opts.callbacks.credentials = gitCred->*pt2cred_acquire_cb;
qDebug() << "Cloning " << url << " in " << tmp_dir_path;
auto error = git_clone(&cloned_repo, url.toString().toLocal8Bit().constData(), tmp_dir_path.toLocal8Bit().constData(), &clone_opts);
if (cloned_repo) {
git_repository_free(cloned_repo);
}
if(error) {
const git_error *err = giterr_last();
if (err) {
qDebug() << "ERROR " << err->klass << ": " << err->message;
}
else {
qDebug() << "ERROR " << error << ": no detailed info";
}
}
else {
qDebug() << "Removing destination";
QDir dir_out(dir_out_path);
dir_out.removeRecursively();
qDebug() << "Moving cloned dir to destination";
QDir dir;
qDebug() << tmp_dir_path << " to " << dir_out_path;
ret = dir.rename(tmp_dir_path, dir_out_path);
}
tmp_dir.removeRecursively();
delete gitCred;
return !error and ret;
}

View File

@ -10,9 +10,7 @@ class Git : public QObject
public:
Git();
~Git();
Q_INVOKABLE bool clone(QUrl clone_url, QString dir_out);
~Git() override = default;
};

View File

@ -1,77 +0,0 @@
#ifndef UTGITCREDPROVIDER_H
#define UTGITCREDPROVIDER_H
class UTGitCredProvider : public QObject, public PassphraseProvider
{
Q_OBJECT
private:
std::unique_ptr<QEventLoop> m_loop;
std::unique_ptr<QSemaphore> m_sem;
char *m_user;
char *m_password;
bool m_canceled;
public slots:
void handleResponse(bool canceled, QString user, QString password)
{
if (!canceled) {
gpgrt_asprintf(&m_user, "%s", user.toUtf8().constData());
gpgrt_asprintf(&m_passphrase, "%s", password.toUtf8().constData());
}
else
m_canceled = true;
m_loop->quit();
};
public:
UTGitCredProvider():
m_loop(std::unique_ptr<QEventLoop>(new QEventLoop)),
m_sem(std::unique_ptr<QSemaphore>(new QSemaphore(1))),
m_user(nullptr),
m_password(nullptr),
m_canceled(false)
{}
int cred_acquire_cb(git_cred **out,
const char *url,
const char *username_from_url,
unsigned int allowed_types,
void *payload) {
if (!m_sem->tryAcquire(1, 3000))
{
qWarning() << "Cannot acquire UTGitCredProvider semaphore.";
canceled = true;
return nullptr;
}
m_passphrase = nullptr;
m_canceled = false;
qDebug() << "Call the QML Dialog Cred Provider";
QMetaObject::invokeMethod(
Gpg::instance()->getWindow(), "callCredDialog",
Q_ARG(QVariant, username_from_url)
);
qDebug() << "Waiting for response";
QObject::connect(
Gpg::instance()->getWindow(), SIGNAL(responseCredDialog(bool, QString, QString)),
this, SLOT(handleResponse(bool, QString, QString))
);
m_loop->exec();
qDebug() << "Set Cred";
error = git_cred_userpass_plaintext_new(out, username, password);
qDebug() << "Clean";
if (m_passphrase) free(m_passphrase);
if (m_user) free(m_user);
m_canceled = false;
m_sem->release(1);
return ret;
};
};
#endif

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-25 17:36+0000\n"
"POT-Creation-Date: 2019-09-21 14:01+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -103,67 +103,63 @@ msgid ""
"No password found<br>You can import a password store zip in the settings"
msgstr ""
#: ../qml/pages/settings/gpg/ImportKeyFile.qml:17
#: ../qml/pages/settings/ImportKeyFile.qml:17
msgid "GPG Key Import"
msgstr ""
#: ../qml/pages/settings/gpg/ImportKeyFile.qml:69
#: ../qml/pages/settings/ImportKeyFile.qml:69
msgid "Key import failed !"
msgstr ""
#: ../qml/pages/settings/gpg/ImportKeyFile.qml:76
#: ../qml/pages/settings/ImportKeyFile.qml:76
msgid "Key successfully imported !"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:16
msgid "Info Keys"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:44
msgid "Key id : %1"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:49
msgid "Delete this key"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:68
msgid "You're are about to delete<br>%1<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:71
msgid "%1<br>will be definitively removed.<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:87
msgid "Key removal failed !"
msgstr ""
#: ../qml/pages/settings/gpg/InfoKeys.qml:94
msgid "Key successfully deleted !"
msgstr ""
#: ../qml/pages/settings/passwordstore/ImportGit.qml:13
msgid "Git clone"
msgstr ""
#: ../qml/pages/settings/passwordstore/ImportZip.qml:17
#: ../qml/pages/settings/ImportZip.qml:17
msgid "Zip Password Store Import"
msgstr ""
#: ../qml/pages/settings/passwordstore/ImportZip.qml:72
#: ../qml/pages/settings/ImportZip.qml:72
msgid ""
"Importing a new zip will delete<br>any existing password store!<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/passwordstore/ImportZip.qml:82
#: ../qml/pages/settings/ImportZip.qml:82
msgid "Password store import failed !"
msgstr ""
#: ../qml/pages/settings/passwordstore/ImportZip.qml:89
#: ../qml/pages/settings/ImportZip.qml:89
msgid "Password store sucessfully imported !"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:16
msgid "Info Keys"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:44
msgid "Key id : %1"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:49
msgid "Delete this key"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:68
msgid "You're are about to delete<br>%1<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:71
msgid "%1<br>will be definitively removed.<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:87
msgid "Key removal failed !"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:94
msgid "Key successfully deleted !"
msgstr ""
#: ../qml/pages/settings/Settings.qml:28
msgid "GPG"
msgstr ""
@ -184,14 +180,6 @@ msgstr ""
msgid "Import a Password Store Zip"
msgstr ""
#: ../qml/pages/settings/Settings.qml:51
msgid "Import a Password Store Git"
msgstr ""
#: ../qml/pages/settings/Settings.qml:60
#: ../qml/pages/settings/Settings.qml:56
msgid "Warning: importing delete any exiting Password Store"
msgstr ""
#: ../qml/pages/settings/Settings.qml:67
msgid "Git"
msgstr ""

View File

@ -38,24 +38,6 @@ MainView {
passphraseDialog.validated.connect(validated)
passphraseDialog.canceled.connect(canceled)
}
function callCredDialog() {
//TODO add parameters to impove passphrase dialog
var credDialog = PopupUtils.open(
Qt.resolvedUrl("dialogs/CredDialog.qml"))
credDialog.activateFocus()
var validated = function (user, password) {
responseCredDialog(false, user, password)
}
var canceled = function () {
responseCredDialog(true, "", "")
}
credDialog.validated.connect(validated)
credDialog.canceled.connect(canceled)
}
PageStack {
id: pageStack

View File

@ -1,63 +0,0 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
Dialog {
id: credProvider
title: i18n.tr("Authentication required")
text_user: i18n.tr("Enter user :")
text_password: i18n.tr("Enter password :")
signal validated(string user, string password)
signal canceled
function activateFocus() {
user.forceActiveFocus()
}
TextField {
id: userField
placeholderText: i18n.tr("user")
echoMode: TextInput.Password
onAccepted: passwordField.forceActiveFocus()
}
TextField {
id: passwordField
placeholderText: i18n.tr("password")
echoMode: TextInput.Password
onAccepted: okButton.clicked(text)
}
Button {
id: okButton
text: i18n.tr("Ok")
color: UbuntuColors.green
onClicked: {
validated(userField.text, passwordField.text)
userField.text = ""
passwordField.text = ""
PopupUtils.close(credProvider)
}
}
Button {
id: cancelButton
text: i18n.tr("Cancel")
color: UbuntuColors.red
onClicked: {
userField.text = ""
passwordField.text = ""
canceled()
PopupUtils.close(credProvider)
}
}
}

View File

@ -43,7 +43,6 @@ Dialog {
color: UbuntuColors.red
onClicked: {
passphraseField.text = ""
canceled()
PopupUtils.close(passphraseProvider)
}

View File

@ -4,8 +4,8 @@ import Ubuntu.Content 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../../headers"
import "../../../dialogs"
import "../headers"
import "../../dialogs"
Page {
id: importKeyFilePage

View File

@ -4,8 +4,8 @@ import Ubuntu.Content 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../../headers"
import "../../../dialogs"
import "../headers"
import "../../dialogs"
Page {
id: importZipPage

View File

@ -2,9 +2,9 @@ import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import "../../headers"
import "../../../components"
import "../../../dialogs"
import "../headers"
import "../../components"
import "../../dialogs"
Page {
id: infoKeysPage

View File

@ -28,11 +28,11 @@ Page {
text: i18n.tr('GPG')
}
PageStackLink {
page: Qt.resolvedUrl("gpg/ImportKeyFile.qml")
page: Qt.resolvedUrl("ImportKeyFile.qml")
text: i18n.tr('Import a GPG key file')
}
PageStackLink {
page: Qt.resolvedUrl("gpg/InfoKeys.qml")
page: Qt.resolvedUrl("InfoKeys.qml")
text: i18n.tr('Show GPG keys')
}
Text {
@ -43,13 +43,9 @@ Page {
text: i18n.tr('Password Store')
}
PageStackLink {
page: Qt.resolvedUrl("passwordstore/ImportZip.qml")
page: Qt.resolvedUrl("ImportZip.qml")
text: i18n.tr('Import a Password Store Zip')
}
PageStackLink {
page: Qt.resolvedUrl("passwordstore/ImportGit.qml")
text: i18n.tr('Import a Password Store Git')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -59,12 +55,5 @@ Page {
text: i18n.tr(
'Warning: importing delete any exiting Password Store')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(4)
text: i18n.tr('Git')
}
}
}

View File

@ -1,61 +0,0 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Git 1.0
import Pass 1.0
import "../../headers"
import "../../../styles"
Page {
id: importGit
header: StackHeader {
id: importGitHeader
title: i18n.tr('Git clone')
}
Row {
anchors.top: importGitHeader.bottom
anchors.topMargin: units.gu(1)
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
height: units.gu(4)
Rectangle {
height: units.gu(4)
width: units.gu(2)
}
TextField {
id: gitUrlTextField
placeholderText: "https://..."
height: units.gu(4)
width: parent.width - units.gu(8)
}
Icon {
id: ico
name: "document-save"
color: UbuntuColors.orange
height: units.gu(4)
width: units.gu(4)
MouseArea {
anchors.fill: parent
onPressed: {
parent.color = UbuntuColors.warmGrey
}
onClicked: {
Git.clone(gitUrlTextField.text, Pass.getPasswordStore())
}
onReleased: {
parent.color = theme.palette.normal.background
}
}
}
}
Component.onCompleted : {
gitUrlTextField.forceActiveFocus()
}
}