diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-21 14:50:20 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-21 14:50:20 +0200 |
commit | 77a0868116fdfb465d3834a81edb93b1605674b1 (patch) | |
tree | 3b5c699ff5c9d40ad025ab5f57d0c04666f17cf2 /src/cprquerydialog.cc | |
parent | eda4e58427a74f8ea969b3062327b6ea6309d310 (diff) |
Fix last TODOs
Diffstat (limited to 'src/cprquerydialog.cc')
-rw-r--r-- | src/cprquerydialog.cc | 35 |
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(); |