Allow setting group icons to children groups/entries (#3273)
* Add combo menu button to apply an icon to children - allow more options to apply icons (child groups, child entries) - extend tests in TestGroup (applying icons for groups/entries only) - prevent blue folder icon being set for entries (on entry creation only) * Do not show the combo menu button for entries
This commit is contained in:
committed by
Jonathan White
parent
84eec03cb7
commit
bb8377ae6a
@@ -1080,8 +1080,10 @@ Entry* Group::addEntryWithPath(const QString& entryPath)
|
||||
return entry;
|
||||
}
|
||||
|
||||
void Group::applyGroupIconTo(Entry* entry)
|
||||
void Group::applyGroupIconOnCreateTo(Entry* entry)
|
||||
{
|
||||
Q_ASSERT(entry);
|
||||
|
||||
if (!config()->get("UseGroupIconOnEntryCreation").toBool()) {
|
||||
return;
|
||||
}
|
||||
@@ -1090,6 +1092,13 @@ void Group::applyGroupIconTo(Entry* entry)
|
||||
return;
|
||||
}
|
||||
|
||||
applyGroupIconTo(entry);
|
||||
}
|
||||
|
||||
void Group::applyGroupIconTo(Entry* entry)
|
||||
{
|
||||
Q_ASSERT(entry);
|
||||
|
||||
if (iconUuid().isNull()) {
|
||||
entry->setIcon(iconNumber());
|
||||
} else {
|
||||
@@ -1097,6 +1106,31 @@ void Group::applyGroupIconTo(Entry* entry)
|
||||
}
|
||||
}
|
||||
|
||||
void Group::applyGroupIconTo(Group* other)
|
||||
{
|
||||
Q_ASSERT(other);
|
||||
|
||||
if (iconUuid().isNull()) {
|
||||
other->setIcon(iconNumber());
|
||||
} else {
|
||||
other->setIcon(iconUuid());
|
||||
}
|
||||
}
|
||||
|
||||
void Group::applyGroupIconToChildGroups()
|
||||
{
|
||||
for (Group* recursiveChild : groupsRecursive(false)) {
|
||||
applyGroupIconTo(recursiveChild);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::applyGroupIconToChildEntries()
|
||||
{
|
||||
for (Entry* recursiveEntry : entriesRecursive(false)) {
|
||||
applyGroupIconTo(recursiveEntry);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::sortChildrenRecursively(bool reverse)
|
||||
{
|
||||
std::sort(
|
||||
|
||||
@@ -168,7 +168,11 @@ public:
|
||||
void addEntry(Entry* entry);
|
||||
void removeEntry(Entry* entry);
|
||||
|
||||
void applyGroupIconOnCreateTo(Entry* entry);
|
||||
void applyGroupIconTo(Entry* entry);
|
||||
void applyGroupIconTo(Group* other);
|
||||
void applyGroupIconToChildGroups();
|
||||
void applyGroupIconToChildEntries();
|
||||
|
||||
void sortChildrenRecursively(bool reverse = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user