×
Namespaces

Variants
Actions
(Difference between revisions)

Listing calendars in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update)
hamishwillee (Talk | contribs)
m (Hamishwillee - Add Abstract. Tidy wiki text)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
[[Category:Symbian Web Runtime]][[Category:PIM]][[Category:S60 5th Edition]][[Category:Code Snippet]]
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
Line 21: Line 22:
 
|author= [[User:Tapla]]
 
|author= [[User:Tapla]]
 
<!-- The following are not in current metadata -->
 
<!-- The following are not in current metadata -->
|subcategory= PIM
 
 
|id= CS001278
 
|id= CS001278
 
}}
 
}}
Line 27: Line 27:
 
==Overview==
 
==Overview==
  
This code snippet shows how to list calendars by using the Calendar Platform Service for S60 Web Runtime introduced in S60 5th Edition.
+
{{Abstract|This code snippet shows how to list calendars in Symbian Web Runtime using the Calendar Platform Service introduced in S60 5th Edition.}}
  
 
The {{Icode|device.getServiceObject("Service.Calendar", "IDataSource")}} method is used to obtain access to the service object for the Calendar Service API.
 
The {{Icode|device.getServiceObject("Service.Calendar", "IDataSource")}} method is used to obtain access to the service object for the Calendar Service API.
Line 110: Line 110:
  
 
[[Listing calendar entries in Symbian Web Runtime]]
 
[[Listing calendar entries in Symbian Web Runtime]]
 
[[Category:Symbian Web Runtime]][[Category:Code Snippet]][[Category:PIM]][[Category:S60 5th Edition (initial release)]][[Category:Code Snippet]]
 

Latest revision as of 08:53, 5 October 2012

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Article
Keywords: device.getServiceObject(), Service.Calendar.GetList()
Created: tapla (16 Jan 2009)
Last edited: hamishwillee (05 Oct 2012)

Contents

[edit] Overview

This code snippet shows how to list calendars in Symbian Web Runtime using the Calendar Platform Service introduced in S60 5th Edition.

The device.getServiceObject("Service.Calendar", "IDataSource") method is used to obtain access to the service object for the Calendar Service API.

[edit] Source: Relevant HTML components

<label for="calendarList">Calendars:</label><br />
<select size="2" id="calendarList" onclick="showEvents();"></select>

[edit] Source: JavaScript file

var serviceObj = null;
 
window.onload = init;
 
// Initializes the widget
function init() {
// Obtain the service object
try {
serviceObj = device.getServiceObject("Service.Calendar",
"IDataSource");
} catch (ex) {
alert("Service object cannot be found.");
return;
}
 
listCalendars();
}
 
function listCalendars() {
try {
var filter = new Object();
// Not using the default calendar
filter.DefaultCalendar = false;
 
// Criteria for fetching calendars
var criteria = new Object();
criteria.Type = "Calendar";
criteria.Filter = filter;
 
// Get the list of calendars
result = serviceObj.IDataSource.GetList(criteria);
if (result.ErrorCode == 0) {
showCalendars(result.ReturnValue);
} else {
alert("Error in getting calendars");
}
} catch( exception ) {
alert("initialize error: " + exception);
}
}
 
function showCalendars(iterator) {
var calendarList = document.getElementById("calendarList");
 
// Empty the calendar list
while (calendarList.length != 0) {
calendarList.remove(0);
}
 
// Set the pointer to the first element
iterator.reset();
 
var item;
while ((item = iterator.getNext()) != undefined) {
var node = document.createElement("option");
node.value = item;
node.appendChild(document.createTextNode(item));
calendarList.appendChild(node);
}
}

[edit] Postconditions

Available calendars are displayed.

[edit] See also

Listing calendar entries in Symbian Web Runtime

This page was last modified on 5 October 2012, at 08:53.
61 page views in the last 30 days.
×