Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bring back QgsNetworkManager slots and signals removed in 2eb8243 as …
…deprecated

(cherry picked from commit 78725fe)
  • Loading branch information
jef-n committed Apr 15, 2016
1 parent 2572d18 commit eab09f0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/core/qgsnetworkaccessmanager.sip
Expand Up @@ -60,12 +60,32 @@ class QgsNetworkAccessManager : QNetworkAccessManager
//! Setup the NAM according to the user's settings
void setupDefaultProxyAndCache();

//! return whether the system proxy should be used
bool useSystemProxy();

public slots:
/** Send GET request, calls get().
* Emits requestSent().
* @param request request to be sent
* @deprecated use get() directly
*/
void sendGet( const QNetworkRequest & request ) /Deprecated/;
/** Abort and delete reply.
* @param reply reply to be aborted.
* @deprecated use abort() and deleteLayer() on the reply directly
*/
void deleteReply( QNetworkReply * reply ) /Deprecated/;

signals:
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );
void requestCreated( QNetworkReply * );
void requestTimedOut( QNetworkReply * );
/** Emitted when request was sent by request()
* @param reply request reply
* @param sender the object which called request() slot.
* @deprecated only emitted from deprecated sendGet
*/
void requestSent( QNetworkReply * reply, QObject *sender );

protected:
virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 );
Expand Down
18 changes: 18 additions & 0 deletions src/core/qgsnetworkaccessmanager.cpp
Expand Up @@ -384,3 +384,21 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
if ( cache() != newcache )
setCache( newcache );
}

void QgsNetworkAccessManager::sendGet( const QNetworkRequest & request )
{
QgsDebugMsg( "Entered" );
QNetworkReply * reply = get( request );
emit requestSent( reply, QObject::sender() );
}

void QgsNetworkAccessManager::deleteReply( QNetworkReply * reply )
{
QgsDebugMsg( "Entered" );
if ( !reply )
{
return;
}
reply->abort();
reply->deleteLater();
}
19 changes: 19 additions & 0 deletions src/core/qgsnetworkaccessmanager.h
Expand Up @@ -85,10 +85,29 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
//! return whether the system proxy should be used
bool useSystemProxy() { return mUseSystemProxy; }

public slots:
/** Send GET request, calls get().
* Emits requestSent().
* @param request request to be sent
* @deprecated use get() directly
*/
Q_DECL_DEPRECATED void sendGet( const QNetworkRequest & request );
/** Abort and delete reply.
* @param reply reply to be aborted.
* @deprecated use abort() and deleteLayer() on the reply directly
*/
Q_DECL_DEPRECATED void deleteReply( QNetworkReply * reply );

signals:
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );
void requestCreated( QNetworkReply * );
void requestTimedOut( QNetworkReply * );
/** Emitted when request was sent by request()
* @param reply request reply
* @param sender the object which called request() slot.
* @deprecated only emitted from deprecated sendGet
*/
void requestSent( QNetworkReply * reply, QObject *sender );

private slots:
void abortRequest();
Expand Down

0 comments on commit eab09f0

Please sign in to comment.