Improve sections
Now they are displayed for each day (if there was at least one message on that day) instead of every few hours
This commit is contained in:
@@ -10,8 +10,7 @@ import org.kde.kirigami 2.13 as Kirigami
|
|||||||
|
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
level: 4
|
level: 4
|
||||||
text: section + " • " + Qt.formatTime(time)
|
text: section
|
||||||
font.capitalization: Font.AllUppercase
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
topPadding: Kirigami.Units.largeSpacing * 2
|
topPadding: Kirigami.Units.largeSpacing * 2
|
||||||
bottomPadding: Kirigami.Units.smallSpacing
|
bottomPadding: Kirigami.Units.smallSpacing
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <user.h>
|
#include <user.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QTimeZone>
|
||||||
#include <QQmlEngine> // for qmlRegisterType()
|
#include <QQmlEngine> // for qmlRegisterType()
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
@@ -452,7 +453,9 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
for (auto r = row + 1; r < rowCount(); ++r) {
|
for (auto r = row + 1; r < rowCount(); ++r) {
|
||||||
auto i = index(r);
|
auto i = index(r);
|
||||||
if (data(i, SpecialMarksRole) != EventStatus::Hidden) {
|
if (data(i, SpecialMarksRole) != EventStatus::Hidden) {
|
||||||
return data(i, TimeRole).toDateTime().msecsTo(data(idx, TimeRole).toDateTime()) > 600000;
|
const auto day = data(idx, TimeRole).toDateTime().toLocalTime().date().dayOfYear();
|
||||||
|
const auto previousEventDay = data(i, TimeRole).toDateTime().toLocalTime().date().dayOfYear();
|
||||||
|
return day != previousEventDay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user