mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-08 14:32:39 -04:00
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.
This commit is contained in:
parent
ff7191eef3
commit
3c362ac822
13 changed files with 296 additions and 300 deletions
|
@ -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 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 csvImportFinished(bool accepted);
|
||||
void switchToImportKeepass1(const QString& filePath);
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue