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
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel
Accepted Solution

Invocation API in QML

Hi,

 

I have a simple app with 2 screens, 1-> form, 2-> calculated result from that form.

I am only using QML for calculations and opening new populated screen.

 

Now I want to add a share All target tab on the second screen.

 

Can any one tell me how I can do this?

 

I am new to C++/cascades.

 

This is how I am calling new populated screen

 onClicked: {
                        var newPage = resultPage.createObject();
                        main.calculate();
                        //popupate fields...
                        nav.push(newPage);
                    }

 

How and where do I need to put following code

qml->setContextProperty("_socialInvocation", new SocialInvocation(&app));

 Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Telus

Re: Invocation API in QML

[ Edited ]

 

Sorry I don't have a QML example because the results from QML have been so varied that I found it easier and less headach to switch to c++ for this portion

 

void ApplicationUI::share(QString text)
{

	qDebug() << "fileName - " << fileName ;
	//fileName = fileName.prepend("file://");
	InvokeQuery *query = InvokeQuery::create()
.mimeType("text/plain"); .data(text.toUtf8()); Invocation *invocation = Invocation::create(query); query->setParent(invocation); // destroy query with invocation invocation->setParent(this); // app can be destroyed before onFinished() is called connect(invocation, SIGNAL(armed()), this, SLOT(onArmed())); connect(invocation, SIGNAL(finished()), this, SLOT(onFinished())); }
Please use plain text.
Developer
abhi007tyagi
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: Invocation API in QML

Thanks... I did it all in QML itself

 

here is the code : 

actions: [
        // General SHARE Framework call
        // Will display all the SHARE Targets available
        InvokeActionItem {
            ActionBar.placement: ActionBarPlacement.OnBar
            query {
                mimeType: "text/plain"
                invokeActionId: "bb.action.SHARE"
            }
            onTriggered: {
                data = qsTr("text to be shared !!!");
                console.log(data);
            }

        }
    ]
    actionBarVisibility: ChromeVisibility.Default

 

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Please use plain text.