create new entry while searching

This commit is contained in:
thez3ro 2018-01-18 01:16:46 +01:00
parent edb7b56f1a
commit 00ce60ef20
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
2 changed files with 7 additions and 2 deletions

View File

@ -339,6 +339,11 @@ void DatabaseWidget::createEntry()
} }
m_newEntry = new Entry(); m_newEntry = new Entry();
if (isInSearchMode()) {
m_newEntry->setTitle(getCurrentSearch());
endSearch();
}
m_newEntry->setUuid(Uuid::random()); m_newEntry->setUuid(Uuid::random());
m_newEntry->setUsername(m_db->metadata()->defaultUserName()); m_newEntry->setUsername(m_db->metadata()->defaultUserName());
m_newParent = m_groupView->currentGroup(); m_newParent = m_groupView->currentGroup();

View File

@ -493,13 +493,13 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
switch (mode) { switch (mode) {
case DatabaseWidget::ViewMode: { case DatabaseWidget::ViewMode: {
bool inSearch = dbWidget->isInSearchMode(); //bool inSearch = dbWidget->isInSearchMode();
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1; bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1;
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0; bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0;
bool groupSelected = dbWidget->isGroupSelected(); bool groupSelected = dbWidget->isGroupSelected();
bool recycleBinSelected = dbWidget->isRecycleBinSelected(); bool recycleBinSelected = dbWidget->isRecycleBinSelected();
m_ui->actionEntryNew->setEnabled(!inSearch); m_ui->actionEntryNew->setEnabled(true);
m_ui->actionEntryClone->setEnabled(singleEntrySelected); m_ui->actionEntryClone->setEnabled(singleEntrySelected);
m_ui->actionEntryEdit->setEnabled(singleEntrySelected); m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
m_ui->actionEntryDelete->setEnabled(entriesSelected); m_ui->actionEntryDelete->setEnabled(entriesSelected);