diff --git a/.gitignore b/.gitignore index 5bf7aab..dc2af8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Builds dirs build* +.cache # IDE & Devs tools .clickable @@ -10,6 +11,7 @@ build* *.kdev4 *swp scripts +CMakeLists.txt.* # venv venv diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 47ddbbf..0000000 --- a/.gitmodules +++ /dev/null @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7863cae..aea1bb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set(PROJECT_NAME "UTPass") set(FULL_PROJECT_NAME "utpass.qrouland") set(CMAKE_INSTALL_PREFIX /) set(DATA_DIR /) -set(BIN_DIR ${DATA_DIR}lib/bin) +# set(BIN_DIR ${DATA_DIR}lib/bin) set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop) 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(DIRECTORY qml DESTINATION ${DATA_DIR}) install(DIRECTORY assets DESTINATION ${DATA_DIR}) -file(GLOB_RECURSE BIN_FILES - "build/${ARCH_TRIPLET}/gpg/local/bin/*") -install( - FILES ${BIN_FILES} - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - DESTINATION ${BIN_DIR} -) + +# file(GLOB_RECURSE BIN_FILES +# "/usr/bin/gpg*" +# ) +# install( +# FILES ${BIN_FILES} +# PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +# DESTINATION ${BIN_DIR} +# ) # Translations 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_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES}) - diff --git a/UTPass.apparmor b/UTPass.apparmor index 08ec2d7..ad615ec 100644 --- a/UTPass.apparmor +++ b/UTPass.apparmor @@ -1,6 +1,7 @@ { "policy_groups": [ - "content_exchange" + "content_exchange", + "networking" ], - "policy_version": 16.04 + "policy_version": 20.04 } diff --git a/UTPass.desktop.in b/UTPass.desktop.in index efd6a8d..e4a8299 100644 --- a/UTPass.desktop.in +++ b/UTPass.desktop.in @@ -4,4 +4,4 @@ Exec=UTPass Icon=assets/logo.svg Terminal=false Type=Application -X-Ubuntu-Touch=true +X-Lomiri-Touch=true diff --git a/clickable.yaml b/clickable.yaml index b36cf76..dd129cf 100644 --- a/clickable.yaml +++ b/clickable.yaml @@ -1,23 +1,28 @@ -clickable_minimum_required: 7 -builder: cmake -kill: UTPass -scripts: - style: >- - echo 'Astyle :' && astyle --options=.astylerc main.cpp && astyle - --options=.astylerc --recursive 'plugins/*.cpp,*.h' && echo 'QmlFmt :' && - qmlfmt -l tests && qmlfmt -w tests && qmlfmt -l qml && qmlfmt -w qml -libraries: - gpg: - builder: cmake - make_jobs: 4 - dependencies_host: - - texinfo - - gpgsm - - bison - quazip: - builder: cmake - make_jobs: 4 - libgit2: - builder: cmake - make_jobs: 4 - build_args: '-DBUILD_SHARED_LIBS=OFF' +clickable_minimum_required: 8 +builder: cmake +kill: UTPass + +scripts: + style: >- + echo 'Astyle :' && astyle --options=.astylerc main.cpp && astyle + --options=.astylerc --recursive 'plugins/*.cpp,*.h' && echo 'QmlFmt :' && + qmlfmt -l tests && qmlfmt -w tests && qmlfmt -l qml && qmlfmt -w qml + +dependencies_target: +- libgpgmepp-dev +- libgpgme-dev +- libgit2-dev +- libquazip5-dev +- gpg + +install_lib: +- "libgpg-error.so.0.28.0" +- "libassuan.so" +- "libgpgme.so" +- "libgpgmepp.so" +- "libqgpgme.so.7" +- "libgit2.so" +- "libquazip5.so" + +install_bin: +- "gpg" diff --git a/libs/gpg/CMakeLists.txt b/libs/gpg/CMakeLists.txt deleted file mode 100644 index 2667b32..0000000 --- a/libs/gpg/CMakeLists.txt +++ /dev/null @@ -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 /autogen.sh && /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 /autogen.sh && /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 /autogen.sh && /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 /autogen.sh && /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) diff --git a/libs/gpg/clean.sh b/libs/gpg/clean.sh deleted file mode 100755 index d2c13dc..0000000 --- a/libs/gpg/clean.sh +++ /dev/null @@ -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 diff --git a/libs/gpg/gnupg b/libs/gpg/gnupg deleted file mode 160000 index 8ae6a24..0000000 --- a/libs/gpg/gnupg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ae6a246bef5b5eb0684e9fb1c933a4f8441dadd diff --git a/libs/gpg/gpgme b/libs/gpg/gpgme deleted file mode 160000 index ea11c2a..0000000 --- a/libs/gpg/gpgme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ea11c2a13cd44caf0bab395bd5132bf232318ad8 diff --git a/libs/gpg/libassuan b/libs/gpg/libassuan deleted file mode 160000 index 4de3154..0000000 --- a/libs/gpg/libassuan +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4de3154ea6e6e89e34760b7b9e0eed5123bb81f9 diff --git a/libs/gpg/libgpg-error b/libs/gpg/libgpg-error deleted file mode 160000 index 85f427f..0000000 --- a/libs/gpg/libgpg-error +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 85f427fd28ae5947277ba02dffc83c53d9da2591 diff --git a/libs/libgit2 b/libs/libgit2 deleted file mode 160000 index 3828d7a..0000000 --- a/libs/libgit2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3828d7afdd08b595584048e8e4dab6ddd4506ed1 diff --git a/libs/quazip b/libs/quazip deleted file mode 160000 index 4df6c74..0000000 --- a/libs/quazip +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4df6c7412e5d123192f9cc937fb5829f8e9b1afc diff --git a/manifest.json.in b/manifest.json.in index 3cc4b87..b612bac 100644 --- a/manifest.json.in +++ b/manifest.json.in @@ -12,5 +12,5 @@ }, "version": "0.0.3-dev", "maintainer": "Quentin Rouland ", - "framework" : "ubuntu-sdk-16.04" + "framework" : "ubuntu-sdk-20.04" } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index d10ae09..6b05459 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,3 +1,2 @@ -add_subdirectory(Git) add_subdirectory(Pass) add_subdirectory(Utils) diff --git a/plugins/Git/CMakeLists.txt b/plugins/Git/CMakeLists.txt deleted file mode 100644 index 74c5426..0000000 --- a/plugins/Git/CMakeLists.txt +++ /dev/null @@ -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}/) diff --git a/plugins/Git/git.cpp b/plugins/Git/git.cpp deleted file mode 100644 index 96134c8..0000000 --- a/plugins/Git/git.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -#include "git.h" - - - -Git::Git() {}; - diff --git a/plugins/Git/git.h b/plugins/Git/git.h deleted file mode 100644 index 59b4c48..0000000 --- a/plugins/Git/git.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GIT_H -#define GIT_H - -#include -#include - -class Git : public QObject -{ - Q_OBJECT - -public: - Git(); - ~Git() override = default; - -}; - -#endif diff --git a/plugins/Git/plugin.cpp b/plugins/Git/plugin.cpp deleted file mode 100644 index 8d375d6..0000000 --- a/plugins/Git/plugin.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#include "plugin.h" -#include "git.h" - -void GitPlugin::registerTypes(const char *uri) -{ - //@uri Utils - qmlRegisterSingletonType(uri, 1, 0, "Git", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Git; }); -} diff --git a/plugins/Git/plugin.h b/plugins/Git/plugin.h deleted file mode 100644 index cce3028..0000000 --- a/plugins/Git/plugin.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef GITPLUGIN_H -#define GITPLUGIN_H - -#include - -class GitPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID - "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) override; -}; - -#endif diff --git a/plugins/Git/qmldir b/plugins/Git/qmldir deleted file mode 100644 index 5e2e41c..0000000 --- a/plugins/Git/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module Git -plugin Git diff --git a/plugins/Pass/CMakeLists.txt b/plugins/Pass/CMakeLists.txt index 0c59465..2c7e504 100644 --- a/plugins/Pass/CMakeLists.txt +++ b/plugins/Pass/CMakeLists.txt @@ -4,6 +4,7 @@ set(PLUGIN "Pass") set( SRC plugin.cpp + git.cpp pass.cpp gpg.cpp passkeymodel.h @@ -26,29 +27,29 @@ 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}/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) -set_property(TARGET GpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.a") +add_library(libassuan SHARED IMPORTED) +set_property(TARGET libassuan PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libassuan.so") -add_library(GpgAssuan STATIC IMPORTED) -set_property(TARGET GpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.a") +add_library(libgpgme SHARED IMPORTED) +set_property(TARGET libgpgme PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgme.so") -add_library(Gpgme STATIC IMPORTED) -set_property(TARGET Gpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgme.a") +add_library(libgpgmepp SHARED IMPORTED) +set_property(TARGET libgpgmepp PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgmepp.so") -add_library(Gpgmepp STATIC IMPORTED) -set_property(TARGET Gpgmepp PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.a") +add_library(libqgpgme SHARED IMPORTED) +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}") - install(TARGETS ${PLUGIN} DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/) install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN}/) diff --git a/plugins/Pass/git.cpp b/plugins/Pass/git.cpp new file mode 100644 index 0000000..690a146 --- /dev/null +++ b/plugins/Pass/git.cpp @@ -0,0 +1,26 @@ + + + +#include +#include +extern "C" { +#include +} + +#include "git.h" + + + +Git::Git() +{ + git_libgit2_init(); +} + +Git::~Git() { + git_libgit2_shutdown(); +} + +bool Git::clone(QString url) +{ + return false; +} diff --git a/plugins/Pass/git.h b/plugins/Pass/git.h new file mode 100644 index 0000000..a97d8d7 --- /dev/null +++ b/plugins/Pass/git.h @@ -0,0 +1,27 @@ +#ifndef GIT_H +#define GIT_H + +#include +#include +#include + +class Git +{ +private: + Git(); +public: + + ~Git(); + + static std::shared_ptr instance() + { + static std::shared_ptr s{new Git}; + return s; + } + Git(Git const &) = delete; + void operator=(Git const &) = delete; + + bool clone(QString url); +}; + +#endif diff --git a/plugins/Pass/gpg.cpp b/plugins/Pass/gpg.cpp index 1f53105..a8e134b 100644 --- a/plugins/Pass/gpg.cpp +++ b/plugins/Pass/gpg.cpp @@ -23,8 +23,8 @@ #include #include "gpg.h" -#include "pass.h" #include "passphraseprovider.h" +#include "qprocess.h" @@ -36,11 +36,9 @@ Gpg::Gpg() { m_window = nullptr; - initializeLibrary(); - Gpg::initGpgConfig(); - auto error = checkEngine(OpenPGP); + auto error = checkEngine(OpenPGP); if (error) { qDebug() << "Code Error : " << error.code(); 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 path = QDir::currentPath().append("/lib/bin/gpg"); - QFileInfo file(path); - if (!file.isFile()) { - qFatal("GNUPGEXEC file not found !"); - } - if (!file.isExecutable()) { - qFatal("GNUPGEXEC file not executable !"); + QString path = findCommandPath("gpg"); + if (path.isNull()) { + qFatal("No valid gpg exec found !"); } return path; } @@ -81,20 +96,30 @@ QString Gpg::initGpgExec() void Gpg::initGpgConfig() { - auto home = initGpgHome(); - auto exec = initGpgExec(); + initializeLibrary(); + 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")); agentConf.remove(); agentConf.open(QIODevice::WriteOnly); - agentConf.write("allow-loopback-pinentry"); + agentConf.write("allow-loopback-pinentry\n"); agentConf.close(); - gpgme_set_engine_info ( + auto err = gpgme_set_engine_info ( GPGME_PROTOCOL_OpenPGP, exec.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 !"); + } } diff --git a/plugins/Pass/gpg.h b/plugins/Pass/gpg.h index 74a1fa6..2b81897 100644 --- a/plugins/Pass/gpg.h +++ b/plugins/Pass/gpg.h @@ -15,6 +15,7 @@ private: Gpg(); QObject *m_window; + QString findCommandPath(const QString &command); QString initGpgHome(); QString initGpgExec(); void initGpgConfig(); diff --git a/plugins/Pass/pass.cpp b/plugins/Pass/pass.cpp index 7b3e9af..e1c0ef7 100644 --- a/plugins/Pass/pass.cpp +++ b/plugins/Pass/pass.cpp @@ -3,8 +3,8 @@ #include #include "pass.h" +#include "git.h" #include "gpg.h" -#include "passphraseprovider.h" #include "passkeymodel.h" @@ -18,44 +18,46 @@ void Pass::init(QObject *window) if (!window) { qFatal("window is invalid. Abording."); } + Gpg::instance()->setWindow(window); QDir dir(m_password_store); if (!dir.exists()) dir.mkpath("."); - qDebug() << "Password Store is :" << m_password_store; + qInfo() << "Password Store is :" << m_password_store; } void Pass::decrypt(QUrl url) { - qDebug() << "Start decrypting"; + qInfo() << "Decrypting"; auto decrypt_ret = Gpg::instance()->decryptFromFile(url.toLocalFile()); if (decrypt_ret.first) { - qDebug() << "Decrypt Failed"; + qInfo() << "Decrypt Failed"; emit decryptFailed(); } else if (decrypt_ret.second.isNull()) { - qDebug() << "Decrypt Canceled"; + qInfo() << "Decrypt Canceled"; emit decryptCanceled(); } else { - qDebug() << "Decrypt OK"; + qInfo() << "Decrypt OK"; emit decrypted(decrypt_ret.second); } } bool Pass::gpgDeleteKeyId(QString id) { - qDebug() << "Start deleting Key id " << id; + qInfo() << "Deleting Key id " << id; return !Gpg::instance()->deleteKeyId(id); } bool Pass::gpgImportKeyFromFile(QUrl url) { - qDebug() << "Start importing Key from " << url; + qInfo() << "Importing Key from " << url; return !Gpg::instance()->importKeysFromFile(url.toLocalFile()); } QVariant Pass::gpgGetAllKeysModel() { + qInfo() << "Getting all key form gpg "; return QVariant::fromValue(PassKeyModel::keysToPassKeyQObjectList( Gpg::instance()->getAllKeys().second)); } @@ -64,3 +66,9 @@ QString Pass::getPasswordStore() { return m_password_store; } + +bool Pass::gitClone(QString url) +{ + qInfo() << "Cloning . password_store from " << url; + return Git::instance()->clone(url); +} diff --git a/plugins/Pass/pass.h b/plugins/Pass/pass.h index 6b71623..fdbc7ed 100644 --- a/plugins/Pass/pass.h +++ b/plugins/Pass/pass.h @@ -27,6 +27,7 @@ public: Q_INVOKABLE bool gpgDeleteKeyId(QString id); Q_INVOKABLE bool gpgImportKeyFromFile(QUrl url); Q_INVOKABLE QVariant gpgGetAllKeysModel(); + Q_INVOKABLE bool gitClone(QString url); }; #endif diff --git a/plugins/Utils/CMakeLists.txt b/plugins/Utils/CMakeLists.txt index d018960..d55b7d7 100644 --- a/plugins/Utils/CMakeLists.txt +++ b/plugins/Utils/CMakeLists.txt @@ -23,15 +23,6 @@ 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}/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}") diff --git a/po/utpass.qrouland.pot b/po/utpass.qrouland.pot index e78f637..5a4b82c 100644 --- a/po/utpass.qrouland.pot +++ b/po/utpass.qrouland.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: utpass.qrouland\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,6 +17,46 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\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 msgid "Info" msgstr "" @@ -41,34 +81,28 @@ msgstr "" msgid "Released under the terms of the GNU GPL v3" 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
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" 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 msgid "GPG Key Import" msgstr "" @@ -126,60 +160,26 @@ msgstr "" msgid "Key successfully deleted !" msgstr "" -#: ../qml/pages/PasswordList.qml:23 -msgid "Back" +#: ../qml/pages/settings/Settings.qml:28 +msgid "GPG" msgstr "" -#: ../qml/pages/PasswordList.qml:43 -msgid "" -"No password found
You can import a password store zip in the settings" +#: ../qml/pages/settings/Settings.qml:32 +msgid "Import a GPG key file" msgstr "" -#: ../qml/pages/headers/StackHeader.qml:8 ../qml/pages/headers/MainHeader.qml:8 -#: UTPass.desktop.in.h:1 -msgid "UTPass" +#: ../qml/pages/settings/Settings.qml:36 +msgid "Show GPG keys" msgstr "" -#: ../qml/pages/headers/MainHeader.qml:23 -msgid "Search" +#: ../qml/pages/settings/Settings.qml:43 +msgid "Password Store" msgstr "" -#: ../qml/components/FileDir.qml:71 -msgid "Decryption failed !" +#: ../qml/pages/settings/Settings.qml:47 +msgid "Import a Password Store Zip" 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/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 !" +#: ../qml/pages/settings/Settings.qml:56 +msgid "Warning: importing delete any exiting Password Store" msgstr "" diff --git a/qml/Main.qml b/qml/Main.qml index afdbf26..5c92be5 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -1,7 +1,7 @@ import QtQuick 2.4 import QtQuick.Layouts 1.1 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 import Pass 1.0 import "dialogs" diff --git a/qml/components/CopyText.qml b/qml/components/CopyText.qml index 97bb348..8d45053 100644 --- a/qml/components/CopyText.qml +++ b/qml/components/CopyText.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import "../styles" Item { @@ -12,7 +12,7 @@ Item { property int tBorderwidth: 0 property int bBorderwidth: 0 property int commonBorderWidth: 0 - property string borderColor: UbuntuColors.warmGrey + property string borderColor: LomiriColors.warmGrey width: parent.width height: units.gu(6) @@ -33,13 +33,13 @@ Item { anchors.rightMargin: units.gu(2) height: units.gu(4) name: "edit-copy" - color: UbuntuColors.orange + color: LomiriColors.orange } MouseArea { anchors.fill: parent onPressed: { - parent.color = UbuntuColors.warmGrey + parent.color = LomiriColors.warmGrey } onClicked: { var mimeData = Clipboard.newData() diff --git a/qml/components/ExternalLink.qml b/qml/components/ExternalLink.qml index 3500c97..e1c1533 100644 --- a/qml/components/ExternalLink.qml +++ b/qml/components/ExternalLink.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import "../styles" Item { @@ -14,7 +14,7 @@ Item { property int tBorderwidth: 0 property int bBorderwidth: 0 property int commonBorderWidth: 0 - property string borderColor: UbuntuColors.warmGrey + property string borderColor: LomiriColors.warmGrey width: parent.width height: units.gu(6) @@ -36,7 +36,7 @@ Item { width: units.gu(4) height: units.gu(4) name: "go-next" - color: UbuntuColors.orange + color: LomiriColors.orange } MouseArea { diff --git a/qml/components/FileDir.qml b/qml/components/FileDir.qml index 3f484bf..b6c09f1 100644 --- a/qml/components/FileDir.qml +++ b/qml/components/FileDir.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 import Pass 1.0 import "../styles" import "../dialogs" @@ -27,7 +27,7 @@ Component { anchors.rightMargin: units.gu(2) height: units.gu(4) name: fileIsDir ? "go-next" : "lock" - color: UbuntuColors.orange + color: LomiriColors.orange } MouseArea { @@ -62,7 +62,7 @@ Component { rBorderwidth: 0 tBorderwidth: 0 bBorderwidth: 1 - borderColor: UbuntuColors.warmGrey + borderColor: LomiriColors.warmGrey } Component { diff --git a/qml/components/PageStackLink.qml b/qml/components/PageStackLink.qml index be21822..fa7ce31 100644 --- a/qml/components/PageStackLink.qml +++ b/qml/components/PageStackLink.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import "../styles" Item { @@ -17,7 +17,7 @@ Item { property int tBorderwidth: 0 property int bBorderwidth: 0 property int commonBorderWidth: 0 - property string borderColor: UbuntuColors.warmGrey + property string borderColor: LomiriColors.warmGrey width: parent.width height: units.gu(6) @@ -39,7 +39,7 @@ Item { width: units.gu(4) height: units.gu(4) name: "go-next" - color: UbuntuColors.orange + color: LomiriColors.orange } MouseArea { diff --git a/qml/dialogs/DoubleValidationDialog.qml b/qml/dialogs/DoubleValidationDialog.qml index 19d741d..be39aa2 100644 --- a/qml/dialogs/DoubleValidationDialog.qml +++ b/qml/dialogs/DoubleValidationDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 Dialog { id: doubleValidationDialog @@ -26,7 +26,7 @@ Dialog { Button { text: i18n.tr("Ok") - color: UbuntuColors.green + color: LomiriColors.green onClicked: { if (nb_validation == 1) { @@ -42,7 +42,7 @@ Dialog { Button { id: cancelButton text: i18n.tr("Cancel") - color: UbuntuColors.red + color: LomiriColors.red onClicked: { nb_validation = 0 canceled() diff --git a/qml/dialogs/ErrorDialog.qml b/qml/dialogs/ErrorDialog.qml index c9e7075..960ac86 100644 --- a/qml/dialogs/ErrorDialog.qml +++ b/qml/dialogs/ErrorDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 Dialog { id: dialogSuccess @@ -13,7 +13,7 @@ Dialog { text: textError Button { text: i18n.tr("OK") - color: UbuntuColors.red + color: LomiriColors.red onClicked: function () { dialogClosed() PopupUtils.close(dialogSuccess) diff --git a/qml/dialogs/PassphraseDialog.qml b/qml/dialogs/PassphraseDialog.qml index 553e1c3..7ab3212 100644 --- a/qml/dialogs/PassphraseDialog.qml +++ b/qml/dialogs/PassphraseDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 Dialog { id: passphraseProvider @@ -27,7 +27,7 @@ Dialog { id: okButton text: i18n.tr("Ok") - color: UbuntuColors.green + color: LomiriColors.green onClicked: { validated(passphraseField.text) @@ -40,7 +40,7 @@ Dialog { id: cancelButton text: i18n.tr("Cancel") - color: UbuntuColors.red + color: LomiriColors.red onClicked: { canceled() diff --git a/qml/dialogs/SimpleValidationDialog.qml b/qml/dialogs/SimpleValidationDialog.qml index 0814fd0..bb4b56a 100644 --- a/qml/dialogs/SimpleValidationDialog.qml +++ b/qml/dialogs/SimpleValidationDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 Dialog { id: doubleValidationDialog @@ -17,7 +17,7 @@ Dialog { Button { text: i18n.tr("Ok") - color: UbuntuColors.green + color: LomiriColors.green onClicked: { validated() @@ -28,7 +28,7 @@ Dialog { Button { id: cancelButton text: i18n.tr("Cancel") - color: UbuntuColors.red + color: LomiriColors.red onClicked: { canceled() PopupUtils.close(doubleValidationDialog) diff --git a/qml/dialogs/SuccessDialog.qml b/qml/dialogs/SuccessDialog.qml index d4faed3..4898dfd 100644 --- a/qml/dialogs/SuccessDialog.qml +++ b/qml/dialogs/SuccessDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 Dialog { id: dialogSuccess @@ -13,7 +13,7 @@ Dialog { text: textSuccess Button { text: i18n.tr("OK") - color: UbuntuColors.green + color: LomiriColors.green onClicked: function () { dialogClosed() PopupUtils.close(dialogSuccess) diff --git a/qml/pages/Info.qml b/qml/pages/Info.qml index 17ecb5f..97f3b6f 100644 --- a/qml/pages/Info.qml +++ b/qml/pages/Info.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import "headers" import "../components" diff --git a/qml/pages/Password.qml b/qml/pages/Password.qml index cab7630..8f78021 100644 --- a/qml/pages/Password.qml +++ b/qml/pages/Password.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 import "headers" Page { diff --git a/qml/pages/PasswordList.qml b/qml/pages/PasswordList.qml index 9546f86..5a7d4e8 100644 --- a/qml/pages/PasswordList.qml +++ b/qml/pages/PasswordList.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import Qt.labs.folderlistmodel 2.1 import Pass 1.0 import "../components" diff --git a/qml/pages/headers/MainHeader.qml b/qml/pages/headers/MainHeader.qml index 8132c13..6874a24 100644 --- a/qml/pages/headers/MainHeader.qml +++ b/qml/pages/headers/MainHeader.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 PageHeader { id: mainHeader diff --git a/qml/pages/headers/StackHeader.qml b/qml/pages/headers/StackHeader.qml index 5ff5419..5395316 100644 --- a/qml/pages/headers/StackHeader.qml +++ b/qml/pages/headers/StackHeader.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 PageHeader { id: stackHeader diff --git a/qml/pages/settings/ImportKeyFile.qml b/qml/pages/settings/ImportKeyFile.qml index ec6d8db..b545896 100644 --- a/qml/pages/settings/ImportKeyFile.qml +++ b/qml/pages/settings/ImportKeyFile.qml @@ -1,7 +1,7 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Content 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Content 1.3 +import Lomiri.Components.Popups 1.3 import Pass 1.0 import Utils 1.0 import "../headers" diff --git a/qml/pages/settings/ImportZip.qml b/qml/pages/settings/ImportZip.qml index b047a4b..19a64d5 100644 --- a/qml/pages/settings/ImportZip.qml +++ b/qml/pages/settings/ImportZip.qml @@ -1,7 +1,7 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Content 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Content 1.3 +import Lomiri.Components.Popups 1.3 import Pass 1.0 import Utils 1.0 import "../headers" diff --git a/qml/pages/settings/InfoKeys.qml b/qml/pages/settings/InfoKeys.qml index bf4ba81..237420c 100644 --- a/qml/pages/settings/InfoKeys.qml +++ b/qml/pages/settings/InfoKeys.qml @@ -1,6 +1,6 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 -import Ubuntu.Components.Popups 1.3 +import Lomiri.Components 1.3 +import Lomiri.Components.Popups 1.3 import Pass 1.0 import "../headers" import "../../components" @@ -47,7 +47,7 @@ Page { Button { id: buttonDeleteKey text: i18n.tr("Delete this key") - color: UbuntuColors.red + color: LomiriColors.red onClicked: { infoKeysPage.currentKey = model.modelData.uid PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage) diff --git a/qml/pages/settings/Settings.qml b/qml/pages/settings/Settings.qml index 7716463..06e2943 100644 --- a/qml/pages/settings/Settings.qml +++ b/qml/pages/settings/Settings.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import Ubuntu.Components 1.3 +import Lomiri.Components 1.3 import Pass 1.0 import "../headers" import "../../components" @@ -51,7 +51,7 @@ Page { verticalAlignment: Text.AlignVCenter width: parent.width height: units.gu(4) - color: UbuntuColors.red + color: LomiriColors.red text: i18n.tr( 'Warning: importing delete any exiting Password Store') }