From 5db3c8d9abf6a780cf8abd4fb84f486c5195916d Mon Sep 17 00:00:00 2001 From: Babu Vincent Date: Wed, 13 Apr 2016 17:15:16 +0530 Subject: [PATCH] task sync and strict mode error fix --- chrome/content/attachments-view.js | 9 +- chrome/content/calendar-common-sets2.js | 6 +- chrome/content/calendar-event-dialog.js | 481 +----------------- chrome/content/calendar-task-view.js | 116 +++-- chrome/content/invite-style.js | 2 +- chrome/content/lightningtimezoneOverlay.js | 2 +- components/ecExchangeRequest.js | 11 +- components/erSyncFolderItems.js | 25 +- .../exchangeBaseItem/mivExchangeBaseItem.js | 7 +- .../exchangeCalendar/mivExchangeCalendar.js | 10 +- interfaces/exchangeEvent/mivExchangeEvent.js | 4 +- interfaces/exchangeTodo/mivExchangeTodo.js | 4 +- interfaces/global/mivFunctions.js | 20 +- 13 files changed, 115 insertions(+), 582 deletions(-) diff --git a/chrome/content/attachments-view.js b/chrome/content/attachments-view.js index 07e432a2..02bafbb0 100644 --- a/chrome/content/attachments-view.js +++ b/chrome/content/attachments-view.js @@ -332,7 +332,13 @@ exchAttachments.prototype = { var taskTree = this._document.getElementById("calendar-task-tree"); var item = taskTree.currentTask; - + var displayElement=function(id,flag) { + setBooleanAttribute(id, "hidden", !flag); + return flag; + } + if (displayElement("calendar-task-details-container", item != null) && + displayElement("calendar-task-view-splitter", item != null)) { + if ((item.calendar) && (item.calendar.type == "exchangecalendar")) { // calendar-task-view (hide existing attachment view) //this.globalFunctions.LOG("exchWebService.attachments.onSelectTask: it is an Exchange task 1."); @@ -370,6 +376,7 @@ exchAttachments.prototype = { catch (ex) {this.globalFunctions.LOG("exchWebService.attachments.onSelectTask: Foutje Y:");} this.attachmentListboxVisible = false; } + } }, onSelect: function _onSelect(aEvent) diff --git a/chrome/content/calendar-common-sets2.js b/chrome/content/calendar-common-sets2.js index 430895a9..d80687b5 100644 --- a/chrome/content/calendar-common-sets2.js +++ b/chrome/content/calendar-common-sets2.js @@ -54,7 +54,8 @@ function newOpenEventDialog(calendarItem, calendar, mode, callback, job, initial if (mode == "new") { calendars = calendars.filter(userCanAddItemsToCalendar); } else { /* modify */ - function calendarCanModifyItems(aCalendar) { + + calendars = calendars.filter(function calendarCanModifyItems(aCalendar) { /* If the calendar is the item calendar, we check that the item * can be modified. If the calendar is NOT the item calendar, we * check that the user can remove items from that calendar and @@ -65,8 +66,7 @@ function newOpenEventDialog(calendarItem, calendar, mode, callback, job, initial && userCanAddItemsToCalendar(aCalendar)) || ((calendarItem.calendar == aCalendar) && userCanModifyItem(calendarItem))); - } - calendars = calendars.filter(calendarCanModifyItems); + }); } if (mode == "new" diff --git a/chrome/content/calendar-event-dialog.js b/chrome/content/calendar-event-dialog.js index 4f95b2b5..e5e77e3c 100644 --- a/chrome/content/calendar-event-dialog.js +++ b/chrome/content/calendar-event-dialog.js @@ -1,480 +1 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: GPL 3.0 - * - * The contents of this file are subject to the General Public License - * 3.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.gnu.org/licenses/gpl.html - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * -- Exchange 2007/2010 Calendar and Tasks Provider. - * -- For Thunderbird with the Lightning add-on. - * - * Author: Michel Verbraak (info@1st-setup.nl) - * Website: http://www.1st-setup.nl/wordpress/?page_id=133 - * email: exchangecalendar@extensions.1st-setup.nl - * - * - * This code uses parts of the Microsoft Exchange Calendar Provider code on which the - * "Exchange Data Provider for Lightning" was based. - * The Initial Developer of the Microsoft Exchange Calendar Provider Code is - * Andrea Bittau , University College London - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * ***** BEGIN LICENSE BLOCK *****/ -var Cu = Components.utils; -var Ci = Components.interfaces; -var Cc = Components.classes; - -Cu.import("resource://calendar/modules/calUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -function exchEventDialog(aDocument, aWindow) -{ - this._document = aDocument; - this._window = aWindow; - - this.globalFunctions = Cc["@1st-setup.nl/global/functions;1"] - .getService(Ci.mivFunctions); -} - -exchEventDialog.prototype = { - - _initialized: false, - _oldCallback: null, - - onAcceptCallback: function _onAcceptCallback(aItem, aCalendar, aOriginalItem, aIsClosing) - { - if ((cal.isEvent(aItem)) && (aCalendar.type == "exchangecalendar")) { - if (!aItem.className) { - var newItem = Cc["@1st-setup.nl/exchange/calendarevent;1"] - .createInstance(Ci.mivExchangeEvent); - newItem.cloneToCalEvent(aItem); - aItem = newItem; - } - } - - if ((!cal.isEvent(aItem)) && (aCalendar.type == "exchangecalendar")) { - // Save extra exchange fields to item. - if (!aItem.className) { - var newItem = Cc["@1st-setup.nl/exchange/calendartodo;1"] - .createInstance(Ci.mivExchangeTodo); - newItem.cloneToCalEvent(aItem); - aItem = newItem; - } - - aItem.totalWork = this._document.getElementById("exchWebService-totalWork-count").value; - aItem.actualWork = this._document.getElementById("exchWebService-actualWork-count").value; - aItem.mileage = this._document.getElementById("exchWebService-mileage-count").value; - aItem.billingInformation = this._document.getElementById("exchWebService-billingInformation-count").value; - aItem.companies = this._document.getElementById("exchWebService-companies-count").value; - } - -try{ - if (this.newItem) { - aItem.bodyType = "HTML"; - aItem.body = this._document.getElementById("exchWebService-body-editor").content; - } - else { - if (aItem.bodyType == "HTML") { - aItem.body = this._document.getElementById("exchWebService-body-editor").content; - } - } -}catch(err){dump("Error saving content\n");} - - if (this._oldCallback) { - this._oldCallback(aItem, aCalendar, aOriginalItem, aIsClosing); - } - }, - - onLoad: function _onLoad() - { - //onLoad(); - this._document.getElementById("exchWebService-body-editor").setAttribute("scrollbars","yes"); - if (this._window.arguments[0].calendarEvent.calendar.type != "exchangecalendar") { - if (this._document.getElementById("item-description")) { - this._document.getElementById("item-description").hidden = false; - } - if (this._document.getElementById("exchWebService-body-editor")) { - this._document.getElementById("exchWebService-body-editor").hidden = true; - } - return; - } - - if (this._initialized) return; - this._oldCallback = this._window.onAcceptCallback; - var self = this; - this._window.onAcceptCallback = function(aItem, aCalendar, aOriginalItem, aIsClosing) { self.onAcceptCallback(aItem, aCalendar, aOriginalItem, aIsClosing); }; - - if (this._document.getElementById("todo-entrydate")) { - this._initialized = true; - - var args = this._window.arguments[0]; - var item = args.calendarEvent; - this.updateScreen(item, item.calendar); - //Cc["@mozilla.org/consoleservice;1"] - // .getService(Ci.nsIConsoleService).logStringMessage(item.exchangeXML); - -//dump("event.dialog: item.exchangeXML:"+item.exchangeXML+"\n"); - - if ((item.bodyType === undefined) || (item.bodyType == "HTML")) { - if (this._document.getElementById("item-description")) { - this._document.getElementById("item-description").hidden = true; - } - if (this._document.getElementById("exchWebService-body-editor")) { - this._document.getElementById("exchWebService-body-editor").hidden = false; - if (item.bodyType !== undefined) { - this._document.getElementById("exchWebService-body-editor").content = item.body; - } - else { - this.newItem = true; - if (item.body) { - if ((item.body.indexOf("") > -1) || (item.body.indexOf("") > -1)) { - this._document.getElementById("exchWebService-body-editor").content = item.body; - } - else { - this._document.getElementById("exchWebService-body-editor").content = this.globalFunctions.fromText2HTML(item.getProperty("DESCRIPTION")); - } - } - else { - this._document.getElementById("exchWebService-body-editor").content = this.globalFunctions.fromText2HTML(item.getProperty("DESCRIPTION")); - } - } - } - } - else { - if (this._document.getElementById("item-description")) { - this._document.getElementById("item-description").hidden = false; - } - if (this._document.getElementById("exchWebService-body-editor")) { - this._document.getElementById("exchWebService-body-editor").hidden = true; - } - } - } - }, - - updateScreen: function _updateScreen(aItem, aCalendar) - { - var item = aItem; - - if ((!cal.isEvent(item)) && (aCalendar.type == "exchangecalendar")) { - - var ownerLabel = this._document.getElementById("exchWebService-owner-label"); - if (ownerLabel) { - ownerLabel.value = item.owner; - } - - try { - this._document.getElementById("exchWebService-details-row1").removeAttribute("collapsed"); - this._document.getElementById("exchWebService-details-row2").removeAttribute("collapsed"); - this._document.getElementById("exchWebService-details-row3").removeAttribute("collapsed"); - } - catch (ex) {} - - this._document.getElementById("exchWebService-owner-row").setAttribute("collapsed", "false"); - this._document.getElementById("exchWebService-details-separator").hidden = false; - - if (item.className) { - this._document.getElementById("exchWebService-totalWork-count").value = item.totalWork; - this._document.getElementById("exchWebService-actualWork-count").value = item.actualWork; - this._document.getElementById("exchWebService-mileage-count").value = item.mileage; - this._document.getElementById("exchWebService-billingInformation-count").value = item.billingInformation; - this._document.getElementById("exchWebService-companies-count").value = item.companies; - } - - this._document.getElementById("event-grid-location-row").hidden = true; - - // Clear reminder select list for todo - this._document.getElementById("reminder-none-separator").hidden = true; - this._document.getElementById("reminder-0minutes-menuitem").hidden = true; - this._document.getElementById("reminder-5minutes-menuitem").hidden = true; - this._document.getElementById("reminder-15minutes-menuitem").hidden = true; - this._document.getElementById("reminder-30minutes-menuitem").hidden = true; - this._document.getElementById("reminder-minutes-separator").hidden = true; - this._document.getElementById("reminder-1hour-menuitem").hidden = true; - this._document.getElementById("reminder-2hours-menuitem").hidden = true; - this._document.getElementById("reminder-12hours-menuitem").hidden = true; - this._document.getElementById("reminder-hours-separator").hidden = true; - this._document.getElementById("reminder-1day-menuitem").hidden = true; - this._document.getElementById("reminder-2days-menuitem").hidden = true; - this._document.getElementById("reminder-1week-menuitem").hidden = true; - - this._document.getElementById("timezone-starttime").hidden = true; - this._document.getElementById("timezone-endtime").hidden = true; - - if (this._document.getElementById("item-repeat")) { - this._document.getElementById("item-repeat").addEventListener("command", function() { self.updateRepeat(); }, false); - } - //this.updateTime(); - this.updateRepeat(); - } - else { - try { - this._document.getElementById("exchWebService-details-row1").setAttribute("collapsed", "true"); - this._document.getElementById("exchWebService-details-row2").setAttribute("collapsed", "true"); - this._document.getElementById("exchWebService-details-row3").setAttribute("collapsed", "true"); - } - catch (ex) {} - - this._document.getElementById("exchWebService-owner-row").setAttribute("collapsed", "true"); - this._document.getElementById("exchWebService-details-separator").hidden = true; - - this._document.getElementById("event-grid-location-row").hidden = false; - this._document.getElementById("event-grid-recurrence-row").hidden=false; - - // Clear reminder select list for todo - this._document.getElementById("reminder-none-separator").hidden = false; - this._document.getElementById("reminder-0minutes-menuitem").hidden = false; - this._document.getElementById("reminder-5minutes-menuitem").hidden = false; - this._document.getElementById("reminder-15minutes-menuitem").hidden = false; - this._document.getElementById("reminder-30minutes-menuitem").hidden = false; - this._document.getElementById("reminder-minutes-separator").hidden = false; - this._document.getElementById("reminder-1hour-menuitem").hidden = false; - this._document.getElementById("reminder-2hours-menuitem").hidden = false; - this._document.getElementById("reminder-12hours-menuitem").hidden = false; - this._document.getElementById("reminder-hours-separator").hidden = false; - this._document.getElementById("reminder-1day-menuitem").hidden = false; - this._document.getElementById("reminder-2days-menuitem").hidden = false; - this._document.getElementById("reminder-1week-menuitem").hidden = false; - - this._document.getElementById("timezone-starttime").hidden = false; - this._document.getElementById("timezone-endtime").hidden = false; - - } - }, - - // This will remove the time value from the repeat part and tooltip. - updateRepeat: function _updateRepeat() - { - var repeatDetails = this._document.getElementById("repeat-details").childNodes; - if (repeatDetails.length == 3) { - this._document.getElementById("repeat-details").removeChild(repeatDetails[2]); - var toolTip = repeatDetails[0].getAttribute("tooltiptext"); - var tmpArray = toolTip.split("\n"); - tmpArray.splice(2,1); - repeatDetails[0].setAttribute("tooltiptext", tmpArray.join("\n")); - repeatDetails[1].setAttribute("tooltiptext", tmpArray.join("\n")); - } - }, - - selectedCalendarChanged: function _selectedCalendarChanged(aMenuList) - { - updateCalendar(); - - this.updateScreen(this._window.calendarItem, getCurrentCalendar()); - }, - -} - -if (!exchWebService) var exchWebService = {}; - -exchWebService.eventDialog = { - - _initialized: false, - onLoad: function _onLoad() { - if (this._initialized) return; - - exchWebService.eventDialog.updateAttendees(); - }, - - - updateAttendees: function _updateAttendees() { - let attendeeRow = document.getElementById("event-grid-attendee-row"); - attendeeRow.setAttribute('collapsed', 'true'); - let attendeeRow2 = document.getElementById("event-grid-attendee-row-2"); - let optAttendeeRow = document.getElementById("event-grid-attendee-row-4"); - let reqAttendeeRow = document.getElementById("event-grid-attendee-row-3"); - if (window.attendees && window.attendees.length > 0) { - if (isEvent(window.calendarItem)) { // sending email invitations currently only supported for events - attendeeRow2.removeAttribute('collapsed'); - } else { - attendeeRow2.setAttribute('collapsed', 'true'); - } - - let attendeeNames = []; - let attendeeEmails = []; - let reqAttendeeNames = []; - let reqAttendeeEmails = []; - let optAttendeeNames = []; - let optAttendeeEmails = []; - let numAttendees = window.attendees.length; - let emailRE = new RegExp("^mailto:(.*)", "i"); - for (let i = 0; i < numAttendees; i++) { - let attendee = window.attendees[i]; - let name = attendee.commonName; - if (attendee.role == "OPT-PARTICIPANT") { - if (name && name.length) { - optAttendeeNames.push(name); - let email = attendee.id; - if (email && email.length) { - if (emailRE.test(email)) { - name += ' <' + RegExp.$1 + '>'; - } else { - name += ' <' + email + '>'; - } - optAttendeeEmails.push(name); - } - } else if (attendee.id && attendee.id.length) { - let email = attendee.id; - if (emailRE.test(email)) { - optAttendeeNames.push(RegExp.$1); - } else { - optAttendeeNames.push(email); - } - } else { - continue; - } - - } else { - - if (name && name.length) { - reqAttendeeNames.push(name); - let email = attendee.id; - if (email && email.length) { - if (emailRE.test(email)) { - name += ' <' + RegExp.$1 + '>'; - } else { - name += ' <' + email + '>'; - } - reqAttendeeEmails.push(name); - } - } else if (attendee.id && attendee.id.length) { - let email = attendee.id; - if (emailRE.test(email)) { - reqAttendeeNames.push(RegExp.$1); - } else { - reqAttendeeNames.push(email); - } - } else { - continue; - } - - } - } - if (reqAttendeeNames.length > 0) { - reqAttendeeRow.removeAttribute('collapsed'); - } else { - reqAttendeeRow.setAttribute('collapsed', 'true'); - } - if (optAttendeeNames.length > 0) { - optAttendeeRow.removeAttribute('collapsed'); - } else { - optAttendeeRow.setAttribute('collapsed', 'true'); - } - - let attendeeList = document.getElementById("attendee-list"); - let reqAttendeeList = document.getElementById("req-attendee-list-3"); - let optAttendeeList = document.getElementById("opt-attendee-list-4"); - - let callback = function func() { - reqAttendeeList.setAttribute('value', reqAttendeeNames.join(', ')); - reqAttendeeList.setAttribute('tooltiptext', reqAttendeeEmails.join(', ')); - optAttendeeList.setAttribute('value', optAttendeeNames.join(', ')); - optAttendeeList.setAttribute('tooltiptext', optAttendeeEmails.join(', ')); - }; - setTimeout(callback, 1); - } else { - - attendeeRow2.setAttribute('collapsed', 'true'); - optAttendeeRow.setAttribute('collapsed', 'true'); - reqAttendeeRow.setAttribute('collapsed', 'true'); - } - }, - - editAttendees: function _editAttendees() { - let savedWindow = window; - let calendar = getCurrentCalendar(); - - var callback = function (attendees, organizer, startTime, endTime) { - savedWindow.attendees = attendees; - if (organizer) { - // In case we didn't have an organizer object before we - // added attendees to our event we take the one created - // by the 'invite attendee'-dialog. - if (savedWindow.organizer) { - // The other case is that we already had an organizer object - // before we went throught the 'invite attendee'-dialog. In that - // case make sure we don't carry over attributes that have been - // set to their default values by the dialog but don't actually - // exist in the original organizer object. - if (!savedWindow.organizer.id) { - organizer.id = null; - } - if (!savedWindow.organizer.role) { - organizer.role = null; - } - if (!savedWindow.organizer.participationStatus) { - organizer.participationStatus = null; - } - if (!savedWindow.organizer.commonName) { - organizer.commonName = null; - } - } - savedWindow.organizer = organizer; - } - var duration = endTime.subtractDate(startTime); - startTime = startTime.clone(); - endTime = endTime.clone(); - var kDefaultTimezone = calendarDefaultTimezone(); - gStartTimezone = startTime.timezone; - gEndTimezone = endTime.timezone; - gStartTime = startTime.getInTimezone(kDefaultTimezone); - gEndTime = endTime.getInTimezone(kDefaultTimezone); - gItemDuration = duration; - exchWebService.eventDialog.updateAttendees(); - updateDateTime(); - updateAllDay(); - if (isAllDay != gStartTime.isDate) { - setShowTimeAs(gStartTime.isDate) - } - }; - - var startTime = gStartTime.getInTimezone(gStartTimezone); - var endTime = gEndTime.getInTimezone(gEndTimezone); - - var isAllDay = getElementValue("event-all-day", "checked"); - if (isAllDay) { - startTime.isDate = true; - endTime.isDate = true; - endTime.day += 1; - } else { - startTime.isDate = false; - endTime.isDate = false; - } - - var menuItem = document.getElementById('options-timezone-menuitem'); - var displayTimezone = true; - if( menuItem != null) - displayTimezone = menuItem.getAttribute('checked') == 'true'; - - var args = new Object(); - args.startTime = startTime; - args.endTime = endTime; - args.displayTimezone = displayTimezone; - args.attendees = window.attendees; - args.organizer = window.organizer && window.organizer.clone(); - args.calendar = calendar; - args.item = window.calendarItem; - args.onOk = callback; - args.fbWrapper = window.fbWrapper; - - // open the dialog modally - openDialog( - "chrome://calendar/content/calendar-event-dialog-attendees.xul", - "_blank", - "chrome,titlebar,modal,resizable", - args); - } -} - -window.addEventListener("load", exchWebService.eventDialog.onLoad, false); - - -var tmpEventDialog = new exchEventDialog(document, window); -window.addEventListener("load", function () { window.removeEventListener("load",arguments.callee,false); tmpEventDialog.onLoad(); }, true); - +chrome://calendar/content/calendar-event-dialog.js \ No newline at end of file diff --git a/chrome/content/calendar-task-view.js b/chrome/content/calendar-task-view.js index baa5069e..1811042e 100644 --- a/chrome/content/calendar-task-view.js +++ b/chrome/content/calendar-task-view.js @@ -18,7 +18,10 @@ Cu.import("resource://calendar/modules/calXMLUtils.jsm"); const globalFunctions = Cc["@1st-setup.nl/global/functions;1"] .getService(Ci.mivFunctions); const gMessenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger); - +function displayElement(id,flag) { + setBooleanAttribute(id, "hidden", !flag); + return flag; + } function taskHtmlDetailsView(event){ function msgHdrToNeckoURL(aMsgHdr, gMessenger) { @@ -43,61 +46,62 @@ function taskHtmlDetailsView(event){ return (/^imap-message:/.test(messageUri)); } - if(event){ - taskDetailsView.onSelect(event); - var item = document.getElementById("calendar-task-tree").currentTask; + if(event){ + taskDetailsView.onSelect(event); + var item = document.getElementById("calendar-task-tree").currentTask; + if (displayElement("calendar-task-details-container", item != null) && + displayElement("calendar-task-view-splitter", item != null)) { + if( item.calendar.type == "exchangecalendar" ){ + //Html manipulations + var ele = document.getElementById("calendar-task-details-description"); + var ele2 = document.getElementById("calendar-task-details-description2"); - if( item.calendar.type == "exchangecalendar" ){ - //Html manipulations - var ele = document.getElementById("calendar-task-details-description"); - var ele2 = document.getElementById("calendar-task-details-description2"); - - - //remove existing task view - //ele.parentNode.removeChild(ele); - if(item.itemClass == "IPM.Task"){ - ele2.hidden = true; - ele.hidden = false; - } - else if(item.itemClass == "IPM.Note") - { - //imap://mail.internal.ericsson.com:993/fetch%3EUID%3E/INBOX%3E9459 - //globalFunctions.LOG("MessageId " + item.messageId ); - var queryListener = { - /* called when new items are returned by the database query or freshly indexed */ - onItemsAdded : function queryListener_onItemsAdded(aItems, aCollection) { - }, - /* called when items that are already in our collection get re-indexed */ - onItemsModified : function queryListener_onItemsModified(aItems, aCollection) { - }, - /* called when items that are in our collection are purged from the system */ - onItemsRemoved : function queryListener_onItemsRemoved(aItems, aCollection) { - }, - /* called when our database query completes */ - onQueryCompleted : function queryListener_onQueryCompleted(aCollection) { - try { - for (var j = 0; j < aCollection.items.length; j++) { - var msgUri = aCollection.items[j].folderMessageURI; - var msgHdr = gMessenger.msgHdrFromURI(msgUri); - - if(IsImapMessage(msgUri)){ - var url = msgHdrToNeckoURL(msgHdr,gMessenger).spec; - showMail(url); - } - } - } - catch (e) { - dump("\nexception " +e); - } - } - }; - var messageId = item.messageId.replace('<', '').replace('>', ''); - if( messageId ){ - var query = Gloda.newQuery(Gloda.NOUN_MESSAGE); - query.headerMessageID(messageId); - var collection = query.getCollection(queryListener); - } - } - } + //remove existing task view + //ele.parentNode.removeChild(ele); + if(item.itemClass == "IPM.Task"){ + ele2.hidden = true; + ele.hidden = false; + } + else if(item.itemClass == "IPM.Note") + { + //imap://mail.internal.ericsson.com:993/fetch%3EUID%3E/INBOX%3E9459 + //globalFunctions.LOG("MessageId " + item.messageId ); + var queryListener = { + /* called when new items are returned by the database query or freshly indexed */ + onItemsAdded : function queryListener_onItemsAdded(aItems, aCollection) { + }, + /* called when items that are already in our collection get re-indexed */ + onItemsModified : function queryListener_onItemsModified(aItems, aCollection) { + }, + /* called when items that are in our collection are purged from the system */ + onItemsRemoved : function queryListener_onItemsRemoved(aItems, aCollection) { + }, + /* called when our database query completes */ + onQueryCompleted : function queryListener_onQueryCompleted(aCollection) { + try { + for (var j = 0; j < aCollection.items.length; j++) { + var msgUri = aCollection.items[j].folderMessageURI; + var msgHdr = gMessenger.msgHdrFromURI(msgUri); + + if(IsImapMessage(msgUri)){ + var url = msgHdrToNeckoURL(msgHdr,gMessenger).spec; + showMail(url); + } + } + } + catch (e) { + dump("\nexception " +e); + } + } + }; + var messageId = item.messageId.replace('<', '').replace('>', ''); + if( messageId ){ + var query = Gloda.newQuery(Gloda.NOUN_MESSAGE); + query.headerMessageID(messageId); + var collection = query.getCollection(queryListener); + } + } + } + } } } \ No newline at end of file diff --git a/chrome/content/invite-style.js b/chrome/content/invite-style.js index 591f537c..8b789578 100644 --- a/chrome/content/invite-style.js +++ b/chrome/content/invite-style.js @@ -257,6 +257,6 @@ mailTools.prototype.onLoad = function(){ var tmpShowIconsAsInviteColumn = new showIconsAsInviteColumn(); var tmpMailTools = new mailTools(window,document); -window.addEventListener("load",tmpShowIconsAsInviteColumn.execute(),false); window.addEventListener("load",tmpMailTools.onLoad(),false); +window.addEventListener("load",tmpShowIconsAsInviteColumn.execute(),false); diff --git a/chrome/content/lightningtimezoneOverlay.js b/chrome/content/lightningtimezoneOverlay.js index 4857824c..46917521 100644 --- a/chrome/content/lightningtimezoneOverlay.js +++ b/chrome/content/lightningtimezoneOverlay.js @@ -36,7 +36,7 @@ lightningTimzone.prototype = { this.onTimezoneChange(); }, - onTimezoneChange:function _onTimezoneChange(self){ + onTimezoneChange:function _onTimezoneChange(){ var oldOffset; var currentOffset; diff --git a/components/ecExchangeRequest.js b/components/ecExchangeRequest.js index 909ff8de..f0dd9a61 100644 --- a/components/ecExchangeRequest.js +++ b/components/ecExchangeRequest.js @@ -112,6 +112,8 @@ function ExchangeRequest(aArgument, aCbOk, aCbError, aListener) this.timeZones = Cc["@1st-setup.nl/exchange/timezones;1"] .getService(Ci.mivExchangeTimeZones); + + this.xml2json = false; } @@ -170,7 +172,7 @@ ExchangeRequest.prototype = { logInfo: function _logInfo(aMsg, aLevel) { - if (!aLevel) var aLevel = 1; + if (!aLevel) aLevel = 1; if ((this.debug) && (aLevel <= this.debuglevel)) { this.globalFunctions.LOG(this.uuid+": "+aMsg); @@ -1310,15 +1312,16 @@ ecnsIAuthPrompt2.prototype = { this.logInfo("getPrePassword for user:"+aUsername+", server url:"+aURL); this.username = aUsername; this.URL = aURL; - + var password; var myAuthPrompt2 = Cc["@1st-setup.nl/exchange/authprompt2;1"].getService(Ci.mivExchangeAuthPrompt2); - if (myAuthPrompt2.getUserCanceled(this.currentUrl)) { + if (myAuthPrompt2.getUserCanceled(aURL)) { return null; } + var openUser = aUsername; try { - password = myAuthPrompt2.getPassword(null, this.mArgument.user, this.currentUrl); + password = myAuthPrompt2.getPassword(null,openUser, aURL); } catch(err) { } diff --git a/components/erSyncFolderItems.js b/components/erSyncFolderItems.js index 8da32a2a..2db67130 100644 --- a/components/erSyncFolderItems.js +++ b/components/erSyncFolderItems.js @@ -56,15 +56,6 @@ var EXPORTED_SYMBOLS = ["erSyncFolderItemsRequest"]; function erSyncFolderItemsRequest(aArgument, aCbOk, aCbError, aListener) { - this.mCbOk = aCbOk; - this.mCbError = aCbError; - - var self = this; - - this.parent = new ExchangeRequest(aArgument, - function(aExchangeRequest, aResp) { self.onSendOk(aExchangeRequest, aResp);}, - function(aExchangeRequest, aCode, aMsg) { self.onSendError(aExchangeRequest, aCode, aMsg);}, - aListener); this.argument = aArgument; this.mailbox = aArgument.mailbox; @@ -74,7 +65,8 @@ function erSyncFolderItemsRequest(aArgument, aCbOk, aCbError, aListener) this.changeKey = aArgument.changeKey; this.listener = aListener; this.syncState = aArgument.syncState; - + this.mCbOk = aCbOk; + this.mCbError = aCbError; if (!aArgument.syncState) { this.getSyncState = true; } @@ -88,8 +80,15 @@ function erSyncFolderItemsRequest(aArgument, aCbOk, aCbError, aListener) this.attempts = 0; this.runs = 0; - this.isRunning = true; + + var self = this; + this.parent = new ExchangeRequest(aArgument, + function(aExchangeRequest, aResp) { self.onSendOk(aExchangeRequest, aResp);}, + function(aExchangeRequest, aCode, aMsg) { self.onSendError(aExchangeRequest, aCode, aMsg);}, + aListener); + + this.execute(aArgument.syncState); } @@ -135,7 +134,7 @@ erSyncFolderItemsRequest.prototype = { onSendOk: function _onSendOk(aExchangeRequest, aResp) { - //dump("erSyncFolderItemsRequest.onSendOk:"+xml2json.toString(aResp)); + dump("\nerSyncFolderItemsRequest.onSendOk:"+xml2json.toString(aResp)); try{ var rm = xml2json.XPath(aResp,"/s:Envelope/s:Body/m:SyncFolderItemsResponse/m:ResponseMessages/m:SyncFolderItemsResponseMessage[@ResponseClass='Success' and m:ResponseCode='NoError']"); @@ -254,7 +253,7 @@ try{ this.parent = null; } catch(tmpErr) { - dump("erSyncFolderItemsRequest.onSendOk: try error '"+tmpErr+"'.\n"); + dump("\nerSyncFolderItemsRequest.onSendOk: try error '"+tmpErr+"'.\n"); } }, diff --git a/interfaces/exchangeBaseItem/mivExchangeBaseItem.js b/interfaces/exchangeBaseItem/mivExchangeBaseItem.js index 8569b1e1..9de0c2f3 100644 --- a/interfaces/exchangeBaseItem/mivExchangeBaseItem.js +++ b/interfaces/exchangeBaseItem/mivExchangeBaseItem.js @@ -220,7 +220,7 @@ const monthMap = { var EXPORTED_SYMBOLS = ["mivExchangeBaseItem"]; -exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] +var exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] .getService(Ci.mivFunctions); function mivExchangeBaseItem() { @@ -258,7 +258,8 @@ mivExchangeBaseItem.prototype = { this._newLegacyFreeBusyStatus = undefined; this._newMyResponseType = undefined; this._newIsInvitation = undefined; - + this._reminderSignalTime = undefined; + this._newXMozSnoozeTime = undefined; this._nonPersonalDataChanged = false; this._occurrences = {}; @@ -3532,7 +3533,7 @@ dump("Error2:"+err+" | "+exchGlobalFunctions.STACK()+"\n"); // Alarm snooze or dismiss if (typeof this._newXMozSnoozeTime !== undefined ) { //dump("checkAlarmChange: this._newXMozSnoozeTime was set to:"+this._newXMozSnoozeTime+", newReminderMinutesBeforeStart="+newReminderMinutesBeforeStart+"\n"); - dump("\ncheckAlarmChange: snoozetime " + this.__newXMozSnoozeTime ); + dump("\ncheckAlarmChange: snoozetime " + this._newXMozSnoozeTime ); if ((this._newXMozSnoozeTime === null ) && (newReminderMinutesBeforeStart !== true)) { dump("\ncheckAlarmChange: dismissed " + newReminderMinutesBeforeStart+ ".\n"); //dump("checkAlarmChange: We have a change\n"); diff --git a/interfaces/exchangeCalendar/mivExchangeCalendar.js b/interfaces/exchangeCalendar/mivExchangeCalendar.js index fd445255..3f9e2cd6 100644 --- a/interfaces/exchangeCalendar/mivExchangeCalendar.js +++ b/interfaces/exchangeCalendar/mivExchangeCalendar.js @@ -7925,9 +7925,7 @@ dump("\n== removed ==:"+aCalendarEvent.toString()+"\n"); mailbox: this.mailbox, serverUrl: this.serverUrl, folderBase: "inbox", - folderID: null, - changeKey: null, - syncState: this.syncStateInbox, + syncState: this.syncStateInbox, actionStart: Date.now() }, function(erSyncFolderItemsRequest, creations, updates, deletions, syncState) { self.syncFolderItemsOK(erSyncFolderItemsRequest, creations, updates, deletions, syncState);}, function(erSyncFolderItemsRequest, aCode, aMsg) { self.syncFolderItemsError(erSyncFolderItemsRequest, aCode, aMsg);}, @@ -7965,7 +7963,7 @@ dump("\n== removed ==:"+aCalendarEvent.toString()+"\n"); if ((creations.length > 0) || (updates.length > 0) || (deletions.length > 0)) { this.addActivity(calGetString("calExchangeCalendar", "syncFolderEventMessage", [creations.length, updates.length, deletions.length, this.name], "exchangecalendar"), "", erSyncFolderItemsRequest.argument.actionStart, Date.now()); - } + } if (syncState) { @@ -7996,7 +7994,7 @@ dump("\n== removed ==:"+aCalendarEvent.toString()+"\n"); for each(var update in updates) { changes.push(update); } if (changes.length > 0) { switch(erSyncFolderItemsRequest.folderBase){ - case "task": + case "tasks": this.findTaskItemsOK(erSyncFolderItemsRequest,changes); break; case "calendar": @@ -8006,7 +8004,7 @@ dump("\n== removed ==:"+aCalendarEvent.toString()+"\n"); this.findFollowupTaskItemsOK(erSyncFolderItemsRequest,changes); break; default: - this.logError("Changes could not be made."); + this.logError("Changes could not be made." + erSyncFolderItemsRequest.folderBase); } /* this.addToQueue( erGetItemsRequest, diff --git a/interfaces/exchangeEvent/mivExchangeEvent.js b/interfaces/exchangeEvent/mivExchangeEvent.js index d9284f1b..6a7fd85b 100644 --- a/interfaces/exchangeEvent/mivExchangeEvent.js +++ b/interfaces/exchangeEvent/mivExchangeEvent.js @@ -37,10 +37,10 @@ Cu.import("resource://interfaces/xml2json/xml2json.js"); var EXPORTED_SYMBOLS = ["mivExchangeEvent"]; -exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] +var exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] .getService(Ci.mivFunctions); -exchTimeZones = Cc["@1st-setup.nl/exchange/timezones;1"] +var exchTimeZones = Cc["@1st-setup.nl/exchange/timezones;1"] .getService(Ci.mivExchangeTimeZones); diff --git a/interfaces/exchangeTodo/mivExchangeTodo.js b/interfaces/exchangeTodo/mivExchangeTodo.js index da65f208..8445e929 100644 --- a/interfaces/exchangeTodo/mivExchangeTodo.js +++ b/interfaces/exchangeTodo/mivExchangeTodo.js @@ -35,10 +35,10 @@ Cu.import("resource://interfaces/exchangeBaseItem/mivExchangeBaseItem.js"); Cu.import("resource://interfaces/xml2json/xml2json.js"); -exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] +var exchGlobalFunctions = Cc["@1st-setup.nl/global/functions;1"] .getService(Ci.mivFunctions); -exchTimeZones = Cc["@1st-setup.nl/exchange/timezones;1"] +var exchTimeZones = Cc["@1st-setup.nl/exchange/timezones;1"] .getService(Ci.mivExchangeTimeZones); var EXPORTED_SYMBOLS = ["mivExchangeTodo"]; diff --git a/interfaces/global/mivFunctions.js b/interfaces/global/mivFunctions.js index 63b36990..d57615d4 100644 --- a/interfaces/global/mivFunctions.js +++ b/interfaces/global/mivFunctions.js @@ -228,11 +228,11 @@ mivFunctions.prototype = { if (!realBranche.branch) { return aDefaultValue; } - var aBranch = realBranche.branch; - var aName = realBranche.name; + aBranch = realBranche.branch; + aName = realBranche.name; } - if (!aCreateWhenNotAvailable) { var aCreateWhenNotAvailable = false; } + if (!aCreateWhenNotAvailable) { aCreateWhenNotAvailable = false; } try { return aBranch.getCharPref(aName); @@ -259,11 +259,11 @@ mivFunctions.prototype = { if (!realBranche.branch) { return aDefaultValue; } - var aBranch = realBranche.branch; - var aName = realBranche.name; + aBranch = realBranche.branch; + aName = realBranche.name; } - if (!aCreateWhenNotAvailable) { var aCreateWhenNotAvailable = false; } + if (!aCreateWhenNotAvailable) { aCreateWhenNotAvailable = false; } try { return aBranch.getBoolPref(aName); @@ -290,11 +290,11 @@ mivFunctions.prototype = { if (!realBranche.branch) { return aDefaultValue; } - var aBranch = realBranche.branch; - var aName = realBranche.name; + aBranch = realBranche.branch; + aName = realBranche.name; } - if (!aCreateWhenNotAvailable) { var aCreateWhenNotAvailable = false; } + if (!aCreateWhenNotAvailable) { aCreateWhenNotAvailable = false; } try { return aBranch.getIntPref(aName); @@ -411,7 +411,7 @@ mivFunctions.prototype = { this.ASSERT(aArg, "Bad log argument.", true); } catch(exc) { - var aArg = exc; + aArg = exc; } var string;