Bug 218549 - Plasma calendar doesn't distinguish holiday types
Summary: Plasma calendar doesn't distinguish holiday types
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Unmaintained
Component: widget-clock (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 218511 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-13 18:52 UTC by John Layt
Modified: 2010-06-06 15:38 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Layt 2009-12-13 18:52:43 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

The Plasma calendar displays all holidays with no distinction made been real public holidays and other significant dates such as religious holy days that are not days off.

The Plasma calendar displays holidays using the list of holidays provided by the Calendar Data Engine, which in turn obtains the list of holidays from the kdepimlibs KHolidays library.  However KHolidays also allows for the definition of other significant dates that are not a public holiday or day off.  The data engine does not make this distinction, so the calendar plasmoid displays all dates returned as a 'Holiday' in red when many are not.

The Data Engine should either return the type of the holiday (preferred but new feature so 4.5?), or only return 'proper' holidays (bug fix for 4.4?).  Discuss :-)

Note that KHolidays is due a major re-write to properly define all the different types of 'holidays', so only a basic solution indicating work/non-work days is required for now.  See http://websvn.kde.org/trunk/KDE/kdepimlibs/kholidays/DESIGN?view=markup
Comment 1 John Layt 2009-12-13 18:59:46 UTC
*** Bug 218511 has been marked as a duplicate of this bug. ***
Comment 2 Anne-Marie Mahfouf 2009-12-13 21:09:10 UTC
Yes KHolidays can make the distinction between workDay and non working day but it does not seem possible to honor colors in the Plasma Calendar. 

My idea was to keep the red color and display "Holiday: Christmas" for non-working days and display only the special days titles for work days like "Spring" (without the "Holiday:" bit). 
Displaying also only the non working holidays would be an easy fix though!

As for the KHolidays rewrite I talked to Allen but he is not sure he'll have time for it for 4.5. The DESIGN document is however sketching it nicely!

Thanks John for filing this clearly and separately!
Comment 3 Anne-Marie Mahfouf 2009-12-16 10:50:44 UTC
Proposed patch for displaying only the Non Work holidays which would be a quick fix for 4.4 but should not be left for 4.5 where we should parse all calendar days. CCing Davide

Index: calendarengine.cpp
===================================================================
--- calendarengine.cpp	(revision 1062832)
+++ calendarengine.cpp	(working copy)
@@ -73,12 +73,14 @@
             if (!holidays.isEmpty()) {
                 QString summary;
                 foreach (const KHolidays::Holiday &holiday, holidays) {
-                    if (!summary.isEmpty()) {
-                        summary.append("\n");
-                    }
+                    if (holiday.dayType()==1) {
+                        if (!summary.isEmpty()) {
+                            summary.append("\n");
+                        }
 
-                    summary.append(holiday.text());
+                        summary.append(holiday.text());
                 }
+            }
 
                 data.insert(dateArg.toString(Qt::ISODate), summary);
             }
Comment 4 John Layt 2009-12-16 11:14:30 UTC
Beat me to it :-)  Looks good, thanks for that Anne-Marie.  Plasma patches normally go up on ReviewBoard, I'd want to get sign-off from Aaron or Marco, but I don't see a problem there.
Comment 5 Anne-Marie Mahfouf 2009-12-16 11:38:28 UTC
The above is my less prefered way. 

My idea was to display "Holiday: summary" for holiday.dayType()==1
for ex "Holiday: Christmas"
and only "summary" for holiday.dayType()==0
for ex "Spring"
so that all days in the calendars are displayed.

Davide, is that easily doable? Given that the "Holiday:" string is in DateExtenderWidget.
Comment 6 John Layt 2009-12-18 23:08:35 UTC
Do you mean have the engine add 'Holiday: ' to the summary string it returns?  Could be a good compromise if it's OK to move the translation.  A grep doesn't appear to show anything besides CalendarTable and ClockApplet that uses the Calendar engine so it could be safe.  The tooltip might look a little strange, would need to check the visuals of that if done.

Otherwise if you mean doing that in the applet, then it's a change to the engine api and the CalendarTable method of caching holidays and a few other things which are too big before 4.5.
Comment 7 Anne-Marie Mahfouf 2009-12-19 11:53:16 UTC
John: you are right, it's too big for 4.4. Then we can commit the above patch but maybe leave the bug report open for the 4.5 real fixe.
Comment 8 John Layt 2009-12-19 18:13:23 UTC
Yes, please leave open for 4.5.  I plan to make changes in 4.5 to allow multiple holidays on the same day, have multiple holiday regions, and maybe even an akonadi interface for calendar events, so I can fix this then.  Thanks!
Comment 9 Anne-Marie Mahfouf 2009-12-19 18:22:32 UTC
SVN commit 1063953 by annma:

fix holidays parsing in order to display only non work holidays - will get a true fix for 4.5 to allow displaying of all holiday days from the calendar and more (thanks to John Layt)
CCBUG=218549


 M  +6 -4      calendarengine.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1063953
Comment 10 Aaron J. Seigo 2010-06-04 01:23:22 UTC
John: has this been satisfactorially addressed in 4.5?
Comment 11 John Layt 2010-06-04 02:06:51 UTC
No, the KHolidays api to provide holiday classifications wasn't finished in time for 4.5.  I could quickly whip up the other solution where the dataengine returns all the holidays again but with the existing DayType flag attached.  The plasmoid would then only highlight in red the days off but the tooltip could list all the holidays returned.
Comment 12 John Layt 2010-06-05 02:15:04 UTC
See review on http://reviewboard.kde.org/r/4236/, there's room for discussion about how each holiday and event type gets displayed.
Comment 13 John Layt 2010-06-06 15:38:44 UTC
Implemented for 4.5 all holidays are shown again, but only days off are highlighted in red and have their description prefixed with "Holiday".  All other holidays are highlighted in green and are not labeled as Holiday.  This is sufficient to close this bug as it resolves the original issue of not distinguishing between days off and not days off.  Proper classification and control of what types of holidays to display is a whole new feature for consideration in 4.6.