QtPass  1.2.0-pre
Multi-platform GUI for pass, the standard unix password manager.
mainwindow.h
Go to the documentation of this file.
1 #ifndef MAINWINDOW_H_
2 #define MAINWINDOW_H_
3 
4 #include "datahelpers.h"
5 #include "enums.h"
6 #include "imitatepass.h"
7 #include "pass.h"
8 #include "realpass.h"
9 #include "storemodel.h"
10 #include "trayicon.h"
11 #include <QFileSystemModel>
12 #include <QMainWindow>
13 #include <QProcess>
14 #include <QQueue>
15 #include <QTimer>
16 #include <QTreeView>
17 
18 #if SINGLE_APP
19 #include "singleapplication.h"
20 #else
21 #define SingleApplication QApplication
22 #endif
23 
24 #ifdef __APPLE__
25 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
26 // http://doc.qt.io/qt-5/qkeysequence.html#qt_set_sequence_auto_mnemonic
27 void qt_set_sequence_auto_mnemonic(bool b);
28 #endif
29 #endif
30 
31 namespace Ui {
32 class MainWindow;
33 }
34 
42 class MainWindow : public QMainWindow {
43  Q_OBJECT
44 
45 public:
46  explicit MainWindow(QWidget *parent = 0);
47  ~MainWindow();
48  bool checkConfig();
49  void setApp(SingleApplication *app);
50  void setText(QString);
51  QStringList getSecretKeys();
52  void generateKeyPair(QString, QDialog *);
53  void userDialog(QString = "");
54  void config();
55  void executePassGitInit();
56 
62 
63 protected:
64  void closeEvent(QCloseEvent *event);
65  void keyPressEvent(QKeyEvent *event);
66  void changeEvent(QEvent *event);
67  bool eventFilter(QObject *obj, QEvent *event);
68 
69 public slots:
70  void deselect();
71 
72 private slots:
73  void on_updateButton_clicked(bool block = false);
74  void on_pushButton_clicked();
75  void on_treeView_clicked(const QModelIndex &index);
76  void on_treeView_doubleClicked(const QModelIndex &index);
77  void on_configButton_clicked();
78  void processFinished(const QString &, const QString &);
79  void processError(QProcess::ProcessError);
80  void clearClipboard();
81  void clearPanel(bool notify = true);
82  void on_lineEdit_textChanged(const QString &arg1);
83  void on_lineEdit_returnPressed();
84  void on_addButton_clicked();
85  void on_deleteButton_clicked();
86  void on_editButton_clicked();
87  void on_usersButton_clicked();
88  void messageAvailable(QString message);
89  void on_profileBox_currentIndexChanged(QString);
90  void showContextMenu(const QPoint &pos);
91  void showBrowserContextMenu(const QPoint &pos);
92  void addFolder();
93  void editPassword(const QString &);
94  void focusInput();
95  void copyTextToClipboard(const QString &text);
96 
97  void executeWrapperStarted();
98  void showStatusMessage(QString msg, int timeout);
99  void startReencryptPath();
100  void endReencryptPath();
101  void critical(QString, QString);
102  void passShowHandler(const QString &);
103  void passStoreChanged(const QString &, const QString &);
104  void doGitPush();
105 
106  void processErrorExit(int exitCode, const QString &);
107 
108  void finishedInsert(const QString &, const QString &);
109  void keyGenerationComplete(const QString &p_output, const QString &p_errout);
110 
111 private:
112  QAction *actionAddPassword;
113  QAction *actionAddFolder;
114 
115  QApplication *QtPass;
116  QScopedPointer<Ui::MainWindow> ui;
117  QFileSystemModel model;
118  StoreModel proxyModel;
119  QScopedPointer<QItemSelectionModel> selectionModel;
120  QTreeView *treeView;
121  QProcess fusedav;
122  QString clippedText;
123  QTimer clearPanelTimer;
124  QTimer clearClipboardTimer;
125  bool freshStart;
126  QDialog *keygen;
127  QString currentDir;
128  bool startupPhase;
129  TrayIcon *tray;
130 
131  void updateText();
132  void enableUiElements(bool state);
133  void selectFirstFile();
134  QModelIndex firstFile(QModelIndex parentIndex);
135  QString getFile(const QModelIndex &, bool);
136  void setPassword(QString, bool isNew = true);
137 
138  void mountWebDav();
139  void updateProfileBox();
140  void initTrayIcon();
141  void destroyTrayIcon();
142  void clearTemplateWidgets();
143  void reencryptPath(QString dir);
144  void addToGridLayout(int position, const QString &field,
145  const QString &value);
146  void DisplayInTextBrowser(QString toShow, QString prefix = QString(),
147  QString postfix = QString());
148  void connectPassSignalHandlers(Pass *pass);
149 };
150 
151 #endif // MAINWINDOW_H_
passwordConfiguration pwdConfig
MainWindow::pwdConfig instance of passwordConfiguration.
Definition: mainwindow.h:61
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
The QSortFilterProxyModel for handling filesystem searches.
Definition: storemodel.h:16
Handles the systemtray icon and menu.
Definition: trayicon.h:15
The SingleApplication class is used for commandline intergration.
holds the Password configuration settings
Definition: datahelpers.h:11
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more...
Definition: mainwindow.h:42