simplewebservergui: added menu item copy url

This commit is contained in:
mattias 2023-02-14 09:20:01 +01:00
parent 1df1c43193
commit d2dbaac10d
8 changed files with 185 additions and 136 deletions

View File

@ -53,6 +53,10 @@ msgstr ""
msgid "Copy Origin" msgid "Copy Origin"
msgstr "" msgstr ""
#: simplewebsrvstrconsts.rsswcopyurl
msgid "Copy URL"
msgstr ""
#: simplewebsrvstrconsts.rsswcopyworkingdirectorypath #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath
msgid "Copy Working Directory Path" msgid "Copy Working Directory Path"
msgstr "" msgstr ""

View File

@ -64,6 +64,10 @@ msgstr "Copiar local"
msgid "Copy Origin" msgid "Copy Origin"
msgstr "Copiar origem" msgstr "Copiar origem"
#: simplewebsrvstrconsts.rsswcopyurl
msgid "Copy URL"
msgstr ""
#: simplewebsrvstrconsts.rsswcopyworkingdirectorypath #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath
msgid "Copy Working Directory Path" msgid "Copy Working Directory Path"
msgstr "Copiar caminho do diretório de trabalho" msgstr "Copiar caminho do diretório de trabalho"

View File

@ -63,6 +63,10 @@ msgstr "Копировать расположение"
msgid "Copy Origin" msgid "Copy Origin"
msgstr "Копировать происхождение" msgstr "Копировать происхождение"
#: simplewebsrvstrconsts.rsswcopyurl
msgid "Copy URL"
msgstr ""
#: simplewebsrvstrconsts.rsswcopyworkingdirectorypath #: simplewebsrvstrconsts.rsswcopyworkingdirectorypath
msgid "Copy Working Directory Path" msgid "Copy Working Directory Path"
msgstr "Копировать путь к рабочему каталогу" msgstr "Копировать путь к рабочему каталогу"

View File

@ -1,34 +1,32 @@
object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
Left = 598 Left = 598
Height = 460 Height = 368
Top = 313 Top = 313
Width = 532 Width = 626
Caption = 'Add Simple Web Server Location' Caption = 'Add Simple Web Server Location'
ClientHeight = 460 ClientHeight = 368
ClientWidth = 532 ClientWidth = 626
DesignTimePPI = 120
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '2.3.0.0' LCLVersion = '2.3.0.0'
object OptionsPageControl: TPageControl object OptionsPageControl: TPageControl
Left = 0 Left = 0
Height = 460 Height = 368
Top = 0 Top = 0
Width = 532 Width = 626
ActivePage = LocationTabSheet ActivePage = LocationTabSheet
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 0
TabOrder = 0 TabOrder = 0
object LocationTabSheet: TTabSheet object LocationTabSheet: TTabSheet
Caption = 'Location' Caption = 'Location'
ClientHeight = 427 ClientHeight = 339
ClientWidth = 524 ClientWidth = 616
object LocButtonPanel: TButtonPanel object LocButtonPanel: TButtonPanel
Left = 8 Left = 6
Height = 38 Height = 40
Top = 381 Top = 293
Width = 508 Width = 604
BorderSpacing.Around = 8
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton' HelpButton.Name = 'HelpButton'
@ -44,34 +42,34 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideLeft.Control = LocationTabSheet AnchorSideLeft.Control = LocationTabSheet
AnchorSideTop.Control = LocationComboBox AnchorSideTop.Control = LocationComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 8 Left = 6
Height = 20 Height = 15
Top = 12 Top = 14
Width = 57 Width = 47
BorderSpacing.Left = 8 BorderSpacing.Left = 6
Caption = 'Location' Caption = 'Location'
end end
object LocationURLLabel: TLabel object LocationURLLabel: TLabel
AnchorSideLeft.Control = LocationTabSheet AnchorSideLeft.Control = LocationTabSheet
AnchorSideTop.Control = LocationDirComboBox AnchorSideTop.Control = LocationDirComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 8 Left = 6
Height = 20 Height = 15
Top = 91 Top = 87
Width = 119 Width = 98
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 19 BorderSpacing.Top = 15
Caption = 'LocationURLLabel' Caption = 'LocationURLLabel'
end end
object LocationDirLabel: TLabel object LocationDirLabel: TLabel
AnchorSideLeft.Control = LocationTabSheet AnchorSideLeft.Control = LocationTabSheet
AnchorSideTop.Control = LocationDirComboBox AnchorSideTop.Control = LocationDirComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 8 Left = 6
Height = 20 Height = 15
Top = 48 Top = 50
Width = 100 Width = 84
BorderSpacing.Left = 8 BorderSpacing.Left = 6
Caption = 'Local Directory' Caption = 'Local Directory'
end end
object LocationBrowserButton: TButton object LocationBrowserButton: TButton
@ -81,13 +79,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = LocationDirComboBox AnchorSideBottom.Control = LocationDirComboBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 481 Left = 585
Height = 28 Height = 30
Top = 44 Top = 42
Width = 35 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Right = 8 BorderSpacing.Right = 6
Caption = '...' Caption = '...'
OnClick = LocationBrowserButtonClick OnClick = LocationBrowserButtonClick
TabOrder = 1 TabOrder = 1
@ -98,14 +96,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideTop.Control = LocationComboBox AnchorSideTop.Control = LocationComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LocationBrowserButton AnchorSideRight.Control = LocationBrowserButton
Left = 116 Left = 96
Height = 28 Height = 30
Top = 44 Top = 42
Width = 365 Width = 489
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
ItemHeight = 20 ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 2 TabOrder = 2
@ -115,13 +113,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideLeft.Control = LocationLabel AnchorSideLeft.Control = LocationLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LocationTabSheet AnchorSideTop.Control = LocationTabSheet
Left = 73 Left = 59
Height = 28 Height = 30
Top = 8 Top = 6
Width = 236 Width = 189
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
ItemHeight = 20 ItemHeight = 0
OnEditingDone = LocationComboBoxEditingDone OnEditingDone = LocationComboBoxEditingDone
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -131,14 +129,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
end end
object ServerTabSheet: TTabSheet object ServerTabSheet: TTabSheet
Caption = 'Custom Server' Caption = 'Custom Server'
ClientHeight = 427 ClientHeight = 339
ClientWidth = 524 ClientWidth = 616
object SrvButtonPanel: TButtonPanel object SrvButtonPanel: TButtonPanel
Left = 8 Left = 6
Height = 38 Height = 40
Top = 381 Top = 293
Width = 508 Width = 604
BorderSpacing.Around = 8
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton' HelpButton.Name = 'HelpButton'
@ -153,22 +150,22 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
object SrvPortLabel: TLabel object SrvPortLabel: TLabel
AnchorSideLeft.Control = ServerTabSheet AnchorSideLeft.Control = ServerTabSheet
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 8 Left = 6
Height = 20 Height = 15
Top = 18 Top = 14
Width = 26 Width = 24
BorderSpacing.Left = 8 BorderSpacing.Left = 6
Caption = 'Port' Caption = 'Port'
end end
object SrvWorkDirLabel: TLabel object SrvWorkDirLabel: TLabel
AnchorSideLeft.Control = ServerTabSheet AnchorSideLeft.Control = ServerTabSheet
AnchorSideTop.Control = SrvWorkDirComboBox AnchorSideTop.Control = SrvWorkDirComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 8 Left = 6
Height = 20 Height = 15
Top = 84 Top = 86
Width = 99 Width = 85
BorderSpacing.Left = 8 BorderSpacing.Left = 6
Caption = 'Work Directory' Caption = 'Work Directory'
end end
object SrvBrowserButton: TButton object SrvBrowserButton: TButton
@ -178,13 +175,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SrvWorkDirComboBox AnchorSideBottom.Control = SrvWorkDirComboBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 481 Left = 585
Height = 28 Height = 30
Top = 80 Top = 78
Width = 35 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Right = 8 BorderSpacing.Right = 6
Caption = '...' Caption = '...'
TabOrder = 1 TabOrder = 1
end end
@ -192,11 +189,11 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideLeft.Control = ServerTabSheet AnchorSideLeft.Control = ServerTabSheet
AnchorSideTop.Control = SrvExeComboBox AnchorSideTop.Control = SrvExeComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 8 Left = 6
Height = 20 Height = 15
Top = 48 Top = 50
Width = 72 Width = 61
BorderSpacing.Left = 8 BorderSpacing.Left = 6
Caption = 'Executable' Caption = 'Executable'
end end
object SrvExeBrowseButton: TButton object SrvExeBrowseButton: TButton
@ -206,13 +203,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SrvExeComboBox AnchorSideBottom.Control = SrvExeComboBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 481 Left = 585
Height = 28 Height = 30
Top = 44 Top = 42
Width = 35 Width = 25
Anchors = [akTop, akRight, akBottom] Anchors = [akTop, akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Right = 8 BorderSpacing.Right = 6
Caption = '...' Caption = '...'
TabOrder = 2 TabOrder = 2
end end
@ -220,12 +217,12 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideLeft.Control = ServerTabSheet AnchorSideLeft.Control = ServerTabSheet
AnchorSideTop.Control = SrvWorkDirComboBox AnchorSideTop.Control = SrvWorkDirComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 8 Left = 6
Height = 20 Height = 15
Top = 116 Top = 114
Width = 73 Width = 63
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
Caption = 'Parameters' Caption = 'Parameters'
end end
object SrvParamsComboBox: TComboBox object SrvParamsComboBox: TComboBox
@ -234,15 +231,15 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ServerTabSheet AnchorSideRight.Control = ServerTabSheet
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 8 Left = 6
Height = 28 Height = 30
Top = 144 Top = 135
Width = 508 Width = 604
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
BorderSpacing.Right = 8 BorderSpacing.Right = 6
ItemHeight = 20 ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 3 TabOrder = 3
@ -253,14 +250,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideTop.Control = SrvPortComboBox AnchorSideTop.Control = SrvPortComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SrvExeBrowseButton AnchorSideRight.Control = SrvExeBrowseButton
Left = 88 Left = 73
Height = 28 Height = 30
Top = 44 Top = 42
Width = 393 Width = 512
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
ItemHeight = 20 ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 4 TabOrder = 4
@ -271,14 +268,14 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideTop.Control = SrvExeComboBox AnchorSideTop.Control = SrvExeComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SrvBrowserButton AnchorSideRight.Control = SrvBrowserButton
Left = 115 Left = 97
Height = 28 Height = 30
Top = 80 Top = 78
Width = 366 Width = 488
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
ItemHeight = 20 ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 5 TabOrder = 5
@ -288,13 +285,13 @@ object SimpleWebSrvAddDialog: TSimpleWebSrvAddDialog
AnchorSideLeft.Control = SrvPortLabel AnchorSideLeft.Control = SrvPortLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ServerTabSheet AnchorSideTop.Control = ServerTabSheet
Left = 42 Left = 36
Height = 28 Height = 30
Top = 8 Top = 6
Width = 176 Width = 141
BorderSpacing.Left = 8 BorderSpacing.Left = 6
BorderSpacing.Top = 8 BorderSpacing.Top = 6
ItemHeight = 20 ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 6 TabOrder = 6

View File

@ -1872,16 +1872,24 @@ end;
function TSimpleWebServerController.GetURLWithServer(aServer: TSWSInstance; function TSimpleWebServerController.GetURLWithServer(aServer: TSWSInstance;
HTMLFilename: string): string; HTMLFilename: string): string;
begin begin
if HTMLFilename<>'' then
begin
Result:=CreateRelativePath(HTMLFilename,aServer.Path); Result:=CreateRelativePath(HTMLFilename,aServer.Path);
Result:=FilenameToURLPath(Result); Result:=FilenameToURLPath(Result);
end else
Result:='';
Result:='http://'+MainSrvAddr+':'+IntToStr(aServer.Port)+'/'+Result; Result:='http://'+MainSrvAddr+':'+IntToStr(aServer.Port)+'/'+Result;
end; end;
function TSimpleWebServerController.GetURLWithLocation(aLocation: TSWSLocation; function TSimpleWebServerController.GetURLWithLocation(aLocation: TSWSLocation;
HTMLFilename: string): string; HTMLFilename: string): string;
begin begin
if HTMLFilename<>'' then
begin
Result:=CreateRelativePath(HTMLFilename,aLocation.Path); Result:=CreateRelativePath(HTMLFilename,aLocation.Path);
Result:=FilenameToURLPath(Result); Result:=FilenameToURLPath(Result);
end else
Result:='';
Result:='http://'+MainSrvAddr+':'+IntToStr(MainSrvPort)+'/'+aLocation.Location+'/'+Result; Result:='http://'+MainSrvAddr+':'+IntToStr(MainSrvPort)+'/'+aLocation.Location+'/'+Result;
end; end;

View File

@ -18,6 +18,7 @@ resourcestring
rsSWOrigin = 'Origin'; rsSWOrigin = 'Origin';
rsSWNote = 'Note'; rsSWNote = 'Note';
rsSWCopyLocation = 'Copy Location'; rsSWCopyLocation = 'Copy Location';
rsSWCopyURL = 'Copy URL';
rsSWCopyWorkingDirectoryPath = 'Copy Working Directory Path'; rsSWCopyWorkingDirectoryPath = 'Copy Working Directory Path';
rsSWCopyOrigin = 'Copy Origin'; rsSWCopyOrigin = 'Copy Origin';
rsSWParametersPleaseUseMacroPort = 'Parameters (please use macro $(port))'; rsSWParametersPleaseUseMacroPort = 'Parameters (please use macro $(port))';

View File

@ -642,7 +642,7 @@ object SimpleWebServerWindow: TSimpleWebServerWindow
end end
item item
Caption = 'Note' Caption = 'Note'
Width = 288 Width = 293
end> end>
HideSelection = False HideSelection = False
PopupMenu = LocationsPopupMenu PopupMenu = LocationsPopupMenu
@ -687,6 +687,10 @@ object SimpleWebServerWindow: TSimpleWebServerWindow
OnPopup = LocationsPopupMenuPopup OnPopup = LocationsPopupMenuPopup
Left = 261 Left = 261
Top = 98 Top = 98
object CopyURLMenuItem: TMenuItem
Caption = 'Copy URL'
OnClick = CopyURLMenuItemClick
end
object CopyLocationMenuItem: TMenuItem object CopyLocationMenuItem: TMenuItem
Caption = 'Copy Location' Caption = 'Copy Location'
OnClick = CopyLocationMenuItemClick OnClick = CopyLocationMenuItemClick

View File

@ -42,6 +42,7 @@ type
CopyLocationMenuItem: TMenuItem; CopyLocationMenuItem: TMenuItem;
CopyDirectoryPathMenuItem: TMenuItem; CopyDirectoryPathMenuItem: TMenuItem;
CopyOriginMenuItem: TMenuItem; CopyOriginMenuItem: TMenuItem;
CopyURLMenuItem: TMenuItem;
MsgSplitter: TSplitter; MsgSplitter: TSplitter;
OptionsPanel: TPanel; OptionsPanel: TPanel;
ServerLogGroupBox: TGroupBox; ServerLogGroupBox: TGroupBox;
@ -53,6 +54,7 @@ type
procedure CopyDirectoryPathMenuItemClick(Sender: TObject); procedure CopyDirectoryPathMenuItemClick(Sender: TObject);
procedure CopyLocationMenuItemClick(Sender: TObject); procedure CopyLocationMenuItemClick(Sender: TObject);
procedure CopyOriginMenuItemClick(Sender: TObject); procedure CopyOriginMenuItemClick(Sender: TObject);
procedure CopyURLMenuItemClick(Sender: TObject);
procedure DeleteButtonClick(Sender: TObject); procedure DeleteButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@ -344,6 +346,7 @@ begin
LocationsListView.Columns[2].Caption:=rsSWOrigin; LocationsListView.Columns[2].Caption:=rsSWOrigin;
LocationsListView.Columns[3].Caption:=rsSWNote; LocationsListView.Columns[3].Caption:=rsSWNote;
CopyURLMenuItem.Caption:=rsSWCopyURL;
CopyLocationMenuItem.Caption:=rsSWCopyLocation; CopyLocationMenuItem.Caption:=rsSWCopyLocation;
CopyDirectoryPathMenuItem.Caption:=rsSWCopyWorkingDirectoryPath; CopyDirectoryPathMenuItem.Caption:=rsSWCopyWorkingDirectoryPath;
CopyOriginMenuItem.Caption:=rsSWCopyOrigin; CopyOriginMenuItem.Caption:=rsSWCopyOrigin;
@ -362,29 +365,50 @@ end;
procedure TSimpleWebServerWindow.CopyDirectoryPathMenuItemClick(Sender: TObject procedure TSimpleWebServerWindow.CopyDirectoryPathMenuItemClick(Sender: TObject
); );
var var
Item: TListItem; LI: TListItem;
begin begin
Item:=LocationsListView.Selected; LI:=LocationsListView.Selected;
if Item=nil then exit; if LI=nil then exit;
Clipboard.AsText:=Item.SubItems[0]; Clipboard.AsText:=LI.SubItems[0];
end; end;
procedure TSimpleWebServerWindow.CopyLocationMenuItemClick(Sender: TObject); procedure TSimpleWebServerWindow.CopyLocationMenuItemClick(Sender: TObject);
var var
Item: TListItem; LI: TListItem;
begin begin
Item:=LocationsListView.Selected; LI:=LocationsListView.Selected;
if Item=nil then exit; if LI=nil then exit;
Clipboard.AsText:=Item.Caption; Clipboard.AsText:=LI.Caption;
end; end;
procedure TSimpleWebServerWindow.CopyOriginMenuItemClick(Sender: TObject); procedure TSimpleWebServerWindow.CopyOriginMenuItemClick(Sender: TObject);
var var
Item: TListItem; LI: TListItem;
begin begin
Item:=LocationsListView.Selected; LI:=LocationsListView.Selected;
if Item=nil then exit; if LI=nil then exit;
Clipboard.AsText:=Item.SubItems[1]; 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; end;
procedure TSimpleWebServerWindow.DeleteButtonClick(Sender: TObject); procedure TSimpleWebServerWindow.DeleteButtonClick(Sender: TObject);
@ -429,11 +453,14 @@ end;
procedure TSimpleWebServerWindow.LocationsPopupMenuPopup(Sender: TObject); procedure TSimpleWebServerWindow.LocationsPopupMenuPopup(Sender: TObject);
var var
LI: TListItem; LI: TListItem;
Enable: Boolean;
begin begin
LI:=LocationsListView.Selected; LI:=LocationsListView.Selected;
CopyLocationMenuItem.Enabled:=LI<>nil; Enable:=LI<>nil;
CopyDirectoryPathMenuItem.Enabled:=LI<>nil; CopyURLMenuItem.Enabled:=Enable;
CopyOriginMenuItem.Enabled:=LI<>nil; CopyLocationMenuItem.Enabled:=Enable;
CopyDirectoryPathMenuItem.Enabled:=Enable;
CopyOriginMenuItem.Enabled:=Enable;
end; end;
end. end.