Skip to content
Snippets Groups Projects
Commit c6376c58 authored by jpbl's avatar jpbl
Browse files

we handle errors in a better way for getevents and callstatus

parent 9e2cf68c
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ PhoneLineManagerImpl::startSession()
{
isInitialized();
closeSession();
emit globalStatusSet(QString(tr("Trying to get line status...")));
mSession->getCallStatus();
}
......@@ -129,6 +130,10 @@ PhoneLineManagerImpl::closeSession()
mPhoneLines[i]->disconnect();
i++;
}
emit lineStatusSet("");
emit bufferStatusSet("");
emit globalStatusSet("Disconnected.");
}
......
......@@ -49,7 +49,8 @@ signals:
void disconnected();
void readyToSendStatus();
void readyToHandleEvents();
void gotErrorOnCallStatus();
void gotErrorOnGetEvents(QString);
void gotErrorOnCallStatus(QString);
void globalStatusSet(QString);
void bufferStatusSet(QString);
void actionSet(QString);
......@@ -241,8 +242,11 @@ public slots:
*/
void setMicVolume(int volume);
void errorOnCallStatus()
{emit gotErrorOnCallStatus();}
void errorOnGetEvents(const QString &message)
{emit gotErrorOnGetEvents(message);}
void errorOnCallStatus(const QString &message)
{emit gotErrorOnCallStatus(message);}
private slots:
/**
......
......@@ -99,8 +99,10 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w)
QObject::connect(w, SIGNAL(reconnectAsked()),
&PhoneLineManager::instance(), SLOT(connect()));
QObject::connect(&PhoneLineManager::instance(), SIGNAL(gotErrorOnCallStatus()),
w, SLOT(askResendStatus()));
QObject::connect(&PhoneLineManager::instance(), SIGNAL(gotErrorOnCallStatus(QString)),
w, SLOT(askResendStatus(QString)));
QObject::connect(&PhoneLineManager::instance(), SIGNAL(gotErrorOnGetEvents(QString)),
w, SLOT(askResendStatus(QString)));
QObject::connect(w, SIGNAL(resendStatusAsked()),
&PhoneLineManager::instance(), SIGNAL(readyToSendStatus()));
......
......@@ -181,7 +181,7 @@ SFLPhoneWindow::askReconnect()
tr("SFLPhone disconnected"),
tr("The link between SFLPhone and SFLPhoned is broken.\n"
"Do you want to try to reconnect? If not, the application\n"
"will close."),
"will close. Be sure that sflphoned is running."),
QMessageBox::Retry | QMessageBox::Default,
QMessageBox::No | QMessageBox::Escape);
if (ret == QMessageBox::Retry) {
......@@ -193,13 +193,14 @@ SFLPhoneWindow::askReconnect()
}
void
SFLPhoneWindow::askResendStatus()
SFLPhoneWindow::askResendStatus(QString message)
{
int ret = QMessageBox::critical(NULL,
tr("SFLPhone status error"),
tr("The server returned an error for the lines status.\n"
"<i>\n%1\n</i>"
"Do you want to try to resend this command? If not,\n"
"the application will close."),
"the application will close.").arg(message),
QMessageBox::Retry | QMessageBox::Default,
QMessageBox::No | QMessageBox::Escape);
if (ret == QMessageBox::Retry) {
......
......@@ -46,7 +46,7 @@ signals:
* This function will prompt a message box, to ask
* if the user want to resend the getcallstatus request.
*/
void askResendStatus();
void askResendStatus(QString);
protected:
void keyPressEvent(QKeyEvent *e);
......
......@@ -26,6 +26,7 @@ EventRequest::onError(const QString &code, const QString &message)
DebugOutput::instance() << QObject::tr("EventRequest error: (%1) %1\n")
.arg(code)
.arg(message);
PhoneLineManager::instance().errorOnGetEvents(message);
}
void
......@@ -42,6 +43,7 @@ EventRequest::onSuccess(const QString &code, const QString &message)
DebugOutput::instance() << QObject::tr("EventRequest success: (%1) %1\n")
.arg(code)
.arg(message);
PhoneLineManager::instance().start();
}
CallStatusRequest::CallStatusRequest(const QString &sequenceId,
......@@ -57,7 +59,7 @@ CallStatusRequest::onError(const QString &code, const QString &message)
DebugOutput::instance() << QObject::tr("CallStatusRequest error: (%1) %1\n")
.arg(code)
.arg(message);
PhoneLineManager::instance().errorOnCallStatus();
PhoneLineManager::instance().errorOnCallStatus(message);
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment