diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/DatabaseWidget.cpp | 9 | ||||
-rw-r--r-- | src/gui/EntryPreviewWidget.cpp | 6 | ||||
-rw-r--r-- | src/gui/EntryPreviewWidget.h | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index e7b6179fb..eb33c09c0 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -154,6 +154,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent) m_shareLabel->setVisible(false); #endif + m_previewView->setObjectName("previewWidget"); m_previewView->hide(); m_previewSplitter->addWidget(m_entryView); m_previewSplitter->addWidget(m_previewView); @@ -552,6 +553,14 @@ void DatabaseWidget::deleteEntries(QList<Entry*> selectedEntries) } refreshSearch(); + + m_entryView->setFirstEntryActive(); + auto* currentEntry = currentSelectedEntry(); + if (currentEntry) { + m_previewView->setEntry(currentEntry); + } else { + m_previewView->setGroup(groupView()->currentGroup()); + } } bool DatabaseWidget::confirmDeleteEntries(QList<Entry*> entries, bool permanent) diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index e46e3a663..2e2e37dbc 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -145,10 +145,12 @@ void EntryPreviewWidget::setDatabaseMode(DatabaseWidget::Mode mode) } if (mode == DatabaseWidget::Mode::ViewMode) { - if (m_ui->stackedWidget->currentWidget() == m_ui->pageGroup) { + if (m_currentGroup && m_ui->stackedWidget->currentWidget() == m_ui->pageGroup) { setGroup(m_currentGroup); - } else { + } else if (m_currentEntry) { setEntry(m_currentEntry); + } else { + hide(); } } } diff --git a/src/gui/EntryPreviewWidget.h b/src/gui/EntryPreviewWidget.h index e8e7d2172..e1a7aff38 100644 --- a/src/gui/EntryPreviewWidget.h +++ b/src/gui/EntryPreviewWidget.h @@ -77,8 +77,8 @@ private: const QScopedPointer<Ui::EntryPreviewWidget> m_ui; bool m_locked; - Entry* m_currentEntry; - Group* m_currentGroup; + QPointer<Entry> m_currentEntry; + QPointer<Group> m_currentGroup; QTimer m_totpTimer; quint8 m_selectedTabEntry; quint8 m_selectedTabGroup; |