File indexing completed on 2024-06-09 05:02:29

0001 /*
0002     A gwenhywfar gui for aqbanking using KDE widgets
0003     SPDX-FileCopyrightText: 2014-2016 Christian David <christian-david@web.de>
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 
0006 */
0007 
0008 #ifndef GWENKDEGUI_H
0009 #define GWENKDEGUI_H
0010 
0011 #include <QObject>
0012 
0013 #include "gwen-gui-qt5/qt5_gui.hpp"
0014 #include "gwen-gui-qt5/qt5_gui_dialog.hpp"
0015 
0016 /**
0017  * @brief Gwenhywfar Gui by KDE
0018  *
0019  *
0020  * @author Christian David
0021  */
0022 class gwenKdeGui : public QT5_Gui
0023 {
0024 public:
0025     gwenKdeGui();
0026     ~gwenKdeGui();
0027 
0028     int getPassword(uint32_t flags,
0029                     const char *token,
0030                     const char *title,
0031                     const char *text,
0032                     char *buffer,
0033                     int minLen,
0034                     int maxLen,
0035                     GWEN_GUI_PASSWORD_METHOD methodId,
0036                     GWEN_DB_NODE *methodParams,
0037                     uint32_t guiid) final override;
0038 
0039     int execDialog(GWEN_DIALOG *dlg, GWEN_UNUSED uint32_t guiid) final override;
0040 
0041 private:
0042     int getPasswordText(uint32_t flags,
0043                         const char *token,
0044                         const char *title,
0045                         const char *text,
0046                         char *buffer,
0047                         int minLen,
0048                         int maxLen,
0049                         GWEN_GUI_PASSWORD_METHOD methodId,
0050                         GWEN_DB_NODE *methodParams,
0051                         uint32_t guiid);
0052     int getPasswordHhd(uint32_t flags,
0053                        const char *token,
0054                        const char *title,
0055                        const char *text,
0056                        char *buffer,
0057                        int minLen,
0058                        int maxLen,
0059                        GWEN_GUI_PASSWORD_METHOD methodId,
0060                        GWEN_DB_NODE *methodParams,
0061                        uint32_t guiid);
0062     int getPasswordPhoto(uint32_t flags,
0063                          const char *token,
0064                          const char *title,
0065                          const char *text,
0066                          char *buffer,
0067                          int minLen,
0068                          int maxLen,
0069                          GWEN_GUI_PASSWORD_METHOD methodId,
0070                          GWEN_DB_NODE *methodParams,
0071                          uint32_t guiid);
0072 
0073     QString passwordId;
0074 };
0075 
0076 /**
0077  * @brief Helper class which is receiver for several signals
0078  */
0079 class gwenKdeGuiTanResult : public QObject
0080 {
0081     Q_OBJECT
0082 
0083 public:
0084     explicit gwenKdeGuiTanResult(QObject* parent = nullptr)
0085         : QObject(parent),
0086           m_tan(QString()),
0087           m_aborted(false)
0088     {}
0089 
0090     ~gwenKdeGuiTanResult() {}
0091 
0092     QString tan() {
0093         return m_tan;
0094     }
0095 
0096     bool aborted() {
0097         return m_aborted;
0098     }
0099 
0100 public Q_SLOTS:
0101     void abort() {
0102         m_aborted = true;
0103     }
0104 
0105     void acceptTan(QString tan) {
0106         m_tan = tan;
0107         m_aborted = false;
0108     }
0109 
0110 private:
0111     QString m_tan;
0112     bool m_aborted;
0113 };
0114 
0115 #endif // GWENKDEGUI_H