mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-02 17:44:46 -05:00
Implement ability to clone an entry when in search mode.
* Cloned entries have "- Clone" appended to their name
This commit is contained in:
parent
6ccae6cc37
commit
16ed89c471
@ -508,7 +508,8 @@ Entry* Entry::clone(CloneFlags flags) const
|
|||||||
entry->m_data.timeInfo.setLocationChanged(now);
|
entry->m_data.timeInfo.setLocationChanged(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags & CloneRenameTitle)
|
||||||
|
entry->setTitle(entry->title() + tr(" - Clone"));
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,8 @@ public:
|
|||||||
CloneNoFlags = 0,
|
CloneNoFlags = 0,
|
||||||
CloneNewUuid = 1, // generate a random uuid for the clone
|
CloneNewUuid = 1, // generate a random uuid for the clone
|
||||||
CloneResetTimeInfo = 2, // set all TimeInfo attributes to the current time
|
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)
|
Q_DECLARE_FLAGS(CloneFlags, CloneFlag)
|
||||||
|
|
||||||
|
@ -312,8 +312,10 @@ void DatabaseWidget::cloneEntry()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo);
|
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo | Entry::CloneRenameTitle);
|
||||||
entry->setGroup(currentEntry->group());
|
entry->setGroup(currentEntry->group());
|
||||||
|
if (isInSearchMode())
|
||||||
|
search(m_lastSearchText);
|
||||||
m_entryView->setFocus();
|
m_entryView->setFocus();
|
||||||
m_entryView->setCurrentEntry(entry);
|
m_entryView->setCurrentEntry(entry);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||||||
bool groupSelected = dbWidget->isGroupSelected();
|
bool groupSelected = dbWidget->isGroupSelected();
|
||||||
|
|
||||||
m_ui->actionEntryNew->setEnabled(!inSearch);
|
m_ui->actionEntryNew->setEnabled(!inSearch);
|
||||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
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);
|
||||||
m_ui->actionEntryCopyTitle->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTitle());
|
m_ui->actionEntryCopyTitle->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTitle());
|
||||||
|
@ -566,7 +566,7 @@ void TestGui::testCloneEntry()
|
|||||||
QCOMPARE(entryView->model()->rowCount(), 2);
|
QCOMPARE(entryView->model()->rowCount(), 2);
|
||||||
Entry* entryClone = entryView->entryFromIndex(entryView->model()->index(1, 1));
|
Entry* entryClone = entryView->entryFromIndex(entryView->model()->index(1, 1));
|
||||||
QVERIFY(entryOrg->uuid() != entryClone->uuid());
|
QVERIFY(entryOrg->uuid() != entryClone->uuid());
|
||||||
QCOMPARE(entryClone->title(), entryOrg->title());
|
QCOMPARE(entryClone->title(), entryOrg->title() + QString(" - Clone"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGui::testDragAndDropEntry()
|
void TestGui::testDragAndDropEntry()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user