serviceproviders/jsapi/platformservices/src/calendar.js
branchRCL_3
changeset 50 5dae2c62e9b6
parent 38 02682e02e51f
equal deleted inserted replaced
46:4ac3198c2c5b 50:5dae2c62e9b6
    76 					  "proto": __device_calendar,
    76 					  "proto": __device_calendar,
    77 					  "descriptor": __device_calendar_descriptor,
    77 					  "descriptor": __device_calendar_descriptor,
    78 					  "providers": [{"descriptor": __sp_calendar_descriptor, "instance": __sp_calendar_instance}]
    78 					  "providers": [{"descriptor": __sp_calendar_descriptor, "instance": __sp_calendar_instance}]
    79 					 };
    79 					 };
    80 		   
    80 		   
    81 //alert(("after com.nokia.device.service");
       
    82 
       
    83 
       
    84 
       
    85 /*
       
    86 Copyright � 2009 Nokia. All rights reserved.
       
    87 Code licensed under the BSD License:
       
    88 Software License Agreement (BSD License) Copyright � 2009 Nokia.
       
    89 All rights reserved.
       
    90 Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
       
    91 
       
    92 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
       
    93 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
       
    94 Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
       
    95 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    96 
       
    97 version: 1.0
       
    98 */
       
    99 
       
   100 var dataGetList = 0;
    81 var dataGetList = 0;
   101 var isUpdate = 0;
    82 var isUpdate = 0;
   102 // S60 sp-based calendar provider
    83 // S60 sp-based calendar provider
   103 
    84 
   104 function __sp_calendar_descriptor(){
    85 function __sp_calendar_descriptor(){
   213 					}
   194 					}
   214 					if (match.time.begin) {
   195 					if (match.time.begin) {
   215 						if (typeof(match.time.begin) != "object") {
   196 						if (typeof(match.time.begin) != "object") {
   216 							return false;
   197 							return false;
   217 						}
   198 						}
   218 						if(match.time.begin == "Invalid Date" )
   199 						
       
   200 						/*if(match.time.begin == "Invalid Date" )
   219 						{
   201 						{
   220 							return false;
   202 							return false;
   221 						}
   203 						}*/
       
   204 						
       
   205 						var validDate = new Date("January 1, 1970 00:01"); 
       
   206 						if(match.time.begin < validDate)
       
   207 						{
       
   208 							return false;
       
   209 						}
       
   210 					
       
   211 						
   222 						try{
   212 						try{
   223 							(match.time.begin).getTime();
   213 							(match.time.begin).getTime();
   224 						}
   214 						}
   225 						catch(e){
   215 						catch(e){
   226 							return false;
   216 							return false;
   428  // ////alert("sp_entry");
   418  // ////alert("sp_entry");
   429   if (sp_entry.id) {
   419   if (sp_entry.id) {
   430   //	////alert("sp_entry id" + sp_entry.id);
   420   //	////alert("sp_entry id" + sp_entry.id);
   431 	this.id = sp_entry.id;
   421 	this.id = sp_entry.id;
   432 	}
   422 	}
   433 	if (sp_entry.type) {
   423 	if (sp_entry.Type ) {
   434 	//	////alert("sp_entry.Type" + sp_entry.type);
   424 	//	////alert("sp_entry.Type" + sp_entry.type);
   435   this.type = sp_entry.Type;
   425   this.type = sp_entry.Type;
   436 	}
   426 	}
   437   if (sp_entry.Summary) {
   427   if (sp_entry.Summary) {
   438  // 	////alert("summary" + sp_entry.Summary);
   428  // 	////alert("summary" + sp_entry.Summary);
   453   	this.priority = sp_entry.Priority;
   443   	this.priority = sp_entry.Priority;
   454   }
   444   }
   455   if (sp_entry.Status) {
   445   if (sp_entry.Status) {
   456   	this.status = sp_entry.Status;
   446   	this.status = sp_entry.Status;
   457   }
   447   }
       
   448   if (sp_entry.Status == "TodoCompleted") {
       
   449   	this.status = "Completed";
       
   450   }
       
   451   else if(sp_entry.Status == "TodoNeedsAction"){
       
   452   	this.status = "NeedsAction";
       
   453   }
       
   454   
       
   455   
   458   if (sp_entry.ExDates) {
   456   if (sp_entry.ExDates) {
   459   	this.exceptionDates = sp_entry.ExDates;
   457   	this.exceptionDates = sp_entry.ExDates;
   460   }
   458   }
   461   if (sp_entry.RepeatRule) {
   459   if (sp_entry.RepeatRule) {
   462   	this.repeatRule = new __sp_calendar_getList_repeatRule(sp_entry.RepeatRule);
   460   	this.repeatRule = new __sp_calendar_getList_repeatRule(sp_entry.RepeatRule);
   642 	{
   640 	{
   643 		this.Priority = 0;
   641 		this.Priority = 0;
   644 	}
   642 	}
   645 	
   643 	
   646 	if (entry.status) {
   644 	if (entry.status) {
   647 		if (this.Type == "ToDo") {
   645 		this.Status = entry.status;
       
   646 		if (entry.status == "NeedsAction" || entry.status == "Completed") {
   648 			this.Status = "Todo"+entry.status;
   647 			this.Status = "Todo"+entry.status;
   649 		}
   648 		}
   650 		else {
   649 	}
   651 			this.Status = entry.status;
   650 	/*else if(isUpdate && (entry.status == null))
   652 		}
       
   653 	}
       
   654 	else if(isUpdate && (entry.status == null))
       
   655 	{
   651 	{
   656 		this.Status = "Tentative";
   652 		this.Status = "Tentative";
   657 		//////alert("status****" + this.Status);
   653 		//////alert("status****" + this.Status);
   658 	}
   654 	}*/
   659 	
   655 	
   660 	if (entry.exceptionDates) {
   656 	if (entry.exceptionDates) {
   661 		this.ExDates = entry.exceptionDates;
   657 		this.ExDates = entry.exceptionDates;
   662 	}
   658 	}
   663 	if(entry.repeatRule){
   659 	if(entry.repeatRule){
   774 		if(typeof err_cb != 'function')
   770 		if(typeof err_cb != 'function')
   775 		{
   771 		{
   776 		   	throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: error callback is invalid");
   772 		   	throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: error callback is invalid");
   777 		}
   773 		}
   778 	}
   774 	}
   779 	if(entry == null || entry == undefined)
   775 	
   780 	{
   776 	if(entry != null)
   781 		throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: entry is invalid");
   777 	{
   782 	}
   778 		throw new DeviceException( this.error.NOT_SUPPORTED_ERR, "Calendar: startEditor: Entry should be null");
       
   779 	}
       
   780 	
   783 	var finished = function(arg1, arg2, arg3){
   781 	var finished = function(arg1, arg2, arg3){
   784 	
   782 	
   785 	
   783 	
   786 	var iter = null;
   784 	var iter = null;
   787 	editor_cb(iter);
   785 	editor_cb(iter);