diff --git a/components/lazmapviewer/examples/fulldemo/main.lfm b/components/lazmapviewer/examples/fulldemo/main.lfm index 60b3abf05..f4b5ff731 100644 --- a/components/lazmapviewer/examples/fulldemo/main.lfm +++ b/components/lazmapviewer/examples/fulldemo/main.lfm @@ -921,7 +921,6 @@ object MainForm: TMainForm NoneColorColor = clWhite Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors] Anchors = [akTop, akLeft, akRight] - AutoSize = False BorderSpacing.Left = 6 ItemHeight = 10 TabOrder = 10 diff --git a/components/lazmapviewer/examples/fulldemo_with_addons/main.lfm b/components/lazmapviewer/examples/fulldemo_with_addons/main.lfm index 00fcb97dd..ec2bdd472 100644 --- a/components/lazmapviewer/examples/fulldemo_with_addons/main.lfm +++ b/components/lazmapviewer/examples/fulldemo_with_addons/main.lfm @@ -38,9 +38,9 @@ object MainForm: TMainForm Height = 662 Top = 0 Width = 275 - ActivePage = PgConfig + ActivePage = PgData Align = alRight - TabIndex = 2 + TabIndex = 0 TabOrder = 1 object PgData: TTabSheet Caption = 'Data' diff --git a/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas b/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas index a4b36f4bc..1d9322fba 100644 --- a/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas +++ b/components/lazmapviewer/source/addons/synapse_downloadengine/mvdlesynapse.pas @@ -16,7 +16,7 @@ unit mvDLESynapse; interface uses - mvDownloadEngine, SysUtils, Classes, ssl_openssl, httpsend; + mvDownloadEngine, SysUtils, Classes, ssl_openssl, synacode, httpsend; type @@ -33,6 +33,7 @@ type procedure InternalDownloadFile(const Url: string; str: TStream); override; public constructor Create(AOwner: TComponent); override; + function EncodeURLElement(const s: String): String; override; procedure SetProxy(AUseSystemProxy, AUseProxy: Boolean; AProxyHost: String; AProxyPort: Word; AProxyUserName, AProxyPassword: String); override; published @@ -65,6 +66,11 @@ begin FSystemProxySupport := false; end; +function TMvDESynapse.EncodeURLElement(const s: String): String; +begin + Result := synacode.EncodeURLElement(s); +end; + procedure TMvDESynapse.InternalDownloadFile(const Url: string; str: TStream); var FHttp: THTTPSend; diff --git a/components/lazmapviewer/source/mvdlefpc.pas b/components/lazmapviewer/source/mvdlefpc.pas index 9d9e9d674..ca1423156 100644 --- a/components/lazmapviewer/source/mvdlefpc.pas +++ b/components/lazmapviewer/source/mvdlefpc.pas @@ -41,6 +41,7 @@ type procedure InternalDownloadFile(const Url: string; AStream: TStream); override; public constructor Create(AOwner: TComponent); override; + function EncodeURLElement(const s: String): String; override; procedure SetProxy(AUseSystemProxy, AUseProxy: Boolean; AProxyHost: String; AProxyPort: Word; AProxyUserName, AProxyPassword: String); override; {$IF FPC_FullVersion >= 30101} @@ -76,6 +77,11 @@ begin FSystemProxySupport := false; end; +function TMvDEFpc.EncodeURLElement(const s: String): String; +begin + Result := fpHttpClient.EncodeURLElement(s); +end; + procedure TMVDEFPC.InternalDownloadFile(const Url: string; AStream: TStream); var http: TFpHttpClient; diff --git a/components/lazmapviewer/source/mvdownloadengine.pas b/components/lazmapviewer/source/mvdownloadengine.pas index fa318cc11..b534e8da5 100644 --- a/components/lazmapviewer/source/mvdownloadengine.pas +++ b/components/lazmapviewer/source/mvdownloadengine.pas @@ -30,6 +30,7 @@ type procedure LoadFromLocalFile(const AFileName: String; AStream: TStream); public procedure DownloadFile(const Url: string; AStream: TStream); virtual; + function EncodeURLElement(const s: String): String; virtual; procedure SetProxy(AUseSystemProxy, AUseProxy: Boolean; AProxyHost: String; AProxyPort: Word; AProxyUserName, AProxyPassword: String); virtual; abstract; property HasProxySupport: Boolean read FProxySupport; @@ -54,6 +55,11 @@ begin InternalDownloadFile(Url, AStream); end; +function TMvCustomDownloadEngine.EncodeURLElement(const s: String): String; +begin + Result := s; +end; + procedure TMvCustomDownloadEngine.LoadFromLocalFile(const AFileName: String; AStream: TStream); var diff --git a/components/lazmapviewer/source/mvgeonames.pas b/components/lazmapviewer/source/mvgeonames.pas index 1ec4e8518..7275d22c7 100644 --- a/components/lazmapviewer/source/mvgeonames.pas +++ b/components/lazmapviewer/source/mvgeonames.pas @@ -62,7 +62,7 @@ type implementation uses - FastHtmlParser; + FastHtmlParser, FPHttpClient; const SEARCH_URL = 'http://geonames.org/search.html?q=%s'; //&country=%s'; @@ -204,7 +204,7 @@ begin FLocationName := ALocationName; ms := TMemoryStream.Create; try - url := Format(SEARCH_URL, [FLocationName]); + url := Format(SEARCH_URL, [ADownloadEngine.EncodeURLElement(FLocationName)]); ADownloadEngine.DownloadFile(url, ms); ms.Position := 0; SetLength(s, ms.Size);