|
|
@ -20,65 +20,61 @@ |
|
|
|
#ifndef PASSWORDDIALOG_H |
|
|
|
#ifndef PASSWORDDIALOG_H |
|
|
|
#define PASSWORDDIALOG_H |
|
|
|
#define PASSWORDDIALOG_H |
|
|
|
|
|
|
|
|
|
|
|
#include <QPixmap> |
|
|
|
|
|
|
|
#include <QPaintEvent> |
|
|
|
#include <QPaintEvent> |
|
|
|
#include "ui_PasswordDlg.h" |
|
|
|
#include "ui_PasswordDlg.h" |
|
|
|
#include "main.h" |
|
|
|
|
|
|
|
#include "lib/UrlLabel.h" |
|
|
|
|
|
|
|
#include "Database.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PasswordDialog : public QDialog, public Ui_PasswordDlg { |
|
|
|
class PasswordDialog : public QDialog, private Ui_PasswordDlg { |
|
|
|
Q_OBJECT |
|
|
|
Q_OBJECT |
|
|
|
public: |
|
|
|
public: |
|
|
|
enum DlgMode { |
|
|
|
enum DlgMode { |
|
|
|
Mode_Ask, // Normal password entry when opening a database
|
|
|
|
Mode_Ask, // Normal password entry when opening a database
|
|
|
|
Mode_Set, // Setting password for the first time after creating a new database
|
|
|
|
Mode_Set, // Setting password for the first time after creating a new database
|
|
|
|
Mode_Change // Changing the password of a database
|
|
|
|
Mode_Change // Changing the password of a database
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum DlgFlags { |
|
|
|
|
|
|
|
Flag_None = 0x00,
|
|
|
|
|
|
|
|
Flag_Auto = 0x01 // Dialog was automatically opened on start-up
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum DlgExit { |
|
|
|
|
|
|
|
Exit_Ok=QDialog::Accepted, |
|
|
|
|
|
|
|
Exit_Cancel=QDialog::Rejected, |
|
|
|
|
|
|
|
Exit_Quit=3 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool (KeyFileGenProc)(const QString& filename,QString* error); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString()); |
|
|
|
enum DlgFlags { |
|
|
|
|
|
|
|
Flag_None = 0x00,
|
|
|
|
// result functions
|
|
|
|
Flag_Auto = 0x01 // Dialog was automatically opened on start-up
|
|
|
|
QString selectedBookmark(); |
|
|
|
}; |
|
|
|
QString keyFile(); |
|
|
|
|
|
|
|
QString password(); |
|
|
|
enum DlgExit { |
|
|
|
|
|
|
|
Exit_Ok=QDialog::Accepted, |
|
|
|
|
|
|
|
Exit_Cancel=QDialog::Rejected, |
|
|
|
|
|
|
|
Exit_Quit=3 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool (KeyFileGenProc)(const QString& filename,QString* error); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// result functions
|
|
|
|
|
|
|
|
QString selectedBookmark(); |
|
|
|
|
|
|
|
QString keyFile(); |
|
|
|
|
|
|
|
QString password(); |
|
|
|
|
|
|
|
|
|
|
|
public slots: |
|
|
|
private slots: |
|
|
|
void OnOK(); |
|
|
|
void OnOK(); |
|
|
|
void OnCancel(); |
|
|
|
void OnCancel(); |
|
|
|
void OnButtonBrowse(); |
|
|
|
void OnButtonBrowse(); |
|
|
|
void OnButtonQuit(); |
|
|
|
void OnButtonQuit(); |
|
|
|
void OnGenKeyFile(); |
|
|
|
void OnGenKeyFile(); |
|
|
|
void OnButtonBack(); |
|
|
|
void OnButtonBack(); |
|
|
|
void ChangeEchoModeDatabaseKey(); |
|
|
|
void ChangeEchoModeDatabaseKey(); |
|
|
|
void OnBookmarkTriggered(QAction* action); |
|
|
|
void OnBookmarkTriggered(QAction* action); |
|
|
|
void OnCheckBoxesChanged(int state); |
|
|
|
void OnCheckBoxesChanged(int state); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
DlgMode Mode; |
|
|
|
DlgMode Mode; |
|
|
|
QPixmap BannerPixmap; |
|
|
|
QPixmap BannerPixmap; |
|
|
|
QString BookmarkFilename; |
|
|
|
QString BookmarkFilename; |
|
|
|
QString Filename; |
|
|
|
QString Filename; |
|
|
|
QString Password; |
|
|
|
QString Password; |
|
|
|
QString KeyFile; |
|
|
|
QString KeyFile; |
|
|
|
void setStatePasswordOnly(); |
|
|
|
void setStatePasswordOnly(); |
|
|
|
void setStateKeyFileOnly(); |
|
|
|
void setStateKeyFileOnly(); |
|
|
|
void setStateBoth(); |
|
|
|
void setStateBoth(); |
|
|
|
virtual void paintEvent(QPaintEvent*); |
|
|
|
virtual void paintEvent(QPaintEvent*); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|