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:
authorJonathan White <support@dmapps.us>2022-09-05 19:56:10 +0300
committerJonathan White <support@dmapps.us>2022-09-22 13:49:07 +0300
commitf4510c64ec20c81362f40e461c6dd9410b8f895b (patch)
treea8334e3ae7566a870a4ace414c7fdb99f4ee9712
parent64dda095657c8ba5193c2cb61b95eb8016ad6d48 (diff)
Show entry count in status bar
Closes #3963
-rw-r--r--src/gui/DatabaseWidget.cpp9
-rw-r--r--src/gui/MainWindow.cpp20
-rw-r--r--src/gui/MainWindow.h2
3 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 09f1b9f21..7f3ef21bd 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -200,7 +200,6 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_previewView, SIGNAL(entryUrlActivated(Entry*)), SLOT(openUrlForEntry(Entry*)));
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
connect(m_groupView, SIGNAL(groupSelectionChanged()), SLOT(onGroupChanged()));
- connect(m_groupView, SIGNAL(groupSelectionChanged()), SIGNAL(groupChanged()));
connect(m_groupView, &GroupView::groupFocused, this, [this] { m_previewView->setGroup(currentGroup()); });
connect(m_entryView, SIGNAL(entryActivated(Entry*,EntryModel::ModelColumn)),
SLOT(entryActivationSignalReceived(Entry*,EntryModel::ModelColumn)));
@@ -1041,12 +1040,6 @@ void DatabaseWidget::switchToMainView(bool previousDialogAccepted)
// Workaround: ensure entries are focused so search doesn't reset
m_entryView->setFocus();
}
-
- if (sender() == m_entryView || sender() == m_editEntryWidget) {
- onEntryChanged(m_entryView->currentEntry());
- } else if (sender() == m_groupView || sender() == m_editGroupWidget) {
- onGroupChanged();
- }
}
void DatabaseWidget::switchToHistoryView(Entry* entry)
@@ -1508,6 +1501,8 @@ void DatabaseWidget::onGroupChanged()
m_shareLabel->setVisible(false);
}
#endif
+
+ emit groupChanged();
}
void DatabaseWidget::onDatabaseModified()
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 1b6ccd2d7..7df74fdf9 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -43,6 +43,7 @@
#include "gui/Icons.h"
#include "gui/MessageBox.h"
#include "gui/SearchWidget.h"
+#include "gui/entry/EntryView.h"
#include "gui/osutils/OSUtils.h"
#ifdef WITH_XC_UPDATECHECK
@@ -431,6 +432,11 @@ MainWindow::MainWindow()
m_actionMultiplexer.connect(SIGNAL(entrySelectionChanged()), this, SLOT(setMenuActionState()));
m_actionMultiplexer.connect(SIGNAL(groupContextMenuRequested(QPoint)), this, SLOT(showGroupContextMenu(QPoint)));
m_actionMultiplexer.connect(SIGNAL(entryContextMenuRequested(QPoint)), this, SLOT(showEntryContextMenu(QPoint)));
+ m_actionMultiplexer.connect(SIGNAL(groupChanged()), this, SLOT(updateEntryCountLabel()));
+ m_actionMultiplexer.connect(SIGNAL(databaseUnlocked()), this, SLOT(updateEntryCountLabel()));
+ m_actionMultiplexer.connect(SIGNAL(databaseModified()), this, SLOT(updateEntryCountLabel()));
+ m_actionMultiplexer.connect(SIGNAL(searchModeActivated()), this, SLOT(updateEntryCountLabel()));
+ m_actionMultiplexer.connect(SIGNAL(listModeActivated()), this, SLOT(updateEntryCountLabel()));
// Notify search when the active database changes or gets locked
connect(m_ui->tabWidget,
@@ -653,6 +659,7 @@ MainWindow::MainWindow()
connect(qApp, SIGNAL(openFile(QString)), this, SLOT(openDatabase(QString)));
connect(qApp, SIGNAL(quitSignalReceived()), this, SLOT(appExit()), Qt::DirectConnection);
+ // Setup the status bar
statusBar()->setFixedHeight(24);
m_progressBarLabel = new QLabel(statusBar());
m_progressBarLabel->setVisible(false);
@@ -665,6 +672,8 @@ MainWindow::MainWindow()
m_progressBar->setMaximum(100);
statusBar()->addPermanentWidget(m_progressBar);
connect(clipboard(), SIGNAL(updateCountdown(int, QString)), this, SLOT(updateProgressBar(int, QString)));
+ m_statusBarLabel = new QLabel(statusBar());
+ statusBar()->addPermanentWidget(m_statusBarLabel);
restoreConfigState();
}
@@ -1546,6 +1555,17 @@ void MainWindow::updateProgressBar(int percentage, QString message)
}
}
+void MainWindow::updateEntryCountLabel()
+{
+ auto dbWidget = m_ui->tabWidget->currentDatabaseWidget();
+ if (dbWidget && dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode) {
+ int numEntries = dbWidget->entryView()->model()->rowCount();
+ m_statusBarLabel->setText(tr("%1 Entry(s)", "", numEntries).arg(numEntries));
+ } else {
+ m_statusBarLabel->setText("");
+ }
+}
+
void MainWindow::obtainContextFocusLock()
{
m_contextMenuFocusLock = true;
diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h
index 8c4821b3e..4e87009a7 100644
--- a/src/gui/MainWindow.h
+++ b/src/gui/MainWindow.h
@@ -147,6 +147,7 @@ private slots:
void agentEnabled(bool enabled);
void updateTrayIcon();
void updateProgressBar(int percentage, QString message);
+ void updateEntryCountLabel();
void focusSearchWidget();
private:
@@ -182,6 +183,7 @@ private:
QPointer<SearchWidget> m_searchWidget;
QPointer<QProgressBar> m_progressBar;
QPointer<QLabel> m_progressBarLabel;
+ QPointer<QLabel> m_statusBarLabel;
Q_DISABLE_COPY(MainWindow)