mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge pull request #219 from keepassxreboot/feature/search-clone-entry
Clone an entry when in search mode
This commit is contained in:
commit
e826309d59
@ -508,7 +508,8 @@ Entry* Entry::clone(CloneFlags flags) const
|
||||
entry->m_data.timeInfo.setLocationChanged(now);
|
||||
}
|
||||
|
||||
|
||||
if (flags & CloneRenameTitle)
|
||||
entry->setTitle(entry->title() + tr(" - Clone"));
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
@ -115,7 +115,8 @@ public:
|
||||
CloneNoFlags = 0,
|
||||
CloneNewUuid = 1, // generate a random uuid for the clone
|
||||
CloneResetTimeInfo = 2, // set all TimeInfo attributes to the current time
|
||||
CloneIncludeHistory = 4 // clone the history items
|
||||
CloneIncludeHistory = 4, // clone the history items
|
||||
CloneRenameTitle = 8 // add "-Clone" after the original title
|
||||
};
|
||||
Q_DECLARE_FLAGS(CloneFlags, CloneFlag)
|
||||
|
||||
|
@ -312,8 +312,10 @@ void DatabaseWidget::cloneEntry()
|
||||
return;
|
||||
}
|
||||
|
||||
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo);
|
||||
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo | Entry::CloneRenameTitle);
|
||||
entry->setGroup(currentEntry->group());
|
||||
if (isInSearchMode())
|
||||
search(m_lastSearchText);
|
||||
m_entryView->setFocus();
|
||||
m_entryView->setCurrentEntry(entry);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
bool groupSelected = dbWidget->isGroupSelected();
|
||||
|
||||
m_ui->actionEntryNew->setEnabled(!inSearch);
|
||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected);
|
||||
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
|
||||
m_ui->actionEntryDelete->setEnabled(entriesSelected);
|
||||
m_ui->actionEntryCopyTitle->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTitle());
|
||||
|
@ -566,7 +566,7 @@ void TestGui::testCloneEntry()
|
||||
QCOMPARE(entryView->model()->rowCount(), 2);
|
||||
Entry* entryClone = entryView->entryFromIndex(entryView->model()->index(1, 1));
|
||||
QVERIFY(entryOrg->uuid() != entryClone->uuid());
|
||||
QCOMPARE(entryClone->title(), entryOrg->title());
|
||||
QCOMPARE(entryClone->title(), entryOrg->title() + QString(" - Clone"));
|
||||
}
|
||||
|
||||
void TestGui::testDragAndDropEntry()
|
||||
|
Loading…
Reference in New Issue
Block a user