From e4ffbeb064894b61c85e09e1a369a13f9906ea2f Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Fri, 8 Oct 2010 14:05:01 +0000 Subject: error handling --- examples/GuiClient/mainDialog.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'examples/GuiClient/mainDialog.cpp') diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp index fba4f250..640ab95f 100644 --- a/examples/GuiClient/mainDialog.cpp +++ b/examples/GuiClient/mainDialog.cpp @@ -79,6 +79,11 @@ mainDialog::mainDialog(QWidget *parent): QDialog(parent, Qt::Window), this, SLOT(rosterChanged(const QString&))); Q_ASSERT(check); + check = connect(&m_xmppClient, + SIGNAL(error(QXmppClient::Error)), + this, SLOT(errorClient(QXmppClient::Error))); + Q_ASSERT(check); + check = connect(&m_xmppClient, SIGNAL(presenceReceived(const QXmppPresence&)), this, SLOT(presenceReceived(const QXmppPresence&))); @@ -756,3 +761,33 @@ void mainDialog::action_removeContact(const QString& bareJid) remove.addItem(itemRemove); m_xmppClient.sendPacket(remove); } + +void mainDialog::errorClient(QXmppClient::Error error) +{ + ui->label_throbber->hide(); + + showSignInPage(); + + switch(error) + { + case QXmppClient::SocketError: + showLoginStatus("Socket error"); + break; + case QXmppClient::KeepAliveError: + showLoginStatus("Keep alive error"); + break; + case QXmppClient::XmppStreamError: + switch(m_xmppClient.xmppStreamError()) + { + case QXmppStanza::Error::NotAuthorized: + showLoginStatus("Invalid password"); + break; + default: + showLoginStatus("Stream error"); + break; + } + break; + default: + break; + } +} -- cgit v1.2.3