Fixes crash when deleting in search mode.

This commit is contained in:
Louis-Bertrand Varin 2017-03-04 12:19:18 -05:00
parent 37c9ad8e8d
commit b2fa6fca82
2 changed files with 12 additions and 5 deletions

View File

@ -322,8 +322,7 @@ void DatabaseWidget::cloneEntry()
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo | Entry::CloneRenameTitle);
entry->setGroup(currentEntry->group());
if (isInSearchMode())
search(m_lastSearchText);
refreshSearch();
m_entryView->setFocus();
m_entryView->setCurrentEntry(entry);
}
@ -366,6 +365,7 @@ void DatabaseWidget::deleteEntries()
for (Entry* entry : asConst(selectedEntries)) {
delete entry;
}
refreshSearch();
}
}
else {
@ -875,6 +875,12 @@ void DatabaseWidget::databaseSaved()
m_databaseModified = false;
}
void DatabaseWidget::refreshSearch() {
if (isInSearchMode()) {
search(m_lastSearchText);
}
}
void DatabaseWidget::search(const QString& searchtext)
{
if (searchtext.isEmpty())
@ -908,9 +914,7 @@ void DatabaseWidget::search(const QString& searchtext)
void DatabaseWidget::setSearchCaseSensitive(bool state)
{
m_searchCaseSensitive = state;
if (isInSearchMode())
search(m_lastSearchText);
refreshSearch();
}
void DatabaseWidget::onGroupChanged(Group* group)

View File

@ -147,10 +147,12 @@ public Q_SLOTS:
void switchToImportKeepass1(const QString& fileName);
void databaseModified();
void databaseSaved();
// Search related slots
void search(const QString& searchtext);
void setSearchCaseSensitive(bool state);
void endSearch();
void showMessage(const QString& text, MessageWidget::MessageType type);
void hideMessage();
@ -177,6 +179,7 @@ private:
void setClipboardTextAndMinimize(const QString& text);
void setIconFromParent();
void replaceDatabase(Database* db);
void refreshSearch();
Database* m_db;
QWidget* m_mainWidget;