mirror of
https://github.com/QRouland/UTPass.git
synced 2024-12-22 09:52: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)
|
add_executable(${PROJECT_NAME} main.cpp)
|
||||||
|
|
||||||
|
|
||||||
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})
|
||||||
|
|
||||||
@ -98,3 +97,18 @@ file(GLOB_RECURSE PROJECT_SRC_FILES
|
|||||||
)
|
)
|
||||||
|
|
||||||
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)
|
||||||
|
10
README.md
10
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)
|
For more options/details see the [clickable documentation](http://clickable.bhdouglass.com/en/latest/index.html)
|
||||||
|
|
||||||
## Custom clickable command
|
## Custom clickable command
|
||||||
* ```clickable c ``` : clean third directory and run ```clickable clean```
|
* ```clickable test ``` : run test for all plugins
|
||||||
* ```clickable cr ``` : clean third directory and run ```clickable```
|
* ```clickable test_gpg ``` : run test for gpg plugin
|
||||||
* ```clickable r``` : run ```clickable --dirty```
|
* ```clickable test_pass``` : run test for pass plugin
|
||||||
* ```clickable crd ``` : clean third directory and run ```clickable desktop```
|
* ```clickable style ``` : reformat the code (Required : [astyle](astyle.sourceforge.ne) & [https://github.com/jesperhh/qmlfmt](https://github.com/jesperhh/qmlfmt))
|
||||||
* ```clickable rd ``` : run ```clickable desktop --dirty ```
|
|
||||||
|
|
||||||
# Contributing
|
# 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
|
# Features
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
template": "unconfined",
|
|
||||||
"policy_groups": [],
|
"policy_groups": [],
|
||||||
"policy_version": 16.04
|
"policy_version": 16.04
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"template": "cmake",
|
"template": "cmake",
|
||||||
"kill": "UTPass",
|
"kill": "UTPass",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"c": "third/clean.sh && clickable clean",
|
"clean": "third/clean.sh && rm -rf build",
|
||||||
"cr": "third/clean.sh && clickable",
|
"style": "astyle --options=.astylerc \"plugins/*.cpp,*.h\" && qmlfmt -w qml",
|
||||||
"r": "clickable --dirty",
|
"test": "clickable run \"cd build && make test\"",
|
||||||
"crd": "third/clean.sh && clickable desktop",
|
"test_gpg": "clickable run \"cd build && ./TestGpg\"",
|
||||||
"rd": "clickable desktop --dirty"
|
"test_pass": "clickable run \"cd build && ./TestPass\""
|
||||||
},
|
},
|
||||||
"dependencies_build": [
|
"dependencies_build": [
|
||||||
"texinfo",
|
"texinfo",
|
||||||
|
@ -17,148 +17,157 @@
|
|||||||
using namespace GpgME;
|
using namespace GpgME;
|
||||||
using namespace QGpgME;
|
using namespace QGpgME;
|
||||||
|
|
||||||
Gpg::Gpg() {
|
Gpg::Gpg()
|
||||||
auto error = initializeLibrary(OpenPGP);
|
{
|
||||||
if (error) {
|
auto error = initializeLibrary(OpenPGP);
|
||||||
qDebug() << "Code Error : " << error.code();
|
if (error) {
|
||||||
qDebug() << "Error str : " << error.asString();
|
qDebug() << "Code Error : " << error.code();
|
||||||
qFatal("GpgME init fail");
|
qDebug() << "Error str : " << error.asString();
|
||||||
}
|
qFatal("GpgME init fail");
|
||||||
|
}
|
||||||
|
|
||||||
QString gnuhome = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/gpghome");
|
QString gnuhome = QStandardPaths::writableLocation(
|
||||||
QDir dir(gnuhome);
|
QStandardPaths::AppDataLocation).append("/gpghome");
|
||||||
if (!dir.exists())
|
QDir dir(gnuhome);
|
||||||
dir.mkpath(".");
|
if (!dir.exists())
|
||||||
qputenv("GNUPGHOME", gnuhome.toStdString().c_str());
|
dir.mkpath(".");
|
||||||
qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME");
|
qputenv("GNUPGHOME", gnuhome.toStdString().c_str());
|
||||||
|
qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME");
|
||||||
|
|
||||||
error = checkEngine(OpenPGP);
|
error = checkEngine(OpenPGP);
|
||||||
if (error) {
|
if (error) {
|
||||||
qDebug() << "Code Error : " << error.code();
|
qDebug() << "Code Error : " << error.code();
|
||||||
qDebug() << "Error str : " << error.asString();
|
qDebug() << "Error str : " << error.asString();
|
||||||
qFatal("Engine check Fail");
|
qFatal("Engine check Fail");
|
||||||
|
}
|
||||||
}
|
qDebug() << "GpgME Engine Version :" << engineInfo(OpenPGP).version();
|
||||||
qDebug() << "GpgME Engine Version :" << engineInfo(OpenPGP).version();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gpg::list_dir() {
|
void Gpg::list_dir()
|
||||||
qDebug() << "hello world!";
|
{
|
||||||
|
qDebug() << "hello world!";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Gpg::decrypt(const QByteArray cipherText) {
|
QString Gpg::decrypt(const QByteArray cipherText)
|
||||||
/*auto decJob = openpgp()->decryptJob();
|
{
|
||||||
auto ctx = DecryptJob::context(decJob);*/
|
/*auto decJob = openpgp()->decryptJob();
|
||||||
|
auto ctx = DecryptJob::context(decJob);*/
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
* TestPassphraseProvider provider;
|
* TestPassphraseProvider provider;
|
||||||
ctx->setPassphraseProvider(&provider);
|
ctx->setPassphraseProvider(&provider);
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);*/
|
ctx->setPinentryMode(Context::PinentryLoopback);*/
|
||||||
|
|
||||||
/*QByteArray plainText;
|
/*QByteArray plainText;
|
||||||
decJob->exec(cipherText, plainText);
|
decJob->exec(cipherText, plainText);
|
||||||
|
|
||||||
return QString::fromUtf8(plainText);*/
|
return QString::fromUtf8(plainText);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Gpg::decrypt_file(const QString path) {
|
QString Gpg::decrypt_file(const QString path)
|
||||||
/*QFile file(path);
|
{
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
/*QFile file(path);
|
||||||
qErrnoWarning("Can't open the File");
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
return nullptr;
|
qErrnoWarning("Can't open the File");
|
||||||
}
|
return nullptr;
|
||||||
QByteArray plainText = file.readAll();
|
}
|
||||||
return this->decrypt(plainText);*/
|
QByteArray plainText = file.readAll();
|
||||||
|
return this->decrypt(plainText);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Gpg::encrypt(const QString str) {
|
QByteArray Gpg::encrypt(const QString str)
|
||||||
/*auto listjob = openpgp()->keyListJob(false, false, false);
|
{
|
||||||
std::vector<Key> keys;
|
/*auto listjob = openpgp()->keyListJob(false, false, false);
|
||||||
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), false, keys);
|
std::vector<Key> keys;
|
||||||
|
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), false, keys);
|
||||||
|
|
||||||
auto job = openpgp()
|
auto job = openpgp()
|
||||||
->encryptJob(
|
->encryptJob(
|
||||||
true, //ASCII Armor
|
true, //ASCII Armor
|
||||||
true //Textmode
|
true //Textmode
|
||||||
);
|
);
|
||||||
QByteArray cipherText;
|
QByteArray cipherText;
|
||||||
auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
|
auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
|
||||||
return cipherText;*/
|
return cipherText;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gpg::encrypt_file(const QString str, const QString path) {
|
bool Gpg::encrypt_file(const QString str, const QString path)
|
||||||
/*QFile file(path);
|
{
|
||||||
if (!file.open(QIODevice::WriteOnly)) {
|
/*QFile file(path);
|
||||||
qErrnoWarning("Can't open the File");
|
if (!file.open(QIODevice::WriteOnly)) {
|
||||||
return false;
|
qErrnoWarning("Can't open the File");
|
||||||
}
|
return false;
|
||||||
file.write(Pass::encrypt(str));
|
}
|
||||||
return true;*/
|
file.write(Pass::encrypt(str));
|
||||||
|
return true;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Gpg::get_key_id(QString uid) {
|
QString Gpg::get_key_id(QString uid)
|
||||||
qDebug() << "Getting the key id " << uid;
|
{
|
||||||
auto *job = openpgp()->keyListJob(false, false, false);
|
qDebug() << "Getting the key id " << uid;
|
||||||
std::vector<Key> keys;
|
auto *job = openpgp()->keyListJob(false, false, false);
|
||||||
auto result = job->exec(QStringList() << uid, false, keys);
|
std::vector<Key> keys;
|
||||||
delete job;
|
auto result = job->exec(QStringList() << uid, false, keys);
|
||||||
|
delete job;
|
||||||
|
|
||||||
if (keys.empty()) {
|
if (keys.empty()) {
|
||||||
qDebug() << "No key found for" << uid;
|
qDebug() << "No key found for" << uid;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const QString kId = QLatin1String(keys.front().keyID());
|
const QString kId = QLatin1String(keys.front().keyID());
|
||||||
qDebug() << "Id key for " << uid << "is : " << kId;
|
qDebug() << "Id key for " << uid << "is : " << kId;
|
||||||
return kId;
|
return kId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Gpg::get_all_keys_id() {
|
QStringList Gpg::get_all_keys_id()
|
||||||
qDebug() << "Show all available key";
|
{
|
||||||
auto job = openpgp()->keyListJob(false, false, false);
|
qDebug() << "Show all available key";
|
||||||
std::vector<Key> keys;
|
auto job = openpgp()->keyListJob(false, false, false);
|
||||||
auto result = job->exec(QStringList(""), false, keys);
|
std::vector<Key> keys;
|
||||||
delete job;
|
auto result = job->exec(QStringList(""), false, keys);
|
||||||
|
delete job;
|
||||||
|
|
||||||
if (keys.empty()) {
|
if (keys.empty()) {
|
||||||
qDebug() << "No key found";
|
qDebug() << "No key found";
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto r = QStringList();
|
auto r = QStringList();
|
||||||
for (const auto &key: keys) {
|
for (const auto &key : keys) {
|
||||||
r.append(QLatin1String(key.keyID()));
|
r.append(QLatin1String(key.keyID()));
|
||||||
qDebug() << "Key" << QLatin1String(key.keyID());
|
qDebug() << "Key" << QLatin1String(key.keyID());
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gpg::import_key(QString path) {
|
bool Gpg::import_key(QString path)
|
||||||
qDebug() << "Importing the key file" << path;
|
{
|
||||||
QFile file(path);
|
qDebug() << "Importing the key file" << path;
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
QFile file(path);
|
||||||
qWarning() << "Can't open the File";
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
return false;
|
qWarning() << "Can't open the File";
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto job = openpgp()->importJob();
|
auto job = openpgp()->importJob();
|
||||||
auto result = job->exec(file.readAll());
|
auto result = job->exec(file.readAll());
|
||||||
|
|
||||||
delete job;
|
delete job;
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if (result.error()) {
|
if (result.error()) {
|
||||||
qWarning() << "Import go wrong";
|
qWarning() << "Import go wrong";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Key imported" << result.numImported();
|
qDebug() << "Key imported" << result.numImported();
|
||||||
qDebug() << "Key not imported" << result.notImported();
|
qDebug() << "Key not imported" << result.notImported();
|
||||||
qDebug() << "Key unchanged" << result.numUnchanged();
|
qDebug() << "Key unchanged" << result.numUnchanged();
|
||||||
qDebug() << "Result null" << result.isNull();
|
qDebug() << "Result null" << result.isNull();
|
||||||
qDebug() << "newUserIDs" << result.newUserIDs();
|
qDebug() << "newUserIDs" << result.newUserIDs();
|
||||||
|
|
||||||
for (const auto &key: result.imports())
|
for (const auto &key : result.imports())
|
||||||
qDebug() << "Key" << key.fingerprint();
|
qDebug() << "Key" << key.fingerprint();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -3,21 +3,22 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class Gpg : public QObject {
|
class Gpg : public QObject
|
||||||
Q_OBJECT
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Gpg();
|
Gpg();
|
||||||
~Gpg() = default;
|
~Gpg() = default;
|
||||||
|
|
||||||
Q_INVOKABLE void list_dir();
|
Q_INVOKABLE void list_dir();
|
||||||
Q_INVOKABLE QString get_key_id(QString uid);
|
Q_INVOKABLE QString get_key_id(QString uid);
|
||||||
Q_INVOKABLE QStringList get_all_keys_id();
|
Q_INVOKABLE QStringList get_all_keys_id();
|
||||||
Q_INVOKABLE bool import_key(QString path);
|
Q_INVOKABLE bool import_key(QString path);
|
||||||
Q_INVOKABLE QString decrypt(QByteArray plainText);
|
Q_INVOKABLE QString decrypt(QByteArray plainText);
|
||||||
Q_INVOKABLE QString decrypt_file(QString path);
|
Q_INVOKABLE QString decrypt_file(QString path);
|
||||||
Q_INVOKABLE QByteArray encrypt(QString str);
|
Q_INVOKABLE QByteArray encrypt(QString str);
|
||||||
Q_INVOKABLE bool encrypt_file(QString str, QString path);
|
Q_INVOKABLE bool encrypt_file(QString str, QString path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
|
||||||
void FileSystemPlugin::registerTypes(const char *uri) {
|
void FileSystemPlugin::registerTypes(const char *uri)
|
||||||
//@uri Pass
|
{
|
||||||
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });
|
//@uri Pass
|
||||||
|
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
#include <QQmlExtensionPlugin>
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
class FileSystemPlugin : public QQmlExtensionPlugin {
|
class FileSystemPlugin : public QQmlExtensionPlugin
|
||||||
Q_OBJECT
|
{
|
||||||
Q_PLUGIN_METADATA(IID
|
Q_OBJECT
|
||||||
"org.qt-project.Qt.QQmlExtensionInterface")
|
Q_PLUGIN_METADATA(IID
|
||||||
|
"org.qt-project.Qt.QQmlExtensionInterface")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void registerTypes(const char *uri);
|
void registerTypes(const char *uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
#include "pass.h"
|
#include "pass.h"
|
||||||
|
|
||||||
Pass::Pass() {
|
Pass::Pass()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::speak() {
|
void Pass::speak()
|
||||||
qDebug() << "Starting app from main.cpp";
|
{
|
||||||
|
qDebug() << "Starting app from main.cpp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,15 +3,16 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class Pass : public QObject {
|
class Pass : public QObject
|
||||||
Q_OBJECT
|
{
|
||||||
QString gpgHome;
|
Q_OBJECT
|
||||||
|
QString gpgHome;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Pass();
|
Pass();
|
||||||
~Pass() override = default;
|
~Pass() override = default;
|
||||||
|
|
||||||
Q_INVOKABLE void speak();
|
Q_INVOKABLE void speak();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "pass.h"
|
#include "pass.h"
|
||||||
|
|
||||||
void PassPlugin::registerTypes(const char *uri) {
|
void PassPlugin::registerTypes(const char *uri)
|
||||||
//@uri Pass
|
{
|
||||||
qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; });
|
//@uri Pass
|
||||||
|
qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; });
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
#include <QQmlExtensionPlugin>
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
class PassPlugin : public QQmlExtensionPlugin {
|
class PassPlugin : public QQmlExtensionPlugin
|
||||||
Q_OBJECT
|
{
|
||||||
Q_PLUGIN_METADATA(IID
|
Q_OBJECT
|
||||||
"org.qt-project.Qt.QQmlExtensionInterface")
|
Q_PLUGIN_METADATA(IID
|
||||||
|
"org.qt-project.Qt.QQmlExtensionInterface")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void registerTypes(const char *uri) override;
|
void registerTypes(const char *uri) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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: 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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -17,32 +17,32 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ../qml/pages/PasswordList.qml:17
|
#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:49
|
||||||
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
|
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/headers/MainHeader.qml:8 ../qml/pages/headers/StackHeader.qml:8
|
#: ../qml/pages/PasswordList.qml:16
|
||||||
#: ../qml/pages/Info.qml:43 UTPass.desktop.in.h:1
|
msgid "Back"
|
||||||
msgid "UTPass"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/pages/headers/MainHeader.qml:23
|
#: ../qml/pages/PasswordList.qml:38
|
||||||
#: ../qml/pages/headers/MainHeader.qml:36
|
msgid "No password found in the current folder"
|
||||||
msgid "Search"
|
|
||||||
msgstr ""
|
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"
|
msgid "Info"
|
||||||
msgstr ""
|
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
|
#: ../qml/pages/Info.qml:53
|
||||||
msgid "Suggest improvement(s) or report a bug(s)"
|
msgid "Suggest improvement(s) or report a bug(s)"
|
||||||
msgstr ""
|
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"
|
import "components"
|
||||||
|
|
||||||
MainView {
|
MainView {
|
||||||
id: root
|
id: "root"
|
||||||
objectName: "mainView"
|
objectName: "mainView"
|
||||||
applicationName: "utpass.qrouland"
|
applicationName: "utpass.qrouland"
|
||||||
|
|
||||||
@ -18,7 +18,12 @@ MainView {
|
|||||||
id: pageStack
|
id: pageStack
|
||||||
anchors.fill: parent
|
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
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: units.gu(4)
|
width: units.gu(4)
|
||||||
height: units.gu(4)
|
height: units.gu(4)
|
||||||
name: fileIsDir ? "go-next" : "lock"
|
name: fileIsDir ? "go-next" : "lock"
|
||||||
color: Theme.raisin_black
|
color: Theme.raisin_black
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
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 {
|
CustomBorder {
|
||||||
|
@ -3,19 +3,19 @@ import Ubuntu.Components 1.3
|
|||||||
import "../styles"
|
import "../styles"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
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
|
||||||
property int tBorderwidth : 0
|
property int tBorderwidth: 0
|
||||||
property int bBorderwidth : 0
|
property int bBorderwidth: 0
|
||||||
property int commonBorderWidth : 0
|
property int commonBorderWidth: 0
|
||||||
property string borderColor : UbuntuColors.warmGrey
|
property string borderColor: UbuntuColors.warmGrey
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: units.gu(6)
|
height: units.gu(6)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -33,17 +33,19 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: units.gu(4)
|
width: units.gu(4)
|
||||||
height: units.gu(4)
|
height: units.gu(4)
|
||||||
name: "go-next"
|
name: "go-next"
|
||||||
color: Theme.raisin_black
|
color: Theme.raisin_black
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: { Qt.openUrlExternally(parent.parent.url); }
|
onClicked: {
|
||||||
|
Qt.openUrlExternally(parent.parent.url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomBorder {
|
CustomBorder {
|
||||||
id : cb
|
id: cb
|
||||||
commonBorder: parent.parent.commonBorder
|
commonBorder: parent.parent.commonBorder
|
||||||
lBorderwidth: parent.parent.lBorderwidth
|
lBorderwidth: parent.parent.lBorderwidth
|
||||||
rBorderwidth: parent.parent.rBorderwidth
|
rBorderwidth: parent.parent.rBorderwidth
|
||||||
|
@ -2,5 +2,4 @@ pragma Singleton
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
|
||||||
Item {
|
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 {
|
Page {
|
||||||
header: StackHeader {
|
header: StackHeader {
|
||||||
id : infoHeader
|
id: infoHeader
|
||||||
title: i18n.tr('Info')
|
title: i18n.tr('Info')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,22 +19,22 @@ Page {
|
|||||||
spacing: 2
|
spacing: 2
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: units.gu(4)
|
height: units.gu(4)
|
||||||
}
|
}
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: units.gu(4)
|
height: units.gu(4)
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@ -55,5 +55,3 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@ import Qt.labs.folderlistmodel 2.1
|
|||||||
import "../components"
|
import "../components"
|
||||||
import "headers"
|
import "headers"
|
||||||
|
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
header : MainHeader {
|
header: MainHeader {
|
||||||
flickable : nav
|
flickable: nav
|
||||||
|
|
||||||
leadingActionBar.height: units.gu(4)
|
leadingActionBar.height: units.gu(4)
|
||||||
leadingActionBar.actions: [
|
leadingActionBar.actions: [
|
||||||
@ -15,11 +14,11 @@ Page {
|
|||||||
id: backAction
|
id: backAction
|
||||||
iconName: "back"
|
iconName: "back"
|
||||||
text: i18n.tr("Back")
|
text: i18n.tr("Back")
|
||||||
visible:false
|
visible: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
folderModel.folder = folderModel.parentFolder;
|
folderModel.folder = folderModel.parentFolder
|
||||||
if(folderModel.rootFolder === folderModel.folder) {
|
if (folderModel.rootFolder === folderModel.folder) {
|
||||||
backAction.visible = false;
|
backAction.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +41,7 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 1
|
spacing: 1
|
||||||
model: FolderListModel {
|
model: FolderListModel {
|
||||||
|
@ -4,7 +4,7 @@ import "headers"
|
|||||||
|
|
||||||
Page {
|
Page {
|
||||||
header: StackHeader {
|
header: StackHeader {
|
||||||
id:settingsHeader
|
id: settingsHeader
|
||||||
title: i18n.tr('Settings')
|
title: i18n.tr('Settings')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,8 +23,6 @@ Page {
|
|||||||
height: units.gu(6)
|
height: units.gu(6)
|
||||||
text: "Settings"
|
text: "Settings"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,23 +8,25 @@ PageHeader {
|
|||||||
title: i18n.tr("UTPass")
|
title: i18n.tr("UTPass")
|
||||||
|
|
||||||
contents: Item {
|
contents: Item {
|
||||||
height : parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Label {
|
Label {
|
||||||
id : labelTitle
|
id: labelTitle
|
||||||
text: mainHeader.title
|
text: mainHeader.title
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: searchBar
|
id: searchBar
|
||||||
anchors.right : parent.right
|
anchors.right: parent.right
|
||||||
anchors.left : parent.left
|
anchors.left: parent.left
|
||||||
placeholderText: i18n.tr("Search")
|
placeholderText: i18n.tr("Search")
|
||||||
height: units.gu(4)
|
height: units.gu(4)
|
||||||
visible: false
|
visible: false
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onFocusChanged: {}
|
onFocusChanged: {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +37,8 @@ PageHeader {
|
|||||||
iconName: "search"
|
iconName: "search"
|
||||||
text: i18n.tr("Search")
|
text: i18n.tr("Search")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
searchBar.visible = !searchBar.visible;
|
searchBar.visible = !searchBar.visible
|
||||||
labelTitle.visible = !searchBar.visible;
|
labelTitle.visible = !searchBar.visible
|
||||||
if (searchBar.visible === true) {
|
if (searchBar.visible === true) {
|
||||||
searchBar.focus = true
|
searchBar.focus = true
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ PageHeader {
|
|||||||
title: i18n.tr("UTPass")
|
title: i18n.tr("UTPass")
|
||||||
|
|
||||||
contents: Item {
|
contents: Item {
|
||||||
height : parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Label {
|
Label {
|
||||||
id : labelTitle
|
id: labelTitle
|
||||||
text: stackHeader.title
|
text: stackHeader.title
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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
|
// @ https://stackoverflow.com/questions/16534489/qml-control-border-width-and-color-on-any-one-side-of-rectangle-element#16562823
|
||||||
import QtQuick 2.4
|
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
|
z: -1
|
||||||
|
|
||||||
property string borderColor : "white"
|
property string borderColor: "white"
|
||||||
|
|
||||||
color: borderColor
|
color: borderColor
|
||||||
|
|
||||||
anchors
|
anchors {
|
||||||
{
|
|
||||||
left: parent.left
|
left: parent.left
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ pragma Singleton
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
readonly property color claret : "#77172A"
|
readonly property color claret: "#77172A"
|
||||||
readonly property color raisin_black : "#AE2B25"
|
readonly property color raisin_black: "#AE2B25"
|
||||||
readonly property color steel_blue : "#462C98"
|
readonly property color steel_blue: "#462C98"
|
||||||
readonly property color twilight_lavender : "#754888"
|
readonly property color twilight_lavender: "#754888"
|
||||||
readonly property color eerie_black : "#191716"
|
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}
|
INSTALL_DIR ${EXTERNAL_LIBS}
|
||||||
DOWNLOAD_COMMAND ""
|
DOWNLOAD_COMMAND ""
|
||||||
SOURCE_DIR ${GNUPG_PATH}
|
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_IN_SOURCE 1
|
||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
INSTALL_COMMAND make install
|
INSTALL_COMMAND make install
|
||||||
|
Loading…
Reference in New Issue
Block a user