[calendar] Add a mark to days containing an event

REVIEW: 127586
This commit is contained in:
Martin Klapetek 2016-04-20 23:41:13 -04:00
parent 1cf145861b
commit 08312b2e34
6 changed files with 32 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2013 Mark Gaiser <markg85@gmail.com> Copyright (C) 2013 Mark Gaiser <markg85@gmail.com>
Copyright (C) 2016 Martin Klapetek <mklapetek@kde.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2013 Mark Gaiser <markg85@gmail.com> Copyright (C) 2013 Mark Gaiser <markg85@gmail.com>
Copyright (C) 2016 Martin Klapetek <mklapetek@kde.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2013 Mark Gaiser <markg85@gmail.com> Copyright (C) 2013 Mark Gaiser <markg85@gmail.com>
Copyright (C) 2016 Martin Klapetek <mklapetek@kde.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -29,6 +30,7 @@
DaysModel::DaysModel(QObject *parent) : DaysModel::DaysModel(QObject *parent) :
QAbstractListModel(parent), QAbstractListModel(parent),
m_pluginsManager(0), m_pluginsManager(0),
m_lastRequestedEventsStartDate(QDate()),
m_agendaNeedsUpdate(false) m_agendaNeedsUpdate(false)
{ {
QHash<int, QByteArray> roleNames; QHash<int, QByteArray> roleNames;
@ -112,7 +114,9 @@ void DaysModel::onDataReady(const QMultiHash<QDate, CalendarEvents::EventData> &
{ {
m_eventsData.reserve(m_eventsData.size() + data.size()); m_eventsData.reserve(m_eventsData.size() + data.size());
m_eventsData += data; m_eventsData += data;
layoutChanged(); layoutChanged();
Q_EMIT agendaUpdated(QDate::currentDate());
} }
void DaysModel::onEventModified(const CalendarEvents::EventData &data) void DaysModel::onEventModified(const CalendarEvents::EventData &data)

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2013 Mark Gaiser <markg85@gmail.com> Copyright (C) 2013 Mark Gaiser <markg85@gmail.com>
Copyright (C) 2016 Martin Klapetek <mklapetek@kde.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -73,6 +74,7 @@ private:
QDate m_lastRequestedAgendaDate; QDate m_lastRequestedAgendaDate;
QList<CalendarEvents::CalendarEventsPlugin*> m_eventPlugins; QList<CalendarEvents::CalendarEventsPlugin*> m_eventPlugins;
QMultiHash<QDate, CalendarEvents::EventData> m_eventsData; QMultiHash<QDate, CalendarEvents::EventData> m_eventsData;
QDate m_lastRequestedEventsStartDate; // this is always this+42 days
bool m_agendaNeedsUpdate; bool m_agendaNeedsUpdate;
}; };

View File

@ -101,6 +101,15 @@ MouseArea {
z: todayRect.z - 1 z: todayRect.z - 1
} }
Loader {
active: containsEventItems
anchors.bottom: parent.bottom
anchors.right: parent.right
height: parent.height / 3
width: height
sourceComponent: eventsMarkerComponent
}
Components.Label { Components.Label {
id: label id: label
anchors { anchors {

View File

@ -229,6 +229,21 @@ Item {
} }
} }
PlasmaCore.Svg {
id: calendarSvg
imagePath: "widgets/calendar"
}
Component {
id: eventsMarkerComponent
PlasmaCore.SvgItem {
id: eventsMarker
svg: calendarSvg
elementId: "event"
}
}
Connections { Connections {
target: theme target: theme
onTextColorChanged: { onTextColorChanged: {