Note that there are some explanatory texts on larger screens.

plurals
  1. POterminate the BB 10 app on Alert button ok pressed
    primarykey
    data
    text
    <p>I have a socket connection App in my BB 10 cascades, when ever socket connection is closed i need to show a dialog box and when pressed on OK button app need to close.</p> <p>please find my code here...</p> <pre><code>void SocketBase::writeLine(QTcpSocket *socket, const QString &amp;line) { if (socket-&gt;state() != QAbstractSocket::ConnectedState) { onOkAlert("Please check your internet connection and restart the app again"); } } </code></pre> <p>void SocketBase::onOkAlert(const QString &amp;message) {</p> <pre><code>dialog = new SystemDialog(tr("OK"), 0); dialog-&gt;setTitle(tr("Alert")); dialog-&gt;setBody(message); bool success= QObject::connect(dialog,SIGNAL(finished(bb::system::SystemUiResult::Type)), this, SLOT(onDialogFinishe(bb::system::SystemUiResult::Type))); if(success){ dialog-&gt;show(); } </code></pre> <p>}</p> <p>and I also added at top of my class,</p> <pre><code>using namespace bb::data; using namespace bb::cascades; using namespace bb::system; SystemDialog *dialog; </code></pre> <p>and my socketBase.h is like,</p> <pre><code> class SocketBase: public QObject{ Q_OBJECT public: SocketBase(const QString &amp;ipAddr, const ushort port) : mIP(ipAddr), mPort(port) { mRunThread = false; } enum Identity { BAD_IDENTITY, SERVER, CLIENT }; virtual void startThread() = 0; virtual void stopThread() = 0; virtual Identity getIdentity() = 0; Q_INVOKABLE void showDialog(int id); void onOkAlert(const QString &amp;message); private slots: void onAPPFinished(); void onDialogFinishe(bb::system::SystemUiResult::Type); } </code></pre> <p>here is the app termination code </p> <pre><code> void SocketBase::onDialogFinishe(bb::system::SystemUiResult::Type) { qDebug()&lt;&lt;" dialog-&gt;result():::"&lt;&lt;dialog-&gt;result(); if(dialog-&gt;result()==2) { qDebug()&lt;&lt;"::: Terminate App :::"; bb::Application::exit(0); } } </code></pre> <p>what is wrong in my code, please help!!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload