Code style

This commit is contained in:
Quentin Rouland 2019-03-21 00:04:05 +01:00
parent 3cbd834787
commit aa4018c680
12 changed files with 166 additions and 169 deletions

View File

@ -62,19 +62,19 @@ file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.q
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE_NAME}.in.h) list(APPEND I18N_SRC_FILES ${DESKTOP_FILE_NAME}.in.h)
find_program(INTLTOOL_MERGE intltool-merge) find_program(INTLTOOL_MERGE intltool-merge)
if(NOT INTLTOOL_MERGE) if (NOT INTLTOOL_MERGE)
message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package") message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
endif() endif ()
find_program(INTLTOOL_EXTRACT intltool-extract) find_program(INTLTOOL_EXTRACT intltool-extract)
if(NOT INTLTOOL_EXTRACT) if (NOT INTLTOOL_EXTRACT)
message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package") message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
endif() endif ()
add_custom_target(${DESKTOP_FILE_NAME} ALL add_custom_target(${DESKTOP_FILE_NAME} ALL
COMMENT "Merging translations into ${DESKTOP_FILE_NAME}..." COMMENT "Merging translations into ${DESKTOP_FILE_NAME}..."
COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${CMAKE_SOURCE_DIR}/${DESKTOP_FILE_NAME}.in ${DESKTOP_FILE_NAME} COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${CMAKE_SOURCE_DIR}/${DESKTOP_FILE_NAME}.in ${DESKTOP_FILE_NAME}
COMMAND sed -i 's/${PROJECT_NAME}-//g' ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} COMMAND sed -i 's/${PROJECT_NAME}-//g' ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}
) )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
@ -95,6 +95,6 @@ file(GLOB_RECURSE PROJECT_SRC_FILES
*.json.in *.json.in
*.apparmor *.apparmor
*.desktop.in *.desktop.in
) )
add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES} ) add_custom_target(${PROJECT_NAME}_FILES ALL SOURCES ${PROJECT_SRC_FILES})

View File

@ -1,7 +1,6 @@
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QtCore/QDirIterator>
#include <QtCore/QStandardPaths> #include <QtCore/QStandardPaths>
#include "gpg.h" #include "gpg.h"
@ -28,7 +27,8 @@ Gpg::Gpg() {
QString gnuhome = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/gpghome"); QString gnuhome = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/gpghome");
QDir dir(gnuhome); QDir dir(gnuhome);
if (!dir.exists()) dir.mkpath("."); if (!dir.exists())
dir.mkpath(".");
qputenv("GNUPGHOME", gnuhome.toStdString().c_str()); qputenv("GNUPGHOME", gnuhome.toStdString().c_str());
qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME"); qDebug() << "GNUPGHOME is :" << qgetenv("GNUPGHOME");
@ -96,8 +96,6 @@ bool Gpg::encrypt_file(const QString str, const QString path) {
return true;*/ return true;*/
} }
QString Gpg::get_key_id(QString uid) { QString Gpg::get_key_id(QString uid) {
qDebug() << "Getting the key id " << uid; qDebug() << "Getting the key id " << uid;
auto *job = openpgp()->keyListJob(false, false, false); auto *job = openpgp()->keyListJob(false, false, false);
@ -122,12 +120,12 @@ QStringList Gpg::get_all_keys_id() {
delete job; 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());
} }
@ -148,7 +146,7 @@ bool Gpg::import_key(QString path) {
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;
} }
@ -159,7 +157,7 @@ bool Gpg::import_key(QString path) {
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;

View File

@ -3,10 +3,10 @@
#include <QObject> #include <QObject>
class Gpg: public QObject { class Gpg : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Gpg(); Gpg();
~Gpg() = default; ~Gpg() = default;

View File

@ -1,10 +1,9 @@
#include <QtQml> #include <QtQml>
#include <QtQml/QQmlContext>
#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 //@uri Pass
qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine*, QJSEngine*) -> QObject* { return new Gpg; }); qmlRegisterSingletonType<Gpg>(uri, 1, 0, "Gpg", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Gpg; });
} }

View File

@ -5,9 +5,10 @@
class FileSystemPlugin : public QQmlExtensionPlugin { class FileSystemPlugin : public QQmlExtensionPlugin {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "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);
}; };

View File

@ -3,7 +3,6 @@
#include "pass.h" #include "pass.h"
Pass::Pass() { Pass::Pass() {
} }

View File

@ -3,11 +3,11 @@
#include <QObject> #include <QObject>
class Pass: public QObject { class Pass : public QObject {
Q_OBJECT Q_OBJECT
QString gpgHome; QString gpgHome;
public: public:
Pass(); Pass();
~Pass() override = default; ~Pass() override = default;

View File

@ -1,10 +1,9 @@
#include <QtQml> #include <QtQml>
#include <QtQml/QQmlContext>
#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 //@uri Pass
qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine*, QJSEngine*) -> QObject* { return new Pass; }); qmlRegisterSingletonType<Pass>(uri, 1, 0, "Pass", [](QQmlEngine *, QJSEngine *) -> QObject * { return new Pass; });
} }

View File

@ -5,9 +5,10 @@
class PassPlugin : public QQmlExtensionPlugin { class PassPlugin : public QQmlExtensionPlugin {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "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;
}; };

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: utpass.qrouland\n" "Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-20 22:15+0000\n" "POT-Creation-Date: 2019-03-20 22:31+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"