gwenhywfar  4.3.1
cpp/cppgui.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright   : (C) 2004 by Martin Preuss
00003     email       : martin@libchipcard.de
00004 
00005  ***************************************************************************
00006  *          Please see toplevel file COPYING for license details           *
00007  ***************************************************************************/
00008 
00009 #ifndef CPPGUI_HPP
00010 #define CPPGUI_HPP
00011 
00012 
00013 #include <gwenhywfar/gui_be.h>
00014 #include <gwenhywfar/i18n.h>
00015 
00016 #define I18N(msg) GWEN_I18N_Translate(PACKAGE, msg)
00017 #define I18S(msg) msg
00018 
00019 #include <list>
00020 #include <string>
00021 
00022 class CppGui;
00023 
00024 #include <gwen-gui-cpp/cppdialog.hpp>
00025 
00026 
00036 class CppGui {
00037   friend class CppGuiLinker;
00038 
00039 private:
00040   GWEN_GUI_CHECKCERT_FN _checkCertFn;
00041 
00042   GWEN_DB_NODE *_dbPasswords;
00043   std::list<std::string> _badPasswords;
00044 
00045   GWEN_GUI_PRINT_FN _printFn;
00046   GWEN_GUI_GETPASSWORD_FN _getPasswordFn;
00047   GWEN_GUI_SETPASSWORDSTATUS_FN _setPasswordStatusFn;
00048   GWEN_GUI_EXEC_DIALOG_FN _execDialogFn;
00049   GWEN_GUI_OPEN_DIALOG_FN _openDialogFn;
00050   GWEN_GUI_CLOSE_DIALOG_FN _closeDialogFn;
00051   GWEN_GUI_RUN_DIALOG_FN _runDialogFn;
00052 
00053   GWEN_GUI_GET_FILENAME_FN _getFileNameFn;
00054 
00055 
00056   std::string _getPasswordHash(const char *token, const char *pin);
00057 
00058 public:
00059   CppGui();
00060   virtual ~CppGui();
00061 
00062   static CppGui *getCppGui();
00063 
00064   GWEN_GUI *getCInterface();
00065 
00066 protected:
00067   GWEN_GUI *_gui;
00068 
00073 
00077   virtual int print(const char *docTitle,
00078                     const char *docType,
00079                     const char *descr,
00080                     const char *text,
00081                     uint32_t guiid);
00082 
00083   virtual int getPassword(uint32_t flags,
00084                           const char *token,
00085                           const char *title,
00086                           const char *text,
00087                           char *buffer,
00088                           int minLen,
00089                           int maxLen,
00090                           uint32_t guiid);
00091 
00092   virtual int setPasswordStatus(const char *token,
00093                                 const char *pin,
00094                                 GWEN_GUI_PASSWORD_STATUS status,
00095                                 uint32_t guiid);
00096 
00097   virtual int checkCert(const GWEN_SSLCERTDESCR *cert,
00098                         GWEN_SYNCIO *sio,
00099                         uint32_t guiid);
00100 
00101   virtual int logHook(const char *logDomain,
00102                       GWEN_LOGGER_LEVEL priority, const char *s);
00103 
00104   virtual int execDialog(GWEN_DIALOG *dlg, uint32_t guiid);
00105 
00106   virtual int openDialog(GWEN_DIALOG *dlg, uint32_t guiid);
00107   virtual int closeDialog(GWEN_DIALOG *dlg);
00108   virtual int runDialog(GWEN_DIALOG *dlg, int untilEnd);
00109 
00110   virtual int getFileName(const char *caption,
00111                           GWEN_GUI_FILENAME_TYPE fnt,
00112                           uint32_t flags,
00113                           const char *patterns,
00114                           GWEN_BUFFER *pathBuffer,
00115                           uint32_t guiid);
00116 
00117 
00118   int checkCertBuiltIn(const GWEN_SSLCERTDESCR *cert,
00119                        GWEN_SYNCIO *sio,
00120                        uint32_t guiid);
00121 
00122   };
00123 
00124 
00125 
00126 
00127 #endif /* CPPGUI_HPP */
00128 
00129