diff --git a/.astylerc b/.astylerc new file mode 100644 index 0000000..115c2ad --- /dev/null +++ b/.astylerc @@ -0,0 +1,13 @@ +suffix=none +recursive +--style=kr +--indent=spaces=4 +--align-pointer=name +--align-reference=name +--convert-tabs +--attach-namespaces +--max-code-length=100 +--max-instatement-indent=120 +--pad-header +--pad-oper +--lineend=linux \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aef5c7..9b47c39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop) add_executable(${PROJECT_NAME} main.cpp) - qt5_use_modules(${PROJECT_NAME} Gui Qml Quick) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) @@ -97,4 +96,19 @@ file(GLOB_RECURSE PROJECT_SRC_FILES *.desktop.in ) -add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES}) \ No newline at end of file +add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES}) + +# Tests +enable_testing(true) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +include_directories(tests/plugins) + +find_package(Qt5Test) + +add_executable(TestGpg tests/plugins/TestGpg.cpp) +add_executable(TestPass tests/plugins/TestPass.cpp) +target_link_libraries(TestGpg Qt5::Test) +target_link_libraries(TestPass Qt5::Test) + +add_test(TestGpg TestGpg) +add_test(TestPass TestPass) diff --git a/README.md b/README.md index 6473a6c..adf1e9c 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,15 @@ A password management app for Ubuntu Touch aiming to be compatible with [ZX2C4 For more options/details see the [clickable documentation](http://clickable.bhdouglass.com/en/latest/index.html) ## Custom clickable command -* ```clickable c ``` : clean third directory and run ```clickable clean``` -* ```clickable cr ``` : clean third directory and run ```clickable``` -* ```clickable r``` : run ```clickable --dirty``` -* ```clickable crd ``` : clean third directory and run ```clickable desktop``` -* ```clickable rd ``` : run ```clickable desktop --dirty ``` +* ```clickable test ``` : run test for all plugins +* ```clickable test_gpg ``` : run test for gpg plugin +* ```clickable test_pass``` : run test for pass plugin +* ```clickable style ``` : reformat the code (Required : [astyle](astyle.sourceforge.ne) & [https://github.com/jesperhh/qmlfmt](https://github.com/jesperhh/qmlfmt)) # Contributing -Any contributions are welcome using the github issue & pull request system. +Any contributions are welcome using the github issue & pull request system. +Please try to respect the code style format by runnning ```clickable style``` before committing. # Features diff --git a/UTPass.apparmor b/UTPass.apparmor index e1ec6b5..7a6cbd5 100644 --- a/UTPass.apparmor +++ b/UTPass.apparmor @@ -1,5 +1,4 @@ { - template": "unconfined", "policy_groups": [], "policy_version": 16.04 } diff --git a/clickable.json b/clickable.json index c3e1a6f..7c6a98f 100644 --- a/clickable.json +++ b/clickable.json @@ -2,11 +2,11 @@ "template": "cmake", "kill": "UTPass", "scripts": { - "c": "third/clean.sh && clickable clean", - "cr": "third/clean.sh && clickable", - "r": "clickable --dirty", - "crd": "third/clean.sh && clickable desktop", - "rd": "clickable desktop --dirty" + "clean": "third/clean.sh && rm -rf build", + "style": "astyle --options=.astylerc \"plugins/*.cpp,*.h\" && qmlfmt -w qml", + "test": "clickable run \"cd build && make test\"", + "test_gpg": "clickable run \"cd build && ./TestGpg\"", + "test_pass": "clickable run \"cd build && ./TestPass\"" }, "dependencies_build": [ "texinfo", diff --git a/plugins/Gpg/gpg.cpp b/plugins/Gpg/gpg.cpp index eb55670..a152a48 100644 --- a/plugins/Gpg/gpg.cpp +++ b/plugins/Gpg/gpg.cpp @@ -17,148 +17,157 @@ using namespace GpgME; using namespace QGpgME; -Gpg::Gpg() { - auto error = initializeLibrary(OpenPGP); - if (error) { - qDebug() << "Code Error : " << error.code(); - qDebug() << "Error str : " << error.asString(); - qFatal("GpgME init fail"); - } +Gpg::Gpg() +{ + auto error = initializeLibrary(OpenPGP); + if (error) { + qDebug() << "Code Error : " << error.code(); + qDebug() << "Error str : " << error.asString(); + qFatal("GpgME init fail"); + } - QString gnuhome = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/gpghome"); - QDir dir(gnuhome); - if (!dir.exists()) - dir.mkpath("."); - qputenv("GNUPGHOME", gnuhome.toStdString().c_str()); - qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME"); + QString gnuhome = QStandardPaths::writableLocation( + QStandardPaths::AppDataLocation).append("/gpghome"); + QDir dir(gnuhome); + if (!dir.exists()) + dir.mkpath("."); + qputenv("GNUPGHOME", gnuhome.toStdString().c_str()); + qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME"); - error = checkEngine(OpenPGP); - if (error) { - qDebug() << "Code Error : " << error.code(); - qDebug() << "Error str : " << error.asString(); - qFatal("Engine check Fail"); - - } - qDebug() << "GpgME Engine Version :" << engineInfo(OpenPGP).version(); + error = checkEngine(OpenPGP); + if (error) { + qDebug() << "Code Error : " << error.code(); + qDebug() << "Error str : " << error.asString(); + qFatal("Engine check Fail"); + } + qDebug() << "GpgME Engine Version :" << engineInfo(OpenPGP).version(); } -void Gpg::list_dir() { - qDebug() << "hello world!"; +void Gpg::list_dir() +{ + qDebug() << "hello world!"; } -QString Gpg::decrypt(const QByteArray cipherText) { - /*auto decJob = openpgp()->decryptJob(); - auto ctx = DecryptJob::context(decJob);*/ +QString Gpg::decrypt(const QByteArray cipherText) +{ + /*auto decJob = openpgp()->decryptJob(); + auto ctx = DecryptJob::context(decJob);*/ - /* TODO - * TestPassphraseProvider provider; - ctx->setPassphraseProvider(&provider); - ctx->setPinentryMode(Context::PinentryLoopback);*/ + /* TODO + * TestPassphraseProvider provider; + ctx->setPassphraseProvider(&provider); + ctx->setPinentryMode(Context::PinentryLoopback);*/ - /*QByteArray plainText; - decJob->exec(cipherText, plainText); + /*QByteArray plainText; + decJob->exec(cipherText, plainText); - return QString::fromUtf8(plainText);*/ + return QString::fromUtf8(plainText);*/ } -QString Gpg::decrypt_file(const QString path) { - /*QFile file(path); - if (!file.open(QIODevice::ReadOnly)) { - qErrnoWarning("Can't open the File"); - return nullptr; - } - QByteArray plainText = file.readAll(); - return this->decrypt(plainText);*/ +QString Gpg::decrypt_file(const QString path) +{ + /*QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + qErrnoWarning("Can't open the File"); + return nullptr; + } + QByteArray plainText = file.readAll(); + return this->decrypt(plainText);*/ } -QByteArray Gpg::encrypt(const QString str) { - /*auto listjob = openpgp()->keyListJob(false, false, false); - std::vector keys; - auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), false, keys); +QByteArray Gpg::encrypt(const QString str) +{ + /*auto listjob = openpgp()->keyListJob(false, false, false); + std::vector keys; + auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), false, keys); - auto job = openpgp() - ->encryptJob( - true, //ASCII Armor - true //Textmode - ); - QByteArray cipherText; - auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText); - return cipherText;*/ + auto job = openpgp() + ->encryptJob( + true, //ASCII Armor + true //Textmode + ); + QByteArray cipherText; + auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText); + return cipherText;*/ } -bool Gpg::encrypt_file(const QString str, const QString path) { - /*QFile file(path); - if (!file.open(QIODevice::WriteOnly)) { - qErrnoWarning("Can't open the File"); - return false; - } - file.write(Pass::encrypt(str)); - return true;*/ +bool Gpg::encrypt_file(const QString str, const QString path) +{ + /*QFile file(path); + if (!file.open(QIODevice::WriteOnly)) { + qErrnoWarning("Can't open the File"); + return false; + } + file.write(Pass::encrypt(str)); + return true;*/ } -QString Gpg::get_key_id(QString uid) { - qDebug() << "Getting the key id " << uid; - auto *job = openpgp()->keyListJob(false, false, false); - std::vector keys; - auto result = job->exec(QStringList() << uid, false, keys); - delete job; +QString Gpg::get_key_id(QString uid) +{ + qDebug() << "Getting the key id " << uid; + auto *job = openpgp()->keyListJob(false, false, false); + std::vector keys; + auto result = job->exec(QStringList() << uid, false, keys); + delete job; - if (keys.empty()) { - qDebug() << "No key found for" << uid; - return nullptr; - } - const QString kId = QLatin1String(keys.front().keyID()); - qDebug() << "Id key for " << uid << "is : " << kId; - return kId; + if (keys.empty()) { + qDebug() << "No key found for" << uid; + return nullptr; + } + const QString kId = QLatin1String(keys.front().keyID()); + qDebug() << "Id key for " << uid << "is : " << kId; + return kId; } -QStringList Gpg::get_all_keys_id() { - qDebug() << "Show all available key"; - auto job = openpgp()->keyListJob(false, false, false); - std::vector keys; - auto result = job->exec(QStringList(""), false, keys); - delete job; +QStringList Gpg::get_all_keys_id() +{ + qDebug() << "Show all available key"; + auto job = openpgp()->keyListJob(false, false, false); + std::vector keys; + auto result = job->exec(QStringList(""), false, keys); + delete job; - if (keys.empty()) { - qDebug() << "No key found"; - return QStringList(); - } + if (keys.empty()) { + qDebug() << "No key found"; + return QStringList(); + } - auto r = QStringList(); - for (const auto &key: keys) { - r.append(QLatin1String(key.keyID())); - qDebug() << "Key" << QLatin1String(key.keyID()); - } - return r; + auto r = QStringList(); + for (const auto &key : keys) { + r.append(QLatin1String(key.keyID())); + qDebug() << "Key" << QLatin1String(key.keyID()); + } + return r; } -bool Gpg::import_key(QString path) { - qDebug() << "Importing the key file" << path; - QFile file(path); - if (!file.open(QIODevice::ReadOnly)) { - qWarning() << "Can't open the File"; - return false; - } +bool Gpg::import_key(QString path) +{ + qDebug() << "Importing the key file" << path; + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + qWarning() << "Can't open the File"; + return false; + } - auto job = openpgp()->importJob(); - auto result = job->exec(file.readAll()); + auto job = openpgp()->importJob(); + auto result = job->exec(file.readAll()); - delete job; - file.close(); + delete job; + file.close(); - if (result.error()) { - qWarning() << "Import go wrong"; - return false; - } + if (result.error()) { + qWarning() << "Import go wrong"; + return false; + } - qDebug() << "Key imported" << result.numImported(); - qDebug() << "Key not imported" << result.notImported(); - qDebug() << "Key unchanged" << result.numUnchanged(); - qDebug() << "Result null" << result.isNull(); - qDebug() << "newUserIDs" << result.newUserIDs(); + qDebug() << "Key imported" << result.numImported(); + qDebug() << "Key not imported" << result.notImported(); + qDebug() << "Key unchanged" << result.numUnchanged(); + qDebug() << "Result null" << result.isNull(); + qDebug() << "newUserIDs" << result.newUserIDs(); - for (const auto &key: result.imports()) - qDebug() << "Key" << key.fingerprint(); + for (const auto &key : result.imports()) + qDebug() << "Key" << key.fingerprint(); - return true; + return true; } \ No newline at end of file diff --git a/plugins/Gpg/gpg.h b/plugins/Gpg/gpg.h index f034eee..1708b05 100644 --- a/plugins/Gpg/gpg.h +++ b/plugins/Gpg/gpg.h @@ -3,21 +3,22 @@ #include -class Gpg : public QObject { - Q_OBJECT +class Gpg : public QObject +{ + Q_OBJECT - public: - Gpg(); - ~Gpg() = default; +public: + Gpg(); + ~Gpg() = default; - Q_INVOKABLE void list_dir(); - Q_INVOKABLE QString get_key_id(QString uid); - Q_INVOKABLE QStringList get_all_keys_id(); - Q_INVOKABLE bool import_key(QString path); - Q_INVOKABLE QString decrypt(QByteArray plainText); - Q_INVOKABLE QString decrypt_file(QString path); - Q_INVOKABLE QByteArray encrypt(QString str); - Q_INVOKABLE bool encrypt_file(QString str, QString path); + Q_INVOKABLE void list_dir(); + Q_INVOKABLE QString get_key_id(QString uid); + Q_INVOKABLE QStringList get_all_keys_id(); + Q_INVOKABLE bool import_key(QString path); + Q_INVOKABLE QString decrypt(QByteArray plainText); + Q_INVOKABLE QString decrypt_file(QString path); + Q_INVOKABLE QByteArray encrypt(QString str); + Q_INVOKABLE bool encrypt_file(QString str, QString path); }; #endif diff --git a/plugins/Gpg/plugin.cpp b/plugins/Gpg/plugin.cpp index 520fd4d..2b044ce 100644 --- a/plugins/Gpg/plugin.cpp +++ b/plugins/Gpg/plugin.cpp @@ -3,7 +3,8 @@ #include "plugin.h" #include "gpg.h" -void FileSystemPlugin::registerTypes(const char *uri) { - //@uri Pass - qmlRegisterSingletonType(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; }); +void FileSystemPlugin::registerTypes(const char *uri) +{ + //@uri Pass + qmlRegisterSingletonType(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; }); } diff --git a/plugins/Gpg/plugin.h b/plugins/Gpg/plugin.h index 131bde1..ee4b9ec 100644 --- a/plugins/Gpg/plugin.h +++ b/plugins/Gpg/plugin.h @@ -3,13 +3,14 @@ #include -class FileSystemPlugin : public QQmlExtensionPlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID - "org.qt-project.Qt.QQmlExtensionInterface") +class FileSystemPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID + "org.qt-project.Qt.QQmlExtensionInterface") - public: - void registerTypes(const char *uri); +public: + void registerTypes(const char *uri); }; #endif diff --git a/plugins/Pass/pass.cpp b/plugins/Pass/pass.cpp index 72f269f..27ba7f4 100644 --- a/plugins/Pass/pass.cpp +++ b/plugins/Pass/pass.cpp @@ -3,12 +3,14 @@ #include "pass.h" -Pass::Pass() { +Pass::Pass() +{ } -void Pass::speak() { - qDebug() << "Starting app from main.cpp"; +void Pass::speak() +{ + qDebug() << "Starting app from main.cpp"; } diff --git a/plugins/Pass/pass.h b/plugins/Pass/pass.h index 1bc82d5..dd01164 100644 --- a/plugins/Pass/pass.h +++ b/plugins/Pass/pass.h @@ -3,15 +3,16 @@ #include -class Pass : public QObject { - Q_OBJECT - QString gpgHome; +class Pass : public QObject +{ + Q_OBJECT + QString gpgHome; - public: - Pass(); - ~Pass() override = default; +public: + Pass(); + ~Pass() override = default; - Q_INVOKABLE void speak(); + Q_INVOKABLE void speak(); }; #endif diff --git a/plugins/Pass/plugin.cpp b/plugins/Pass/plugin.cpp index 5c415bc..104e5f1 100644 --- a/plugins/Pass/plugin.cpp +++ b/plugins/Pass/plugin.cpp @@ -3,7 +3,8 @@ #include "plugin.h" #include "pass.h" -void PassPlugin::registerTypes(const char *uri) { - //@uri Pass - qmlRegisterSingletonType(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; }); +void PassPlugin::registerTypes(const char *uri) +{ + //@uri Pass + qmlRegisterSingletonType(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; }); } diff --git a/plugins/Pass/plugin.h b/plugins/Pass/plugin.h index 8554993..aeb7bb2 100644 --- a/plugins/Pass/plugin.h +++ b/plugins/Pass/plugin.h @@ -3,13 +3,14 @@ #include -class PassPlugin : public QQmlExtensionPlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID - "org.qt-project.Qt.QQmlExtensionInterface") +class PassPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID + "org.qt-project.Qt.QQmlExtensionInterface") - public: - void registerTypes(const char *uri) override; +public: + void registerTypes(const char *uri) override; }; #endif diff --git a/po/utpass.qrouland.pot b/po/utpass.qrouland.pot index 199919c..138414e 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: 2019-03-20 22:31+0000\n" +"POT-Creation-Date: 2019-03-21 16:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,32 +17,32 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../qml/pages/PasswordList.qml:17 -msgid "Back" -msgstr "" - -#: ../qml/pages/PasswordList.qml:39 -msgid "No password found in the current folder" -msgstr "" - -#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:47 +#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:49 msgid "Settings" msgstr "" -#: ../qml/pages/headers/MainHeader.qml:8 ../qml/pages/headers/StackHeader.qml:8 -#: ../qml/pages/Info.qml:43 UTPass.desktop.in.h:1 -msgid "UTPass" +#: ../qml/pages/PasswordList.qml:16 +msgid "Back" msgstr "" -#: ../qml/pages/headers/MainHeader.qml:23 -#: ../qml/pages/headers/MainHeader.qml:36 -msgid "Search" +#: ../qml/pages/PasswordList.qml:38 +msgid "No password found in the current folder" msgstr "" -#: ../qml/pages/headers/MainHeader.qml:54 ../qml/pages/Info.qml:9 +#: ../qml/pages/Info.qml:9 ../qml/pages/headers/MainHeader.qml:56 msgid "Info" msgstr "" +#: ../qml/pages/Info.qml:43 ../qml/pages/headers/MainHeader.qml:8 +#: ../qml/pages/headers/StackHeader.qml:8 UTPass.desktop.in.h:1 +msgid "UTPass" +msgstr "" + #: ../qml/pages/Info.qml:53 msgid "Suggest improvement(s) or report a bug(s)" msgstr "" + +#: ../qml/pages/headers/MainHeader.qml:23 +#: ../qml/pages/headers/MainHeader.qml:38 +msgid "Search" +msgstr "" diff --git a/qml/Main.qml b/qml/Main.qml index 4d635ec..2bf79b1 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -6,7 +6,7 @@ import Gpg 1.0 import "components" MainView { - id: root + id: "root" objectName: "mainView" applicationName: "utpass.qrouland" @@ -18,7 +18,12 @@ MainView { id: pageStack anchors.fill: parent - Component.onCompleted: push(pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml"))) + Component.onCompleted: push(pageStack.push( + Qt.resolvedUrl( + "pages/PasswordList.qml"))) + } + Component.onCompleted: { + Gpg.import_key("password-store/public.key") + Gpg.get_all_keys_id() } - Component.onCompleted: { Gpg.import_key("password-store/public.key"); Gpg.get_all_keys_id();} } diff --git a/qml/components/FileDir.qml b/qml/components/FileDir.qml index f6697b2..8992476 100644 --- a/qml/components/FileDir.qml +++ b/qml/components/FileDir.qml @@ -19,13 +19,18 @@ Component { anchors.verticalCenter: parent.verticalCenter width: units.gu(4) height: units.gu(4) - name: fileIsDir ? "go-next" : "lock" + name: fileIsDir ? "go-next" : "lock" color: Theme.raisin_black } MouseArea { anchors.fill: parent - onClicked: { if (fileIsDir){ folderModel.folder = folderModel.folder + "/" + fileName ; backAction.visible = true;} } + onClicked: { + if (fileIsDir) { + folderModel.folder = folderModel.folder + "/" + fileName + backAction.visible = true + } + } } CustomBorder { @@ -37,4 +42,4 @@ Component { borderColor: UbuntuColors.warmGrey } } -} \ No newline at end of file +} diff --git a/qml/components/Link.qml b/qml/components/Link.qml index a9fc165..d328af9 100644 --- a/qml/components/Link.qml +++ b/qml/components/Link.qml @@ -3,19 +3,19 @@ import Ubuntu.Components 1.3 import "../styles" Item { - property string url - property string text + property string url + property string text - property bool commonBorder : true - property int lBorderwidth : 0 - property int rBorderwidth : 0 - property int tBorderwidth : 0 - property int bBorderwidth : 0 - property int commonBorderWidth : 0 - property string borderColor : UbuntuColors.warmGrey + property bool commonBorder: true + property int lBorderwidth: 0 + property int rBorderwidth: 0 + property int tBorderwidth: 0 + property int bBorderwidth: 0 + property int commonBorderWidth: 0 + property string borderColor: UbuntuColors.warmGrey - width: parent.width - height: units.gu(6) + width: parent.width + height: units.gu(6) Rectangle { width: parent.width @@ -33,17 +33,19 @@ Item { anchors.verticalCenter: parent.verticalCenter width: units.gu(4) height: units.gu(4) - name: "go-next" + name: "go-next" color: Theme.raisin_black } MouseArea { anchors.fill: parent - onClicked: { Qt.openUrlExternally(parent.parent.url); } + onClicked: { + Qt.openUrlExternally(parent.parent.url) + } } CustomBorder { - id : cb + id: cb commonBorder: parent.parent.commonBorder lBorderwidth: parent.parent.lBorderwidth rBorderwidth: parent.parent.rBorderwidth @@ -52,4 +54,4 @@ Item { borderColor: parent.parent.borderColor } } -} \ No newline at end of file +} diff --git a/qml/models/Manifest.qml b/qml/models/Manifest.qml index a840c46..a16cb51 100644 --- a/qml/models/Manifest.qml +++ b/qml/models/Manifest.qml @@ -2,5 +2,4 @@ pragma Singleton import QtQuick 2.4 Item { - } diff --git a/qml/models/Passstore.qml b/qml/models/Passstore.qml deleted file mode 100644 index e69de29..0000000 diff --git a/qml/models/Passtore.qml b/qml/models/Passtore.qml new file mode 100644 index 0000000..a16cb51 --- /dev/null +++ b/qml/models/Passtore.qml @@ -0,0 +1,5 @@ +pragma Singleton +import QtQuick 2.4 + +Item { +} diff --git a/qml/pages/Info.qml b/qml/pages/Info.qml index 072d4d7..ac5e2ca 100644 --- a/qml/pages/Info.qml +++ b/qml/pages/Info.qml @@ -5,7 +5,7 @@ import "../components" Page { header: StackHeader { - id : infoHeader + id: infoHeader title: i18n.tr('Info') } @@ -19,22 +19,22 @@ Page { spacing: 2 anchors.fill: parent Rectangle { - width: parent.width - height: units.gu(4) + width: parent.width + height: units.gu(4) } Rectangle { - width: parent.width - height: units.gu(12) - Image { - source: "../../assets/logo.svg" - width: units.gu(12) - height: units.gu(12) - anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + height: units.gu(12) + Image { + source: "../../assets/logo.svg" + width: units.gu(12) + height: units.gu(12) + anchors.horizontalCenter: parent.horizontalCenter } } Rectangle { - width: parent.width - height: units.gu(4) + width: parent.width + height: units.gu(4) } Text { horizontalAlignment: Text.AlignHCenter @@ -55,5 +55,3 @@ Page { } } } - - diff --git a/qml/pages/PasswordList.qml b/qml/pages/PasswordList.qml index 67aac9b..ac7b2ca 100644 --- a/qml/pages/PasswordList.qml +++ b/qml/pages/PasswordList.qml @@ -4,10 +4,9 @@ import Qt.labs.folderlistmodel 2.1 import "../components" import "headers" - Page { - header : MainHeader { - flickable : nav + header: MainHeader { + flickable: nav leadingActionBar.height: units.gu(4) leadingActionBar.actions: [ @@ -15,11 +14,11 @@ Page { id: backAction iconName: "back" text: i18n.tr("Back") - visible:false + visible: false onTriggered: { - folderModel.folder = folderModel.parentFolder; - if(folderModel.rootFolder === folderModel.folder) { - backAction.visible = false; + folderModel.folder = folderModel.parentFolder + if (folderModel.rootFolder === folderModel.folder) { + backAction.visible = false } } } @@ -42,7 +41,7 @@ Page { } } - ListView { + ListView { anchors.fill: parent spacing: 1 model: FolderListModel { @@ -56,4 +55,4 @@ Page { } } } -} \ No newline at end of file +} diff --git a/qml/pages/Settings.qml b/qml/pages/Settings.qml index f9f341e..5a27ed8 100644 --- a/qml/pages/Settings.qml +++ b/qml/pages/Settings.qml @@ -4,7 +4,7 @@ import "headers" Page { header: StackHeader { - id:settingsHeader + id: settingsHeader title: i18n.tr('Settings') } @@ -23,8 +23,6 @@ Page { height: units.gu(6) text: "Settings" } - } + } } } - - diff --git a/qml/pages/headers/MainHeader.qml b/qml/pages/headers/MainHeader.qml index 190304f..d3d9ae8 100644 --- a/qml/pages/headers/MainHeader.qml +++ b/qml/pages/headers/MainHeader.qml @@ -8,23 +8,25 @@ PageHeader { title: i18n.tr("UTPass") contents: Item { - height : parent.height + height: parent.height width: parent.width Label { - id : labelTitle + id: labelTitle text: mainHeader.title anchors.verticalCenter: parent.verticalCenter visible: true } TextField { id: searchBar - anchors.right : parent.right - anchors.left : parent.left + anchors.right: parent.right + anchors.left: parent.left placeholderText: i18n.tr("Search") height: units.gu(4) visible: false anchors.verticalCenter: parent.verticalCenter - onFocusChanged: {} + onFocusChanged: { + + } } } @@ -35,8 +37,8 @@ PageHeader { iconName: "search" text: i18n.tr("Search") onTriggered: { - searchBar.visible = !searchBar.visible; - labelTitle.visible = !searchBar.visible; + searchBar.visible = !searchBar.visible + labelTitle.visible = !searchBar.visible if (searchBar.visible === true) { searchBar.focus = true } @@ -57,4 +59,4 @@ PageHeader { } } ] -} \ No newline at end of file +} diff --git a/qml/pages/headers/StackHeader.qml b/qml/pages/headers/StackHeader.qml index 5ac1c74..5ff5419 100644 --- a/qml/pages/headers/StackHeader.qml +++ b/qml/pages/headers/StackHeader.qml @@ -8,10 +8,10 @@ PageHeader { title: i18n.tr("UTPass") contents: Item { - height : parent.height + height: parent.height width: parent.width Label { - id : labelTitle + id: labelTitle text: stackHeader.title anchors.verticalCenter: parent.verticalCenter } diff --git a/qml/styles/CustomBorder.qml b/qml/styles/CustomBorder.qml index 40aee8d..96f7921 100644 --- a/qml/styles/CustomBorder.qml +++ b/qml/styles/CustomBorder.qml @@ -2,33 +2,31 @@ // @ https://stackoverflow.com/questions/16534489/qml-control-border-width-and-color-on-any-one-side-of-rectangle-element#16562823 import QtQuick 2.4 -Rectangle -{ - property bool commonBorder : true +Rectangle { + property bool commonBorder: true - property int lBorderwidth : 1 - property int rBorderwidth : 1 - property int tBorderwidth : 1 - property int bBorderwidth : 1 + property int lBorderwidth: 1 + property int rBorderwidth: 1 + property int tBorderwidth: 1 + property int bBorderwidth: 1 - property int commonBorderWidth : 1 + property int commonBorderWidth: 1 - z : -1 + z: -1 - property string borderColor : "white" + property string borderColor: "white" color: borderColor - anchors - { + anchors { left: parent.left right: parent.right top: parent.top bottom: parent.bottom - topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth - bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth - leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth - rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth + topMargin: commonBorder ? -commonBorderWidth : -tBorderwidth + bottomMargin: commonBorder ? -commonBorderWidth : -bBorderwidth + leftMargin: commonBorder ? -commonBorderWidth : -lBorderwidth + rightMargin: commonBorder ? -commonBorderWidth : -rBorderwidth } } diff --git a/qml/styles/Theme.qml b/qml/styles/Theme.qml index 76ffc64..5b2a0a5 100644 --- a/qml/styles/Theme.qml +++ b/qml/styles/Theme.qml @@ -2,9 +2,9 @@ pragma Singleton import QtQuick 2.4 Item { - readonly property color claret : "#77172A" - readonly property color raisin_black : "#AE2B25" - readonly property color steel_blue : "#462C98" - readonly property color twilight_lavender : "#754888" - readonly property color eerie_black : "#191716" -} \ No newline at end of file + readonly property color claret: "#77172A" + readonly property color raisin_black: "#AE2B25" + readonly property color steel_blue: "#462C98" + readonly property color twilight_lavender: "#754888" + readonly property color eerie_black: "#191716" +} diff --git a/tests/plugins/TestGpg.cpp b/tests/plugins/TestGpg.cpp new file mode 100644 index 0000000..3eaafcd --- /dev/null +++ b/tests/plugins/TestGpg.cpp @@ -0,0 +1,17 @@ +#include + +class TestGpg: public QObject +{ +Q_OBJECT +private slots: + void toUpper(); +}; + +void TestGpg::toUpper() +{ + QString str = "Hello"; + QCOMPARE(str.toUpper(), QString("HELLO")); +} + +QTEST_MAIN(TestGpg) +#include "TestGpg.moc" \ No newline at end of file diff --git a/tests/plugins/TestPass.cpp b/tests/plugins/TestPass.cpp new file mode 100644 index 0000000..29803fe --- /dev/null +++ b/tests/plugins/TestPass.cpp @@ -0,0 +1,17 @@ +#include + +class TestPass: public QObject +{ +Q_OBJECT +private slots: + void toUpper(); +}; + +void TestPass::toUpper() +{ + QString str = "Hello"; + QCOMPARE(str.toUpper(), QString("HELLO")); +} + +QTEST_MAIN(TestPass) +#include "TestPass.moc" \ No newline at end of file diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index 8984e4e..24392aa 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -56,7 +56,7 @@ ExternalProject_Add( INSTALL_DIR ${EXTERNAL_LIBS} DOWNLOAD_COMMAND "" SOURCE_DIR ${GNUPG_PATH} - CONFIGURE_COMMAND /autogen.sh && /configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --host ${ARCH_TRIPLET} --disable-doc + CONFIGURE_COMMAND /autogen.sh && /configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --host ${ARCH_TRIPLET} BUILD_IN_SOURCE 1 BUILD_COMMAND make INSTALL_COMMAND make install