sort labels in article previewer alphabetically - fixes #978

This commit is contained in:
Martin Rotter 2023-06-12 08:03:15 +02:00
parent 1cc9b1d773
commit da4acf9044
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "gui/messagepreviewer.h"
#include "3rd-party/boolinq/boolinq.h"
#include "database/databasequeries.h"
#include "gui/dialogs/formmain.h"
#include "gui/itemdetails.h"
@ -282,6 +283,10 @@ void MessagePreviewer::updateLabels(bool only_clear) {
m_separator = m_toolBar->addSeparator();
auto lbls = m_root.data()->getParentServiceRoot()->labelsNode()->labels();
std::sort(lbls.begin(), lbls.end(), [](Label* lhs, Label* rhs) {
return lhs->title().compare(rhs->title(), Qt::CaseSensitivity::CaseInsensitive) < 0;
});
for (auto* label : lbls) {
LabelToolbarAction* act_label = new LabelToolbarAction(this);