Skip to content

Commit

Permalink
Merge pull request #1398 from keepassxreboot/feature/add-entry-while-…
Browse files Browse the repository at this point in the history
…searching

Create new entry while searching
  • Loading branch information
phoerious authored Jan 18, 2018
2 parents edb7b56 + 00ce60e commit 92dd4c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ void DatabaseWidget::createEntry()
}

m_newEntry = new Entry();

if (isInSearchMode()) {
m_newEntry->setTitle(getCurrentSearch());
endSearch();
}
m_newEntry->setUuid(Uuid::random());
m_newEntry->setUsername(m_db->metadata()->defaultUserName());
m_newParent = m_groupView->currentGroup();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)

switch (mode) {
case DatabaseWidget::ViewMode: {
bool inSearch = dbWidget->isInSearchMode();
//bool inSearch = dbWidget->isInSearchMode();
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1;
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0;
bool groupSelected = dbWidget->isGroupSelected();
bool recycleBinSelected = dbWidget->isRecycleBinSelected();

m_ui->actionEntryNew->setEnabled(!inSearch);
m_ui->actionEntryNew->setEnabled(true);
m_ui->actionEntryClone->setEnabled(singleEntrySelected);
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
m_ui->actionEntryDelete->setEnabled(entriesSelected);
Expand Down

0 comments on commit 92dd4c0

Please sign in to comment.