Skip to content

Commit

Permalink
Overhaul action states and add icons to toolbar
Browse files Browse the repository at this point in the history
* Fixes #10981
  • Loading branch information
droidmonkey committed Sep 7, 2024
1 parent c8fc25e commit 135eedc
Show file tree
Hide file tree
Showing 17 changed files with 275 additions and 284 deletions.
7 changes: 4 additions & 3 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Files: share/icons/application/scalable/actions/application-exit.svg
share/icons/application/scalable/actions/database-lock-all.svg
share/icons/application/scalable/actions/database-merge.svg
share/icons/application/scalable/actions/database-search.svg
share/icons/application/scalable/actions/database-settings.svg
share/icons/application/scalable/actions/dialog-close.svg
share/icons/application/scalable/actions/dialog-ok.svg
share/icons/application/scalable/actions/document-close.svg
Expand Down Expand Up @@ -243,9 +244,9 @@ Files: share/icons/application/scalable/actions/application-exit.svg
share/icons/application/scalable/actions/lock-open-alert.svg
share/icons/application/scalable/actions/lock-open.svg
share/icons/application/scalable/actions/lock.svg
Copyright: 2019 Austin Andrews <http://templarian.com/>
License: SIL OPEN FONT LICENSE Version 1.1
Comment: Taken from Material Design icon set (https://github.com/templarian/MaterialDesign/)
Copyright: 2023 Pictogrammers <https://pictogrammers.com/docs/general/about/>
License: Apache-2.0
Comment: Some icons are modified to fit KeePassXC design (https://pictogrammers.com/library/mdi/)

Files: src/streams/qtiocompressor.*
src/streams/QtIOCompressor
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion share/icons/application/scalable/actions/entry-delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion share/icons/application/scalable/actions/reports.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions share/icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<file>application/scalable/actions/database-lock-all.svg</file>
<file>application/scalable/actions/database-merge.svg</file>
<file>application/scalable/actions/database-search.svg</file>
<file>application/scalable/actions/database-settings.svg</file>
<file>application/scalable/actions/dialog-close.svg</file>
<file>application/scalable/actions/dialog-ok.svg</file>
<file>application/scalable/actions/document-close.svg</file>
Expand Down
32 changes: 24 additions & 8 deletions src/gui/DatabaseTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,25 +537,41 @@ bool DatabaseTabWidget::warnOnExport()
return ans == MessageBox::Yes;
}

void DatabaseTabWidget::showDatabaseSecurity()
void DatabaseTabWidget::showDatabaseSecurity(bool state)
{
currentDatabaseWidget()->switchToDatabaseSecurity();
if (state) {
currentDatabaseWidget()->switchToDatabaseSecurity();
} else {
currentDatabaseWidget()->switchToMainView();
}
}

void DatabaseTabWidget::showDatabaseReports()
void DatabaseTabWidget::showDatabaseReports(bool state)
{
currentDatabaseWidget()->switchToDatabaseReports();
if (state) {
currentDatabaseWidget()->switchToDatabaseReports();
} else {
currentDatabaseWidget()->switchToMainView();
}
}

void DatabaseTabWidget::showDatabaseSettings()
void DatabaseTabWidget::showDatabaseSettings(bool state)
{
currentDatabaseWidget()->switchToDatabaseSettings();
if (state) {
currentDatabaseWidget()->switchToDatabaseSettings();
} else {
currentDatabaseWidget()->switchToMainView();
}
}

#ifdef WITH_XC_BROWSER_PASSKEYS
void DatabaseTabWidget::showPasskeys()
void DatabaseTabWidget::showPasskeys(bool state)
{
currentDatabaseWidget()->switchToPasskeys();
if (state) {
currentDatabaseWidget()->switchToPasskeys();
} else {
currentDatabaseWidget()->switchToMainView();
}
}

void DatabaseTabWidget::importPasskey()
Expand Down
8 changes: 4 additions & 4 deletions src/gui/DatabaseTabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public slots:
void unlockAnyDatabaseInDialog(DatabaseOpenDialog::Intent intent);
void relockPendingDatabase();

void showDatabaseSecurity();
void showDatabaseReports();
void showDatabaseSettings();
void showDatabaseSecurity(bool state);
void showDatabaseReports(bool state);
void showDatabaseSettings(bool state);
#ifdef WITH_XC_BROWSER_PASSKEYS
void showPasskeys();
void showPasskeys(bool state);
void importPasskey();
void importPasskeyToEntry();
void removePasskeyFromEntry();
Expand Down
25 changes: 18 additions & 7 deletions src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,26 @@ QSharedPointer<Database> DatabaseWidget::database() const

DatabaseWidget::Mode DatabaseWidget::currentMode() const
{
if (currentWidget() == nullptr) {
return Mode::None;
} else if (currentWidget() == m_mainWidget) {
return Mode::ViewMode;
} else if (currentWidget() == m_databaseOpenWidget) {
return Mode::LockedMode;
auto mode = Mode::None;
auto widget = currentWidget();
if (widget == m_mainWidget) {
mode = Mode::ViewMode;
} else if (widget == m_databaseOpenWidget) {
mode = Mode::LockedMode;
} else if (widget == m_reportsDialog) {
mode = m_reportsDialog->onPassKeysPage() ? Mode::PassKeysMode : Mode::ReportsMode;
} else if (widget == m_databaseSettingDialog) {
mode = Mode::DatabaseSettingsMode;
} else if (widget == m_editEntryWidget) {
mode = Mode::EditEntryMode;
} else if (widget == m_editGroupWidget) {
mode = Mode::EditGroupMode;
} else {
return Mode::EditMode;
// We are missing a condition if we reach here
Q_ASSERT(false);
}

return mode;
}

bool DatabaseWidget::isLocked() const
Expand Down
8 changes: 6 additions & 2 deletions src/gui/DatabaseWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ class DatabaseWidget : public QStackedWidget
{
None,
ViewMode,
EditMode,
LockedMode
EditEntryMode,
EditGroupMode,
LockedMode,
ReportsMode,
PassKeysMode,
DatabaseSettingsMode
};

explicit DatabaseWidget(QSharedPointer<Database> db, QWidget* parent = nullptr);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/EditWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ EditWidget::EditWidget(QWidget* parent)
setModified(false);

m_ui->messageWidget->setHidden(true);
m_ui->headerLabel->setHidden(true);

QFont headerLabelFont = m_ui->headerLabel->font();
headerLabelFont.setBold(true);
Expand Down Expand Up @@ -118,6 +119,7 @@ void EditWidget::setCurrentPage(int index)

void EditWidget::setHeadline(const QString& text)
{
m_ui->headerLabel->setHidden(text.isEmpty());
m_ui->headerLabel->setText(text);
}

Expand Down
Loading

0 comments on commit 135eedc

Please sign in to comment.