diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-10-08 14:05:01 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-10-08 14:05:01 +0000 |
| commit | e4ffbeb064894b61c85e09e1a369a13f9906ea2f (patch) | |
| tree | 5f19fbf8deb6ffb5ec97a2fb574424c638397cc2 /examples/GuiClient/mainDialog.cpp | |
| parent | 54cadce4c8057ca11ba1048d0da8b8800ae03a73 (diff) | |
| download | qxmpp-e4ffbeb064894b61c85e09e1a369a13f9906ea2f.tar.gz | |
error handling
Diffstat (limited to 'examples/GuiClient/mainDialog.cpp')
| -rw-r--r-- | examples/GuiClient/mainDialog.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ -80,6 +80,11 @@ mainDialog::mainDialog(QWidget *parent): QDialog(parent, Qt::Window), 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&))); Q_ASSERT(check); @@ -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; + } +} |
