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 {
|
||||
level: 4
|
||||
text: section + " • " + Qt.formatTime(time)
|
||||
font.capitalization: Font.AllUppercase
|
||||
text: section
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
topPadding: Kirigami.Units.largeSpacing * 2
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <user.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTimeZone>
|
||||
#include <QQmlEngine> // for qmlRegisterType()
|
||||
|
||||
#include <KLocalizedString>
|
||||
@@ -452,7 +453,9 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
for (auto r = row + 1; r < rowCount(); ++r) {
|
||||
auto i = index(r);
|
||||
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