summaryrefslogtreecommitdiff
path: root/src/cprquerydialog.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cprquerydialog.cc')
-rw-r--r--src/cprquerydialog.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc
index c58a8ed..6f33785 100644
--- a/src/cprquerydialog.cc
+++ b/src/cprquerydialog.cc
@@ -354,27 +354,24 @@ int CPRQueryDialog::test_cpr(const char *s)
*/
void CPRQueryDialog::cprSocket_error(QAbstractSocket::SocketError err)
{
- (void)err;
-
QString msg = QString("cprSocket encountered an error: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
- /* // TODO
// Print error message
- switch(errnum) {
- case QTcpSocket::ErrConnectionRefused: // if the connection was refused
+ switch(err) {
+ case QAbstractSocket::ConnectionRefusedError: // if the connection was refused
msg.append("ErrConnectionRefused");
break;
- case QTcpSocket::ErrHostNotFound: // if the host was not found
+ case QAbstractSocket::HostNotFoundError: // if the host was not found
msg.append("ErrHostNotFound");
break;
- case QTcpSocket::ErrSocketRead: // if a read from the socket failed
- msg.append("ErrSocketRead");
+ default:
+ msg.sprintf("Socket Error %d", (int)err);
break;
}
- */
+
if(statusbar) statusbar->showMessage(msg, 5000);
MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec();
accept();
@@ -455,26 +452,28 @@ void CPRQueryDialog::cprSocket_timeout()
lbl_name->setText(NAME_NOT_AVAILABLE);
- /* // TODO
+ QAbstractSocket::SocketState state = cprSocket->state();
// Print connection status
- switch(cprSocket->state()) {
- case QTcpSocket::Idle: // if there is no connection
+ switch(state) {
+ case QAbstractSocket::UnconnectedState: // if there is no connection
msg.append("Idle");
break;
- case QTcpSocket::HostLookup: // during a DNS lookup
+ case QAbstractSocket::HostLookupState: // during a DNS lookup
msg.append("HostLookup");
break;
- case QTcpSocket::Connecting: // during TCP connection establishment
+ case QAbstractSocket::ConnectingState: // during TCP connection establishment
msg.append("Connecting");
break;
- case QTcpSocket::Connected: // when there is an operational connection
- msg.append("Conected");
+ case QAbstractSocket::ConnectedState: // when there is an operational connection
+ msg.append("Connected");
break;
- case QTcpSocket::Closing: // if the socket is closing down, but is not yet closed.
+ case QAbstractSocket::ClosingState: // if the socket is closing down, but is not yet closed.
msg.append("Closing");
break;
+ default:
+ msg.sprintf("Unknown state: %d", state);
+ break;
}
- */
if(statusbar) statusbar->showMessage(msg, 5000);
MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec();