diff --git a/components/simplewebservergui/languages/simplewebsrvstrconsts.pot b/components/simplewebservergui/languages/simplewebsrvstrconsts.pot index aeb35ebbc0..7a724a03e6 100644 --- a/components/simplewebservergui/languages/simplewebsrvstrconsts.pot +++ b/components/simplewebservergui/languages/simplewebsrvstrconsts.pot @@ -53,6 +53,10 @@ msgstr "" msgid "Copy Origin" msgstr "" +#: simplewebsrvstrconsts.rsswcopyurl +msgid "Copy URL" +msgstr "" + #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath msgid "Copy Working Directory Path" msgstr "" diff --git a/components/simplewebservergui/languages/simplewebsrvstrconsts.pt_BR.po b/components/simplewebservergui/languages/simplewebsrvstrconsts.pt_BR.po index d3894ad5ad..ce90bf7c41 100644 --- a/components/simplewebservergui/languages/simplewebsrvstrconsts.pt_BR.po +++ b/components/simplewebservergui/languages/simplewebsrvstrconsts.pt_BR.po @@ -64,6 +64,10 @@ msgstr "Copiar local" msgid "Copy Origin" msgstr "Copiar origem" +#: simplewebsrvstrconsts.rsswcopyurl +msgid "Copy URL" +msgstr "" + #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath msgid "Copy Working Directory Path" msgstr "Copiar caminho do diretório de trabalho" diff --git a/components/simplewebservergui/languages/simplewebsrvstrconsts.ru.po b/components/simplewebservergui/languages/simplewebsrvstrconsts.ru.po index 3ecd7e4055..190d9789d6 100644 --- a/components/simplewebservergui/languages/simplewebsrvstrconsts.ru.po +++ b/components/simplewebservergui/languages/simplewebsrvstrconsts.ru.po @@ -63,6 +63,10 @@ msgstr "Копировать расположение" msgid "Copy Origin" msgstr "Копировать происхождение" +#: simplewebsrvstrconsts.rsswcopyurl +msgid "Copy URL" +msgstr "" + #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath msgid "Copy Working Directory Path" msgstr "Копировать путь к рабочему каталогу" diff --git a/components/simplewebservergui/simplewebsrvadd.lfm b/components/simplewebservergui/simplewebsrvadd.lfm index c882b22b01..457b37a2c5 100644 --- a/components/simplewebservergui/simplewebsrvadd.lfm +++ b/components/simplewebservergui/simplewebsrvadd.lfm @@ -1,34 +1,32 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog Left = 598 - Height = 460 + Height = 368 Top = 313 - Width = 532 + Width = 626 Caption = 'Add Simple Web Server Location' - ClientHeight = 460 - ClientWidth = 532 - DesignTimePPI = 120 + ClientHeight = 368 + ClientWidth = 626 OnCreate = FormCreate Position = poScreenCenter LCLVersion = '2.3.0.0' object OptionsPageControl: TPageControl Left = 0 - Height = 460 + Height = 368 Top = 0 - Width = 532 + Width = 626 ActivePage = LocationTabSheet Align = alClient TabIndex = 0 TabOrder = 0 object LocationTabSheet: TTabSheet Caption = 'Location' - ClientHeight = 427 - ClientWidth = 524 + ClientHeight = 339 + ClientWidth = 616 object LocButtonPanel: TButtonPanel - Left = 8 - Height = 38 - Top = 381 - Width = 508 - BorderSpacing.Around = 8 + Left = 6 + Height = 40 + Top = 293 + Width = 604 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True HelpButton.Name = 'HelpButton' @@ -44,34 +42,34 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideLeft.Control = LocationTabSheet AnchorSideTop.Control = LocationComboBox AnchorSideTop.Side = asrCenter - Left = 8 - Height = 20 - Top = 12 - Width = 57 - BorderSpacing.Left = 8 + Left = 6 + Height = 15 + Top = 14 + Width = 47 + BorderSpacing.Left = 6 Caption = 'Location' end object LocationURLLabel: TLabel AnchorSideLeft.Control = LocationTabSheet AnchorSideTop.Control = LocationDirComboBox AnchorSideTop.Side = asrBottom - Left = 8 - Height = 20 - Top = 91 - Width = 119 - BorderSpacing.Left = 8 - BorderSpacing.Top = 19 + Left = 6 + Height = 15 + Top = 87 + Width = 98 + BorderSpacing.Left = 6 + BorderSpacing.Top = 15 Caption = 'LocationURLLabel' end object LocationDirLabel: TLabel AnchorSideLeft.Control = LocationTabSheet AnchorSideTop.Control = LocationDirComboBox AnchorSideTop.Side = asrCenter - Left = 8 - Height = 20 - Top = 48 - Width = 100 - BorderSpacing.Left = 8 + Left = 6 + Height = 15 + Top = 50 + Width = 84 + BorderSpacing.Left = 6 Caption = 'Local Directory' end object LocationBrowserButton: TButton @@ -81,13 +79,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = LocationDirComboBox AnchorSideBottom.Side = asrBottom - Left = 481 - Height = 28 - Top = 44 - Width = 35 + Left = 585 + Height = 30 + Top = 42 + Width = 25 Anchors = [akTop, akRight, akBottom] AutoSize = True - BorderSpacing.Right = 8 + BorderSpacing.Right = 6 Caption = '...' OnClick = LocationBrowserButtonClick TabOrder = 1 @@ -98,14 +96,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideTop.Control = LocationComboBox AnchorSideTop.Side = asrBottom AnchorSideRight.Control = LocationBrowserButton - Left = 116 - Height = 28 - Top = 44 - Width = 365 + Left = 96 + Height = 30 + Top = 42 + Width = 489 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - ItemHeight = 20 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 2 @@ -115,13 +113,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideLeft.Control = LocationLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = LocationTabSheet - Left = 73 - Height = 28 - Top = 8 - Width = 236 - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - ItemHeight = 20 + Left = 59 + Height = 30 + Top = 6 + Width = 189 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + ItemHeight = 0 OnEditingDone = LocationComboBoxEditingDone ParentShowHint = False ShowHint = True @@ -131,14 +129,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog end object ServerTabSheet: TTabSheet Caption = 'Custom Server' - ClientHeight = 427 - ClientWidth = 524 + ClientHeight = 339 + ClientWidth = 616 object SrvButtonPanel: TButtonPanel - Left = 8 - Height = 38 - Top = 381 - Width = 508 - BorderSpacing.Around = 8 + Left = 6 + Height = 40 + Top = 293 + Width = 604 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True HelpButton.Name = 'HelpButton' @@ -153,22 +150,22 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog object SrvPortLabel: TLabel AnchorSideLeft.Control = ServerTabSheet AnchorSideTop.Side = asrCenter - Left = 8 - Height = 20 - Top = 18 - Width = 26 - BorderSpacing.Left = 8 + Left = 6 + Height = 15 + Top = 14 + Width = 24 + BorderSpacing.Left = 6 Caption = 'Port' end object SrvWorkDirLabel: TLabel AnchorSideLeft.Control = ServerTabSheet AnchorSideTop.Control = SrvWorkDirComboBox AnchorSideTop.Side = asrCenter - Left = 8 - Height = 20 - Top = 84 - Width = 99 - BorderSpacing.Left = 8 + Left = 6 + Height = 15 + Top = 86 + Width = 85 + BorderSpacing.Left = 6 Caption = 'Work Directory' end object SrvBrowserButton: TButton @@ -178,13 +175,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = SrvWorkDirComboBox AnchorSideBottom.Side = asrBottom - Left = 481 - Height = 28 - Top = 80 - Width = 35 + Left = 585 + Height = 30 + Top = 78 + Width = 25 Anchors = [akTop, akRight, akBottom] AutoSize = True - BorderSpacing.Right = 8 + BorderSpacing.Right = 6 Caption = '...' TabOrder = 1 end @@ -192,11 +189,11 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideLeft.Control = ServerTabSheet AnchorSideTop.Control = SrvExeComboBox AnchorSideTop.Side = asrCenter - Left = 8 - Height = 20 - Top = 48 - Width = 72 - BorderSpacing.Left = 8 + Left = 6 + Height = 15 + Top = 50 + Width = 61 + BorderSpacing.Left = 6 Caption = 'Executable' end object SrvExeBrowseButton: TButton @@ -206,13 +203,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = SrvExeComboBox AnchorSideBottom.Side = asrBottom - Left = 481 - Height = 28 - Top = 44 - Width = 35 + Left = 585 + Height = 30 + Top = 42 + Width = 25 Anchors = [akTop, akRight, akBottom] AutoSize = True - BorderSpacing.Right = 8 + BorderSpacing.Right = 6 Caption = '...' TabOrder = 2 end @@ -220,12 +217,12 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideLeft.Control = ServerTabSheet AnchorSideTop.Control = SrvWorkDirComboBox AnchorSideTop.Side = asrBottom - Left = 8 - Height = 20 - Top = 116 - Width = 73 - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 + Left = 6 + Height = 15 + Top = 114 + Width = 63 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'Parameters' end object SrvParamsComboBox: TComboBox @@ -234,15 +231,15 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideTop.Side = asrBottom AnchorSideRight.Control = ServerTabSheet AnchorSideRight.Side = asrBottom - Left = 8 - Height = 28 - Top = 144 - Width = 508 + Left = 6 + Height = 30 + Top = 135 + Width = 604 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - ItemHeight = 20 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + BorderSpacing.Right = 6 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 3 @@ -253,14 +250,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideTop.Control = SrvPortComboBox AnchorSideTop.Side = asrBottom AnchorSideRight.Control = SrvExeBrowseButton - Left = 88 - Height = 28 - Top = 44 - Width = 393 + Left = 73 + Height = 30 + Top = 42 + Width = 512 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - ItemHeight = 20 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 4 @@ -271,14 +268,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideTop.Control = SrvExeComboBox AnchorSideTop.Side = asrBottom AnchorSideRight.Control = SrvBrowserButton - Left = 115 - Height = 28 - Top = 80 - Width = 366 + Left = 97 + Height = 30 + Top = 78 + Width = 488 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - ItemHeight = 20 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 5 @@ -288,13 +285,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog AnchorSideLeft.Control = SrvPortLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = ServerTabSheet - Left = 42 - Height = 28 - Top = 8 - Width = 176 - BorderSpacing.Left = 8 - BorderSpacing.Top = 8 - ItemHeight = 20 + Left = 36 + Height = 30 + Top = 6 + Width = 141 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + ItemHeight = 0 ParentShowHint = False ShowHint = True TabOrder = 6 diff --git a/components/simplewebservergui/simplewebsrvcontroller.pas b/components/simplewebservergui/simplewebsrvcontroller.pas index fbd545bd45..f4fa54c29e 100644 --- a/components/simplewebservergui/simplewebsrvcontroller.pas +++ b/components/simplewebservergui/simplewebsrvcontroller.pas @@ -1872,16 +1872,24 @@ end; function TSimpleWebServerController.GetURLWithServer(aServer: TSWSInstance; HTMLFilename: string): string; begin - Result:=CreateRelativePath(HTMLFilename,aServer.Path); - Result:=FilenameToURLPath(Result); + if HTMLFilename<>'' then + begin + Result:=CreateRelativePath(HTMLFilename,aServer.Path); + Result:=FilenameToURLPath(Result); + end else + Result:=''; Result:='http://'+MainSrvAddr+':'+IntToStr(aServer.Port)+'/'+Result; end; function TSimpleWebServerController.GetURLWithLocation(aLocation: TSWSLocation; HTMLFilename: string): string; begin - Result:=CreateRelativePath(HTMLFilename,aLocation.Path); - Result:=FilenameToURLPath(Result); + if HTMLFilename<>'' then + begin + Result:=CreateRelativePath(HTMLFilename,aLocation.Path); + Result:=FilenameToURLPath(Result); + end else + Result:=''; Result:='http://'+MainSrvAddr+':'+IntToStr(MainSrvPort)+'/'+aLocation.Location+'/'+Result; end; diff --git a/components/simplewebservergui/simplewebsrvstrconsts.pas b/components/simplewebservergui/simplewebsrvstrconsts.pas index 3647265dc5..ba4c01869a 100644 --- a/components/simplewebservergui/simplewebsrvstrconsts.pas +++ b/components/simplewebservergui/simplewebsrvstrconsts.pas @@ -18,6 +18,7 @@ resourcestring rsSWOrigin = 'Origin'; rsSWNote = 'Note'; rsSWCopyLocation = 'Copy Location'; + rsSWCopyURL = 'Copy URL'; rsSWCopyWorkingDirectoryPath = 'Copy Working Directory Path'; rsSWCopyOrigin = 'Copy Origin'; rsSWParametersPleaseUseMacroPort = 'Parameters (please use macro $(port))'; diff --git a/components/simplewebservergui/simplewebsrvwnd.lfm b/components/simplewebservergui/simplewebsrvwnd.lfm index 8cbd23fde7..7574b0f59f 100644 --- a/components/simplewebservergui/simplewebsrvwnd.lfm +++ b/components/simplewebservergui/simplewebsrvwnd.lfm @@ -642,7 +642,7 @@ object SimpleWebServerWindow: TSimpleWebServerWindow end item Caption = 'Note' - Width = 288 + Width = 293 end> HideSelection = False PopupMenu = LocationsPopupMenu @@ -687,6 +687,10 @@ object SimpleWebServerWindow: TSimpleWebServerWindow OnPopup = LocationsPopupMenuPopup Left = 261 Top = 98 + object CopyURLMenuItem: TMenuItem + Caption = 'Copy URL' + OnClick = CopyURLMenuItemClick + end object CopyLocationMenuItem: TMenuItem Caption = 'Copy Location' OnClick = CopyLocationMenuItemClick diff --git a/components/simplewebservergui/simplewebsrvwnd.pas b/components/simplewebservergui/simplewebsrvwnd.pas index 942233f714..9f1c6838b1 100644 --- a/components/simplewebservergui/simplewebsrvwnd.pas +++ b/components/simplewebservergui/simplewebsrvwnd.pas @@ -42,6 +42,7 @@ type CopyLocationMenuItem: TMenuItem; CopyDirectoryPathMenuItem: TMenuItem; CopyOriginMenuItem: TMenuItem; + CopyURLMenuItem: TMenuItem; MsgSplitter: TSplitter; OptionsPanel: TPanel; ServerLogGroupBox: TGroupBox; @@ -53,6 +54,7 @@ type procedure CopyDirectoryPathMenuItemClick(Sender: TObject); procedure CopyLocationMenuItemClick(Sender: TObject); procedure CopyOriginMenuItemClick(Sender: TObject); + procedure CopyURLMenuItemClick(Sender: TObject); procedure DeleteButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -344,6 +346,7 @@ begin LocationsListView.Columns[2].Caption:=rsSWOrigin; LocationsListView.Columns[3].Caption:=rsSWNote; + CopyURLMenuItem.Caption:=rsSWCopyURL; CopyLocationMenuItem.Caption:=rsSWCopyLocation; CopyDirectoryPathMenuItem.Caption:=rsSWCopyWorkingDirectoryPath; CopyOriginMenuItem.Caption:=rsSWCopyOrigin; @@ -362,29 +365,50 @@ end; procedure TSimpleWebServerWindow.CopyDirectoryPathMenuItemClick(Sender: TObject ); var - Item: TListItem; + LI: TListItem; begin - Item:=LocationsListView.Selected; - if Item=nil then exit; - Clipboard.AsText:=Item.SubItems[0]; + LI:=LocationsListView.Selected; + if LI=nil then exit; + Clipboard.AsText:=LI.SubItems[0]; end; procedure TSimpleWebServerWindow.CopyLocationMenuItemClick(Sender: TObject); var - Item: TListItem; + LI: TListItem; begin - Item:=LocationsListView.Selected; - if Item=nil then exit; - Clipboard.AsText:=Item.Caption; + LI:=LocationsListView.Selected; + if LI=nil then exit; + Clipboard.AsText:=LI.Caption; end; procedure TSimpleWebServerWindow.CopyOriginMenuItemClick(Sender: TObject); var - Item: TListItem; + LI: TListItem; begin - Item:=LocationsListView.Selected; - if Item=nil then exit; - Clipboard.AsText:=Item.SubItems[1]; + LI:=LocationsListView.Selected; + if LI=nil then exit; + Clipboard.AsText:=LI.SubItems[1]; +end; + +procedure TSimpleWebServerWindow.CopyURLMenuItemClick(Sender: TObject); +var + LI: TListItem; + Obj: TObject; + Server: TSWSInstance; + URL: String; +begin + LI:=LocationsListView.Selected; + if LI=nil then exit; + Obj:=CaptionToControllerObj(LI.Caption); + if Obj is TSWSLocation then + begin + URL:=Controller.GetURLWithLocation(TSWSLocation(Obj),''); + end else if Obj is TSWSInstance then + begin + Server:=TSWSInstance(Obj); + URL:=Controller.GetURLWithServer(Server,''); + end; + Clipboard.AsText:=URL; end; procedure TSimpleWebServerWindow.DeleteButtonClick(Sender: TObject); @@ -429,11 +453,14 @@ end; procedure TSimpleWebServerWindow.LocationsPopupMenuPopup(Sender: TObject); var LI: TListItem; + Enable: Boolean; begin LI:=LocationsListView.Selected; - CopyLocationMenuItem.Enabled:=LI<>nil; - CopyDirectoryPathMenuItem.Enabled:=LI<>nil; - CopyOriginMenuItem.Enabled:=LI<>nil; + Enable:=LI<>nil; + CopyURLMenuItem.Enabled:=Enable; + CopyLocationMenuItem.Enabled:=Enable; + CopyDirectoryPathMenuItem.Enabled:=Enable; + CopyOriginMenuItem.Enabled:=Enable; end; end.