Patch Calendar Show All-Day Events in Month View

From WebOS Internals
Revision as of 10:05, 22 July 2009 by Hopspitfire (talk | contribs) (New page: 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 changing the background of the cell to b...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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 changing the background of the cell to be blue.

Modifies the month controller to show allday events in the month scene by changing the background of the cell to a light blue.
Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
===================================================================
--- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
+++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
@@ -25,11 +25,25 @@ var MonthAssistant = Class.create({
                this.scrollerModel = { scrollbars: false, mode: "vertical-snap", snapIndex: 0, snapElements: { y: [] } };
        },

+  fullEvts: null,
+
        setupMonth: function(startDate, endDate, callbackfn)
        {
+               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);
        },
-
+
+       getEventsCallback: function(resp)
+       {
+Mojo.Log.info('month-assistant:getEventsCallback');
+               this.fullEvts = resp.days;
+       },
+
        buildViewHeader: function()
        {
                //Mojo.Log.info("month-assistant: buildViewHeader");
@@ -342,6 +356,10 @@ var MonthAssistant = Class.create({
                var daylen = days.length - 1; // We get back more days of info that we want - 1 more in fact, because its inclusive, rather than exclusive
                for (var d = 0; d < daylen; d++)
                {
+                       if (this.fullEvts[d].allDayEvents.length > 0)
+                       {
+                                       dayCell.style.backgroundColor = '#99ccff';
+                       }
                        var day = this._token2state(days.charCodeAt(d));

                        var child = dayCell.firstChild;