Skip to content

Commit

Permalink
emit signals before and after QgsNetworkAccessManager creates requests
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13453 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 9, 2010
1 parent 194e07d commit a9faa57
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/core/qgsnetworkaccessmanager.sip
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class QgsNetworkAccessManager : QNetworkAccessManager

//! set fallback proxy and URL that shouldn't use it.
void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes );

signals:
void requestAboutToBeCreated( Operation, const QNetworkRequest &, QIODevice * );
void requestCreated( QNetworkReply * );

protected:
virtual QNetworkReply *createRequest( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 );

private:
QgsNetworkAccessManager( QObject * );
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,11 @@ void QgsNetworkAccessManager::setFallbackProxyAndExcludes( const QNetworkProxy &
mFallbackProxy = proxy;
mExcludedURLs = excludes;
}

QNetworkReply *QgsNetworkAccessManager::createRequest( QgsNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData )
{
emit requestAboutToBeCreated( op, req, outgoingData );
QNetworkReply *reply = QNetworkAccessManager::createRequest( op, req, outgoingData );
emit requestCreated( reply );
return reply;
}
7 changes: 7 additions & 0 deletions src/core/qgsnetworkaccessmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
//! set fallback proxy and URL that shouldn't use it.
void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes );

signals:
void requestAboutToBeCreated( Operation, const QNetworkRequest &, QIODevice * );
void requestCreated( QNetworkReply * );

protected:
virtual QNetworkReply *createRequest( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 );

private:
QgsNetworkAccessManager( QObject *parent = 0 );
#if QT_VERSION >= 0x40500
Expand Down

0 comments on commit a9faa57

Please sign in to comment.