summaryrefslogtreecommitdiffstats
path: root/configdialog.h
blob: 43f4136ce268b3120425a4b4d857aaaef48cc979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef CONFIGDIALOG_H_
#define CONFIGDIALOG_H_

#include "mainwindow.h"
#include <QCloseEvent>
#include <QDialog>
#include <QFileDialog>
#include <QTableWidgetItem>

namespace Ui {
struct UserInfo;

class ConfigDialog;
}

/*!
    \class ConfigDialog
    \brief The ConfigDialog handles the configuration interface.

    This class should also take the handling from the MainWindow class.
*/
class ConfigDialog : public QDialog {
  Q_OBJECT

public:
  explicit ConfigDialog(MainWindow *parent);
  ~ConfigDialog();
  void setPassPath(QString);
  void setGitPath(QString);
  void setGpgPath(QString);
  void setStorePath(QString);
  void setProfiles(QHash<QString, QString>, QString);
  void usePass(bool usePass);
  void useClipboard(MainWindow::clipBoardType);
  void useAutoclear(bool useAutoclear);
  void setAutoclear(int seconds);
  void useAutoclearPanel(bool useAutoclearPanel);
  void setAutoclearPanel(int seconds);
  void hidePassword(bool hidePassword);
  void hideContent(bool hideContent);
  void addGPGId(bool addGPGId);
  QString getPassPath();
  QString getGitPath();
  QString getGpgPath();
  QString getStorePath();
  QHash<QString, QString> getProfiles();
  bool usePass();
  MainWindow::clipBoardType useClipboard();
  bool useAutoclear();
  int getAutoclear();
  bool useAutoclearPanel();
  int getAutoclearPanel();
  bool hidePassword();
  bool hideContent();
  bool addGPGId();
  void wizard();
  void genKey(QString, QDialog *);
  bool useTrayIcon();
  bool hideOnClose();
  bool startMinimized();
  void useTrayIcon(bool useTrayIdon);
  void hideOnClose(bool hideOnClose);
  void startMinimized(bool startMinimized);
  void useGit(bool useGit);
  bool useGit();
  QString getPwgenPath();
  void setPwgenPath(QString);
  void usePwgen(bool usePwgen);
  void avoidCapitals(bool avoidCapitals);
  void avoidNumbers(bool avoidNumbers);
  void lessRandom(bool lessRandom);
  void useSymbols(bool useSymbols);
  void setPasswordLength(int pwLen);
  void setPasswordChars(QString);
  void setPwdTemplateSelector(int selection);
  void setLineEditEnabled(bool b);
  int getPwdTemplateSelector();
  bool usePwgen();
  bool avoidCapitals();
  bool avoidNumbers();
  bool lessRandom();
  bool useSymbols();
  int getPasswordLength();
  QString getPasswordChars();
  bool useTemplate();
  void useTemplate(bool useTemplate);
  QString getTemplate();
  void setTemplate(QString);
  void templateAllFields(bool templateAllFields);
  bool templateAllFields();
  bool autoPull();
  void autoPull(bool autoPull);
  bool autoPush();
  void autoPush(bool autoPush);
  bool alwaysOnTop();
  void alwaysOnTop(bool alwaysOnTop);

protected:
  void closeEvent(QCloseEvent *event);

private slots:
  void on_radioButtonNative_clicked();
  void on_radioButtonPass_clicked();
  void on_toolButtonGit_clicked();
  void on_toolButtonGpg_clicked();
  void on_toolButtonPwgen_clicked();
  void on_toolButtonPass_clicked();
  void on_toolButtonStore_clicked();
  void on_comboBoxClipboard_activated(int);
  void on_passwordCharTemplateSelector_activated(int);
  void on_checkBoxAutoclear_clicked();
  void on_checkBoxAutoclearPanel_clicked();
  void on_addButton_clicked();
  void on_deleteButton_clicked();
  void on_checkBoxUseTrayIcon_clicked();
  void on_checkBoxUseGit_clicked();
  void on_checkBoxUsePwgen_clicked();
  void on_checkBoxUseTemplate_clicked();

private:
  QScopedPointer<Ui::ConfigDialog> ui;
  void setGroupBoxState();
  QString selectExecutable();
  QString selectFolder();
  // QMessageBox::critical with hack to avoid crashes with
  // Qt 5.4.1 when QApplication::exec was not yet called
  void criticalMessage(const QString &title, const QString &text);
  MainWindow *mainWindow;
};

#endif // CONFIGDIALOG_H_