[9.1] Calendar

Login to reply to this topic.
Wed, 2006-03-29 08:39
Joined: 2004-06-17
Forum posts: 47
Hi,

did someone manage to work with the new calinterim api to access calender in Symbian 9.1?

I would like to iterate or fill an array with all entries, but it always fails

Regards
lkz633

Wed, 2006-03-29 10:35
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
And the error you get is?
It should be very simple to get entries using calinterim api. The new CCalEntryView class has the FetchL method (or better said 2 overloaded method) used to fetch entries. You should provide a uid to this method.....those uid you can get using GetIdsModifiedSinceDateL (here you can use min date to get all your ids).

pirosl

Wed, 2006-03-29 14:29
Joined: 2004-12-06
Forum posts: 39
Re: [9.1] Calendar
Wed, 2006-03-29 14:36
Joined: 2004-06-17
Forum posts: 47
Re: [9.1] Calendar
Hi,

now the session does not even start correctly, here is the code:

   iSession = CCalSession::NewL();
   CleanupStack::PushL(iSession);
   iSession->OpenL(iSession->DefaultFileNameL());
   iView = CCalInstanceView::NewL(*iSession,*this);

The Completed method of the observer is never called.

After this to get all instances, I would then try with this code:

               TTime Start;
   Start.HomeTime();
   
   TTime End(_L("20080000:"));

   TCalTime iStart;
   iStart.SetTimeLocalL(Start);
   TCalTime iEnd;
   iEnd.SetTimeLocalL(End);
   
   CalCommon::TCalTimeRange iRange(iStart,iEnd);

   RPointerArray<CCalInstance> iInstances;
   
   iView->FindInstanceL(iInstances, CalCommon::EThisOnly, iRange);
   

How to correctly open the session?

Regards
lkz633
Wed, 2006-03-29 14:39
Joined: 2004-06-17
Forum posts: 47
Re: [9.1] Calendar
Quote from: pirosl
those uid you can get using GetIdsModifiedSinceDateL (here you can use min date to get all

This seems to be not in the SDK

Wed, 2006-03-29 14:53
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
Got your error. You're working with CCalInstanceView but you should work with CCalEntryView...and in CCalEntryView there should be GetIdsModifiedSinceDateL method, rigth Wink?
The diference between an entry and an instance exists also in pre 9.1 version rigth? An entry is a calendar event of some sort (can be simple or repeating). An instance is a single occurence of a repeating entry.

Also i don't understand your problem with the session. What error do you get there?

Quote from: lkz633
Hi,

now the session does not even start correctly, here is the code:

   iSession = CCalSession::NewL();
   CleanupStack::PushL(iSession);
   iSession->OpenL(iSession->DefaultFileNameL());
   iView = CCalInstanceView::NewL(*iSession,*this);

The Completed method of the observer is never called.

After this to get all instances, I would then try with this code:

               TTime Start;
   Start.HomeTime();
   
   TTime End(_L("20080000:"));

   TCalTime iStart;
   iStart.SetTimeLocalL(Start);
   TCalTime iEnd;
   iEnd.SetTimeLocalL(End);
   
   CalCommon::TCalTimeRange iRange(iStart,iEnd);

   RPointerArray<CCalInstance> iInstances;
   
   iView->FindInstanceL(iInstances, CalCommon::EThisOnly, iRange);
   

How to correctly open the session?

Regards
lkz633

pirosl

Wed, 2006-03-29 16:15
Joined: 2004-06-17
Forum posts: 47
Re: [9.1] Calendar
Hi,

I want to get all instances/occurences, not just an entry, so I am using CCalInstanceView


I do not get an error, but the SDK says:

static IMPORT_C CCalInstanceView *NewL(CCalSession &aSession, MCalProgressCallBack &aProgressCallBack);
The instance view can not be used until the Completed() function is called on the progress callback with the value KErrNone.


But this completed() function is never called


lkz633
Wed, 2006-03-29 16:41
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
Ok...i understood what you mean....you should start the activescheduler to get the callback Smiley
Your code will be:
Code:
   iSession = CCalSession::NewL();
   CleanupStack::PushL(iSession);
   iSession->OpenL(iSession->DefaultFileNameL());
   iView = CCalInstanceView::NewL(*iSession,*this);
   ActiveScheduler::Start();

I know this is far from obviuos from SDK.

And the rest of the code should be ok....it should work.
If not try to see if with CalCommon::EIncludeAll you get something or not

pirosl

Thu, 2006-03-30 10:58
Joined: 2006-03-30
Forum posts: 1
Re: [9.1] Calendar
pirosl,
could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK.
If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid?
Thank you.
Thu, 2006-03-30 11:24
Joined: 2004-06-17
Forum posts: 47
Re: [9.1] Calendar
Quote from: pirosl
Code:
   ActiveScheduler::Start();

Thanks a lot for your help Lucian, that solved it Smiley

The SDK should be really updated at this point.

Regards
lkz633

Thu, 2006-03-30 11:29
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
Quote from: mobile
pirosl,
could you help me also, I need get RPointerArray< CCalEntry >, contained ALL entries of calendar, but have no idea how to do with new SDK.
If i use CCalEntryView::FetchL(const TDesC8 &aUid, RPointerArray< CCalEntry > &aCalEntryArray), what should be used as aUid?
Thank you.

You can't get in a single shot all entries. The valid uids you will get it using GetIdsModifiedSinceDateL  method as i mentioned in an earlier porst

pirosl

Tue, 2006-04-04 10:14
Joined: 2004-12-06
Forum posts: 39
Re: [9.1] Calendar
I add to my console app ONLY one string:
CCalSession* iSession = CCalSession::NewL();
and after that app failed with leave code -1 (object not found).
If I comment this one, app works without any problems.
What problem can be here? Should I do smth except of adding of lib and header files for this class?
Thank you in advance,
Julia
Tue, 2006-04-04 10:41
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
Don't understand ...do you have problems with CCalSession* iSession = CCalSession::NewL();? Or?

pirosl

Tue, 2006-04-04 13:16
Joined: 2004-12-06
Forum posts: 39
Re: [9.1] Calendar
if i create even simplest console application (using wizard), add library calinterimapi.lib, CAPABILITY and include <calsession.h> it works correctly on emulator and prints "hello, world!",
but when I add ONLY one string CCalSession* iSession = CCalSession::NewL();
it failed with output: "failed, leave code -1". 
Tue, 2006-04-04 13:32
Joined: 2004-05-24
Forum posts: 982
Re: [9.1] Calendar
There shouldn't be anything wrong with CCalSession::NewL();.....i suppose you are not making any debug there....you only see that your app crashes rigth? If so....have you delete the session? May be the error you mention is in other place

pirosl

Tue, 2006-04-04 17:17
Joined: 2004-07-10
Forum posts: 364
Re: [9.1] Calendar
The calendar engine loads some other component (I forget which from memory, the alarm server or something like that) which isn't present and running in a text shell environment - which is probably what is happening if you are running a simple console application as opposed to a full UI application. So when you try to create a session to the calendar it in turn trys to connect to the missing server and you get -1 as it can't be found.

Try running your application in the full emulator environment and not the text emulator environment.

(Make sure in epoc32/data/epoc.ini there isn't the line startupmode 1)

  • Login to reply to this topic.