Patch Calendar Show All-Day Events in Month View

From WebOS Internals
Revision as of 20:13, 23 October 2009 by Pyrognome (talk | contribs) (This needs to be updated for 1.2.1 and released to webos-internals for a patch.)
Jump to navigation Jump to search


Is any one going to update this for 1.2.1? Could some one add this patch to the webos modifications series for quilt?

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;

Notes

  • When changing (scrolling) from current month to the next month, the All-Day Events seem to be appended to the current list, therefore the dates show the blue background even though there isn't an event on the day. I'm still working on a fix for it but right now I have the correct dates showing but the color format for the previous and next overlapping month dates are incorrect -sstallard419