getting a panic Agenda Model 0 in Calendar APIs

Login to reply to this topic.
Tue, 2008-03-18 19:57
Joined: 2007-09-19
Forum posts: 18

Hi,

I know that this query has been posted before..but i couldnt get the answer from that. so, m posting it again.
I am getting a panic in the storeL().

My code is:

The code in CalEx.h is:

// Sets some entry details - start and end date/time, description, categories and attendees
void CCalExample::SetEntryDetailsL(CCalEntry* aEntry,const TDesC& aDescription, TDateTime& aStartTime,TDateTime& aEndTime)
{
TCalTime startTime;
TCalTime endTime;

// Set the start and end times using time values local to the current system time zone
startTime.SetTimeLocalL(aStartTime);
endTime.SetTimeLocalL(aEndTime);
aEntry->SetStartAndEndTimeL(startTime, endTime);

// Set the description text
aEntry->SetDescriptionL(aDescription);

// Add a category
const RPointerArray categoryList = aEntry->CategoryListL();
if(categoryList.Count() == 0)
{
TBuf<32> buf;
_LIT(KCategoryName, "Dummy Category");
buf.Copy(KCategoryName);

CCalCategory* category = CCalCategory::NewL(buf);
CleanupStack::PushL(category);
aEntry->AddCategoryL(category);
CleanupStack::Pop(category);
}

// Add some attendees
const RPointerArrayattendeeList = aEntry->AttendeesL();
if(attendeeList.Count() == 0)
{
_LIT(KAttendeeOne, "symbianuk@symbian.com");
_LIT(KAttendeeTwo, "symbianindia@symbian.com");

CCalAttendee* attendeeOne = CCalAttendee::NewL(KAttendeeOne);
CleanupStack::PushL(attendeeOne);
aEntry->AddAttendeeL(attendeeOne);
CleanupStack::Pop(attendeeOne);

CCalAttendee* attendeeTwo = CCalAttendee::NewL(KAttendeeTwo);
CleanupStack::PushL(attendeeTwo);
aEntry->AddAttendeeL(attendeeTwo);
CleanupStack::Pop(attendeeTwo);
}
}

// Add a non-repeating appointment to the calendar file
void CCalExample::AddEntryL()
{
const TDesC8& guidDes = KGuid;
HBufC8* guid = guidDes.AllocL();

CCalEntry* entry = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodNone, 0);
CleanupStack::PushL(entry);

// For an appointment, the time as well as the date is relevant
TDateTime startTime(2006, EJanuary, 12, 10, 0, 0, 0);
TDateTime endTime(2006, EJanuary, 16, 16, 0, 0, 0);

/* _LIT(KAddingMsg, "\n\nAdding an entry...");
iConsole->Printf ( KAddingMsg );*/

_LIT(KDescription,"Meeting is scheduled in 2nd week of March");
SetEntryDetailsL(entry,KDescription, startTime, endTime);

RPointerArray array;
CleanupClosePushL(array);
array.AppendL(entry);

TInt success = 0;

// StoreL() leaves if success is zero.
//-------------------------code is panicing in the following StoreL function.

iCalEntryView->StoreL(array, success);

CleanupStack::PopAndDestroy(&array);
CleanupStack::PopAndDestroy(entry);

}

Code in HandleCommandL is:
case EHelloWorldBasicCommand1:
{
const TDesC8& guidDes = KGuid;
HBufC8* guid = guidDes.AllocL();
CCalExample* app = CCalExample::NewL();
CleanupStack::PushL(app);

// add an entry to the calendar
app->AddEntryL();

CleanupStack::PopAndDestroy(app);
}

Plz help..


Wed, 2008-03-19 07:23
Joined: 2005-12-07
Forum posts: 56
Re: getting a panic Agenda Model 0 in Calendar APIs

i thik StoreL function dont panic... at least from the documents....

can you just see iCalEntryView is intialized properly....

i mean is it allocated or it has a garbage value or a NULL value in it...

Wed, 2008-03-19 17:33
Joined: 2007-09-23
Forum posts: 132
Re: getting a panic Agenda Model 0 in Calendar APIs

Nothing to do with StoreL or NULL or garbage, see the answer on the posting in forum nokia as that is correct.

Wed, 2008-03-19 20:47
Joined: 2007-09-19
Forum posts: 18
Re: getting a panic Agenda Model 0 in Calendar APIs

hi,

i could solve the problem. The panic is not coming now.

I decalred a iReady as TBoolean and checked its value before making an entry.

But the To-Do entry is not getting reflected in the calendar even after refreshing it. The code is:

void CCalExample::AddEntryL()
{

if(!iReady)
return;

const TDesC8& guidDes = KGuid;
HBufC8* guid = guidDes.AllocL();

CCalEntry* todo = CCalEntry::NewL(CCalEntry::ETodo, guid, CCalEntry::EMethodNone, 0);
CleanupStack::PushL(todo);

todo->SetSummaryL( _L("Summary") );
//Priority
TInt priority = 1;
todo->SetPriorityL(priority);

//End date
TCalTime calStartDate;
calStartDate.SetTimeLocalL(TDateTime(2008, EMarch, 19, 11, 0, 0, 0));
TCalTime calEndDate;
calEndDate.SetTimeLocalL(TDateTime(2008, EMarch, 19, 12, 0, 0, 0));


todo->SetStartAndEndTimeL(calStartDate, calEndDate);

//Store New Entry
RPointerArray<CCalEntry> entryArray;

CleanupClosePushL(entryArray);
entryArray.AppendL(todo);

TInt success(0);
iCalEntryView->StoreL(entryArray, success);
entryArray.Reset();
CleanupStack::PopAndDestroy(&entryArray);
CleanupStack::PopAndDestroy(todo);


And it gives a msg:
Application Closed: Calendar apis ALLOC:30b521c40

And the number in bold changes every time i open the emulator. Does it have any relation with the entries not getting reflected in the calendar?

Please help..
Thanx in advance. Smiling

Thu, 2008-03-20 19:49
Joined: 2007-09-23
Forum posts: 132
Re: getting a panic Agenda Model 0 in Calendar APIs

Error codes, or in this case a success code, are there for a reason - to tell you if something went wrong, and if so give some inidcation as to what the problem is.

Fri, 2008-03-21 10:50
Joined: 2007-09-19
Forum posts: 18
Re: getting a panic Agenda Model 0 in Calendar APIs

hi,

i initialised iReady as EFalse and did the following:

void CCalExample::Completed(TInt aError)
{
if(aError==KErrNone)
iReady=ETrue;

// CActiveScheduler::Stop();

and the code for adding the to-do entry is as following:

void CCalExample::AddEntryL()
{

if(!iReady)
return;

const TDesC8& guidDes = KGuid;
HBufC8* guid = guidDes.AllocL();

CCalEntry* todo = CCalEntry::NewL(CCalEntry::ETodo, guid, CCalEntry::EMethodNone, 0);
CleanupStack::PushL(todo);

todo->SetSummaryL( _L("Summary") );
//Priority
TInt priority = 1;
todo->SetPriorityL(priority);

//End date
TCalTime calStartDate;
calStartDate.SetTimeLocalL(TDateTime(2008, EMarch, 19, 11, 0, 0, 0));
TCalTime calEndDate;
calEndDate.SetTimeLocalL(TDateTime(2008, EMarch, 19, 12, 0, 0, 0));


todo->SetStartAndEndTimeL(calStartDate, calEndDate);

//Store New Entry
RPointerArray<CCalEntry> entryArray;

CleanupClosePushL(entryArray);
entryArray.AppendL(todo);

TInt success(0);
iCalEntryView->StoreL(entryArray, success);
entryArray.Reset();
CleanupStack::PopAndDestroy(&entryArray);
CleanupStack::PopAndDestroy(todo);

Now the problem is the function is always getting returned coz of the if(!iReady) return; statement. and if i dont use this statement, its giving me Agenda Model 0 panic.

What should i do now?

Plz help..

Fri, 2008-03-21 20:19
Joined: 2007-09-19
Forum posts: 18
Re: getting a panic Agenda Model 0 in Calendar APIs

hi,

i could resolve the prevoius problem now.. and the control is passing through all the statements of the AddEntryL().. I added an activescheduler.
but still the entries are not getting reflected in the calendar. I also tried by closing the emulator and starting it again..

Can you please check the following code?

void CCalExample::AddEntryL()
{

if(!iReady)
return;

const TDesC8& guidDes = KGuid;
HBufC8* guid = guidDes.AllocL();

CCalEntry* todo = CCalEntry::NewL(CCalEntry::ETodo, guid, CCalEntry::EMethodNone, 0);
CleanupStack::PushL(todo);

todo->SetSummaryL( _L("Summary") );
//Priority
TInt priority = 1;
todo->SetPriorityL(priority);

//Completed
/*
TCalTime calTime;
TTime time; time.UniversalTime();
calTime.SetTimeUtcL(time);
todo->SetCompletedL(ETrue, calTime); */

//End date
TCalTime calStartDate;
calStartDate.SetTimeLocalL(TDateTime(2008, EMarch, 28, 11, 0, 0, 0));
TCalTime calEndDate;
calEndDate.SetTimeLocalL(TDateTime(2008, EMarch, 28, 12, 0, 0, 0));

todo->SetStartAndEndTimeL(calStartDate, calEndDate);

//Store New Entry
RPointerArray<CCalEntry> entryArray;

CleanupClosePushL(entryArray);
entryArray.AppendL(todo);

TInt success(0);
iCalEntryView->StoreL(entryArray, success);
entryArray.Reset();
CleanupStack::PopAndDestroy(&entryArray);
CleanupStack::PopAndDestroy(todo);

thanx..

  • Login to reply to this topic.