aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-08 14:05:01 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-08 14:05:01 +0000
commite4ffbeb064894b61c85e09e1a369a13f9906ea2f (patch)
tree5f19fbf8deb6ffb5ec97a2fb574424c638397cc2 /examples
parent54cadce4c8057ca11ba1048d0da8b8800ae03a73 (diff)
downloadqxmpp-e4ffbeb064894b61c85e09e1a369a13f9906ea2f.tar.gz
error handling
Diffstat (limited to 'examples')
-rw-r--r--examples/GuiClient/mainDialog.cpp35
-rw-r--r--examples/GuiClient/mainDialog.h1
2 files changed, 36 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;
+ }
+}
diff --git a/examples/GuiClient/mainDialog.h b/examples/GuiClient/mainDialog.h
index 1e3252a0..c9ae6014 100644
--- a/examples/GuiClient/mainDialog.h
+++ b/examples/GuiClient/mainDialog.h
@@ -84,6 +84,7 @@ private slots:
void userNameCompleter_activated(const QString&);
void addAccountToCache();
void presenceReceived(const QXmppPresence&);
+ void errorClient(QXmppClient::Error);
void action_addContact();
void action_removeContact(const QString& bareJid);