mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Add EntryAttributes::rename().
This commit is contained in:
parent
de4b90cdf1
commit
7c094d4723
@ -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)) {
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
bool isProtected(const QString& key) const;
|
||||
void set(const QString& key, const QString& value, bool protect = false);
|
||||
void remove(const QString& key);
|
||||
void rename(const QString& oldKey, const QString& newKey);
|
||||
void copyCustomKeysFrom(const EntryAttributes* other);
|
||||
bool areCustomKeysDifferent(const EntryAttributes* other);
|
||||
void clear();
|
||||
|
Loading…
Reference in New Issue
Block a user