mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-26 09:21:21 -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();
|
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)
|
void EntryAttributes::copyCustomKeysFrom(const EntryAttributes* other)
|
||||||
{
|
{
|
||||||
if (!areCustomKeysDifferent(other)) {
|
if (!areCustomKeysDifferent(other)) {
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
bool isProtected(const QString& key) const;
|
bool isProtected(const QString& key) const;
|
||||||
void set(const QString& key, const QString& value, bool protect = false);
|
void set(const QString& key, const QString& value, bool protect = false);
|
||||||
void remove(const QString& key);
|
void remove(const QString& key);
|
||||||
|
void rename(const QString& oldKey, const QString& newKey);
|
||||||
void copyCustomKeysFrom(const EntryAttributes* other);
|
void copyCustomKeysFrom(const EntryAttributes* other);
|
||||||
bool areCustomKeysDifferent(const EntryAttributes* other);
|
bool areCustomKeysDifferent(const EntryAttributes* other);
|
||||||
void clear();
|
void clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user