summaryrefslogtreecommitdiff
path: root/src/cprquerydialog.cc
diff options
context:
space:
mode:
authordeva <deva>2005-03-27 18:16:31 +0000
committerdeva <deva>2005-03-27 18:16:31 +0000
commit088296e7e6e5fd6c837ae08b826c8b56baa0eb4b (patch)
tree58c119a46aab42d2bb3b7feb43d16a40d7e67dd1 /src/cprquerydialog.cc
parent3392d8657f6f6ebc341709d5f500040ed4f559ef (diff)
Fixed pixmap path and dist taget in Makefiles.
Diffstat (limited to 'src/cprquerydialog.cc')
-rw-r--r--src/cprquerydialog.cc36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc
index e5a722f..14b7950 100644
--- a/src/cprquerydialog.cc
+++ b/src/cprquerydialog.cc
@@ -34,13 +34,15 @@
CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
QLabel *lname,
QWidget *parent,
- const char *name)
+ const char *name,
+ QStatusBar *status)
: QDialog(parent, name, TRUE)
{
MiavConfig cfg("cprquery.conf");
lbl_name = lname;
lbl_cpr = lcpr;
+ statusbar = status;
//Read configuration
CPR_HOST = cfg.readString("cpr_host");
@@ -317,6 +319,7 @@ int CPRQueryDialog::test_cpr(const char *s)
*/
void CPRQueryDialog::cprSocket_error(int errnum)
{
+ QString msg = QString("cprSocket encountered an error: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
@@ -324,16 +327,18 @@ void CPRQueryDialog::cprSocket_error(int errnum)
// Print error message
switch(errnum) {
case QSocket::ErrConnectionRefused: // if the connection was refused
- printf("ErrConnectionRefused\n");
+ msg.append("ErrConnectionRefused");
break;
case QSocket::ErrHostNotFound: // if the host was not found
- printf("ErrHostNotFound\n");
+ msg.append("ErrHostNotFound");
break;
case QSocket::ErrSocketRead: // if a read from the socket failed
- printf("ErrSocketRead\n");
+ msg.append("ErrSocketRead");
break;
}
+ if(statusbar) statusbar->message(msg);
+ MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec();
accept();
}
@@ -350,10 +355,12 @@ void CPRQueryDialog::cprSocket_readyRead()
QString lastname;
int timeout = 0;
- timer->stop();
-
if (!cprSocket->canReadLine()) return;
+ QString msg = QString("Recieving name from cpr database...");
+ if(statusbar) statusbar->message(msg);
+ timer->stop();
+
while(cprSocket->canReadLine()) {
QString s = cprSocket->readLine();
if (s.startsWith("0001")) {
@@ -391,7 +398,10 @@ void CPRQueryDialog::cprSocket_readyRead()
*/
void CPRQueryDialog::cprSocket_connected()
{
+ QString msg = QString("Connected to cpr database, sending cpr number...");
+ if(statusbar) statusbar->message(msg);
timer->stop();
+
cprSocket->writeBlock(internalCpr, 10);
cprSocket->writeBlock("\n", 1);
}
@@ -402,31 +412,33 @@ void CPRQueryDialog::cprSocket_connected()
*/
void CPRQueryDialog::cprSocket_timeout()
{
+ QString msg = QString("cprSocket timed out doing: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
- printf("cprSocket timed out tryning to:\n");
// Print connection status
switch(cprSocket->state()) {
case QSocket::Idle: // if there is no connection
- printf("Idle\n");
+ msg.append("Idle");
break;
case QSocket::HostLookup: // during a DNS lookup
- printf("HostLookup\n");
+ msg.append("HostLookup");
break;
case QSocket::Connecting: // during TCP connection establishment
- printf("Connecting\n");
+ msg.append("Connecting");
break;
case QSocket::Connected: // when there is an operational connection
- printf("Conected\n");
+ msg.append("Conected");
break;
case QSocket::Closing: // if the socket is closing down, but is not yet closed.
- printf("Closing\n");
+ msg.append("Closing");
break;
}
+ if(statusbar) statusbar->message(msg);
+ MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec();
accept();
}