Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Calendar Invokation - only default calendar selectable



I'm invoking the Calendar application using this from within my C++ code:



Everything works fine. But only the default system calendar is available, I'm unable to select a different one. The button is there, but the other calendars are grayed out.


After creating the event I can move it to a different calendar without problem. So I see no reason why it shouldn't work out of the box. I see also no invokation parameter to change this behavior.


A Android app I tried (http://oeffi.schildbach.de/download.html) is able to invoke the calendar and I'm able to select the target calendar without issue. But here the Calendar application opens in a separate window, at my Application it is a Card Invokation.


Any ideas?

Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Calendar Invokation - only default calendar selectable

Which invoke parameters are yo using? Best if you paste your invoke code here.

Posts: 27
Registered: ‎03-27-2011
My Device: Z10,Q10,Z30
My Carrier: Verizon and ATT

Re: Calendar Invokation - only default calendar selectable

The following code will select thed default calendar(not the home calendar/local calendar). most important thing setting accountId and folderId through whatever methods before invoking calendar



   data.insert("accountId", defaultCalendar.first);
    data.insert("folderId", defaultCalendar.second);




//Code starts

// Create the calendar service object
    CalendarService calendarService;

    // Retrieve the IDs for the default calendar
    QPair<AccountId, FolderId> defaultCalendar = calendarService.defaultCalendarFolder();

    QVariantList participants = QVariantList();
    QVariantMap data;
    data.insert("accountId", defaultCalendar.first);
    data.insert("folderId", defaultCalendar.second);
     qDebug() << "Account id " << defaultCalendar.first;
    qDebug() << "Folder id " << defaultCalendar.second;
     InvokeRequest request;
    QByteArray encData = bb:Smiley TonguesObject::encode(data,NULL);
     bb::system::InvokeManager* m_invokeManager = new InvokeManager(this);


//Code ends



Now if there are mutliple calendars, then you have to iterate through the calendar and take the right accountId and folderId and invoke calendar, it will work


Use the following code to iterate through the calendars


// Create the calendar service object
CalendarService calendarService;
// Retrieve the list of all calendars
QList<CalendarFolder> allFolders = calendarService.folders();
// Determine whether a calendar named "Birthdays" exists in the list of
// all calendars
bool found = false;
for (int i = 0; i < allFolders.size(); i++) {
//set the above 2 values while creating calendar entry or invoking calendar entry


Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: Calendar Invokation - only default calendar selectable

Thanks for your reply bennyantony.


My current code was like this one:


    InvokeManager invokeManager;

    InvokeRequest request;

    QVariantMap map;

    QTextDocument ver;
    map.insert("subject", tr("Test: ") + ver.toPlainText());

    QString BodyText;
    BodyText = "Testtext"
    map.insert("body", BodyText);

    QByteArray requestData = bb::PpsObject::encode(map, NULL);




Worked fine at firmware 10.2.0 and below. I haven't set the accountId or folderId because the user should chose himself which calendar should get used.


But beginning with firmware 10.2.1 the Option for the target calendar is grayed out.


The big benefit was that I haven't needed the permission to access the calendar. I just started the invocation and the calendar dialog has done the rest. According to the CalendarService documentation I would need the permission using your method.


I wonder how I could give the user the option in the invoked dialog back without the need to get before all available calendars and handle it myself via a setting.


Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: Calendar Invokation - only default calendar selectable

Okay, even after adding the <permission>access_pimdomain_calendars</permission> permission and adding all calendars to the invocation the selection dialog is still grayed out:


CalendarService calendarService;
QList<CalendarFolder> allFolders = calendarService.folders();
for (int i = 0; i < allFolders.size(); i++) {
            map.insert("accountId", allFolders.at(i).accountId());
            map.insert("folderId", allFolders.at(i).id());


Using this code only the last calendar gets added to the dialog. Without the additional permission only the default calender is in the CalendarFolder list.


Preferable I would use again the invocation dialog without the additional access_pimdomain_calendars permission. I'm using the invocation framework especially because it works natively and without additional permission which would make reading and changing possible without the knowledge of the user.


Android apps are still able to select the target calendar in the invocation dialog. Why not the native ones? What am I making here wrong?