Listing calendars in Symbian Web Runtime
(New page: __NOTOC__ __NOEDITSECTION__ {{KBCS}} {{CodeSnippet |id= |platform=S60 5th Edition |devices=Nokia 5800 XpressMusic |category=Web Runtime (WRT) |subcategory=PIM |creationdate=January 1...) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Add Abstract. Tidy wiki text) |
||
| (11 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | [[Category:Symbian Web Runtime]][[Category:PIM]][[Category:S60 5th Edition]][[Category:Code Snippet]] | |
| − | + | {{ArticleMetaData <!-- v1.2 --> | |
| − | {{ | + | |sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) --> |
| − | + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | |
| − | | | + | |devices= Nokia 5800 XpressMusic |
| − | | | + | |sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> |
| − | |devices=Nokia 5800 XpressMusic | + | |platform= S60 5th Edition |
| − | | | + | |devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) --> |
| − | | | + | |dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 --> |
| − | | | + | |signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer --> |
| − | |keywords=device.getServiceObject(), Service.Calendar.GetList() | + | |capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> |
| + | |keywords= device.getServiceObject(), Service.Calendar.GetList() | ||
| + | |language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | ||
| + | |translated-by= <!-- [[User:XXXX]] --> | ||
| + | |translated-from-title= <!-- Title only --> | ||
| + | |translated-from-id= <!-- Id of translated revision --> | ||
| + | |review-by= <!-- After re-review: [[User:username]] --> | ||
| + | |review-timestamp= <!-- After re-review: YYYYMMDD --> | ||
| + | |update-by= <!-- After significant update: [[User:username]]--> | ||
| + | |update-timestamp= <!-- After significant update: YYYYMMDD --> | ||
| + | |creationdate= 20090116 | ||
| + | |author= [[User:Tapla]] | ||
| + | <!-- The following are not in current metadata --> | ||
| + | |id= CS001278 | ||
}} | }} | ||
==Overview== | ==Overview== | ||
| − | This code snippet shows how to list calendars | + | {{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. | |
==Source: Relevant HTML components== | ==Source: Relevant HTML components== | ||
| Line 96: | Line 109: | ||
==See also== | ==See also== | ||
| − | [[Listing calendar entries | + | [[Listing calendar entries in Symbian Web Runtime]] |
| − | + | ||
| − | + | ||
Latest revision as of 08:53, 5 October 2012
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
Article
Keywords: device.getServiceObject(), Service.Calendar.GetList()
Created: tapla
(16 Jan 2009)
Last edited: hamishwillee
(05 Oct 2012)
Contents |
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.
Source: Relevant HTML components
<label for="calendarList">Calendars:</label><br />
<select size="2" id="calendarList" onclick="showEvents();"></select>
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);
}
}
Postconditions
Available calendars are displayed.

