aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index f41fe12c..ee2e2b8e 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -752,6 +752,18 @@ void Room::setTags(TagsMap newTags)
void Room::Private::setTags(TagsMap newTags)
{
emit q->tagsAboutToChange();
+ const auto keys = newTags.keys();
+ for (const auto& k: keys)
+ {
+ const auto& checkRes = validatedTag(k);
+ if (checkRes.first)
+ {
+ if (newTags.contains(checkRes.second))
+ newTags.remove(k);
+ else
+ newTags.insert(checkRes.second, newTags.take(k));
+ }
+ }
tags = move(newTags);
qCDebug(MAIN) << "Room" << q->objectName() << "is tagged with"
<< q->tagNames().join(", ");