Commit Graph

27 Commits

Author SHA1 Message Date
Christophe Giboudeaux
1587ead53e Fix typos found by codespell
GIT_SILENT
2021-07-14 11:01:00 +02:00
Carl Schwan
c1517f728e Fix crash when there is already exactly 5 events displayed
And simplify code:
* Add constant for the max number of events that can be displayed at the
same time
* Use std::min to simplify a bit the code
* Rename nextIndex to addedEventCount
2021-06-03 15:32:20 +02:00
Carl Schwan
b3f8e96517 Add up to 5 event indicators to the DayDelegate
This commit replaces the existing triangular event indicator on calendar
days with colored dots; one per event, up to five events per day. The dots
will use the color of the event, if it has one.
2021-04-29 21:38:46 +00:00
Ahmad Samir
c0274df69a Run clang-format on all cpp/h files
NO_CHANGELOG
2021-03-13 17:35:34 +00:00
Ahmad Samir
34a8b79aa7 Use Q_EMIT instead of emit
In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

GIT_SILENT
2021-01-18 13:08:40 +02:00
Andreas Cord-Landwehr
d10afb5d2a plasma-framework: Convert copyright statements to SPDX expressions 2020-08-13 19:08:54 +00:00
Laurent Montel
48f60533b9 [plasma-framework] make it compiles without foreach
Summary: compile without foreach

Test Plan: autotest ok

Reviewers: dfaure, apol

Reviewed By: dfaure, apol

Subscribers: ahmadsamir, nicolasfella, broulik, apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19913
2020-04-17 06:47:04 +02:00
Friedrich W. H. Kossebau
67f5ad29e8 Fix PlasmaCalendar widget to not mark days with minor events
Summary:
CalendarEvents::EventData (in KDeclarative) has a property isMinor, which is
described as "If set to true, it won't be marked in the calendar grid".

This patch fulfils that promise, by introducing separate roles on the model
which explicitly report the existance of any major or any minor events at a
given day, so that the marker loader can concentrate on the major events.

Test Plan:
Using a plasmacalendar plugin which feeds events with isMinor=true the
widget now only marks days which have major events.

Reviewers: #plasma, broulik, davidedmundson

Reviewed By: #plasma, broulik, davidedmundson

Subscribers: davidedmundson, broulik, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D12438
2018-05-02 17:33:30 +02:00
Laurent Montel
a4eeca5190 Warning-- 2018-04-13 09:05:26 +02:00
Laurent Montel
d1949d9149 Const'ify, use nullptr 2017-12-25 18:41:50 +01:00
Kai Uwe Broulik
dfbf2c1c30 Port away from setRoleNames where easily possible
It is deprecated. Instead re-implement roleNames().
Done in places where only static roles were used.

Differential Revision: https://phabricator.kde.org/D4891
2017-03-06 13:36:17 +01:00
David Edmundson
2e944d53a3 Avoid using deprecated Qt code QAbstractItemModel::reset
Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3839
2016-12-28 15:43:38 +00:00
Kai Uwe Broulik
97a3611c16 [Calendar DaysModel] Don't call layoutChanged() and emit dataChanged() with roles
LayoutChanged causes QML to destroy all delegates and re-create them.
Since the number of days doesn't change but only the numbers, we can just call dataChanged on all roles.

Furthermore, when agenda-related data changes, only the containsEventItems role
might have changed, so only emit a change for it.

CHANGELOG: Performance when changing months in the calendar has been greatly improved

REVIEW: 128648
2016-08-14 11:48:11 +02:00
Daniel Vrátil
93905e8c68 DaysModel: reset m_agendaNeedsUpdate when plugin sends new events
Only reset if there's an event for current date. Without that when
the applet tries to get the updated list of events and it gets the
old one (empty) due to the check at the beginning of  eventsForDate().
2016-05-30 01:17:18 +02:00
Martin Klapetek
08312b2e34 [calendar] Add a mark to days containing an event
REVIEW: 127586
2016-04-20 23:41:23 -04:00
Aleix Pol
06c7b9c050 Remove some warnings
Unused variables
Unused code
Unused arguments
Unnecessarily complex code
Initialization order
Duplicated properties

REVIEW: 127214
2016-02-29 00:59:44 +01:00
Aleix Pol
9f62532674 Fix most of Clazy warnings in plasma-framework
REVIEW: 126672
2016-02-29 00:13:41 +01:00
Martin Klapetek
e33b486be6 [calendar] Delay the model reset until the view is ready
Otherwise things will crash.

Reviewed-by: Eike Hein
BUG: 355943
2015-12-02 12:57:57 -05:00
Martin Klapetek
e571628b18 [calendar] Sort the events by their type too
The QML sectioning code does not actually sort the model, this needs to
be done beforehand. This should now sort the events by their type and
their start datetime
2015-11-18 12:38:08 -05:00
Martin Klapetek
520837a07c [calendar] Move the plugin library to KDeclarative
Marco is not happy with the plugin being here and having a Plasma
namespace, so after some discussion it was decided to move it to
KDeclarative and change to CalendarEvents namespace.
2015-11-16 14:26:26 -05:00
Martin Klapetek
d0d0a27bac [calendar] Move the plugins handling to a separate class
This is also made a QML singleton that will be used for the applet
config view where it will add the plugin configs once we add that
possibility.

The same instance is then set to the DaysModel from QML.

REVIEW: 125951
2015-11-16 11:49:02 -05:00
Martin Klapetek
fe0384f0d4 [calendar] Add plugin system for Calendar events
This adds a simple plugin interface that can be subclassed
and provide events integration with Plasma Calendar applet.

It's asynchronous and I've kept it deliberately simple.
For now the Calendar tells the plugins which date range
is being displayed, the plugins load the data and then
emit the dataReady() signal containing the events.

The events are stored in a multihash for quick access
by the Calendar's agenda part but also for overall
easy-to-use (eg. in teh model data()).

The event data is stored in EventData class, which has
a pretty self-explanatory members, except perhaps the
"isMinor" property. The intention with this is to support
namedays, where in some countries the calendars have
different name every day. This is just a minor holiday
and as such should not mark the calendar grid, otherwise
the whole grid would be in a different color.

Putting the interface here might raise the question of
depending on plasma-framework, but plugins provided by
KDE can go to plasma-workspace and other 3rd party ones
would just have to live with it. I don't think it will
be a problem but if it turns out it is, we can rethink
the placement.

REVIEW: 125817
CCBUG: 349676
CHANGELOG: Allow plugins to supply event data to Calendar applet
2015-11-16 11:46:26 -05:00
Kai Uwe Broulik
11e5ff10ae Improve calendar navigation
This adds a "Year overview" showing all 12 months in a grid, and a "Decade overview"
showing the current decade.

CHANGELOG: Calendar navigation has been significantly improved, providing a year and decade overview
REVIEW: 122488
2015-07-27 11:41:35 +02:00
Kevin Ottens
72ba7b4146 Apply the astyle-kdelibs script 2014-04-26 01:48:37 +02:00
Martin Klapetek
6eea4da70d Use proper index validity checking 2013-11-27 00:22:57 +01:00
Mark Gaiser
d56f690fcf Add license to calendar component classes. 2013-11-13 13:41:41 +01:00
Marco Martin
e8a4332034 re-add the calendar qml component
CCMAIL:heena393@gmail.com
2013-08-31 15:23:04 +02:00