Skip to content

Commit

Permalink
Fix another signal/slot mismatch. This re-enables the error messages
Browse files Browse the repository at this point in the history
for the 'Help:Check Qgis Version' function.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6302 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Dec 22, 2006
1 parent 020a1ce commit 77a3941
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 15 additions & 7 deletions src/gui/qgisapp.cpp
Expand Up @@ -4037,7 +4037,8 @@ void QgisApp::checkQgisVersion()
connect(mSocket, SIGNAL(connected()), SLOT(socketConnected()));
connect(mSocket, SIGNAL(connectionClosed()), SLOT(socketConnectionClosed()));
connect(mSocket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
connect(mSocket, SIGNAL(error(int)), SLOT(socketError(int)));
connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)),
SLOT(socketError(QAbstractSocket::SocketError)));
mSocket->connectToHost("mrcc.com", 80);
}

Expand Down Expand Up @@ -4108,25 +4109,32 @@ void QgisApp::socketConnectionClosed()
QMessageBox::warning(this, tr("QGIS Version Information"), tr("Unable to get current version information from server"));
}
}
void QgisApp::socketError(int e)
void QgisApp::socketError(QAbstractSocket::SocketError e)
{
if (e == QAbstractSocket::RemoteHostClosedError)
return;

QApplication::restoreOverrideCursor();
// get error type
QString detail;
switch (e)
{
case QTcpSocket::ErrConnectionRefused:
case QAbstractSocket::ConnectionRefusedError:
detail = tr("Connection refused - server may be down");
break;
case QTcpSocket::ErrHostNotFound:
case QAbstractSocket::HostNotFoundError:
detail = tr("QGIS server was not found");
break;
case QTcpSocket::ErrSocketRead:
detail = tr("Error reading from server");
case QAbstractSocket::NetworkError:
detail = tr("Network error while communicating with server");
break;
default:
detail = tr("Unknown network socket error");
break;
}

// show version message from server
QMessageBox::critical(this, tr("QGIS Version Information"), tr("Unable to connect to the QGIS Version server") + "\n" + detail);
QMessageBox::critical(this, tr("QGIS Version Information"), tr("Unable to communicate with QGIS Version server") + "\n" + detail);
}

void QgisApp::socketReadyRead()
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgisapp.h
Expand Up @@ -54,7 +54,7 @@ class QgsComposer;

#include <ui_qgisappbase.h>
#include <QMainWindow>

#include <QAbstractSocket>

/*! \class QgisApp
* \brief Main window for the Qgis application
Expand Down Expand Up @@ -273,7 +273,7 @@ public slots:
void socketConnected();
void socketConnectionClosed();
void socketReadyRead();
void socketError(int e);
void socketError(QAbstractSocket::SocketError e);
//! Set project properties, including map untis
void projectProperties();
//! Open project properties dialog and show the projections tab
Expand Down

0 comments on commit 77a3941

Please sign in to comment.