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
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

System Toast on top of core application Card?

I was playing around with the screenshot sample app and was trying to use a system toast ontop of the previewer card that comes in...no luck...is there a way of making a toast become a priority and be on top of all other screens? Any help would be appreciated. the below code is from sample app with my additions of a system toast.

 

Right now the toast comes in before the card comes in...

 

Here is the code below:

 

attachedObjects: [

 

SystemToast{

 

id: savepic

 

body: "Use the previewer to:

Save as, Set as or Share

your masterpiece"

button.label: "OK"button.enabled: trueonFinished: {

}

},

 

Screenshot{

id: screenshot

},

 

QTimer{

 

// A timer is needed to delay the screen shot until the ActionBar is hidden.// Here we use the QTimer, which has to be registered as a type in the application// constructor to work (see constructor in appshotapp.cpp).id: hideActionBarTimer

 

interval: 300

 

singleShot: true

 

onTimeout: {

 

// Take a screen shot by calling the captureScreen function of the AppShot object.var filePath = screenshot.captureWindow("file:data/Appshot.jpg", Application.mainWindow.handle);

 

// Show the screen shot in a pictures card (see invokalble function in appshotapp.cpp).

_app.showPhotoInCard(filePath);

 

savepic.show()

 

// Show the action bar again, so that more screen shots can be made by the user.

actionBarVisibility = ChromeVisibility.Visible

}

}

]

 

The AppShot.cpp code is:

 

void

AppShotApp::showPhotoInCard(constQStringfileName)

{

// Create InvokeManager and InvokeRequest objects to able to invoke a card with a viewer that will show the// snapped screen shot. Requires libbbsystem.so to be added (System APIs for the clipboard, toasts, dialogs,// and inter-application invocation).

bb::system::InvokeManagermanager;

bb::system::InvokeRequestrequest;

 

// Setup what to show and in what target.

request.setUri(QUrl::fromLocalFile(fileName));

request.setTarget("sys.pictures.card.previewer");

request.setAction("bb.action.VIEW");

 

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);

}

}

 

Thx for any help.

Simplify your Life...
Please use plain text.