-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13103 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
jef
committed
Mar 20, 2010
1 parent
527a7d3
commit 0e8d074
Showing
5 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*************************************************************************** | ||
qgsnetworkproxyfactory.cpp - description | ||
------------------- | ||
begin : Sat Mar 20 2010 | ||
copyright : (C) 2010 by Juergen E. Fischer | ||
email : jef at norbit dot de | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
|
||
#include <QtGlobal> | ||
|
||
#if QT_VERSION >= 0x40500 | ||
|
||
#include <QSettings> | ||
#include <QUrl> | ||
|
||
#include "qgsnetworkproxyfactory.h" | ||
#include "qgslogger.h" | ||
|
||
QgsNetworkProxyFactory::QgsNetworkProxyFactory( const QNetworkProxy &proxy, const QStringList &excludes ) | ||
{ | ||
mProxy = proxy; | ||
mExcludedURLs = excludes; | ||
} | ||
|
||
QgsNetworkProxyFactory::~QgsNetworkProxyFactory() | ||
{ | ||
} | ||
|
||
QList<QNetworkProxy> QgsNetworkProxyFactory::queryProxy( const QNetworkProxyQuery &query ) | ||
{ | ||
if( query.queryType() != QNetworkProxyQuery::UrlRequest ) | ||
return QList<QNetworkProxy>() << mProxy; | ||
|
||
QString url = query.url().toString(); | ||
|
||
foreach( QString exclude, mExcludedURLs ) | ||
{ | ||
if ( url.startsWith( exclude ) ) | ||
{ | ||
QgsDebugMsg( QString("using default proxy for %1 [exclude %2]").arg( url ).arg( exclude ) ); | ||
return QList<QNetworkProxy>() << QNetworkProxy(); | ||
} | ||
} | ||
|
||
QgsDebugMsg( QString("using user proxy for %1").arg( url ) ); | ||
return QList<QNetworkProxy>() << mProxy; | ||
} | ||
|
||
#endif // QT_VERSION >= 0x40500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
qgsabout.h - description | ||
------------------- | ||
begin : Sat, 20 Mar 2010 | ||
copyright : (C) 2010 by Juergen E. Fischer | ||
email : jef at norbit dot de | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id:$ */ | ||
#ifndef QGSNETWORKPROXYFACTORY_H | ||
#define QGSNETWORKPROXYFACTORY_H | ||
|
||
#if QT_VERSION >= 0x40500 | ||
|
||
#include <QNetworkProxyFactory> | ||
#include <QStringList> | ||
|
||
class QgsNetworkProxyFactory : public QNetworkProxyFactory | ||
{ | ||
public: | ||
QgsNetworkProxyFactory( const QNetworkProxy &proxy, const QStringList &excludes ); | ||
virtual ~QgsNetworkProxyFactory(); | ||
virtual QList<QNetworkProxy> queryProxy( const QNetworkProxyQuery & query = QNetworkProxyQuery() ); | ||
|
||
private: | ||
QStringList mExcludedURLs; | ||
QNetworkProxy mProxy; | ||
}; | ||
|
||
#endif // QT_VERSION >= 0x40500 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters