Commit f0b3afc6 authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Enabled selected hierarchy names sorting.

parent 40e6ce31
......@@ -21,8 +21,10 @@
* the two.
*/
#include <algorithm> /* std::sort */
#include <QQmlEngine> /* qmlRegisterType */
#include "src/datovka_shared/localisation/localisation.h"
#include "src/records_management/models/upload_hierarchy_list_model.h"
void UploadHierarchyListModel::declareQML(void)
......@@ -346,11 +348,26 @@ QStringList UploadHierarchyListModel::selectedIds(void) const
return m_selected.keys();
}
/*!
* @brief Used for sorting hierarchy names.
*/
class HierarchyNameLess {
public:
bool operator()(const QString &a, const QString &b) const
{
return Localisation::stringCollator.compare(a, b) < 0;
}
};
QStringList UploadHierarchyListModel::selectedFullNames(bool sort) const
{
/* TODO -- Enable sorting. */
QStringList values(m_selected.values());
if (sort) {
::std::sort(values.begin(), values.end(), HierarchyNameLess());
}
return m_selected.values();
return values;
}
UploadHierarchyListModel *UploadHierarchyListModel::fromVariant(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment