diff --git a/components/lazmapviewer/example/main.lfm b/components/lazmapviewer/example/main.lfm index e4891b287..3c80a34ee 100644 --- a/components/lazmapviewer/example/main.lfm +++ b/components/lazmapviewer/example/main.lfm @@ -387,6 +387,7 @@ object MainForm: TMainForm Align = alClient CacheOnDisk = True CachePath = 'cache/' + DownloadEngine = MapView.BuiltIn InactiveColor = clWhite MapProvider = 'OpenStreetMap Mapnik' UseThreads = True diff --git a/components/lazmapviewer/lazmapviewerpkg.pas b/components/lazmapviewer/lazmapviewerpkg.pas index 31bb1d40c..9b44a94bd 100644 --- a/components/lazmapviewer/lazmapviewerpkg.pas +++ b/components/lazmapviewer/lazmapviewerpkg.pas @@ -4,12 +4,11 @@ unit lazMapViewerPkg; -{$warn 5023 off : no warning about unused units} interface uses - mvCache, mvDownloadEngine, mvdragobj, mvEngine, mvGeoNames, mvgpsobj, - mvJobQueue, mvJobs, mvMapProvider, mvtypes, mvmapviewer, mvextradata, + mvCache, mvDownloadEngine, mvDragObj, mvEngine, mvGeoNames, mvGpsObj, + mvJobQueue, mvJobs, mvMapProvider, mvTypes, mvMapViewer, mvExtraData, mvDLEFpc, mvMapViewerReg, LazarusPackageIntf; implementation diff --git a/components/lazmapviewer/source/mvdlefpc.pas b/components/lazmapviewer/source/mvdlefpc.pas index c8a01f50a..5bfb52333 100644 --- a/components/lazmapviewer/source/mvdlefpc.pas +++ b/components/lazmapviewer/source/mvdlefpc.pas @@ -36,16 +36,24 @@ type { TMVDEFPC } TMVDEFPC = class(TMvCustomDownloadEngine) + {$IF FPC_FullVersion >= 30101} + private + FUseProxy: Boolean; + FProxyHost: string; + FProxyPort: Word; + FProxyUserName: String; + FProxyPassWord: String; + {$IFEND} public procedure DownloadFile(const Url: string; AStream: TStream); override; {$IF FPC_FullVersion >= 30101} published - property UseProxy; - property ProxyHost; - property ProxyPort; - property ProxyUsername; - property ProxyPassword; - {$ENDIF} + property UseProxy: Boolean read FUseProxy write FUseProxy default false; + property ProxyHost: String read FProxyHost write FProxyHost; + property ProxyPort: Word read FProxyPort write FProxyPort; + property ProxyUsername: String read FProxyUserName write FProxyUserName; + property ProxyPassword: String read FProxyPassword write FProxyPassword; + {$IFEND} end; @@ -63,14 +71,16 @@ begin inherited; http := TFpHttpClient.Create(nil); try + {$IF FPC_FullVersion >= 30000} http.AllowRedirect := true; + {$IFEND} http.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)'); {$IF FPC_FullVersion >= 30101} if UseProxy then begin - http.Proxy.Host := ProxyHost; - http.Proxy.Port := ProxyPort; - http.Proxy.UserName := ProxyUserName; - http.Proxy.Password := ProxyPassword; + http.Proxy.Host := FProxyHost; + http.Proxy.Port := FProxyPort; + http.Proxy.UserName := FProxyUserName; + http.Proxy.Password := FProxyPassword; end; {$ENDIF} http.Get(Url, AStream);