mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-08 22:42:34 -04:00
Merge branch 'develop'
Conflicts: CMakeLists.txt cmake/CLangFormat.cmake snapcraft.yaml src/CMakeLists.txt src/core/Database.cpp src/core/Database.h src/core/Tools.cpp src/crypto/CryptoHash.h src/crypto/ssh/ASN1Key.h src/crypto/ssh/OpenSSHKey.cpp src/format/Kdbx4Reader.cpp src/gui/DatabaseTabWidget.cpp src/gui/DatabaseTabWidget.h src/gui/DatabaseWidget.cpp src/gui/DatabaseWidget.h src/gui/DetailsWidget.cpp src/gui/DetailsWidget.ui src/gui/EditWidgetProperties.cpp src/gui/EntryPreviewWidget.cpp src/gui/EntryPreviewWidget.ui src/gui/FileDialog.cpp src/gui/dbsettings/DatabaseSettingsDialog.cpp src/gui/dbsettings/DatabaseSettingsDialog.h src/gui/group/EditGroupWidget.cpp src/gui/group/EditGroupWidget.h src/sshagent/ASN1Key.h src/sshagent/OpenSSHKey.cpp src/sshagent/SSHAgent.cpp tests/CMakeLists.txt
This commit is contained in:
commit
9e2be34897
421 changed files with 18208 additions and 12907 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
|
||||
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,31 +24,30 @@
|
|||
#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 ChangeMasterKeyWidget;
|
||||
class DatabaseOpenWidget;
|
||||
class KeePass1OpenWidget;
|
||||
class DatabaseSettingsDialog;
|
||||
class Database;
|
||||
class DelayingFileWatcher;
|
||||
class EditEntryWidget;
|
||||
class EditGroupWidget;
|
||||
class Entry;
|
||||
class EntryView;
|
||||
class DelayingFileWatcher;
|
||||
class EntrySearcher;
|
||||
class Group;
|
||||
class GroupView;
|
||||
class KeePass1OpenWidget;
|
||||
class QFile;
|
||||
class QMenu;
|
||||
class QSplitter;
|
||||
class QLabel;
|
||||
class UnlockDatabaseWidget;
|
||||
class MessageWidget;
|
||||
class DetailsWidget;
|
||||
class UnlockDatabaseDialog;
|
||||
class EntryPreviewWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -60,7 +59,9 @@ class DatabaseWidget : public QStackedWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode
|
||||
friend class DatabaseOpenDialog;
|
||||
|
||||
enum class Mode
|
||||
{
|
||||
None,
|
||||
ImportMode,
|
||||
|
@ -69,72 +70,83 @@ public:
|
|||
LockedMode
|
||||
};
|
||||
|
||||
explicit DatabaseWidget(Database* db, QWidget* parent = nullptr);
|
||||
explicit DatabaseWidget(QSharedPointer<Database> db, QWidget* parent = nullptr);
|
||||
explicit DatabaseWidget(const QString& filePath, QWidget* parent = nullptr);
|
||||
~DatabaseWidget();
|
||||
Database* database();
|
||||
bool dbHasKey() const;
|
||||
bool canDeleteCurrentGroup() const;
|
||||
bool isInSearchMode() const;
|
||||
QString getCurrentSearch();
|
||||
Group* currentGroup() const;
|
||||
int addWidget(QWidget* w);
|
||||
void setCurrentIndex(int index);
|
||||
void setCurrentWidget(QWidget* widget);
|
||||
|
||||
QSharedPointer<Database> database() const;
|
||||
|
||||
DatabaseWidget::Mode currentMode() const;
|
||||
void lock();
|
||||
void updateFilePath(const QString& filePath);
|
||||
int numberOfSelectedEntries() const;
|
||||
QStringList customEntryAttributes() const;
|
||||
bool isLocked() const;
|
||||
bool isSearchActive() const;
|
||||
|
||||
QString getCurrentSearch();
|
||||
void refreshSearch();
|
||||
|
||||
GroupView* groupView();
|
||||
EntryView* entryView();
|
||||
|
||||
Group* currentGroup() const;
|
||||
bool canDeleteCurrentGroup() const;
|
||||
bool isGroupSelected() const;
|
||||
bool isInEditMode() const;
|
||||
bool isRecycleBinSelected() const;
|
||||
int numberOfSelectedEntries() const;
|
||||
|
||||
QStringList customEntryAttributes() const;
|
||||
bool isEditWidgetModified() const;
|
||||
QList<int> mainSplitterSizes() const;
|
||||
void setMainSplitterSizes(const QList<int>& sizes);
|
||||
QList<int> detailSplitterSizes() const;
|
||||
void setDetailSplitterSizes(const QList<int>& sizes);
|
||||
bool isUsernamesHidden() const;
|
||||
void setUsernamesHidden(const bool hide);
|
||||
void setUsernamesHidden(bool hide);
|
||||
bool isPasswordsHidden() const;
|
||||
void setPasswordsHidden(const bool hide);
|
||||
QByteArray entryViewState() const;
|
||||
bool setEntryViewState(const QByteArray& state) const;
|
||||
void setPasswordsHidden(bool hide);
|
||||
void clearAllWidgets();
|
||||
bool currentEntryHasFocus();
|
||||
bool currentEntryHasTitle();
|
||||
bool currentEntryHasUsername();
|
||||
bool currentEntryHasPassword();
|
||||
bool currentEntryHasUrl();
|
||||
bool currentEntryHasNotes();
|
||||
bool currentEntryHasTotp();
|
||||
GroupView* groupView();
|
||||
EntryView* entryView();
|
||||
void showUnlockDialog();
|
||||
void closeUnlockDialog();
|
||||
|
||||
void blockAutoReload(bool block = true);
|
||||
void refreshSearch();
|
||||
bool isRecycleBinSelected() const;
|
||||
|
||||
QByteArray entryViewState() const;
|
||||
bool setEntryViewState(const QByteArray& state) const;
|
||||
QList<int> mainSplitterSizes() const;
|
||||
void setMainSplitterSizes(const QList<int>& sizes);
|
||||
QList<int> previewSplitterSizes() const;
|
||||
void setPreviewSplitterSizes(const QList<int>& sizes);
|
||||
|
||||
signals:
|
||||
// relayed Database signals
|
||||
void databaseFilePathChanged(const QString& oldPath, const QString& newPath);
|
||||
void databaseModified();
|
||||
void databaseSaved();
|
||||
void databaseUnlocked();
|
||||
void databaseLocked();
|
||||
|
||||
void closeRequest();
|
||||
void currentModeChanged(DatabaseWidget::Mode mode);
|
||||
void groupChanged();
|
||||
void entrySelectionChanged();
|
||||
void databaseChanged(Database* newDb, bool unsavedChanges);
|
||||
void databaseMerged(Database* mergedDb);
|
||||
void requestOpenDatabase(const QString& filePath, bool inBackground, const QString& password);
|
||||
void databaseMerged(QSharedPointer<Database> mergedDb);
|
||||
void groupContextMenuRequested(const QPoint& globalPos);
|
||||
void entryContextMenuRequested(const QPoint& globalPos);
|
||||
void pressedEntry(Entry* selectedEntry);
|
||||
void pressedGroup(Group* selectedGroup);
|
||||
void unlockedDatabase();
|
||||
void listModeAboutToActivate();
|
||||
void listModeActivated();
|
||||
void searchModeAboutToActivate();
|
||||
void searchModeActivated();
|
||||
void mainSplitterSizesChanged();
|
||||
void detailSplitterSizesChanged();
|
||||
void previewSplitterSizesChanged();
|
||||
void entryViewStateChanged();
|
||||
void updateSearch(QString text);
|
||||
void clearSearch();
|
||||
|
||||
public slots:
|
||||
bool lock();
|
||||
bool save(int attempt = 0);
|
||||
bool saveAs();
|
||||
|
||||
void replaceDatabase(QSharedPointer<Database> db);
|
||||
void createEntry();
|
||||
void cloneEntry();
|
||||
void deleteEntries();
|
||||
|
@ -146,6 +158,7 @@ public slots:
|
|||
void copyNotes();
|
||||
void copyAttribute(QAction* action);
|
||||
void showTotp();
|
||||
void showTotpKeyQrCode();
|
||||
void copyTotp();
|
||||
void setupTotp();
|
||||
void performAutoType();
|
||||
|
@ -153,21 +166,18 @@ public slots:
|
|||
void openUrlForEntry(Entry* entry);
|
||||
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 databaseModified();
|
||||
void databaseSaved();
|
||||
void emptyRecycleBin();
|
||||
|
||||
// Search related slots
|
||||
|
@ -183,70 +193,69 @@ public slots:
|
|||
void showErrorMessage(const QString& errorMessage);
|
||||
void hideMessage();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void updateFilePath(const QString& filePath);
|
||||
void entryActivationSignalReceived(Entry* entry, EntryModel::ModelColumn column);
|
||||
void switchBackToEntryEdit();
|
||||
void switchToHistoryView(Entry* entry);
|
||||
void switchToEntryEdit(Entry* entry);
|
||||
void switchToEntryEdit(Entry*);
|
||||
void switchToEntryEdit(Entry* entry, bool create);
|
||||
void switchToGroupEdit(Group* entry, bool create);
|
||||
void emitGroupContextMenuRequested(const QPoint& pos);
|
||||
void emitEntryContextMenuRequested(const QPoint& pos);
|
||||
void emitPressedEntry();
|
||||
void emitPressedEntry(Entry* currentEntry);
|
||||
void emitPressedGroup(Group* currentGroup);
|
||||
void openDatabase(bool accepted);
|
||||
void mergeDatabase(bool accepted);
|
||||
void onEntryChanged(Entry* entry);
|
||||
void onGroupChanged(Group* group);
|
||||
void connectDatabaseSignals();
|
||||
void loadDatabase(bool accepted);
|
||||
void unlockDatabase(bool accepted);
|
||||
void mergeDatabase(bool accepted);
|
||||
void emitCurrentModeChanged();
|
||||
// Database autoreload slots
|
||||
void reloadDatabaseFile();
|
||||
void restoreGroupEntryFocus(const QUuid& groupUuid, const QUuid& EntryUuid);
|
||||
|
||||
private:
|
||||
int addChildWidget(QWidget* w);
|
||||
void setClipboardTextAndMinimize(const QString& text);
|
||||
void setIconFromParent();
|
||||
void replaceDatabase(Database* db);
|
||||
void processAutoOpen();
|
||||
|
||||
Database* m_db;
|
||||
QWidget* m_mainWidget;
|
||||
EditEntryWidget* m_editEntryWidget;
|
||||
EditEntryWidget* m_historyEditEntryWidget;
|
||||
EditGroupWidget* m_editGroupWidget;
|
||||
ChangeMasterKeyWidget* m_changeMasterKeyWidget;
|
||||
CsvImportWizard* m_csvImportWizard;
|
||||
DatabaseSettingsDialog* m_databaseSettingDialog;
|
||||
DatabaseOpenWidget* m_databaseOpenWidget;
|
||||
DatabaseOpenWidget* m_databaseOpenMergeWidget;
|
||||
KeePass1OpenWidget* m_keepass1OpenWidget;
|
||||
UnlockDatabaseWidget* m_unlockDatabaseWidget;
|
||||
UnlockDatabaseDialog* m_unlockDatabaseDialog;
|
||||
QSplitter* m_mainSplitter;
|
||||
QSplitter* m_detailSplitter;
|
||||
GroupView* m_groupView;
|
||||
EntryView* m_entryView;
|
||||
QString m_filePath;
|
||||
QLabel* m_searchingLabel;
|
||||
Group* m_newGroup;
|
||||
Entry* m_newEntry;
|
||||
Group* m_newParent;
|
||||
QSharedPointer<Database> m_db;
|
||||
|
||||
QPointer<QWidget> m_mainWidget;
|
||||
QPointer<QSplitter> m_mainSplitter;
|
||||
QPointer<MessageWidget> m_messageWidget;
|
||||
QPointer<EntryPreviewWidget> m_previewView;
|
||||
QPointer<QSplitter> m_previewSplitter;
|
||||
QPointer<QLabel> m_searchingLabel;
|
||||
QPointer<CsvImportWizard> m_csvImportWizard;
|
||||
QPointer<EditEntryWidget> m_editEntryWidget;
|
||||
QPointer<EditGroupWidget> m_editGroupWidget;
|
||||
QPointer<EditEntryWidget> m_historyEditEntryWidget;
|
||||
QPointer<DatabaseSettingsDialog> m_databaseSettingDialog;
|
||||
QPointer<DatabaseOpenWidget> m_databaseOpenWidget;
|
||||
QPointer<KeePass1OpenWidget> m_keepass1OpenWidget;
|
||||
QPointer<GroupView> m_groupView;
|
||||
QPointer<EntryView> m_entryView;
|
||||
|
||||
QScopedPointer<Group> m_newGroup;
|
||||
QScopedPointer<Entry> m_newEntry;
|
||||
QPointer<Group> m_newParent;
|
||||
|
||||
QUuid m_groupBeforeLock;
|
||||
QUuid m_entryBeforeLock;
|
||||
MessageWidget* m_messageWidget;
|
||||
DetailsWidget* m_detailsView;
|
||||
|
||||
// Search state
|
||||
EntrySearcher* m_EntrySearcher;
|
||||
QString m_lastSearchText;
|
||||
bool m_searchCaseSensitive;
|
||||
bool m_searchLimitGroup;
|
||||
|
||||
// CSV import state
|
||||
bool m_importingCsv;
|
||||
|
||||
// Autoreload
|
||||
QPointer<DelayingFileWatcher> m_fileWatcher;
|
||||
bool m_databaseModified;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_DATABASEWIDGET_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue