~szszszsz/nitrokey/release_no_gpg

« back to all changes in this revision

Viewing changes to src/ui/mainwindow.h

  • Committer: Szczepan Zalega
  • Date: 2016-09-28 08:21:46 UTC
  • Revision ID: git-v1:d7fb3cc165e41a9f70009a4f16fc9078c8f89b8e
release v0.5

Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "device.h"
25
25
#include <QMainWindow>
26
26
#include <QSystemTrayIcon>
 
27
#include <QValidator>
 
28
 
27
29
#include <climits>
28
30
 
29
31
#define uint64_t unsigned long long
76
78
  void closeEvent(QCloseEvent *event);
77
79
 
78
80
private:
 
81
    bool validate_secret(const uint8_t *secret) const;
 
82
    void initialTimeReset(int ret);
 
83
    QMutex check_connection_mutex;
 
84
  QString nkpro_user_PIN;
 
85
  void overwrite_string(QString &str);
 
86
 
79
87
  void InitState();
80
88
  void createIndicator();
81
89
  void startDebug();
87
95
  AppIndicator *indicator;
88
96
  GtkWidget *indicatorMenu;
89
97
#endif // HAVE_LIBAPPINDICATOR
 
98
 
90
99
  QSystemTrayIcon *trayIcon;
91
100
  QMenu *trayMenu;
92
101
  QMenu *trayMenuSubConfigure;
157
166
  QString DebugText;
158
167
  QString otpInClipboard;
159
168
  QString secretInClipboard;
 
169
  QString PWSInClipboard;
160
170
 
161
171
  int ExecStickCmd(char *Cmdline);
162
172
  int getNextCode(uint8_t slotNumber);
178
188
  int UpdateDynamicMenuEntrys(void);
179
189
  int AnalyseProductionInfos();
180
190
  void refreshStick20StatusData();
 
191
  void translateDeviceStatusToUserMessage(const int getStatus);
 
192
  void showTrayMessage(QString message);
181
193
 
182
194
public slots:
183
195
  void startAboutDialog();
214
226
private slots:
215
227
  void resizeMin();
216
228
  void checkConnection();
217
 
  void getCode(uint8_t slotNo);
 
229
 
218
230
  void on_writeButton_clicked();
219
231
  void displayCurrentTotpSlotConfig(uint8_t slotNo);
220
232
  void displayCurrentHotpSlotConfig(uint8_t slotNo);
230
242
  void on_writeGeneralConfigButton_clicked();
231
243
 
232
244
  void copyToClipboard(QString text);
233
 
  void checkClipboard_Valid();
 
245
  void checkClipboard_Valid(bool ignore_time = false);
234
246
  void checkPasswordTime_Valid();
235
247
  void checkTextEdited();
236
248
 
306
318
  void on_counterEdit_editingFinished();
307
319
  void on_radioButton_2_toggled(bool checked);
308
320
  void on_radioButton_toggled(bool checked);
 
321
  void on_PWS_EditSlotName_textChanged(const QString &arg1);
 
322
  void on_PWS_EditLoginName_textChanged(const QString &arg1);
 
323
  void on_PWS_EditPassword_textChanged(const QString &arg1);
 
324
 
 
325
  void generateTemporaryPassword(uint8_t *tempPassword) const;
 
326
 
 
327
  int userAuthenticate(const QString &password);
 
328
 
 
329
  void on_enableUserPasswordCheckBox_clicked(bool checked);
 
330
 
 
331
};
 
332
 
 
333
class utf8FieldLengthValidator : public QValidator {
 
334
  Q_OBJECT
 
335
private:
 
336
  int field_max_length;
 
337
 
 
338
public:
 
339
  explicit utf8FieldLengthValidator(QObject *parent = 0);
 
340
  explicit utf8FieldLengthValidator(int _field_max_length, QObject *parent = 0)
 
341
      : QValidator(parent), field_max_length(_field_max_length) {}
 
342
  virtual State validate(QString &input, int &) const {
 
343
 
 
344
    int chars_left = field_max_length - input.toUtf8().size();
 
345
 
 
346
    if (chars_left >= 0) {
 
347
      return Acceptable;
 
348
    }
 
349
    return Invalid;
 
350
  }
309
351
};
310
352
 
311
353
#endif // MAINWINDOW_H