mirror of
https://github.com/QRouland/UTPass.git
synced 2024-12-21 09:22:39 +00:00
Add style command && applied new style format to existing code && setup tests plugins
This commit is contained in:
parent
aa4018c680
commit
7dc320f8ce
13
.astylerc
Normal file
13
.astylerc
Normal file
@ -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
|
@ -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})
|
||||
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)
|
||||
|
12
README.md
12
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
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
template": "unconfined",
|
||||
"policy_groups": [],
|
||||
"policy_version": 16.04
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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<Key> 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<Key> 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<Key> 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<Key> 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<Key> 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<Key> 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;
|
||||
}
|
@ -3,21 +3,22 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
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
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include "plugin.h"
|
||||
#include "gpg.h"
|
||||
|
||||
void FileSystemPlugin::registerTypes(const char *uri) {
|
||||
//@uri Pass
|
||||
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });
|
||||
void FileSystemPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
//@uri Pass
|
||||
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });
|
||||
}
|
||||
|
@ -3,13 +3,14 @@
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
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
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,15 +3,16 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
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
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include "plugin.h"
|
||||
#include "pass.h"
|
||||
|
||||
void PassPlugin::registerTypes(const char *uri) {
|
||||
//@uri Pass
|
||||
qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; });
|
||||
void PassPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
//@uri Pass
|
||||
qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; });
|
||||
}
|
||||
|
@ -3,13 +3,14 @@
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
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
|
||||
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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 ""
|
||||
|
11
qml/Main.qml
11
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();}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,5 +2,4 @@ pragma Singleton
|
||||
import QtQuick 2.4
|
||||
|
||||
Item {
|
||||
|
||||
}
|
||||
|
5
qml/models/Passtore.qml
Normal file
5
qml/models/Passtore.qml
Normal file
@ -0,0 +1,5 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.4
|
||||
|
||||
Item {
|
||||
}
|
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 {
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
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"
|
||||
}
|
||||
|
17
tests/plugins/TestGpg.cpp
Normal file
17
tests/plugins/TestGpg.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
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"
|
17
tests/plugins/TestPass.cpp
Normal file
17
tests/plugins/TestPass.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
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"
|
@ -56,7 +56,7 @@ ExternalProject_Add(
|
||||
INSTALL_DIR ${EXTERNAL_LIBS}
|
||||
DOWNLOAD_COMMAND ""
|
||||
SOURCE_DIR ${GNUPG_PATH}
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --host ${ARCH_TRIPLET} --disable-doc
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --host ${ARCH_TRIPLET}
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
|
Loading…
Reference in New Issue
Block a user