1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-04-21 21:46:31 +00:00

Compare commits

..

7 Commits

45 changed files with 809 additions and 478 deletions

View File

@ -5,8 +5,7 @@ suffix=none
--align-reference=name --align-reference=name
--convert-tabs --convert-tabs
--attach-namespaces --attach-namespaces
--max-code-length=100 --max-code-length=120
--max-instatement-indent=120
--pad-header --pad-header
--pad-oper --pad-oper
--lineend=linux --lineend=linux

View File

@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
execute_process( execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH OUTPUT_VARIABLE CLICK_ARCH
@ -28,10 +32,11 @@ 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(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
qml/pages/settings/ImportGitClone.qml)
qt5_use_modules(${PROJECT_NAME} Gui Qml Quick) qt5_use_modules(${PROJECT_NAME} Gui Qml Quick)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
@ -41,7 +46,6 @@ configure_file(${CMAKE_CURRENT_BINARY_DIR}/manifest.json ${CMAKE_CURRENT_BINARY_
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest_.json DESTINATION ${DATA_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest_.json DESTINATION ${DATA_DIR})
#install(DIRECTORY desktop DESTINATION ${DATA_DIR})
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR}) install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(FILES ${PROJECT_NAME}.contenthub DESTINATION ${DATA_DIR}) install(FILES ${PROJECT_NAME}.contenthub DESTINATION ${DATA_DIR})
@ -49,14 +53,6 @@ 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
# "/usr/bin/gpg*"
# )
# install(
# 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)

View File

@ -4,9 +4,10 @@ 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 'Running QmlFormat' && find . -name "*.qml" -exec qmlformat -i {} \; && echo 'Success'
--options=.astylerc --recursive 'plugins/*.cpp,*.h' && echo 'QmlFmt :' &&
qmlfmt -l tests && qmlfmt -w tests && qmlfmt -l qml && qmlfmt -w qml
dependencies_target: dependencies_target:
- libgpgmepp-dev - libgpgmepp-dev
@ -17,12 +18,17 @@ dependencies_target:
install_lib: install_lib:
- "libgpg-error.so.0.28.0" - "libgpg-error.so.0.28.0"
- "libassuan.so" - "libassuan.so*"
- "libgpgme.so" - "libgpgme.so*"
- "libgpgmepp.so" - "libgpgmepp.so*"
- "libqgpgme.so.7" - "libqgpgme.so*"
- "libgit2.so" - "libgit2.so*"
- "libquazip5.so" - "libquazip5.so*"
- "libmbedtls.so*"
- "libmbedx509.so*"
- "libmbedcrypto.so*"
- "libhttp_parser.so*"
- "libssh2.so*"
install_bin: install_bin:
- "gpg" - "gpg"

View File

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

View File

@ -0,0 +1,37 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PLUGIN "Git")
set(
SRC
plugin.cpp
libgit.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)
add_library(libgit2 SHARED IMPORTED)
set_property(TARGET libgit2 PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgit2.so")
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}/)

34
plugins/Git/git.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <QUrl>
#include <QtCore/QDir>
#include <QDebug>
#include <QStandardPaths>
#include "git.h"
#include "libgit.h"
bool Git::clone(QString url, QString destination_dir_path)
{
qInfo() << "Cloning " << url << " to destination " << destination_dir_path;
QDir tmp_dir(QStandardPaths::writableLocation(
QStandardPaths::CacheLocation).append("/clone"));
tmp_dir.removeRecursively();
tmp_dir.mkpath(".");
qDebug() << "Temp dir path is " << tmp_dir.absolutePath();
qDebug() << "Cloning " << url << " to tmp dir " << tmp_dir.absolutePath();
auto ret = LibGit::instance()->clone(url, tmp_dir.absolutePath()); // TODO Better error handling
if (ret) {
qDebug() << "Removing password_store " << destination_dir_path;
QDir destination_dir(destination_dir_path);
destination_dir.removeRecursively();
qDebug() << "Moving cloned content to destination dir";
QDir dir;
qDebug() << tmp_dir.absolutePath() << " to " << destination_dir.absolutePath();
ret = dir.rename(tmp_dir.absolutePath(), destination_dir.absolutePath()); // TODO Better error handling
}
//tmp_dir.removeRecursively();
return ret ;
}

20
plugins/Git/git.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef GIT_H
#define GIT_H
#include <QUrl>
#include <QObject>
class Git : public QObject
{
Q_OBJECT
public:
Git() = default;
~Git() override = default;
Q_INVOKABLE bool clone(QString url, QString path);
// Q_INVOKABLE bool update(QUrl url, QString path);
};
#endif

52
plugins/Git/libgit.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <QUrl>
#include <QDebug>
extern "C" {
#include <git2.h>
}
#include "libgit.h"
LibGit::LibGit()
{
git_libgit2_init();
}
LibGit::~LibGit()
{
git_libgit2_shutdown();
}
int LibGit::credentials_cb(git_cred **out, const char *url, const char *username_from_url,
unsigned int allowed_types, void *payload)
{
int error;
const char *user, *pass;
/*
* Ask the user via the UI. On error, store the information and return GIT_EUSER which will be
* bubbled up to the code performing the fetch or push. Using GIT_EUSER allows the application
* to know it was an error from the application instead of libgit2.
*/
// if ((error = ask_user(&user, &pass, url, username_from_url, allowed_types)) < 0) {
// store_error(error);
// return GIT_EUSER;
// }
// user = "user";
// pass = "pass";
// return git_cred_userpass_plaintext_new(out, user, pass);
return GIT_EUSER;
}
bool LibGit::clone(QString url, QString path)
{
git_repository *repo = NULL;
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
opts.fetch_opts.callbacks.credentials = *credentials_cb;
int ret = git_clone(&repo, url.toLocal8Bit().data(), path.toLocal8Bit().data(), &opts);
if (repo) {
git_repository_free(repo);
}
return ret == 0; // TODO Clean error handling to return specifics errors for the ui
}

32
plugins/Git/libgit.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef LIBGIT_H
#define LIBGIT_H
#include <QObject>
#include <QUrl>
extern "C" {
#include <git2/transport.h>
}
#include <memory>
class LibGit
{
private:
LibGit();
static int credentials_cb(git_cred **out, const char *url, const char *username_from_url,
unsigned int allowed_types, void *payload);
public:
~LibGit();
static std::shared_ptr<LibGit> instance()
{
static std::shared_ptr<LibGit> s{new LibGit};
return s;
}
LibGit(LibGit const &) = delete;
void operator=(LibGit const &) = delete;
bool clone(QString url, QString path);
};
#endif

10
plugins/Git/plugin.cpp Normal file
View File

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

16
plugins/Git/plugin.h Normal file
View File

@ -0,0 +1,16 @@
#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

2
plugins/Git/qmldir Normal file
View File

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

View File

@ -4,7 +4,6 @@ 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
@ -41,13 +40,10 @@ add_library(libgpgmepp SHARED IMPORTED)
set_property(TARGET libgpgmepp PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgmepp.so") set_property(TARGET libgpgmepp PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libgpgmepp.so")
add_library(libqgpgme SHARED IMPORTED) add_library(libqgpgme SHARED IMPORTED)
set_property(TARGET libqgpgme PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libqgpgme.so.7") set_property(TARGET libqgpgme PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libqgpgme.so")
add_library(libgit2 SHARED IMPORTED) target_link_libraries(${PLUGIN} gpgerror libassuan libgpgme libgpgmepp libqgpgme)
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}")

View File

@ -1,26 +0,0 @@
#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;
}

View File

@ -1,27 +0,0 @@
#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

@ -63,7 +63,8 @@ QString Gpg::initGpgHome()
} }
QString Gpg::findCommandPath(const QString &command) { QString Gpg::findCommandPath(const QString &command)
{
// Retrieve the PATH environment variable // Retrieve the PATH environment variable
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString pathEnv = env.value("PATH"); QString pathEnv = env.value("PATH");
@ -111,10 +112,10 @@ void Gpg::initGpgConfig()
agentConf.close(); agentConf.close();
auto err = 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) { if (err != GPG_ERR_NO_ERROR) {
qDebug() << "Error code : " << err; qDebug() << "Error code : " << err;
qDebug() << "Error str : " << gpg_strerror(err); qDebug() << "Error str : " << gpg_strerror(err);
@ -198,13 +199,13 @@ Error Gpg::encryptToFile(QString str, QString path, QString uid, bool ascii_armo
QPair<Error, std::vector< GpgME::Key >> Gpg::getAllKeys ( bool remote, const bool include_sigs, QPair<Error, std::vector< GpgME::Key >> Gpg::getAllKeys ( bool remote, const bool include_sigs,
bool validate ) bool validate )
{ {
return getKeys(QString(""), remote, include_sigs, validate); return getKeys(QString(""), remote, include_sigs, validate);
} }
QPair<Error, std::vector<Key>> Gpg::getKeys(QString pattern_uid, bool remote, bool include_sigs, QPair<Error, std::vector<Key >> Gpg::getKeys(QString pattern_uid, bool remote, bool include_sigs,
bool validate) bool validate)
{ {
qDebug() << "Getting the keys " << pattern_uid; qDebug() << "Getting the keys " << pattern_uid;
auto job = std::unique_ptr<KeyListJob>(openpgp()->keyListJob(remote, include_sigs, validate)); auto job = std::unique_ptr<KeyListJob>(openpgp()->keyListJob(remote, include_sigs, validate));
@ -213,7 +214,7 @@ QPair<Error, std::vector<Key>> Gpg::getKeys(QString pattern_uid, bool remote, bo
auto result = job->exec(QStringList() << pattern_uid, false, keys); auto result = job->exec(QStringList() << pattern_uid, false, keys);
qDebug() << "Got the keys " << pattern_uid; qDebug() << "Got the keys " << pattern_uid;
return QPair<Error, std::vector< Key >>(result.error(), keys); return QPair<Error, std::vector< Key >> (result.error(), keys);
} }

View File

@ -13,6 +13,7 @@ class Gpg
{ {
private: private:
Gpg(); Gpg();
QObject *m_window; QObject *m_window;
QString findCommandPath(const QString &command); QString findCommandPath(const QString &command);
@ -21,8 +22,6 @@ private:
void initGpgConfig(); void initGpgConfig();
public: public:
~Gpg();
static std::shared_ptr<Gpg> instance() static std::shared_ptr<Gpg> instance()
{ {
static std::shared_ptr<Gpg> s{new Gpg}; static std::shared_ptr<Gpg> s{new Gpg};
@ -42,11 +41,11 @@ public:
}; };
QPair< Error, std::vector< Key > > getAllKeys(bool remote = false, bool include_sigs = {}, bool QPair<Error, std::vector<Key >> getAllKeys(bool remote = false, bool include_sigs = {}, bool
validate = false); validate = false);
QPair<Error, std::vector<Key>> getKeys( QString pattern_uid, bool remote = false, QPair<Error, std::vector<Key >> getKeys( QString pattern_uid, bool remote = false,
bool include_sigs = false, bool include_sigs = false,
bool validate = false); bool validate = false);
QPair<Error, Key> getKey( QString uid, bool remote = false, bool include_sigs = false, QPair<Error, Key> getKey( QString uid, bool remote = false, bool include_sigs = false,
bool validate = false); bool validate = false);
QPair<Error, QString> decrypt( QByteArray cipherText); QPair<Error, QString> decrypt( QByteArray cipherText);

View File

@ -3,7 +3,6 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include "pass.h" #include "pass.h"
#include "git.h"
#include "gpg.h" #include "gpg.h"
#include "passkeymodel.h" #include "passkeymodel.h"
@ -22,8 +21,9 @@ void Pass::init(QObject *window)
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(".");
}
qInfo() << "Password Store is :" << m_password_store; qInfo() << "Password Store is :" << m_password_store;
} }
@ -62,13 +62,3 @@ QVariant Pass::gpgGetAllKeysModel()
Gpg::instance()->getAllKeys().second)); Gpg::instance()->getAllKeys().second));
} }
QString Pass::getPasswordStore()
{
return m_password_store;
}
bool Pass::gitClone(QString url)
{
qInfo() << "Cloning . password_store from " << url;
return Git::instance()->clone(url);
}

View File

@ -9,6 +9,9 @@
class Pass : public QObject class Pass : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString password_store READ password_store)
private:
QString m_password_store; QString m_password_store;
signals: signals:
@ -16,18 +19,20 @@ signals:
void decryptCanceled(); void decryptCanceled();
void decryptFailed(); void decryptFailed();
public: public:
Pass(); Pass();
~Pass() override = default; ~Pass() override = default;
QString password_store() const
{
return m_password_store;
}
Q_INVOKABLE void init(QObject *window); Q_INVOKABLE void init(QObject *window);
Q_INVOKABLE QString getPasswordStore();
Q_INVOKABLE void decrypt(QUrl url); Q_INVOKABLE void decrypt(QUrl url);
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

@ -7,7 +7,6 @@
#include <QEventLoop> #include <QEventLoop>
#include <QSemaphore> #include <QSemaphore>
#include <gpgme++/interfaces/passphraseprovider.h> #include <gpgme++/interfaces/passphraseprovider.h>
#include "passphraseprovider.h"
#include "gpg.h" #include "gpg.h"

View File

@ -23,6 +23,10 @@ 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)
add_library(libquazip5 SHARED IMPORTED)
set_property(TARGET libquazip5 PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libquazip5.so")
target_link_libraries(${PLUGIN} libquazip5)
set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}") set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")

View File

@ -7,8 +7,6 @@
#include "utils.h" #include "utils.h"
Utils::Utils() {};
bool Utils::unzip(QUrl zip_url, QString dir_out_path) bool Utils::unzip(QUrl zip_url, QString dir_out_path)
{ {
auto tmp_dir_path = QStandardPaths::writableLocation( auto tmp_dir_path = QStandardPaths::writableLocation(
@ -31,7 +29,7 @@ bool Utils::unzip(QUrl zip_url, QString dir_out_path)
qDebug() << "Guessing if it should remove a single root folder"; qDebug() << "Guessing if it should remove a single root folder";
QStringList files_in_tmp_dir = tmp_dir.entryList(QDir::AllEntries | QDir::Hidden | QStringList files_in_tmp_dir = tmp_dir.entryList(QDir::AllEntries | QDir::Hidden |
QDir::NoDotAndDotDot); QDir::NoDotAndDotDot);
auto dir_import_path = auto dir_import_path =
files_in_tmp_dir.length() == 1 ? files_in_tmp_dir.length() == 1 ?

View File

@ -10,7 +10,7 @@ class Utils : public QObject
Q_OBJECT Q_OBJECT
public: public:
Utils(); Utils() = default;
~Utils() override = default; ~Utils() override = default;
Q_INVOKABLE bool unzip(QUrl zip_url, QString dir_out); Q_INVOKABLE bool unzip(QUrl zip_url, QString dir_out);

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: 2025-01-07 13:36+0000\n" "POT-Creation-Date: 2025-01-10 14:39+0100\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"
@ -37,8 +37,8 @@ msgstr ""
msgid "Error !" msgid "Error !"
msgstr "" msgstr ""
#: ../qml/dialogs/ErrorDialog.qml:15 ../qml/dialogs/SuccessDialog.qml:15 #: ../qml/dialogs/ErrorDialog.qml:15
msgid "OK" msgid "Close"
msgstr "" msgstr ""
#: ../qml/dialogs/PassphraseDialog.qml:7 #: ../qml/dialogs/PassphraseDialog.qml:7
@ -57,6 +57,10 @@ msgstr ""
msgid "Success !" msgid "Success !"
msgstr "" msgstr ""
#: ../qml/dialogs/SuccessDialog.qml:15
msgid "OK"
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 ""
@ -103,6 +107,37 @@ msgstr ""
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:15
msgid "Git Clone Import"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:36
msgid "Repo Url"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:44
msgid "Git repo url"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:50
msgid "Clone"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:68
msgid ""
"Importing a git repo will delete<br>any existing password store!"
"<br>Continue ?"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:78
msgid "An error occured during git clone !"
msgstr ""
#: ../qml/pages/settings/ImportGitClone.qml:85
#: ../qml/pages/settings/ImportZip.qml:89
msgid "Password store sucessfully imported !"
msgstr ""
#: ../qml/pages/settings/ImportKeyFile.qml:17 #: ../qml/pages/settings/ImportKeyFile.qml:17
msgid "GPG Key Import" msgid "GPG Key Import"
msgstr "" msgstr ""
@ -128,10 +163,6 @@ msgstr ""
msgid "Password store import failed !" msgid "Password store import failed !"
msgstr "" msgstr ""
#: ../qml/pages/settings/ImportZip.qml:89
msgid "Password store sucessfully imported !"
msgstr ""
#: ../qml/pages/settings/InfoKeys.qml:16 #: ../qml/pages/settings/InfoKeys.qml:16
msgid "Info Keys" msgid "Info Keys"
msgstr "" msgstr ""
@ -177,9 +208,13 @@ msgid "Password Store"
msgstr "" msgstr ""
#: ../qml/pages/settings/Settings.qml:47 #: ../qml/pages/settings/Settings.qml:47
msgid "Import a Password Store using Git"
msgstr ""
#: ../qml/pages/settings/Settings.qml:51
msgid "Import a Password Store Zip" msgid "Import a Password Store Zip"
msgstr "" msgstr ""
#: ../qml/pages/settings/Settings.qml:56 #: ../qml/pages/settings/Settings.qml:60
msgid "Warning: importing delete any exiting Password Store" msgid "Warning: importing delete any exiting Password Store"
msgstr "" msgstr ""

View File

@ -1,49 +1,46 @@
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import QtQuick 2.4
import QtQuick.Layouts 1.1
import "dialogs" import "dialogs"
MainView { MainView {
id: root id: root
objectName: "mainView"
applicationName: "utpass.qrouland"
automaticOrientation: false
width: units.gu(48)
height: units.gu(80)
signal responsePassphraseDialog(bool canceled, string passphrase) signal responsePassphraseDialog(bool canceled, string passphrase)
function initPass(rootView) { function initPass(rootView) {
Pass.init(rootView) Pass.init(rootView);
pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml")); pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml"));
} }
function callPassphraseDialog(useridHint, description, previousWasBad) { function callPassphraseDialog(useridHint, description, previousWasBad) {
//TODO use parameters to impove passphrase dialog //TODO use parameters to impove passphrase dialog
var passphraseDialog = PopupUtils.open( var passphraseDialog = PopupUtils.open(Qt.resolvedUrl("dialogs/PassphraseDialog.qml"));
Qt.resolvedUrl("dialogs/PassphraseDialog.qml")) passphraseDialog.activateFocus();
passphraseDialog.activateFocus() var validated = function validated(passphrase) {
responsePassphraseDialog(false, passphrase);
var validated = function (passphrase) { };
responsePassphraseDialog(false, passphrase) var canceled = function canceled() {
} responsePassphraseDialog(true, "");
};
var canceled = function () { passphraseDialog.validated.connect(validated);
responsePassphraseDialog(true, "") passphraseDialog.canceled.connect(canceled);
}
passphraseDialog.validated.connect(validated)
passphraseDialog.canceled.connect(canceled)
} }
objectName: "mainView"
applicationName: "utpass.qrouland"
automaticOrientation: false
width: units.gu(48)
height: units.gu(80)
PageStack { PageStack {
id: pageStack id: pageStack
anchors.fill: parent
Component.onCompleted: {} anchors.fill: parent
Component.onCompleted: {
}
} }
} }

View File

@ -1,11 +1,11 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import "../styles" import "../styles"
import Lomiri.Components 1.3
import QtQuick 2.4
Item { Item {
id: copyText id: copyText
property string text
property string text
property bool commonBorder: true property bool commonBorder: true
property int lBorderwidth: 0 property int lBorderwidth: 0
property int rBorderwidth: 0 property int rBorderwidth: 0
@ -39,20 +39,21 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onPressed: { onPressed: {
parent.color = LomiriColors.warmGrey parent.color = LomiriColors.warmGrey;
} }
onClicked: { onClicked: {
var mimeData = Clipboard.newData() var mimeData = Clipboard.newData();
mimeData.text = copyText.text mimeData.text = copyText.text;
Clipboard.push(mimeData) Clipboard.push(mimeData);
} }
onReleased: { onReleased: {
parent.color = theme.palette.normal.background parent.color = theme.palette.normal.background;
} }
} }
CustomBorder { CustomBorder {
id: cb id: cb
commonBorder: copyText.commonBorder commonBorder: copyText.commonBorder
lBorderwidth: copyText.lBorderwidth lBorderwidth: copyText.lBorderwidth
rBorderwidth: copyText.rBorderwidth rBorderwidth: copyText.rBorderwidth
@ -60,5 +61,7 @@ Item {
bBorderwidth: copyText.bBorderwidth bBorderwidth: copyText.bBorderwidth
borderColor: copyText.borderColor borderColor: copyText.borderColor
} }
} }
} }

View File

@ -1,13 +1,12 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import "../styles" import "../styles"
import Lomiri.Components 1.3
import QtQuick 2.4
Item { Item {
id: externalLink id: externalLink
property string url property string url
property string text property string text
property bool commonBorder: true property bool commonBorder: true
property int lBorderwidth: 0 property int lBorderwidth: 0
property int rBorderwidth: 0 property int rBorderwidth: 0
@ -42,12 +41,13 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
Qt.openUrlExternally(externalLink.url) Qt.openUrlExternally(externalLink.url);
} }
} }
CustomBorder { CustomBorder {
id: cb id: cb
commonBorder: externalLink.commonBorder commonBorder: externalLink.commonBorder
lBorderwidth: externalLink.lBorderwidth lBorderwidth: externalLink.lBorderwidth
rBorderwidth: externalLink.rBorderwidth rBorderwidth: externalLink.rBorderwidth
@ -55,5 +55,7 @@ Item {
bBorderwidth: externalLink.bBorderwidth bBorderwidth: externalLink.bBorderwidth
borderColor: externalLink.borderColor borderColor: externalLink.borderColor
} }
} }
} }

View File

@ -1,13 +1,14 @@
import QtQuick 2.4 import "../dialogs"
import "../styles"
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import "../styles" import QtQuick 2.4
import "../dialogs"
Component { Component {
Rectangle { Rectangle {
id: fileDir id: fileDir
property string activePasswordName property string activePasswordName
anchors.right: parent.right anchors.right: parent.right
@ -34,24 +35,20 @@ Component {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if (fileIsDir) { if (fileIsDir) {
folderModel.folder = folderModel.folder + "/" + fileName folderModel.folder = folderModel.folder + "/" + fileName;
backAction.visible = true backAction.visible = true;
} else { } else {
fileDir.activePasswordName = fileBaseName fileDir.activePasswordName = fileBaseName;
Pass.onDecrypted.connect(function(text) {
Pass.onDecrypted.connect(function (text) { pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), {
pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), "plainText": text,
{ "title": fileDir.activePasswordName
"plainText": text, });
"title": fileDir.activePasswordName });
}) Pass.onDecryptFailed.connect(function() {
}) PopupUtils.open(passwordPageDecryptError);
});
Pass.onDecryptFailed.connect(function () { Pass.decrypt(folderModel.folder + "/" + fileName);
PopupUtils.open(passwordPageDecryptError)
})
Pass.decrypt(folderModel.folder + "/" + fileName)
} }
} }
} }
@ -67,12 +64,13 @@ Component {
Component { Component {
id: passwordPageDecryptError id: passwordPageDecryptError
ErrorDialog { ErrorDialog {
textError: i18n.tr("Decryption failed !") textError: i18n.tr("Decryption failed !")
onDialogClosed: {
pageStack.pop()
}
} }
} }
} }
} }

View File

@ -1,16 +1,14 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import "../styles" import "../styles"
import Lomiri.Components 1.3
import QtQuick 2.4
Item { Item {
id: pageStackLink id: pageStackLink
property string page property string page
property var params: { property var params: {
} }
property string text property string text
property bool commonBorder: true property bool commonBorder: true
property int lBorderwidth: 0 property int lBorderwidth: 0
property int rBorderwidth: 0 property int rBorderwidth: 0
@ -45,12 +43,13 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
pageStack.push(page, params) pageStack.push(page, params);
} }
} }
CustomBorder { CustomBorder {
id: cb id: cb
commonBorder: pageStackLink.commonBorder commonBorder: pageStackLink.commonBorder
lBorderwidth: pageStackLink.lBorderwidth lBorderwidth: pageStackLink.lBorderwidth
rBorderwidth: pageStackLink.rBorderwidth rBorderwidth: pageStackLink.rBorderwidth
@ -58,5 +57,7 @@ Item {
bBorderwidth: pageStackLink.bBorderwidth bBorderwidth: pageStackLink.bBorderwidth
borderColor: pageStackLink.borderColor borderColor: pageStackLink.borderColor
} }
} }
} }

View File

@ -1,6 +1,6 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
Dialog { Dialog {
id: doubleValidationDialog id: doubleValidationDialog
@ -9,8 +9,8 @@ Dialog {
property string text1 property string text1
property string text2 property string text2
signal doubleValidated signal doubleValidated()
signal canceled signal canceled()
Text { Text {
visible: nb_validation == 0 visible: nb_validation == 0
@ -27,26 +27,27 @@ Dialog {
Button { Button {
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: LomiriColors.green color: LomiriColors.green
onClicked: { onClicked: {
if (nb_validation == 1) { if (nb_validation == 1) {
nb_validation = 0 nb_validation = 0;
doubleValidated() doubleValidated();
PopupUtils.close(doubleValidationDialog) PopupUtils.close(doubleValidationDialog);
} else { } else {
nb_validation += 1 nb_validation += 1;
} }
} }
} }
Button { Button {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: LomiriColors.red color: LomiriColors.red
onClicked: { onClicked: {
nb_validation = 0 nb_validation = 0;
canceled() canceled();
PopupUtils.close(doubleValidationDialog) PopupUtils.close(doubleValidationDialog);
} }
} }
} }

View File

@ -1,22 +1,24 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
Dialog { Dialog {
id: dialogSuccess id: dialogError
property string textError property string textError
signal dialogClosed signal dialogClosed()
title: i18n.tr("Error !") title: i18n.tr("Error !")
text: textError text: textError
Button { Button {
text: i18n.tr("OK") text: i18n.tr("Close")
color: LomiriColors.red color: LomiriColors.red
onClicked: function () { onClicked: function() {
dialogClosed() dialogClosed();
PopupUtils.close(dialogSuccess) PopupUtils.close(dialogError);
} }
} }
} }

View File

@ -1,25 +1,25 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
Dialog { Dialog {
id: passphraseProvider id: passphraseProvider
title: i18n.tr("Authentication required")
text: i18n.tr("Enter passphrase:")
signal validated(string passphrase) signal validated(string passphrase)
signal canceled signal canceled()
function activateFocus() { function activateFocus() {
passphraseField.forceActiveFocus() passphraseField.forceActiveFocus();
} }
title: i18n.tr("Authentication required")
text: i18n.tr("Enter passphrase:")
TextField { TextField {
id: passphraseField id: passphraseField
placeholderText: i18n.tr("passphrase") placeholderText: i18n.tr("passphrase")
echoMode: TextInput.Password echoMode: TextInput.Password
onAccepted: okButton.clicked(text) onAccepted: okButton.clicked(text)
} }
@ -28,23 +28,22 @@ Dialog {
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: LomiriColors.green color: LomiriColors.green
onClicked: { onClicked: {
validated(passphraseField.text) validated(passphraseField.text);
passphraseField.text = "" passphraseField.text = "";
PopupUtils.close(passphraseProvider) PopupUtils.close(passphraseProvider);
} }
} }
Button { Button {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: LomiriColors.red color: LomiriColors.red
onClicked: { onClicked: {
canceled() canceled();
PopupUtils.close(passphraseProvider) PopupUtils.close(passphraseProvider);
} }
} }
} }

View File

@ -1,14 +1,14 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
Dialog { Dialog {
id: doubleValidationDialog id: doubleValidationDialog
property string text property string text
signal validated signal validated()
signal canceled signal canceled()
Text { Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -18,20 +18,21 @@ Dialog {
Button { Button {
text: i18n.tr("Ok") text: i18n.tr("Ok")
color: LomiriColors.green color: LomiriColors.green
onClicked: { onClicked: {
validated() validated();
PopupUtils.close(doubleValidationDialog) PopupUtils.close(doubleValidationDialog);
} }
} }
Button { Button {
id: cancelButton id: cancelButton
text: i18n.tr("Cancel") text: i18n.tr("Cancel")
color: LomiriColors.red color: LomiriColors.red
onClicked: { onClicked: {
canceled() canceled();
PopupUtils.close(doubleValidationDialog) PopupUtils.close(doubleValidationDialog);
} }
} }
} }

View File

@ -1,22 +1,24 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
Dialog { Dialog {
id: dialogSuccess id: dialogSuccess
property string textSuccess property string textSuccess
signal dialogClosed signal dialogClosed()
title: i18n.tr("Success !") title: i18n.tr("Success !")
text: textSuccess text: textSuccess
Button { Button {
text: i18n.tr("OK") text: i18n.tr("OK")
color: LomiriColors.green color: LomiriColors.green
onClicked: function () { onClicked: function() {
dialogClosed() dialogClosed();
PopupUtils.close(dialogSuccess) PopupUtils.close(dialogSuccess);
} }
} }
} }

View File

@ -1,14 +1,19 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import "headers"
import "../components" import "../components"
import Lomiri.Components 1.3
import QtQuick 2.4
import "headers"
Page { Page {
id: infoPage id: infoPage
header: StackHeader { Component.onCompleted: {
id: infoHeader var xhr = new XMLHttpRequest();
title: i18n.tr('Info') xhr.open("GET", "../../manifest_.json", false);
xhr.send();
var mJson = JSON.parse(xhr.responseText);
manifestTitle.text = "<b>" + mJson.title + "</b>";
manifestVersion.text = mJson.version + "<br>" + mJson.framework + "@" + mJson.architecture;
manifestMaintener.text = mJson.maintainer;
} }
Flow { Flow {
@ -24,6 +29,7 @@ Page {
Text { Text {
id: manifestTitle id: manifestTitle
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
width: parent.width width: parent.width
@ -35,12 +41,14 @@ Page {
Rectangle { Rectangle {
width: parent.width width: parent.width
height: units.gu(12) height: units.gu(12)
Image { Image {
source: "../../assets/logo.svg" source: "../../assets/logo.svg"
width: units.gu(12) width: units.gu(12)
height: units.gu(12) height: units.gu(12)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }
Text { Text {
@ -54,6 +62,7 @@ Page {
Text { Text {
id: manifestVersion id: manifestVersion
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width width: parent.width
height: units.gu(4) height: units.gu(4)
@ -72,12 +81,14 @@ Page {
Text { Text {
id: manifestMaintener id: manifestMaintener
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width width: parent.width
height: units.gu(2) height: units.gu(2)
fontSizeMode: Text.Fit fontSizeMode: Text.Fit
font.pixelSize: 72 font.pixelSize: 72
} }
} }
Flow { Flow {
@ -85,14 +96,17 @@ Page {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
ExternalLink { ExternalLink {
url: "https://taiga.rdrive.ovh/project/utpass/issues" url: "https://github.com/QRouland/UTPass/issues"
text: i18n.tr("Suggest improvement(s) or report a bug(s)") text: i18n.tr("Suggest improvement(s) or report a bug(s)")
} }
ExternalLink { ExternalLink {
url: "https://git.rdrive.ovh/QRouland/UTPass" url: "https://github.com/QRouland/UTPass"
text: i18n.tr("Access to the source code") text: i18n.tr("Access to the source code")
} }
Text { Text {
width: parent.width width: parent.width
height: units.gu(2) height: units.gu(2)
@ -100,17 +114,13 @@ Page {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: i18n.tr("Released under the terms of the GNU GPL v3") text: i18n.tr("Released under the terms of the GNU GPL v3")
} }
} }
Component.onCompleted: { header: StackHeader {
var xhr = new XMLHttpRequest() id: infoHeader
xhr.open("GET", "../../manifest_.json", false)
xhr.send()
var mJson = JSON.parse(xhr.responseText) title: i18n.tr('Info')
manifestTitle.text = "<b>" + mJson.title + "</b>"
manifestVersion.text = mJson.version + "<br>" + mJson.framework + "@" + mJson.architecture
manifestMaintener.text = mJson.maintainer
} }
} }

View File

@ -1,6 +1,6 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import QtQuick 2.4
import "headers" import "headers"
Page { Page {
@ -10,38 +10,15 @@ Page {
property string plainText property string plainText
property var objects property var objects
header: PageHeader { Component.onCompleted: {
id: passwordPageHeader var text_split = passwordPage.plainText.split('\n');
width: parent.width var component = Qt.createComponent("../components/CopyText.qml");
height: units.gu(6) for (var i = 0; i < text_split.length; i++) {
title: passwordPage.title if (text_split[i]) {
var object = component.createObject(container);
contents: Item { object.text = text_split[i];
height: parent.height
width: parent.width
Label {
id: labelTitle
text: passwordPage.title
anchors.verticalCenter: parent.verticalCenter
} }
} }
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: "Back"
onTriggered: {
passwordPage.plainText = ""
for (var object in objects) {
object.text = ""
object.destroy()
}
pageStack.pop()
}
}
]
} }
Rectangle { Rectangle {
@ -52,18 +29,49 @@ Page {
Flow { Flow {
id: container id: container
anchors.fill: parent anchors.fill: parent
} }
} }
Component.onCompleted: { header: PageHeader {
var text_split = passwordPage.plainText.split('\n') id: passwordPageHeader
var component = Qt.createComponent("../components/CopyText.qml")
for (var i = 0; i < text_split.length; i++) { width: parent.width
if (text_split[i]) { height: units.gu(6)
var object = component.createObject(container) title: passwordPage.title
object.text = text_split[i] leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: "Back"
onTriggered: {
passwordPage.plainText = "";
for (var object in objects) {
object.text = "";
object.destroy();
}
pageStack.pop();
}
} }
]
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: passwordPage.title
anchors.verticalCenter: parent.verticalCenter
}
} }
} }
} }

View File

@ -1,8 +1,8 @@
import QtQuick 2.4
import Lomiri.Components 1.3
import Qt.labs.folderlistmodel 2.1
import Pass 1.0
import "../components" import "../components"
import Lomiri.Components 1.3
import Pass 1.0
import Qt.labs.folderlistmodel 2.1
import QtQuick 2.4
import "headers" import "headers"
Page { Page {
@ -11,25 +11,8 @@ Page {
property string passwordStorePath property string passwordStorePath
anchors.fill: parent anchors.fill: parent
Component.onCompleted: {
header: MainHeader { passwordStorePath = "file:" + Pass.password_store;
id: passwordListHeader
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: i18n.tr("Back")
visible: false
onTriggered: {
folderModel.folder = folderModel.parentFolder
if (folderModel.rootFolder === folderModel.folder) {
backAction.visible = false
}
}
}
]
} }
Rectangle { Rectangle {
@ -38,13 +21,14 @@ Page {
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
visible: folderModel.count == 0 visible: folderModel.count == 0
Text { Text {
text: i18n.tr( text: i18n.tr("No password found<br>You can import a password store zip in the settings")
"No password found<br>You can import a password store zip in the settings")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
ListView { ListView {
@ -56,17 +40,38 @@ Page {
model: FolderListModel { model: FolderListModel {
id: folderModel id: folderModel
nameFilters: ["*.gpg"] nameFilters: ["*.gpg"]
rootFolder: passwordStorePath rootFolder: passwordStorePath
folder: passwordStorePath folder: passwordStorePath
showDirs: true showDirs: true
} }
delegate: FileDir { delegate: FileDir {
id: fileDelegate id: fileDelegate
} }
} }
Component.onCompleted: { header: MainHeader {
passwordStorePath = "file:" + Pass.getPasswordStore() id: passwordListHeader
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: i18n.tr("Back")
visible: false
onTriggered: {
folderModel.folder = folderModel.parentFolder;
if (folderModel.rootFolder === folderModel.folder)
backAction.visible = false;
}
}
]
} }
} }

View File

@ -1,40 +1,15 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import QtQuick 2.4
PageHeader { PageHeader {
id: mainHeader id: mainHeader
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
title: i18n.tr("UTPass") title: i18n.tr("UTPass")
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: mainHeader.title
anchors.verticalCenter: parent.verticalCenter
visible: true
}
TextField {
id: searchBar
anchors.right: parent.right
anchors.left: parent.left
placeholderText: i18n.tr("Search")
height: units.gu(4)
visible: false
anchors.verticalCenter: parent.verticalCenter
onFocusChanged: {
}
}
}
trailingActionBar.height: units.gu(4) trailingActionBar.height: units.gu(4)
trailingActionBar.numberOfSlots: 2 trailingActionBar.numberOfSlots: 2
trailingActionBar.actions: [ trailingActionBar.actions: [
/*Action { TODO /*Action { TODO
iconName: "search" iconName: "search"
text: i18n.tr("Search") text: i18n.tr("Search")
@ -50,15 +25,43 @@ PageHeader {
iconName: "settings" iconName: "settings"
text: i18n.tr("Settings") text: i18n.tr("Settings")
onTriggered: { onTriggered: {
pageStack.push(Qt.resolvedUrl("../settings/Settings.qml")) pageStack.push(Qt.resolvedUrl("../settings/Settings.qml"));
} }
}, },
Action { Action {
iconName: "info" iconName: "info"
text: i18n.tr("Info") text: i18n.tr("Info")
onTriggered: { onTriggered: {
pageStack.push(Qt.resolvedUrl("../Info.qml")) pageStack.push(Qt.resolvedUrl("../Info.qml"));
} }
} }
] ]
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: mainHeader.title
anchors.verticalCenter: parent.verticalCenter
visible: true
}
TextField {
id: searchBar
anchors.right: parent.right
anchors.left: parent.left
placeholderText: i18n.tr("Search")
height: units.gu(4)
visible: false
anchors.verticalCenter: parent.verticalCenter
onFocusChanged: {
}
}
}
} }

View File

@ -1,31 +1,36 @@
import QtQuick 2.4
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import QtQuick 2.4
PageHeader { PageHeader {
id: stackHeader id: stackHeader
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
title: i18n.tr("UTPass") title: i18n.tr("UTPass")
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: stackHeader.title
anchors.verticalCenter: parent.verticalCenter
}
}
leadingActionBar.height: units.gu(4) leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [ leadingActionBar.actions: [
Action { Action {
id: backAction id: backAction
iconName: "back" iconName: "back"
text: "Back" text: "Back"
onTriggered: { onTriggered: {
pageStack.pop() pageStack.pop();
} }
} }
] ]
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: stackHeader.title
anchors.verticalCenter: parent.verticalCenter
}
}
} }

View File

@ -0,0 +1,104 @@
import "../../components"
import "../../dialogs"
import "../headers"
import Git 1.0
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Pass 1.0
import QtQuick 2.4
Page {
id: importGitClonePage
Component.onCompleted: {
PopupUtils.open(importGitCloneValidation, importGitClonePage);
}
Flow {
anchors.top: importGitCloneHeader.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.leftMargin: units.gu(2)
anchors.rightMargin: units.gu(2)
spacing: units.gu(1)
Rectangle {
width: parent.width
height: units.gu(1)
}
Text {
id: repoUrlLabe
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
text: i18n.tr('Repo Url')
}
TextField {
id: textFieldInput
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
placeholderText: i18n.tr('Git repo url')
}
Button {
id: buttonAdd
width: parent.width
text: i18n.tr('Clone')
onClicked: {
var ret = Git.clone(textFieldInput.text, Pass.password_store);
if (ret)
PopupUtils.open(dialogImportGitCloneSuccess);
else
PopupUtils.open(importGitCloneError, importGitClonePage);
}
}
}
Component {
id: importGitCloneValidation
SimpleValidationDialog {
text: i18n.tr("Importing a git repo will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop();
}
}
}
Component {
id: importGitCloneError
ErrorDialog {
textError: i18n.tr("An error occured during git clone !")
}
}
Component {
id: dialogImportGitCloneSuccess
SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: {
pageStack.pop();
pageStack.pop();
}
}
}
header: StackHeader {
id: importGitCloneHeader
title: i18n.tr('Git Clone Import')
}
}

View File

@ -1,82 +1,80 @@
import QtQuick 2.4
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"
import "../../dialogs" import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Lomiri.Content 1.3
import Pass 1.0
import QtQuick 2.4
import Utils 1.0
Page { Page {
id: importKeyFilePage id: importKeyFilePage
property var activeTransfer property var activeTransfer
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
ContentPeerPicker { ContentPeerPicker {
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
width: parent.width width: parent.width
visible: parent.visible visible: parent.visible
showTitle: false showTitle: false
contentType: ContentType.Text contentType: ContentType.Text
handler: ContentHandler.Source handler: ContentHandler.Source
onPeerSelected: { onPeerSelected: {
peer.selectionType = ContentTransfer.Single peer.selectionType = ContentTransfer.Single;
importKeyFilePage.activeTransfer = peer.request() importKeyFilePage.activeTransfer = peer.request();
importKeyFilePage.activeTransfer.stateChanged.connect(function() {
importKeyFilePage.activeTransfer.stateChanged.connect(function () {
if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) { if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged") console.log("Charged");
console.log(importKeyFilePage.activeTransfer.items[0].url) console.log(importKeyFilePage.activeTransfer.items[0].url);
var status = Pass.gpgImportKeyFromFile(importKeyFilePage.activeTransfer.items[0].url);
var status = Pass.gpgImportKeyFromFile( Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url);
importKeyFilePage.activeTransfer.items[0].url) if (status)
PopupUtils.open(dialogImportKeyPageSucess);
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url) else
if (status) { PopupUtils.open(dialogImportKeyPageError);
PopupUtils.open(dialogImportKeyPageSucess) importKeyFilePage.activeTransfer = null;
} else {
PopupUtils.open(dialogImportKeyPageError)
}
importKeyFilePage.activeTransfer = null
} }
}) });
} }
onCancelPressed: { onCancelPressed: {
pageStack.pop() pageStack.pop();
} }
} }
ContentTransferHint { ContentTransferHint {
id: transferHint id: transferHint
anchors.fill: parent anchors.fill: parent
activeTransfer: importKeyFilePage.activeTransfer activeTransfer: importKeyFilePage.activeTransfer
} }
Component { Component {
id: dialogImportKeyPageError id: dialogImportKeyPageError
ErrorDialog { ErrorDialog {
textError: i18n.tr("Key import failed !") textError: i18n.tr("Key import failed !")
} }
} }
Component { Component {
id: dialogImportKeyPageSucess id: dialogImportKeyPageSucess
SuccessDialog { SuccessDialog {
textSuccess: i18n.tr("Key successfully imported !") textSuccess: i18n.tr("Key successfully imported !")
onDialogClosed: { onDialogClosed: {
pageStack.pop() pageStack.pop();
} }
} }
} }
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
} }

View File

@ -1,99 +1,97 @@
import QtQuick 2.4
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"
import "../../dialogs" import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import Lomiri.Content 1.3
import Pass 1.0
import QtQuick 2.4
import Utils 1.0
Page { Page {
id: importZipPage id: importZipPage
property var activeTransfer property var activeTransfer
header: StackHeader { Component.onCompleted: {
id: importZipHeader PopupUtils.open(importZipPageImportValidation, importZipPage);
title: i18n.tr("Zip Password Store Import")
} }
ContentPeerPicker { ContentPeerPicker {
anchors.top: importZipHeader.bottom anchors.top: importZipHeader.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.topMargin: importZipPage.header.height anchors.topMargin: importZipPage.header.height
width: parent.width width: parent.width
visible: parent.visible visible: parent.visible
showTitle: false showTitle: false
contentType: ContentType.Text contentType: ContentType.Text
handler: ContentHandler.Source handler: ContentHandler.Source
onPeerSelected: { onPeerSelected: {
peer.selectionType = ContentTransfer.Single peer.selectionType = ContentTransfer.Single;
importZipPage.activeTransfer = peer.request() importZipPage.activeTransfer = peer.request();
importZipPage.activeTransfer.stateChanged.connect(function() {
importZipPage.activeTransfer.stateChanged.connect(function () {
if (importZipPage.activeTransfer.state === ContentTransfer.Charged) { if (importZipPage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged") console.log("Charged");
console.log(importZipPage.activeTransfer.items[0].url) console.log(importZipPage.activeTransfer.items[0].url);
var status = Utils.unzip(importZipPage.activeTransfer.items[0].url, Pass.getPasswordStore());
var status = Utils.unzip( Utils.rmFile(importZipPage.activeTransfer.items[0].url);
importZipPage.activeTransfer.items[0].url, if (status)
Pass.getPasswordStore()) PopupUtils.open(dialogImportZipPageSuccess);
else
Utils.rmFile(importZipPage.activeTransfer.items[0].url) PopupUtils.open(dialogImportZipPageError);
importZipPage.activeTransfer = null;
if (status) {
PopupUtils.open(dialogImportZipPageSuccess)
} else {
PopupUtils.open(dialogImportZipPageError)
}
importZipPage.activeTransfer = null
} }
}) });
} }
onCancelPressed: { onCancelPressed: {
pageStack.pop() pageStack.pop();
} }
} }
ContentTransferHint { ContentTransferHint {
id: transferHint id: transferHint
anchors.fill: parent anchors.fill: parent
activeTransfer: importZipPage.activeTransfer activeTransfer: importZipPage.activeTransfer
} }
Component { Component {
id: importZipPageImportValidation id: importZipPageImportValidation
SimpleValidationDialog { SimpleValidationDialog {
text: i18n.tr( text: i18n.tr("Importing a new zip will delete<br>any existing password store!<br>Continue ?")
"Importing a new zip will delete<br>any existing password store!<br>Continue ?")
onCanceled: { onCanceled: {
pageStack.pop() pageStack.pop();
} }
} }
} }
Component { Component {
id: dialogImportZipPageError id: dialogImportZipPageError
ErrorDialog { ErrorDialog {
textError: i18n.tr("Password store import failed !") textError: i18n.tr("Password store import failed !")
} }
} }
Component { Component {
id: dialogImportZipPageSuccess id: dialogImportZipPageSuccess
SuccessDialog { SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !") textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: { onDialogClosed: {
pageStack.pop() pageStack.pop();
pageStack.pop();
} }
} }
} }
Component.onCompleted: { header: StackHeader {
PopupUtils.open(importZipPageImportValidation, importZipPage) id: importZipHeader
title: i18n.tr("Zip Password Store Import")
} }
} }

View File

@ -1,28 +1,23 @@
import QtQuick 2.4 import "../../components"
import "../../dialogs"
import "../headers"
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3 import Lomiri.Components.Popups 1.3
import Pass 1.0 import Pass 1.0
import "../headers" import QtQuick 2.4
import "../../components"
import "../../dialogs"
Page { Page {
id: infoKeysPage id: infoKeysPage
property string currentKey property string currentKey
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
}
ListView { ListView {
id: infoKeysListView id: infoKeysListView
anchors.top: infoKeysHeader.bottom anchors.top: infoKeysHeader.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
model: Pass.gpgGetAllKeysModel() model: Pass.gpgGetAllKeysModel()
delegate: Grid { delegate: Grid {
@ -38,6 +33,7 @@ Page {
Text { Text {
id: uidKey id: uidKey
width: parent.width width: parent.width
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@ -46,11 +42,12 @@ Page {
Button { Button {
id: buttonDeleteKey id: buttonDeleteKey
text: i18n.tr("Delete this key") text: i18n.tr("Delete this key")
color: LomiriColors.red color: LomiriColors.red
onClicked: { onClicked: {
infoKeysPage.currentKey = model.modelData.uid infoKeysPage.currentKey = model.modelData.uid;
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage) PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage);
} }
} }
@ -58,43 +55,53 @@ Page {
width: parent.width width: parent.width
height: units.gu(1) height: units.gu(1)
} }
} }
} }
Component { Component {
id: infoKeysPageDeleteValidation id: infoKeysPageDeleteValidation
DoubleValidationDialog { DoubleValidationDialog {
text1: i18n.tr( text1: i18n.tr("You're are about to delete<br>%1<br>Continue ?").arg(infoKeysPage.currentKey)
"You're are about to delete<br>%1<br>Continue ?").arg( text2: i18n.tr("%1<br>will be definitively removed.<br>Continue ?").arg(infoKeysPage.currentKey)
infoKeysPage.currentKey)
text2: i18n.tr(
"%1<br>will be definitively removed.<br>Continue ?").arg(
infoKeysPage.currentKey)
onDoubleValidated: { onDoubleValidated: {
var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey) var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey);
if (status) { if (status)
PopupUtils.open(infoKeysPageDeleteSuccess) PopupUtils.open(infoKeysPageDeleteSuccess);
} else { else
PopupUtils.open(infoKeysPageDeleteError) PopupUtils.open(infoKeysPageDeleteError);
}
} }
} }
} }
Component { Component {
id: infoKeysPageDeleteError id: infoKeysPageDeleteError
ErrorDialog { ErrorDialog {
textError: i18n.tr("Key removal failed !") textError: i18n.tr("Key removal failed !")
} }
} }
Component { Component {
id: infoKeysPageDeleteSuccess id: infoKeysPageDeleteSuccess
SuccessDialog { SuccessDialog {
textSuccess: i18n.tr("Key successfully deleted !") textSuccess: i18n.tr("Key successfully deleted !")
onDialogClosed: { onDialogClosed: {
infoKeysListView.model = Pass.gpgGetAllKeysModel() infoKeysListView.model = Pass.gpgGetAllKeysModel();
} }
} }
} }
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
}
} }

View File

@ -1,19 +1,14 @@
import QtQuick 2.4 import "../../components"
import "../headers"
import Lomiri.Components 1.3 import Lomiri.Components 1.3
import Pass 1.0 import Pass 1.0
import "../headers" import QtQuick 2.4
import "../../components"
Page { Page {
id: settingsPage id: settingsPage
property string gpgKeyId: "" property string gpgKeyId: ""
header: StackHeader {
id: settingsHeader
title: i18n.tr('Settings')
}
Flow { Flow {
anchors.top: settingsHeader.bottom anchors.top: settingsHeader.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -27,14 +22,17 @@ Page {
height: units.gu(4) height: units.gu(4)
text: i18n.tr('GPG') text: i18n.tr('GPG')
} }
PageStackLink { PageStackLink {
page: Qt.resolvedUrl("ImportKeyFile.qml") page: Qt.resolvedUrl("ImportKeyFile.qml")
text: i18n.tr('Import a GPG key file') text: i18n.tr('Import a GPG key file')
} }
PageStackLink { PageStackLink {
page: Qt.resolvedUrl("InfoKeys.qml") page: Qt.resolvedUrl("InfoKeys.qml")
text: i18n.tr('Show GPG keys') text: i18n.tr('Show GPG keys')
} }
Text { Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@ -42,18 +40,32 @@ Page {
height: units.gu(4) height: units.gu(4)
text: i18n.tr('Password Store') text: i18n.tr('Password Store')
} }
PageStackLink {
page: Qt.resolvedUrl("ImportGitClone.qml")
text: i18n.tr('Import a Password Store using Git')
}
PageStackLink { PageStackLink {
page: Qt.resolvedUrl("ImportZip.qml") page: Qt.resolvedUrl("ImportZip.qml")
text: i18n.tr('Import a Password Store Zip') text: i18n.tr('Import a Password Store Zip')
} }
Text { Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
width: parent.width width: parent.width
height: units.gu(4) height: units.gu(4)
color: LomiriColors.red color: LomiriColors.red
text: i18n.tr( text: i18n.tr('Warning: importing delete any exiting Password Store')
'Warning: importing delete any exiting Password Store')
} }
} }
header: StackHeader {
id: settingsHeader
title: i18n.tr('Settings')
}
} }

View File

@ -4,18 +4,14 @@ import QtQuick 2.4
Rectangle { Rectangle {
property bool commonBorder: true property bool commonBorder: true
property int lBorderwidth: 1 property int lBorderwidth: 1
property int rBorderwidth: 1 property int rBorderwidth: 1
property int tBorderwidth: 1 property int tBorderwidth: 1
property int bBorderwidth: 1 property int bBorderwidth: 1
property int commonBorderWidth: 1 property int commonBorderWidth: 1
z: -1
property string borderColor: "white" property string borderColor: "white"
z: -1
color: borderColor color: borderColor
anchors { anchors {
@ -23,10 +19,10 @@ Rectangle {
right: parent.right right: parent.right
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
topMargin: commonBorder ? -commonBorderWidth : -tBorderwidth topMargin: commonBorder ? -commonBorderWidth : -tBorderwidth
bottomMargin: commonBorder ? -commonBorderWidth : -bBorderwidth bottomMargin: commonBorder ? -commonBorderWidth : -bBorderwidth
leftMargin: commonBorder ? -commonBorderWidth : -lBorderwidth leftMargin: commonBorder ? -commonBorderWidth : -lBorderwidth
rightMargin: commonBorder ? -commonBorderWidth : -rBorderwidth rightMargin: commonBorder ? -commonBorderWidth : -rBorderwidth
} }
} }