Skip to content

Commit 82c8f13

Browse files
author
g_j_m
committed
Fix another signal/slot mismatch. This re-enables the error messages
for the 'Help:Check Qgis Version' function. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6302 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c6938bd commit 82c8f13

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/gui/qgisapp.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4037,7 +4037,8 @@ void QgisApp::checkQgisVersion()
40374037
connect(mSocket, SIGNAL(connected()), SLOT(socketConnected()));
40384038
connect(mSocket, SIGNAL(connectionClosed()), SLOT(socketConnectionClosed()));
40394039
connect(mSocket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
4040-
connect(mSocket, SIGNAL(error(int)), SLOT(socketError(int)));
4040+
connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)),
4041+
SLOT(socketError(QAbstractSocket::SocketError)));
40414042
mSocket->connectToHost("mrcc.com", 80);
40424043
}
40434044

@@ -4108,25 +4109,32 @@ void QgisApp::socketConnectionClosed()
41084109
QMessageBox::warning(this, tr("QGIS Version Information"), tr("Unable to get current version information from server"));
41094110
}
41104111
}
4111-
void QgisApp::socketError(int e)
4112+
void QgisApp::socketError(QAbstractSocket::SocketError e)
41124113
{
4114+
if (e == QAbstractSocket::RemoteHostClosedError)
4115+
return;
4116+
41134117
QApplication::restoreOverrideCursor();
41144118
// get error type
41154119
QString detail;
41164120
switch (e)
41174121
{
4118-
case QTcpSocket::ErrConnectionRefused:
4122+
case QAbstractSocket::ConnectionRefusedError:
41194123
detail = tr("Connection refused - server may be down");
41204124
break;
4121-
case QTcpSocket::ErrHostNotFound:
4125+
case QAbstractSocket::HostNotFoundError:
41224126
detail = tr("QGIS server was not found");
41234127
break;
4124-
case QTcpSocket::ErrSocketRead:
4125-
detail = tr("Error reading from server");
4128+
case QAbstractSocket::NetworkError:
4129+
detail = tr("Network error while communicating with server");
4130+
break;
4131+
default:
4132+
detail = tr("Unknown network socket error");
41264133
break;
41274134
}
4135+
41284136
// show version message from server
4129-
QMessageBox::critical(this, tr("QGIS Version Information"), tr("Unable to connect to the QGIS Version server") + "\n" + detail);
4137+
QMessageBox::critical(this, tr("QGIS Version Information"), tr("Unable to communicate with QGIS Version server") + "\n" + detail);
41304138
}
41314139

41324140
void QgisApp::socketReadyRead()

src/gui/qgisapp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class QgsComposer;
5454

5555
#include <ui_qgisappbase.h>
5656
#include <QMainWindow>
57-
57+
#include <QAbstractSocket>
5858

5959
/*! \class QgisApp
6060
* \brief Main window for the Qgis application
@@ -273,7 +273,7 @@ public slots:
273273
void socketConnected();
274274
void socketConnectionClosed();
275275
void socketReadyRead();
276-
void socketError(int e);
276+
void socketError(QAbstractSocket::SocketError e);
277277
//! Set project properties, including map untis
278278
void projectProperties();
279279
//! Open project properties dialog and show the projections tab

0 commit comments

Comments
 (0)