getting a panic Agenda Model 0 in Calendar APIs
| Tue, 2008-03-18 19:57 | |
|
Hi, I know that this query has been posted before..but i couldnt get the answer from that. so, m posting it again. My code is: The code in CalEx.h is: // Sets some entry details - start and end date/time, description, categories and attendees // Set the start and end times using time values local to the current system time zone // Set the description text // Add a category CCalCategory* category = CCalCategory::NewL(buf); // Add some attendees CCalAttendee* attendeeOne = CCalAttendee::NewL(KAttendeeOne); CCalAttendee* attendeeTwo = CCalAttendee::NewL(KAttendeeTwo); // Add a non-repeating appointment to the calendar file CCalEntry* entry = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodNone, 0); // For an appointment, the time as well as the date is relevant /* _LIT(KAddingMsg, "\n\nAdding an entry..."); _LIT(KDescription,"Meeting is scheduled in 2nd week of March"); RPointerArray TInt success = 0; // StoreL() leaves if success is zero. iCalEntryView->StoreL(array, success); CleanupStack::PopAndDestroy(&array); } Code in HandleCommandL is: // add an entry to the calendar CleanupStack::PopAndDestroy(app); Plz help.. |
|






Forum posts: 56
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...
Forum posts: 132
Nothing to do with StoreL or NULL or garbage, see the answer on the posting in forum nokia as that is correct.
Forum posts: 18
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.
Forum posts: 132
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.
Forum posts: 18
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..
Forum posts: 18
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..