Welcome!

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

Reply
Trusted Contributor
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Calendar Invocation in QML

I'm trying to invoke a calendar card in QML. According to documentation, this should work, but it doesn't:

 

                    Button {
                        attachedObjects: [
                            Invocation {
                                id: invokeCalendar
                                query {
                                    invokeTargetId: "sys.pim.calendar.viewer.eventcreate"
                                    mimeType: "text/calendar" 
                                }
                            }
                        ]

                        id: createReminder
                        text: "Create a reminder"
                        onClicked: {
                            invokeCalendar.trigger("bb.action.CREATE");                        
                        }

                    }

 Can anyone point me to what I'm doing wrong, or any code snippet that works?

Developer
Posts: 366
Registered: ‎07-15-2013
My Device: blackberry Z10
My Carrier: Personal

Re: Calendar Invocation in QML

mmm try with this , Im not sure that this will works 

                    actions: [
                    InvokeActionItem {
                        ActionBar.placement: ActionBarPlacement.OnBar
                        
                        query {
                                    invokeTargetId: "sys.pim.calendar.viewer.eventcreate"
                                    mimeType: "text/calendar" 
                        }
                        
                        onTriggered: {

                            
                           invokeCalendar.trigger("bb.action.CREATE");  
                            
                        }
                    }
                          
                    ]

 

If you find this information useful please click like --->
@mezeitune on twitter
Trusted Contributor
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Re: Calendar Invocation in QML

Thanks. Can you specify how to call the trigger? "invokeCalendar" is an ID of the button I had, and your code is implementing action bar invocation, which doesn't allow IDs.

Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Calendar Invocation in QML

I was reading through the documentation and I belive that just clicking the actionItem that InvokeActionItem creates should make the call to create the invocation.   Here's an example of 2 different types of invocations, the 2nd which is not an action item must be called to trigger when needed

 

Action [
InvokeActionItem { title: "Share Over BBM" query { invokeTargetId: "sys.bbm.sharehandler" invokeActionId: "bb.action.SHARE" uri: "file:///path/to/your/file/someFile.m4a" } }
]
Button {
      id: myButton
      text: "Click me"                       
      attachedObjects: [
            Invocation {
                    id: invoke
                    query: InvokeQuery {
                         mimeType: "application/x-bb-appworld"
                         uri: "appworld://content/124432"
                    }
           }
] onClicked: { invoke.trigger("bb.action.OPEN") } } }
Trusted Contributor
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Re: Calendar Invocation in QML

Hi, and thanks! Yes, the 2nd tpe actually works, it's identical to the code I posted originally. I have it working with the e-mail invocation... however, I have had absolutely no luck with the CALENDAR invocation... It simply refuses to invoke, and the settings are all exactly asin the reference/documentation. So, the invoking mechanism is correct, however, the CALENDAR part is not working. Help!

Developer
Posts: 366
Registered: ‎07-15-2013
My Device: blackberry Z10
My Carrier: Personal

Re: Calendar Invocation in QML

maybe this can serve you

https://github.com/blackberry/Cascades-Samples/tree/master/calendar

If you find this information useful please click like --->
@mezeitune on twitter
Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Calendar Invocation in QML

[ Edited ]

Well I followed the documentation for opening the calendar app

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/calendar.h...

 

I was able to open the calendar using the c++ invocation methed but not from qml

 

here's the code which can easily be adjusted to edit events etc

 

use everything but ApplicationUI:: permissions from this post

http://supportforums.blackberry.com/t5/Native-Development/Is-it-possible-to-Postpone-or-further-stre...

 

replace ApplicationUI:: permissions with this

void ApplicationUI::calendar()
{
	InvokeManager manager;
	InvokeRequest request;



	// Setup what to show and in what target.
	request.setAction("bb.calendar.OPEN");
	request.setMimeType("text/calendar");
	request.setData("view://monthly");
	InvokeTargetReply *targetReply = manager.invoke(request);
	//setting the parent to "this" will make the manager live on after this function is destroyed
	manager.setParent(this);

	if (targetReply == NULL) {
		qDebug() << "InvokeTargetReply is NULL: targetReply = " << targetReply;
	} else {
		targetReply->setParent(this);
	}
}

 

Trusted Contributor
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Re: Calendar Invocation in QML

Thanks, Ive gone through it... this app, rather than opening a calendar card, has it's own UI to create and view calendar events.

 

While I can use the approach from this example as a last resort, I'd prefer to open a Calendar card and let user use its UI.

Trusted Contributor
Posts: 102
Registered: ‎05-09-2013
My Device: BB10 Z10
My Carrier: Virgin

Re: Calendar Invocation in QML

Thanks! I will try it shortly and report back!

 

I'd prefer to have this in QML, so the question still stands Smiley Sad

Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Calendar Invocation in QML

[ Edited ]

to open the card just adjust the action id's etc see "Picking an existing event" or "Creating an event" from

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/calendar.h...

 

in my example i just followed "Opening the calendar app"

 

I tried doing this using the qml method but nothing happened when i clicked the button...

QML invocation has never fully worked properly for everything Smiley Wink