gwenhywfar  4.3.3
cpp/cppgui.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2004 by Martin Preuss
3  email : martin@libchipcard.de
4 
5  ***************************************************************************
6  * Please see toplevel file COPYING for license details *
7  ***************************************************************************/
8 
9 #ifndef CPPGUI_HPP
10 #define CPPGUI_HPP
11 
12 
13 #include <gwenhywfar/gui_be.h>
14 #include <gwenhywfar/i18n.h>
15 
16 #define I18N(msg) GWEN_I18N_Translate(PACKAGE, msg)
17 #define I18S(msg) msg
18 
19 #include <list>
20 #include <string>
21 
22 class CppGui;
23 
24 #include <gwen-gui-cpp/cppdialog.hpp>
25 
26 
36 class CppGui {
37  friend class CppGuiLinker;
38 
39 private:
40  GWEN_GUI_CHECKCERT_FN _checkCertFn;
41 
42  GWEN_DB_NODE *_dbPasswords;
43  std::list<std::string> _badPasswords;
44 
45  GWEN_GUI_PRINT_FN _printFn;
46  GWEN_GUI_GETPASSWORD_FN _getPasswordFn;
47  GWEN_GUI_SETPASSWORDSTATUS_FN _setPasswordStatusFn;
48  GWEN_GUI_EXEC_DIALOG_FN _execDialogFn;
49  GWEN_GUI_OPEN_DIALOG_FN _openDialogFn;
50  GWEN_GUI_CLOSE_DIALOG_FN _closeDialogFn;
51  GWEN_GUI_RUN_DIALOG_FN _runDialogFn;
52 
53  GWEN_GUI_GET_FILENAME_FN _getFileNameFn;
54 
55 
56  std::string _getPasswordHash(const char *token, const char *pin);
57 
58 public:
59  CppGui();
60  virtual ~CppGui();
61 
62  static CppGui *getCppGui();
63 
65 
66 protected:
68 
73 
77  virtual int print(const char *docTitle,
78  const char *docType,
79  const char *descr,
80  const char *text,
81  uint32_t guiid);
82 
83  virtual int getPassword(uint32_t flags,
84  const char *token,
85  const char *title,
86  const char *text,
87  char *buffer,
88  int minLen,
89  int maxLen,
90  uint32_t guiid);
91 
92  virtual int setPasswordStatus(const char *token,
93  const char *pin,
95  uint32_t guiid);
96 
97  virtual int checkCert(const GWEN_SSLCERTDESCR *cert,
98  GWEN_SYNCIO *sio,
99  uint32_t guiid);
100 
101  virtual int logHook(const char *logDomain,
102  GWEN_LOGGER_LEVEL priority, const char *s);
103 
104  virtual int execDialog(GWEN_DIALOG *dlg, uint32_t guiid);
105 
106  virtual int openDialog(GWEN_DIALOG *dlg, uint32_t guiid);
107  virtual int closeDialog(GWEN_DIALOG *dlg);
108  virtual int runDialog(GWEN_DIALOG *dlg, int untilEnd);
109 
110  virtual int getFileName(const char *caption,
112  uint32_t flags,
113  const char *patterns,
114  GWEN_BUFFER *pathBuffer,
115  uint32_t guiid);
116 
117 
118  int checkCertBuiltIn(const GWEN_SSLCERTDESCR *cert,
119  GWEN_SYNCIO *sio,
120  uint32_t guiid);
121 
122  };
123 
124 
125 
126 
127 #endif /* CPPGUI_HPP */
128 
129