Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2018-11-24 02:57:41 +0300
committerJanek Bevendorff <janek@jbev.net>2018-11-24 17:51:05 +0300
commit3c362ac82279123432f421df8c4a1bc71bb44b24 (patch)
treebc7603dc11b943e05e1f50649d949441bdcc7756 /src/gui/DatabaseWidget.h
parentff7191eef3f10a5d70a975177308872dbb750291 (diff)
Refactor DatabaseOpenWidget/Dialog and Auto-Type Database unlocking.
This patch removes redundant lock widget members of the DatabaseWidget and consolidates all unlocking functionality into a single DatabaseOpenWidget (with the exception of KeePass1OpenWidget). Distinction between different unlock actions is now done via a dedicated Intent enum class instead of using individual widgets. Further, the DatabaseUnlockDialog has been generalized so that it is usable for unlock intents other than just Auto-Type and is now also used for merging databases which is less confusing to the user. The KeePassXC main window is no longer a parent of the DatabaseUnlockDialog and has the Qt::ForeignWindow flag set, which should cause fewer issues with Auto-Type trying to type into KeePassXC after unlock instead of the intended target window. In addition, its instance has been moved into the DatabaseTabWidget class so that it is no longer bound to individual DatabaseWidgets, potentially allowing for database selection during Auto-Type. The actual selection has not yet been implemented, but Auto-Type has been adjusted to use the currently selected tab instead of the first one as an intermediary improvement.
Diffstat (limited to 'src/gui/DatabaseWidget.h')
-rw-r--r--src/gui/DatabaseWidget.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h
index addabe060..078ae9d23 100644
--- a/src/gui/DatabaseWidget.h
+++ b/src/gui/DatabaseWidget.h
@@ -24,12 +24,14 @@
#include <QStackedWidget>
#include <QTimer>
+#include "DatabaseOpenDialog.h"
#include "gui/entry/EntryModel.h"
#include "gui/MessageWidget.h"
#include "gui/csvImport/CsvImportWizard.h"
#include "gui/entry/EntryModel.h"
class DatabaseOpenWidget;
+class KeePass1OpenWidget;
class DatabaseSettingsDialog;
class Database;
class EditEntryWidget;
@@ -39,15 +41,12 @@ class EntryView;
class EntrySearcher;
class Group;
class GroupView;
-class KeePass1OpenWidget;
class QFile;
class QMenu;
class QSplitter;
class QLabel;
-class UnlockDatabaseWidget;
class MessageWidget;
class EntryPreviewWidget;
-class UnlockDatabaseDialog;
class QFileSystemWatcher;
namespace Ui
@@ -60,6 +59,8 @@ class DatabaseWidget : public QStackedWidget
Q_OBJECT
public:
+ friend class DatabaseOpenDialog;
+
enum class Mode
{
None,
@@ -75,11 +76,6 @@ public:
QSharedPointer<Database> database() const;
- bool lock();
- void prepareUnlock();
- bool save(int attempt = 0);
- bool saveAs();
-
DatabaseWidget::Mode currentMode() const;
bool isLocked() const;
bool isSearchActive() const;
@@ -148,6 +144,10 @@ signals:
void clearSearch();
public slots:
+ bool lock();
+ bool save(int attempt = 0);
+ bool saveAs();
+
void replaceDatabase(QSharedPointer<Database> db);
void createEntry();
void cloneEntry();
@@ -169,19 +169,18 @@ public slots:
void createGroup();
void deleteGroup();
void onGroupChanged(Group* group);
- void switchToView(bool accepted);
+ void switchToMainView(bool previousDialogAccepted = false);
void switchToEntryEdit();
void switchToGroupEdit();
void switchToMasterKeyChange();
void switchToDatabaseSettings();
void switchToOpenDatabase();
void switchToOpenDatabase(const QString& filePath);
+ void switchToOpenDatabase(const QString& filePath, const QString& password, const QString& keyFile);
void switchToCsvImport(const QString& filePath);
+ void performUnlockDatabase(const QString& password, const QString& keyfile = {});
void csvImportFinished(bool accepted);
- void switchToOpenMergeDatabase(const QString& filePath);
- void switchToOpenMergeDatabase(const QString& filePath, const QString& password, const QString& keyFile);
void switchToImportKeepass1(const QString& filePath);
- void performUnlockDatabase(const QString& password, const QString& keyfile = {});
void emptyRecycleBin();
// Search related slots
@@ -215,8 +214,8 @@ private slots:
void emitEntrySelectionChanged();
void connectDatabaseSignals();
void loadDatabase(bool accepted);
- void mergeDatabase(bool accepted);
void unlockDatabase(bool accepted);
+ void mergeDatabase(bool accepted);
void emitCurrentModeChanged();
// Database autoreload slots
void onWatchedFileChanged();
@@ -244,23 +243,17 @@ private:
QPointer<EditEntryWidget> m_historyEditEntryWidget;
QPointer<DatabaseSettingsDialog> m_databaseSettingDialog;
QPointer<DatabaseOpenWidget> m_databaseOpenWidget;
- QPointer<DatabaseOpenWidget> m_databaseOpenMergeWidget;
QPointer<KeePass1OpenWidget> m_keepass1OpenWidget;
- QPointer<UnlockDatabaseWidget> m_unlockDatabaseWidget;
- QPointer<UnlockDatabaseDialog> m_unlockDatabaseDialog;
QPointer<GroupView> m_groupView;
QPointer<EntryView> m_entryView;
- QPointer<Group> m_newGroup;
- QPointer<Entry> m_newEntry;
+ QScopedPointer<Group> m_newGroup;
+ QScopedPointer<Entry> m_newEntry;
QPointer<Group> m_newParent;
QUuid m_groupBeforeLock;
QUuid m_entryBeforeLock;
- QString m_databaseName;
- QString m_databaseFileName;
-
// Search state
EntrySearcher* m_EntrySearcher;
QString m_lastSearchText;