×
Namespaces

Variants
Actions

Archived:Calendar Settings Symbian API

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Compatibility
Platform(s): S60 3rd Edition, FP2
S60 3rd Edition FP2
Article
Keywords: Calendar Settings API
Created: User:Technical writer 1 (13 Jun 2008)
Last edited: hamishwillee (13 Jun 2012)


Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

The Calendar Setting APIs are used to retrieve the settings information of the calendar, such as Calendar DefaultAlarmTime, DefaultStartView, WeekViewTitle, SoundFile, DefaultSoundFile, and SnoozeTime.

Contents

Header files

    #include <CalendarinternalCRKeys.h>
#include <centralrepository.h> // for CRepository

Link against

    LIBRARY centralrepository.lib

Capabilities

    WriteUserData WriteDeviceData
    // We need to Query Central Repository
CRepository* iRepository = CRepository::NewL( KCRUiCalendar );

Commonly used instance variables

    TInt iErrCode;
TInt iVal;
TBuf<200> iDispVal;

Example code

Retrieving default alarm time in minutes before event starting time:

     iErrCode = iRepository->Get(KCalendarDefaultAlarmTime, iVal);
if(iErrCode == KErrNone)
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("alarmtime"), iDispVal);
}
else
{
iDispVal.Num(iErrCode);
iEikonEnv->AlertWin(_L("error"), iDispVal);
}

Setting default alarm time in minutes before event starting time:

    iErrCode =iRepository->Set(KCalendarDefaultAlarmTime,30);
if(iErrCode != KErrNone)
{
iDispVal.Num(iErrCode);
iEikonEnv->AlertWin(_L("error"),iDispVal);
}

Retrieving default starting view for Calendar:

Possible values:0: Month view (default) 1 = Week view 2 = Day view

    iErrCode = iRepository->Get(KCalendarDefaultStartView, iVal);
if(iErrCode == KErrNone)
{
switch(iVal)
{
case 0:
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("monthview"), iDispVal);
}
break;
case 1:
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("weekview"), iDispVal);
}
break;
default:
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("dayview"), iDispVal);
}
break;
}
}
else
{
iDispVal.Num(iErrCode);
iEikonEnv->AlertWin(_L("error"), iDispVal);
}

Retrieving the Week view title in the Calendar application:

Possible values: 0: Week number (default) 1: Week dates

    iErrCode= iRepository->Get(KCalendarWeekViewTitle, iVal);
if(iErrCode == KErrNone)
{
if(iVal == 0)
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("weeknumbertitle"), iDispVal);
}
else
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("weekdays title"), iDispVal);
}
}
else
{
iDispVal.Num(iErrCode);
iEikonEnv->AlertWin(_L("error"), iDispVal);
}

Retrieving Calendar alarm sound file:

    iErrCode = iRepository->Get(KCalendarSoundFile,iDispVal);
if(iErrCode == KErrNone)
{
iEikonEnv->AlertWin(_L("soundfile"), iDispVal);
}

Retrieving Calendar alarm snooze time interval in minutes:

     iErrCode =iRepository->Get(KCalendarSnoozeTime, iVal);
if(iErrCode == KErrNone)
{
iDispVal.Num(iVal);
iEikonEnv->AlertWin(_L("snoozetime"), iDispVal);
}
else
{
iDispVal.Num(iErrCode);
iEikonEnv->AlertWin(_L("error"), iDispVal);
}

Setting Calendar alarm snooze time interval in minutes:

     iErrCode = iRepository->Get(KCalendarSnoozeTime, iVal);
if(iErrCode == KErrNone)
{
iRepository->Set(KCalendarSnoozeTime, (iVal+1));
}
else
{
iDispVal.Num(iErrCode) ;
iEikonEnv->AlertWin(_L("error"), iDispVal);
}
This page was last modified on 13 June 2012, at 09:11.
125 page views in the last 30 days.
×