mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-20 15:02:32 -05:00
Add EntryAttributes::rename().
This commit is contained in:
parent
de4b90cdf1
commit
7c094d4723
2 changed files with 18 additions and 0 deletions
|
|
@ -100,6 +100,23 @@ void EntryAttributes::remove(const QString& key)
|
|||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
void EntryAttributes::rename(const QString& oldKey, const QString& newKey)
|
||||
{
|
||||
Q_ASSERT(!isDefaultAttribute(oldKey));
|
||||
Q_ASSERT(!isDefaultAttribute(newKey));
|
||||
|
||||
if (!m_attributes.contains(oldKey)) {
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
QString data = value(oldKey);
|
||||
bool protect = isProtected(oldKey);
|
||||
|
||||
remove(oldKey);
|
||||
set(newKey, data, protect);
|
||||
}
|
||||
|
||||
void EntryAttributes::copyCustomKeysFrom(const EntryAttributes* other)
|
||||
{
|
||||
if (!areCustomKeysDifferent(other)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue