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
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

NetworkManagerClass

Hello,

I am thinking to write a network manager class, e.g., something similar to this one: http://www.clearbridgemobile.com/2012/11/14/blackberrry-10-http-communication/. But when this slot gets called:

void NetworkManager::requestFinished(QNetworkReply* reply)

 I can't have some specific behaviour implemented in the definition of the above function inside the NetworkManager class. Since other classes will be using the NetworkManager class, what I want is that when the reply comes from the server (e.g., requestFinished gets called), I want to be notified about this (say even in QML), and then I want to "decide" what to do with the response... How can I achieve this? What are the ways? Thank you.

Developer
Posts: 16,574
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: NetworkManagerClass

the easy way would be to display a SystemDialog directly from c++
If you want to keep UI and native really separate you could send a signal to your qml and then back to c++ where you continue processing.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: NetworkManagerClass

[ Edited ]

Aahh I will phrase my question this way for now... Say the requestFinished(QNetworkReply* reply) has

returned some value which I have processed etc. requestFinished is basically a slot to a finished() signal

which gets called at a time we don't know. No, once I calculate some values inside the requestFinished

call, how can I communicate it to QML????

Developer
Posts: 16,574
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: NetworkManagerClass

i would suggest to send a signal with the result and connect that in qml.
if you start the request from qml you can connect the signal at that time and disconnect it after it was received.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter