1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-01-24 07:36:39 +00:00

Update build : use prebuild binaries + Add libgit2

This commit is contained in:
Quentin Rouland 2025-01-07 14:41:48 +01:00
parent c6d7a025ff
commit 37c481ece1
50 changed files with 294 additions and 408 deletions

2
.gitignore vendored
View File

@ -1,5 +1,6 @@
# Builds dirs # Builds dirs
build* build*
.cache
# IDE & Devs tools # IDE & Devs tools
.clickable .clickable
@ -10,6 +11,7 @@ build*
*.kdev4 *.kdev4
*swp *swp
scripts scripts
CMakeLists.txt.*
# venv # venv
venv venv

18
.gitmodules vendored
View File

@ -1,18 +0,0 @@
[submodule "libs/gpg/gpgme"]
path = libs/gpg/gpgme
url = https://github.com/gpg/gpgme
[submodule "libs/gpg/libassuan"]
path = libs/gpg/libassuan
url = https://github.com/gpg/libassuan
[submodule "libs/gpg/libgpg-error"]
path = libs/gpg/libgpg-error
url = https://github.com/gpg/libgpg-error
[submodule "libs/gpg/gnupg"]
path = libs/gpg/gnupg
url = https://github.com/gpg/gnupg
[submodule "libs/quazip"]
path = libs/quazip
url = https://github.com/stachenov/quazip
[submodule "libs/libgit2"]
path = libs/libgit2
url = https://github.com/libgit2/libgit2

View File

@ -28,7 +28,7 @@ set(PROJECT_NAME "UTPass")
set(FULL_PROJECT_NAME "utpass.qrouland") set(FULL_PROJECT_NAME "utpass.qrouland")
set(CMAKE_INSTALL_PREFIX /) set(CMAKE_INSTALL_PREFIX /)
set(DATA_DIR /) set(DATA_DIR /)
set(BIN_DIR ${DATA_DIR}lib/bin) # set(BIN_DIR ${DATA_DIR}lib/bin)
set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop) set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop)
add_executable(${PROJECT_NAME} main.cpp) add_executable(${PROJECT_NAME} main.cpp)
@ -48,13 +48,15 @@ install(FILES ${PROJECT_NAME}.contenthub DESTINATION ${DATA_DIR})
install(FILES LICENSE DESTINATION ${DATA_DIR}) install(FILES LICENSE DESTINATION ${DATA_DIR})
install(DIRECTORY qml DESTINATION ${DATA_DIR}) install(DIRECTORY qml DESTINATION ${DATA_DIR})
install(DIRECTORY assets DESTINATION ${DATA_DIR}) install(DIRECTORY assets DESTINATION ${DATA_DIR})
file(GLOB_RECURSE BIN_FILES
"build/${ARCH_TRIPLET}/gpg/local/bin/*") # file(GLOB_RECURSE BIN_FILES
install( # "/usr/bin/gpg*"
FILES ${BIN_FILES} # )
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE # install(
DESTINATION ${BIN_DIR} # FILES ${BIN_FILES}
) # PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
# DESTINATION ${BIN_DIR}
# )
# Translations # Translations
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js) file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js)
@ -81,4 +83,3 @@ add_subdirectory(po)
add_subdirectory(plugins) add_subdirectory(plugins)
add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES}) add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES})

View File

@ -1,6 +1,7 @@
{ {
"policy_groups": [ "policy_groups": [
"content_exchange" "content_exchange",
"networking"
], ],
"policy_version": 16.04 "policy_version": 20.04
} }

View File

@ -4,4 +4,4 @@ Exec=UTPass
Icon=assets/logo.svg Icon=assets/logo.svg
Terminal=false Terminal=false
Type=Application Type=Application
X-Ubuntu-Touch=true X-Lomiri-Touch=true

View File

@ -1,23 +1,28 @@
clickable_minimum_required: 7 clickable_minimum_required: 8
builder: cmake builder: cmake
kill: UTPass kill: UTPass
scripts: scripts:
style: >- style: >-
echo 'Astyle :' && astyle --options=.astylerc main.cpp && astyle echo 'Astyle :' && astyle --options=.astylerc main.cpp && astyle
--options=.astylerc --recursive 'plugins/*.cpp,*.h' && echo 'QmlFmt :' && --options=.astylerc --recursive 'plugins/*.cpp,*.h' && echo 'QmlFmt :' &&
qmlfmt -l tests && qmlfmt -w tests && qmlfmt -l qml && qmlfmt -w qml qmlfmt -l tests && qmlfmt -w tests && qmlfmt -l qml && qmlfmt -w qml
libraries:
gpg: dependencies_target:
builder: cmake - libgpgmepp-dev
make_jobs: 4 - libgpgme-dev
dependencies_host: - libgit2-dev
- texinfo - libquazip5-dev
- gpgsm - gpg
- bison
quazip: install_lib:
builder: cmake - "libgpg-error.so.0.28.0"
make_jobs: 4 - "libassuan.so"
libgit2: - "libgpgme.so"
builder: cmake - "libgpgmepp.so"
make_jobs: 4 - "libqgpgme.so.7"
build_args: '-DBUILD_SHARED_LIBS=OFF' - "libgit2.so"
- "libquazip5.so"
install_bin:
- "gpg"

View File

@ -1,70 +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(EXTERNAL_LIBS "${CMAKE_CURRENT_BINARY_DIR}/local/")
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
set(LIBGPGERROR_PATH "${THIRD_PATH}/libgpg-error")
set(LIBASSUAN_PATH "${THIRD_PATH}/libassuan")
set(LIBGPGME_PATH "${THIRD_PATH}/gpgme")
set(GNUPG_PATH "${THIRD_PATH}/gnupg")
ExternalProject_Add(
LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGERROR_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-static=yes --enable-shared=no --with-pic=yes --enable-maintainer-mode --host ${ARCH_TRIPLET} --disable-doc --disable-dependency-tracking
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
LibGpgAssuan
DEPENDS LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBASSUAN_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-static=yes --enable-shared=no --with-pic=yes --enable-maintainer-mode --with-libgpg-error-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET} --disable-doc --disable-dependency-tracking
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
LibGpgme
DEPENDS LibGpgError LibGpgAssuan
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGME_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --enable-languages=cpp,qt --enable-static=yes --enable-shared=no --with-pic=yes --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --with-libgpg-error-prefix=${EXTERNAL_LIBS} --with-libassuan-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET} --disable-doc --disable-largefile --disable-dependency-tracking
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
Gnupg
DEPENDS LibGpgError LibGpgAssuan
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${GNUPG_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --with-libgpg-error-prefix=${EXTERNAL_LIBS} --with-libassuan-prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --with-libassuan-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET} --disable-doc --disable-dependency-tracking
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
install(TARGETS)

View File

@ -1,14 +0,0 @@
#!/bin/bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
if [ ! -z "$1" ] && [ -d $SCRIPTPATH/../../build/$1/gpg ]; then
rm -rf $SCRIPTPATH/../../build/$1/gpg
fi
git submodule update --init --recursive
for LIB in $SCRIPTPATH/*/
do
echo $LIB
cd $LIB && git clean -xdf && git reset --hard HEAD
done

@ -1 +0,0 @@
Subproject commit 8ae6a246bef5b5eb0684e9fb1c933a4f8441dadd

@ -1 +0,0 @@
Subproject commit ea11c2a13cd44caf0bab395bd5132bf232318ad8

@ -1 +0,0 @@
Subproject commit 4de3154ea6e6e89e34760b7b9e0eed5123bb81f9

@ -1 +0,0 @@
Subproject commit 85f427fd28ae5947277ba02dffc83c53d9da2591

@ -1 +0,0 @@
Subproject commit 3828d7afdd08b595584048e8e4dab6ddd4506ed1

@ -1 +0,0 @@
Subproject commit 4df6c7412e5d123192f9cc937fb5829f8e9b1afc

View File

@ -12,5 +12,5 @@
}, },
"version": "0.0.3-dev", "version": "0.0.3-dev",
"maintainer": "Quentin Rouland <quentin@qrouland.com>", "maintainer": "Quentin Rouland <quentin@qrouland.com>",
"framework" : "ubuntu-sdk-16.04" "framework" : "ubuntu-sdk-20.04"
} }

View File

@ -1,3 +1,2 @@
add_subdirectory(Git)
add_subdirectory(Pass) add_subdirectory(Pass)
add_subdirectory(Utils) add_subdirectory(Utils)

View File

@ -1,39 +0,0 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PLUGIN "Git")
set(
SRC
plugin.cpp
git.cpp
)
set(CMAKE_AUTOMOC ON)
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(ARCH_TRIPLET STREQUAL "")
set(ARCH_TRIPLET x86_64-linux-gnu)
endif()
add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/build/${ARCH_TRIPLET}/libgit2/install/")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
add_library(libgit2 STATIC IMPORTED)
set_property(TARGET libgit2 PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgit2.a")
target_link_libraries(${PLUGIN} libgit2)
set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")
install(TARGETS ${PLUGIN} DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/)
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/)

View File

@ -1,10 +0,0 @@
#include <QDebug>
#include <QUrl>
#include <git2.h>
#include "git.h"
Git::Git() {};

View File

@ -1,17 +0,0 @@
#ifndef GIT_H
#define GIT_H
#include <QObject>
#include <QUrl>
class Git : public QObject
{
Q_OBJECT
public:
Git();
~Git() override = default;
};
#endif

View File

@ -1,10 +0,0 @@
#include <QtQml>
#include "plugin.h"
#include "git.h"
void GitPlugin::registerTypes(const char *uri)
{
//@uri Utils
qmlRegisterSingletonType<Git>(uri, 1, 0, "Git", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Git; });
}

View File

@ -1,16 +0,0 @@
#ifndef GITPLUGIN_H
#define GITPLUGIN_H
#include <QQmlExtensionPlugin>
class GitPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID
"org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};
#endif

View File

@ -1,2 +0,0 @@
module Git
plugin Git

View File

@ -4,6 +4,7 @@ set(PLUGIN "Pass")
set( set(
SRC SRC
plugin.cpp plugin.cpp
git.cpp
pass.cpp pass.cpp
gpg.cpp gpg.cpp
passkeymodel.h passkeymodel.h
@ -26,29 +27,29 @@ add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN}) set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus) qt5_use_modules(${PLUGIN} Qml Quick DBus)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/build/${ARCH_TRIPLET}/gpg/local/")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include) add_library(gpgerror SHARED IMPORTED)
set_property(TARGET gpgerror PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpg-error.so.0.28.0")
add_library(GpgError STATIC IMPORTED) add_library(libassuan SHARED IMPORTED)
set_property(TARGET GpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.a") set_property(TARGET libassuan PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libassuan.so")
add_library(GpgAssuan STATIC IMPORTED) add_library(libgpgme SHARED IMPORTED)
set_property(TARGET GpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.a") set_property(TARGET libgpgme PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgme.so")
add_library(Gpgme STATIC IMPORTED) add_library(libgpgmepp SHARED IMPORTED)
set_property(TARGET Gpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgme.a") set_property(TARGET libgpgmepp PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgmepp.so")
add_library(Gpgmepp STATIC IMPORTED) add_library(libqgpgme SHARED IMPORTED)
set_property(TARGET Gpgmepp PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.a") set_property(TARGET libqgpgme PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libqgpgme.so.7")
add_library(QGpgme STATIC IMPORTED)
set_property(TARGET QGpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libqgpgme.a")
target_link_libraries(${PLUGIN} QGpgme Gpgmepp Gpgme GpgAssuan GpgError) add_library(libgit2 SHARED IMPORTED)
set_property(TARGET libgit2 PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgit2.so")
target_link_libraries(${PLUGIN} gpgerror libassuan libgpgme libgpgmepp libgit2)
set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}") set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")
install(TARGETS ${PLUGIN} DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/) install(TARGETS ${PLUGIN} DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/)
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/) install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/)

26
plugins/Pass/git.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <QDebug>
#include <QUrl>
extern "C" {
#include <git2.h>
}
#include "git.h"
Git::Git()
{
git_libgit2_init();
}
Git::~Git() {
git_libgit2_shutdown();
}
bool Git::clone(QString url)
{
return false;
}

27
plugins/Pass/git.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef GIT_H
#define GIT_H
#include <QObject>
#include <QUrl>
#include <memory>
class Git
{
private:
Git();
public:
~Git();
static std::shared_ptr<Git> instance()
{
static std::shared_ptr<Git> s{new Git};
return s;
}
Git(Git const &) = delete;
void operator=(Git const &) = delete;
bool clone(QString url);
};
#endif

View File

@ -23,8 +23,8 @@
#include <qgpgme/changeownertrustjob.h> #include <qgpgme/changeownertrustjob.h>
#include "gpg.h" #include "gpg.h"
#include "pass.h"
#include "passphraseprovider.h" #include "passphraseprovider.h"
#include "qprocess.h"
@ -36,11 +36,9 @@ Gpg::Gpg()
{ {
m_window = nullptr; m_window = nullptr;
initializeLibrary();
Gpg::initGpgConfig(); Gpg::initGpgConfig();
auto error = checkEngine(OpenPGP); auto error = checkEngine(OpenPGP);
if (error) { if (error) {
qDebug() << "Code Error : " << error.code(); qDebug() << "Code Error : " << error.code();
qDebug() << "Error str : " << error.asString(); qDebug() << "Error str : " << error.asString();
@ -65,15 +63,32 @@ QString Gpg::initGpgHome()
} }
QString Gpg::findCommandPath(const QString &command) {
// Retrieve the PATH environment variable
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString pathEnv = env.value("PATH");
// Split the PATH by colon
QStringList pathDirs = pathEnv.split(":", QString::SkipEmptyParts);
// Check each directory in the PATH
foreach (const QString &dir, pathDirs) {
QFileInfo fileInfo(QDir(dir).filePath(command));
// If the file exists and is executable, return the path
if (fileInfo.exists() && fileInfo.isExecutable()) {
return fileInfo.absoluteFilePath();
}
}
return QString::null;
}
QString Gpg::initGpgExec() QString Gpg::initGpgExec()
{ {
QString path = QDir::currentPath().append("/lib/bin/gpg"); QString path = findCommandPath("gpg");
QFileInfo file(path); if (path.isNull()) {
if (!file.isFile()) { qFatal("No valid gpg exec found !");
qFatal("GNUPGEXEC file not found !");
}
if (!file.isExecutable()) {
qFatal("GNUPGEXEC file not executable !");
} }
return path; return path;
} }
@ -81,20 +96,30 @@ QString Gpg::initGpgExec()
void Gpg::initGpgConfig() void Gpg::initGpgConfig()
{ {
auto home = initGpgHome(); initializeLibrary();
auto exec = initGpgExec(); gpgme_set_global_flag("disable-gpgconf", "1");
QString home = initGpgHome();
qDebug() << "Gpg home is " << home;
QString exec = initGpgExec();
qDebug() << "Gpg exec is " << exec;
QFile agentConf(home + QStringLiteral("/gpg-agent.conf")); QFile agentConf(home + QStringLiteral("/gpg-agent.conf"));
agentConf.remove(); agentConf.remove();
agentConf.open(QIODevice::WriteOnly); agentConf.open(QIODevice::WriteOnly);
agentConf.write("allow-loopback-pinentry"); agentConf.write("allow-loopback-pinentry\n");
agentConf.close(); agentConf.close();
gpgme_set_engine_info ( auto err = gpgme_set_engine_info (
GPGME_PROTOCOL_OpenPGP, GPGME_PROTOCOL_OpenPGP,
exec.toLocal8Bit().data(), exec.toLocal8Bit().data(),
home.toLocal8Bit().data() home.toLocal8Bit().data()
); );
if (err != GPG_ERR_NO_ERROR) {
qDebug() << "Error code : " << err;
qDebug() << "Error str : " << gpg_strerror(err);
qFatal("GPGME set engine info failed !");
}
} }

View File

@ -15,6 +15,7 @@ private:
Gpg(); Gpg();
QObject *m_window; QObject *m_window;
QString findCommandPath(const QString &command);
QString initGpgHome(); QString initGpgHome();
QString initGpgExec(); QString initGpgExec();
void initGpgConfig(); void initGpgConfig();

View File

@ -3,8 +3,8 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include "pass.h" #include "pass.h"
#include "git.h"
#include "gpg.h" #include "gpg.h"
#include "passphraseprovider.h"
#include "passkeymodel.h" #include "passkeymodel.h"
@ -18,44 +18,46 @@ void Pass::init(QObject *window)
if (!window) { if (!window) {
qFatal("window is invalid. Abording."); qFatal("window is invalid. Abording.");
} }
Gpg::instance()->setWindow(window); Gpg::instance()->setWindow(window);
QDir dir(m_password_store); QDir dir(m_password_store);
if (!dir.exists()) if (!dir.exists())
dir.mkpath("."); dir.mkpath(".");
qDebug() << "Password Store is :" << m_password_store; qInfo() << "Password Store is :" << m_password_store;
} }
void Pass::decrypt(QUrl url) void Pass::decrypt(QUrl url)
{ {
qDebug() << "Start decrypting"; qInfo() << "Decrypting";
auto decrypt_ret = Gpg::instance()->decryptFromFile(url.toLocalFile()); auto decrypt_ret = Gpg::instance()->decryptFromFile(url.toLocalFile());
if (decrypt_ret.first) { if (decrypt_ret.first) {
qDebug() << "Decrypt Failed"; qInfo() << "Decrypt Failed";
emit decryptFailed(); emit decryptFailed();
} else if (decrypt_ret.second.isNull()) { } else if (decrypt_ret.second.isNull()) {
qDebug() << "Decrypt Canceled"; qInfo() << "Decrypt Canceled";
emit decryptCanceled(); emit decryptCanceled();
} else { } else {
qDebug() << "Decrypt OK"; qInfo() << "Decrypt OK";
emit decrypted(decrypt_ret.second); emit decrypted(decrypt_ret.second);
} }
} }
bool Pass::gpgDeleteKeyId(QString id) bool Pass::gpgDeleteKeyId(QString id)
{ {
qDebug() << "Start deleting Key id " << id; qInfo() << "Deleting Key id " << id;
return !Gpg::instance()->deleteKeyId(id); return !Gpg::instance()->deleteKeyId(id);
} }
bool Pass::gpgImportKeyFromFile(QUrl url) bool Pass::gpgImportKeyFromFile(QUrl url)
{ {
qDebug() << "Start importing Key from " << url; qInfo() << "Importing Key from " << url;
return !Gpg::instance()->importKeysFromFile(url.toLocalFile()); return !Gpg::instance()->importKeysFromFile(url.toLocalFile());
} }
QVariant Pass::gpgGetAllKeysModel() QVariant Pass::gpgGetAllKeysModel()
{ {
qInfo() << "Getting all key form gpg ";
return QVariant::fromValue(PassKeyModel::keysToPassKeyQObjectList( return QVariant::fromValue(PassKeyModel::keysToPassKeyQObjectList(
Gpg::instance()->getAllKeys().second)); Gpg::instance()->getAllKeys().second));
} }
@ -64,3 +66,9 @@ QString Pass::getPasswordStore()
{ {
return m_password_store; return m_password_store;
} }
bool Pass::gitClone(QString url)
{
qInfo() << "Cloning . password_store from " << url;
return Git::instance()->clone(url);
}

View File

@ -27,6 +27,7 @@ public:
Q_INVOKABLE bool gpgDeleteKeyId(QString id); Q_INVOKABLE bool gpgDeleteKeyId(QString id);
Q_INVOKABLE bool gpgImportKeyFromFile(QUrl url); Q_INVOKABLE bool gpgImportKeyFromFile(QUrl url);
Q_INVOKABLE QVariant gpgGetAllKeysModel(); Q_INVOKABLE QVariant gpgGetAllKeysModel();
Q_INVOKABLE bool gitClone(QString url);
}; };
#endif #endif

View File

@ -23,15 +23,6 @@ add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN}) set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus) qt5_use_modules(${PLUGIN} Qml Quick DBus)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/build/${ARCH_TRIPLET}/quazip/install/")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
add_library(quazip STATIC IMPORTED)
set_property(TARGET quazip PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libquazip5.a")
target_link_libraries(${PLUGIN} quazip)
set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}") set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: utpass.qrouland\n" "Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-17 21:41-0400\n" "POT-Creation-Date: 2025-01-07 13:36+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,6 +17,46 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../qml/components/FileDir.qml:71
msgid "Decryption failed !"
msgstr ""
#: ../qml/dialogs/DoubleValidationDialog.qml:28
#: ../qml/dialogs/PassphraseDialog.qml:29
#: ../qml/dialogs/SimpleValidationDialog.qml:19
msgid "Ok"
msgstr ""
#: ../qml/dialogs/DoubleValidationDialog.qml:44
#: ../qml/dialogs/PassphraseDialog.qml:41
#: ../qml/dialogs/SimpleValidationDialog.qml:30
msgid "Cancel"
msgstr ""
#: ../qml/dialogs/ErrorDialog.qml:12
msgid "Error !"
msgstr ""
#: ../qml/dialogs/ErrorDialog.qml:15 ../qml/dialogs/SuccessDialog.qml:15
msgid "OK"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:7
msgid "Authentication required"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:8
msgid "Enter passphrase:"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:20
msgid "passphrase"
msgstr ""
#: ../qml/dialogs/SuccessDialog.qml:12
msgid "Success !"
msgstr ""
#: ../qml/pages/Info.qml:11 ../qml/pages/headers/MainHeader.qml:58 #: ../qml/pages/Info.qml:11 ../qml/pages/headers/MainHeader.qml:58
msgid "Info" msgid "Info"
msgstr "" msgstr ""
@ -41,34 +81,28 @@ msgstr ""
msgid "Released under the terms of the GNU GPL v3" msgid "Released under the terms of the GNU GPL v3"
msgstr "" msgstr ""
#: ../qml/pages/settings/Settings.qml:14 ../qml/pages/headers/MainHeader.qml:51 #: ../qml/pages/PasswordList.qml:23
msgid "Back"
msgstr ""
#: ../qml/pages/PasswordList.qml:43
msgid ""
"No password found<br>You can import a password store zip in the settings"
msgstr ""
#: ../qml/pages/headers/MainHeader.qml:8 ../qml/pages/headers/StackHeader.qml:8
#: UTPass.desktop.in.h:1
msgid "UTPass"
msgstr ""
#: ../qml/pages/headers/MainHeader.qml:23
msgid "Search"
msgstr ""
#: ../qml/pages/headers/MainHeader.qml:51 ../qml/pages/settings/Settings.qml:14
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: ../qml/pages/settings/Settings.qml:28
msgid "GPG"
msgstr ""
#: ../qml/pages/settings/Settings.qml:32
msgid "Import a GPG key file"
msgstr ""
#: ../qml/pages/settings/Settings.qml:36
msgid "Show GPG keys"
msgstr ""
#: ../qml/pages/settings/Settings.qml:43
msgid "Password Store"
msgstr ""
#: ../qml/pages/settings/Settings.qml:47
msgid "Import a Password Store Zip"
msgstr ""
#: ../qml/pages/settings/Settings.qml:56
msgid "Warning: importing delete any exiting Password Store"
msgstr ""
#: ../qml/pages/settings/ImportKeyFile.qml:17 #: ../qml/pages/settings/ImportKeyFile.qml:17
msgid "GPG Key Import" msgid "GPG Key Import"
msgstr "" msgstr ""
@ -126,60 +160,26 @@ msgstr ""
msgid "Key successfully deleted !" msgid "Key successfully deleted !"
msgstr "" msgstr ""
#: ../qml/pages/PasswordList.qml:23 #: ../qml/pages/settings/Settings.qml:28
msgid "Back" msgid "GPG"
msgstr "" msgstr ""
#: ../qml/pages/PasswordList.qml:43 #: ../qml/pages/settings/Settings.qml:32
msgid "" msgid "Import a GPG key file"
"No password found<br>You can import a password store zip in the settings"
msgstr "" msgstr ""
#: ../qml/pages/headers/StackHeader.qml:8 ../qml/pages/headers/MainHeader.qml:8 #: ../qml/pages/settings/Settings.qml:36
#: UTPass.desktop.in.h:1 msgid "Show GPG keys"
msgid "UTPass"
msgstr "" msgstr ""
#: ../qml/pages/headers/MainHeader.qml:23 #: ../qml/pages/settings/Settings.qml:43
msgid "Search" msgid "Password Store"
msgstr "" msgstr ""
#: ../qml/components/FileDir.qml:71 #: ../qml/pages/settings/Settings.qml:47
msgid "Decryption failed !" msgid "Import a Password Store Zip"
msgstr "" msgstr ""
#: ../qml/dialogs/ErrorDialog.qml:12 #: ../qml/pages/settings/Settings.qml:56
msgid "Error !" msgid "Warning: importing delete any exiting Password Store"
msgstr ""
#: ../qml/dialogs/ErrorDialog.qml:15 ../qml/dialogs/SuccessDialog.qml:15
msgid "OK"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:7
msgid "Authentication required"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:8
msgid "Enter passphrase:"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:20
msgid "passphrase"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:29
#: ../qml/dialogs/DoubleValidationDialog.qml:28
#: ../qml/dialogs/SimpleValidationDialog.qml:19
msgid "Ok"
msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:41
#: ../qml/dialogs/DoubleValidationDialog.qml:44
#: ../qml/dialogs/SimpleValidationDialog.qml:30
msgid "Cancel"
msgstr ""
#: ../qml/dialogs/SuccessDialog.qml:12
msgid "Success !"
msgstr "" msgstr ""

View File

@ -1,7 +1,7 @@
import QtQuick 2.4 import QtQuick 2.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import "dialogs" import "dialogs"

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import "../styles" import "../styles"
Item { Item {
@ -12,7 +12,7 @@ Item {
property int tBorderwidth: 0 property int tBorderwidth: 0
property int bBorderwidth: 0 property int bBorderwidth: 0
property int commonBorderWidth: 0 property int commonBorderWidth: 0
property string borderColor: UbuntuColors.warmGrey property string borderColor: LomiriColors.warmGrey
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -33,13 +33,13 @@ Item {
anchors.rightMargin: units.gu(2) anchors.rightMargin: units.gu(2)
height: units.gu(4) height: units.gu(4)
name: "edit-copy" name: "edit-copy"
color: UbuntuColors.orange color: LomiriColors.orange
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onPressed: { onPressed: {
parent.color = UbuntuColors.warmGrey parent.color = LomiriColors.warmGrey
} }
onClicked: { onClicked: {
var mimeData = Clipboard.newData() var mimeData = Clipboard.newData()

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import "../styles" import "../styles"
Item { Item {
@ -14,7 +14,7 @@ Item {
property int tBorderwidth: 0 property int tBorderwidth: 0
property int bBorderwidth: 0 property int bBorderwidth: 0
property int commonBorderWidth: 0 property int commonBorderWidth: 0
property string borderColor: UbuntuColors.warmGrey property string borderColor: LomiriColors.warmGrey
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -36,7 +36,7 @@ Item {
width: units.gu(4) width: units.gu(4)
height: units.gu(4) height: units.gu(4)
name: "go-next" name: "go-next"
color: UbuntuColors.orange color: LomiriColors.orange
} }
MouseArea { MouseArea {

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import "../styles" import "../styles"
import "../dialogs" import "../dialogs"
@ -27,7 +27,7 @@ Component {
anchors.rightMargin: units.gu(2) anchors.rightMargin: units.gu(2)
height: units.gu(4) height: units.gu(4)
name: fileIsDir ? "go-next" : "lock" name: fileIsDir ? "go-next" : "lock"
color: UbuntuColors.orange color: LomiriColors.orange
} }
MouseArea { MouseArea {
@ -62,7 +62,7 @@ Component {
rBorderwidth: 0 rBorderwidth: 0
tBorderwidth: 0 tBorderwidth: 0
bBorderwidth: 1 bBorderwidth: 1
borderColor: UbuntuColors.warmGrey borderColor: LomiriColors.warmGrey
} }
Component { Component {

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import "../styles" import "../styles"
Item { Item {
@ -17,7 +17,7 @@ Item {
property int tBorderwidth: 0 property int tBorderwidth: 0
property int bBorderwidth: 0 property int bBorderwidth: 0
property int commonBorderWidth: 0 property int commonBorderWidth: 0
property string borderColor: UbuntuColors.warmGrey property string borderColor: LomiriColors.warmGrey
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -39,7 +39,7 @@ Item {
width: units.gu(4) width: units.gu(4)
height: units.gu(4) height: units.gu(4)
name: "go-next" name: "go-next"
color: UbuntuColors.orange color: LomiriColors.orange
} }
MouseArea { MouseArea {

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
Dialog { Dialog {
id: doubleValidationDialog id: doubleValidationDialog
@ -26,7 +26,7 @@ Dialog {
Button { Button {
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: UbuntuColors.green color: LomiriColors.green
onClicked: { onClicked: {
if (nb_validation == 1) { if (nb_validation == 1) {
@ -42,7 +42,7 @@ Dialog {
Button { Button {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: UbuntuColors.red color: LomiriColors.red
onClicked: { onClicked: {
nb_validation = 0 nb_validation = 0
canceled() canceled()

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
Dialog { Dialog {
id: dialogSuccess id: dialogSuccess
@ -13,7 +13,7 @@ Dialog {
text: textError text: textError
Button { Button {
text: i18n.tr("OK") text: i18n.tr("OK")
color: UbuntuColors.red color: LomiriColors.red
onClicked: function () { onClicked: function () {
dialogClosed() dialogClosed()
PopupUtils.close(dialogSuccess) PopupUtils.close(dialogSuccess)

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
Dialog { Dialog {
id: passphraseProvider id: passphraseProvider
@ -27,7 +27,7 @@ Dialog {
id: okButton id: okButton
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: UbuntuColors.green color: LomiriColors.green
onClicked: { onClicked: {
validated(passphraseField.text) validated(passphraseField.text)
@ -40,7 +40,7 @@ Dialog {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: UbuntuColors.red color: LomiriColors.red
onClicked: { onClicked: {
canceled() canceled()

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
Dialog { Dialog {
id: doubleValidationDialog id: doubleValidationDialog
@ -17,7 +17,7 @@ Dialog {
Button { Button {
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: UbuntuColors.green color: LomiriColors.green
onClicked: { onClicked: {
validated() validated()
@ -28,7 +28,7 @@ Dialog {
Button { Button {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: UbuntuColors.red color: LomiriColors.red
onClicked: { onClicked: {
canceled() canceled()
PopupUtils.close(doubleValidationDialog) PopupUtils.close(doubleValidationDialog)

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
Dialog { Dialog {
id: dialogSuccess id: dialogSuccess
@ -13,7 +13,7 @@ Dialog {
text: textSuccess text: textSuccess
Button { Button {
text: i18n.tr("OK") text: i18n.tr("OK")
color: UbuntuColors.green color: LomiriColors.green
onClicked: function () { onClicked: function () {
dialogClosed() dialogClosed()
PopupUtils.close(dialogSuccess) PopupUtils.close(dialogSuccess)

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import "headers" import "headers"
import "../components" import "../components"

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import "headers" import "headers"
Page { Page {

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Qt.labs.folderlistmodel 2.1 import Qt.labs.folderlistmodel 2.1
import Pass 1.0 import Pass 1.0
import "../components" import "../components"

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
PageHeader { PageHeader {
id: mainHeader id: mainHeader

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
PageHeader { PageHeader {
id: stackHeader id: stackHeader

View File

@ -1,7 +1,7 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Content 1.3 import Lomiri.Content 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import Utils 1.0 import Utils 1.0
import "../headers" import "../headers"

View File

@ -1,7 +1,7 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Content 1.3 import Lomiri.Content 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import Utils 1.0 import Utils 1.0
import "../headers" import "../headers"

View File

@ -1,6 +1,6 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Ubuntu.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import "../headers" import "../headers"
import "../../components" import "../../components"
@ -47,7 +47,7 @@ Page {
Button { Button {
id: buttonDeleteKey id: buttonDeleteKey
text: i18n.tr("Delete this key") text: i18n.tr("Delete this key")
color: UbuntuColors.red color: LomiriColors.red
onClicked: { onClicked: {
infoKeysPage.currentKey = model.modelData.uid infoKeysPage.currentKey = model.modelData.uid
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage) PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage)

View File

@ -1,5 +1,5 @@
import QtQuick 2.4 import QtQuick 2.4
import Ubuntu.Components 1.3 import Lomiri.Components 1.3
import Pass 1.0 import Pass 1.0
import "../headers" import "../headers"
import "../../components" import "../../components"
@ -51,7 +51,7 @@ Page {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
width: parent.width width: parent.width
height: units.gu(4) height: units.gu(4)
color: UbuntuColors.red color: LomiriColors.red
text: i18n.tr( text: i18n.tr(
'Warning: importing delete any exiting Password Store') 'Warning: importing delete any exiting Password Store')
} }