Patch Calendar Show All-Day Events in Month View

From WebOS Internals
Revision as of 04:27, 24 October 2009 by Daventx (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This patch will modify the calendar application to show all day events in the month view of the application. It denotes days with all day events by grey in the all view, and by the calendar color when viewing a specific calendar.

--- /tmp/month-assistant.js	Fri Aug 28 12:51:48 2009
+++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js	Fri Oct 23 12:37:41 2009
@@ -27,12 +27,21 @@
 		this.scrollerModel = { scrollbars: false, mode: "vertical-snap", snapIndex: 0, snapElements: { y: [] } };
 	},
 														
- 	setupMonth: function(startDate, endDate, callbackfn) 
+ 	fullEvts: null,
+
+        setupMonth: function(startDate, endDate, callbackfn) 
 	{
-		getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+		getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(), this.getEventsCallback.bind(this), this.controller, this.getEventsFailCallback, {useSlices: true});
+                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
 	},
 	
-	buildViewHeader: function() 
+	getEventsCallback: function(resp)
+        {
+                //Mojo.Log.info('month-assistant:getEventsCallback');
+                this.fullEvts = resp.days;
+        },
+
+        buildViewHeader: function() 
 	{
 		//Mojo.Log.info("month-assistant: buildViewHeader");
 		this.controller.get('mv_header_container1').update(Mojo.View.render({object: { viewPrefix: 'mv' }, template: 'shared/calendar_view_header'}));
@@ -376,7 +385,11 @@
 			var cls;
 			for (var i = 1; i < 8; i <<= 1)
 			{
-				if (day & (i << 3)) 
+				if (this.fullEvts[d].allDayEvents.length > 0)
+				{
+					cls = "monthview-busy-time " + calStyle;
+				}
+				else if (day & (i << 3)) 
 				{
 					cls = "monthview-busy-time " + calStyle;
 				}

Notes

Updated and working with 1.2.1 on 2009/10/23 by daventx