diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abe8f96..de359a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (C) 2018 Intevation GmbH # # This file is Free Software under the GNU GPL (v>=2) # and comes with ABSOLUTELY NO WARRANTY! # See LICENSE.txt for details. include_directories(${Qt5Core_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(util) add_subdirectory(resolver) add_subdirectory(overlayer) add_subdirectory(gpgolconfig) +add_subdirectory(gpgcardgui) add_subdirectory(gpgolkeyadder) diff --git a/src/gpgcardgui/CMakeLists.txt b/src/gpgcardgui/CMakeLists.txt new file mode 100644 index 0000000..961b2d2 --- /dev/null +++ b/src/gpgcardgui/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (C) 2018 Intevation GmbH +# +# This file is Free Software under the GNU GPL (v>=2) +# and comes with ABSOLUTELY NO WARRANTY! +# See LICENSE.txt for details. + +set(EXECUTABLE_NAME "gpgcardgui") + +set(EXECUTABLE_SRC + main.cpp +) + +add_executable(${EXECUTABLE_NAME} + ${_add_executable_params} + ${EXECUTABLE_SRC} +) + +target_link_libraries(${EXECUTABLE_NAME} + Qt5::Widgets + KF5::Libkleo + Gpgmepp + QGpgme +) + +if (WIN32) + set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "-municode") +endif(WIN32) + +install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin) diff --git a/src/gpgcardgui/GPGAbstracrCard.cpp b/src/gpgcardgui/GPGAbstracrCard.cpp new file mode 100644 index 0000000..31b7e12 --- /dev/null +++ b/src/gpgcardgui/GPGAbstracrCard.cpp @@ -0,0 +1,23 @@ +#include "GPGAbstractCard.h" + +GPGCard::GPGAbstractCard::GPGAbstractCard() +{ + QObject *parent; + QString program = "/usr/bin/gpg-card"; // FIXME add autodiscoverw + QStringList arguments; + arguments << "list"; + + QProcess *myProcess = new QProcess(parent); + myProcess->setReadChannel(QProcess::StandardOutput); + QObject::connect(myProcess, &QProcess::readyReadStandardOutput, readStdoutLine); +} + +GPGCard::GPGAbstractCard::~GPGAbstractCard() +{ + +} + +void GPGCard::GPGAbstractCard::RecieveStdout(QString StdOut) +{ + qInfo() << StdOut; +} diff --git a/src/gpgcardgui/GPGAbstractCard.h b/src/gpgcardgui/GPGAbstractCard.h new file mode 100644 index 0000000..6370ac8 --- /dev/null +++ b/src/gpgcardgui/GPGAbstractCard.h @@ -0,0 +1,15 @@ +#pragma once +#include +#include + +class GpgCard; +class GPGAbstractCard { +public: + GPGAbstractCard(); + + // set, getter +private: + gpgcard_process *QProcess; +private slots: + void RecieveStdOut(QString StdOut); +} diff --git a/src/gpgcardgui/gpgcardgui.h b/src/gpgcardgui/gpgcardgui.h new file mode 100644 index 0000000..83f83dd --- /dev/null +++ b/src/gpgcardgui/gpgcardgui.h @@ -0,0 +1,13 @@ +#pragma once +#include +#include + +class GpgCard; +class BasicCard { +public: + BasicCard(); + + // set, getter +private slots: + void RecieveStdOut(QString StdOut); +} diff --git a/src/gpgcardgui/main.cpp b/src/gpgcardgui/main.cpp new file mode 100644 index 0000000..38e147d --- /dev/null +++ b/src/gpgcardgui/main.cpp @@ -0,0 +1,81 @@ +/* Copyright (C) 2018 by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=2) + * and comes with ABSOLUTELY NO WARRANTY! + * See LICENSE.txt for details. + */ + +/** @file Main entry point for the application. + */ +#include "strhelp.h" +#include "gpgcardgui.h" +#include +#include + +#include + +#include +#include +#include +#include +#include + +#ifndef APPNAME +#define APPNAME "Resolver" +#endif + +#ifndef VERSION +#define VERSION "0.0" +#endif + +/** @brief The real entry point to the application. + * + * @param [in] argc the count of the arguments. + * @param [in] argv On GNU/Linux this function expects argv to be in the + * native system encoding. On Windows the arguments + * shall be UTF-8 + * + * @returns 0 on success an error code otherwise. */ + + + +void readStdoutLine(QString line) +{ + qInfo() << line; +} + + +int main(int argc, char **argv) +{ + /* QApplication setup */ + QApplication app(argc, argv); + QApplication::setOrganizationName(QStringLiteral(APPNAME)); + QApplication::setApplicationName(QStringLiteral(APPNAME)); + QApplication::setApplicationVersion(QStringLiteral(VERSION)); + + + /* Parse the command line */ + QCommandLineParser parser; + + + const auto lang = parser.value("lang"); + + if (!lang.isEmpty()) { + qputenv("LANG", lang.toUtf8()); + } + + + QObject *parent; + QString program = "/usr/bin/gpg-card"; + QStringList arguments; + arguments << "list"; + + QProcess *myProcess = new QProcess(parent); + myProcess->setReadChannel(QProcess::StandardOutput); + QObject::connect(myProcess, &QProcess::readyReadStandardOutput, readStdoutLine); + + myProcess->start(program, arguments); + + + return EXIT_SUCCESS; +}