1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-25 14:19:30 +03:00

It is possible to copy information to the clipboard from the Properties dialog

Source commit: 81b58097069ee7f62cd1744b88c345c0aff29216
This commit is contained in:
Martin Prikryl
2021-10-06 10:43:55 +00:00
parent 919837c3d0
commit 2e12d755d7
3 changed files with 87 additions and 51 deletions

View File

@@ -62,13 +62,19 @@ __fastcall TPropertiesDialog::TPropertiesDialog(TComponent* AOwner,
FChecksumLoaded = false;
FMultipleChecksum = false;
LocationLabel->Caption = Directory;
LocationLabel->Text = Directory;
FGroupList = GroupList;
FUserList = UserList;
FChecksumAlgs = ChecksumAlgs;
ReadOnlyControl(ChecksumEdit);
ReadOnlyControl(OwnerView);
ReadOnlyControl(GroupView);
ReadOnlyControl(FileLabel);
ReadOnlyControl(LocationLabel);
ReadOnlyControl(SizeLabel);
ReadOnlyControl(LinksToLabel);
ChecksumUnknownLabel->Caption = LoadStr(PROPERTIES_CHECKSUM_UNKNOWN);
LoadInfo();
@@ -165,16 +171,19 @@ UnicodeString __fastcall TPropertiesDialog::LoadRemoteToken(
}
//---------------------------------------------------------------------------
void __fastcall TPropertiesDialog::LoadRemoteToken(
TComboBox * ComboBox, bool Valid, const TRemoteToken & Token)
TComboBox * ComboBox, TEdit * View, TLabel * Label, bool Valid, const TRemoteToken & Token, int Change)
{
if (Valid)
{
ComboBox->Text = LoadRemoteToken(Token);
}
else
{
ComboBox->Text = L"";
UnicodeString Value = LoadRemoteToken(Token);
ComboBox->Text = Value;
View->Text = Value;
}
bool AllowedChange = FLAGSET(FAllowedChanges, Change);
ComboBox->Visible = Valid && AllowedChange;
View->Visible = Valid && !AllowedChange;
Label->Visible = Valid;
Label->FocusControl = AllowedChange ? static_cast<TWinControl *>(ComboBox) : static_cast<TWinControl *>(View);
}
//---------------------------------------------------------------------------
void __fastcall TPropertiesDialog::LoadRemoteTokens(TComboBox * ComboBox,
@@ -266,7 +275,7 @@ void __fastcall TPropertiesDialog::LoadInfo()
LinksToLabel->Visible = File->IsSymLink;
if (File->IsSymLink)
{
LinksToLabel->Caption = File->LinkTo;
LinksToLabel->Text = File->LinkTo;
}
Caption = FMTLOAD(PROPERTIES_FILE_CAPTION, (File->FileName));
@@ -367,8 +376,8 @@ void __fastcall TPropertiesDialog::LoadStats(__int64 FilesSize,
}
}
SizeLabel->Caption = SizeStr;
FileLabel->Caption = FilesStr;
SizeLabel->Text = SizeStr;
FileLabel->Text = FilesStr;
}
//---------------------------------------------------------------------------
void __fastcall TPropertiesDialog::SetFileProperties(const TRemoteProperties & value)
@@ -395,21 +404,16 @@ void __fastcall TPropertiesDialog::SetFileProperties(const TRemoteProperties & v
RightsFrame->AddXToDirectories = false;
}
bool HasGroup = value.Valid.Contains(vpGroup);
LoadRemoteToken(GroupComboBox, HasGroup, value.Group);
bool HasOwner = value.Valid.Contains(vpOwner);
LoadRemoteToken(OwnerComboBox, HasOwner, value.Owner);
// Not necesarily true, let's find the scenario when it is not and then decide how to render that (shift group up?)
DebugAssert(value.Valid.Contains(vpOwner) || !value.Valid.Contains(vpGroup));
LoadRemoteToken(GroupComboBox, GroupView, GroupLabel, value.Valid.Contains(vpGroup), value.Group, cpGroup);
LoadRemoteToken(OwnerComboBox, OwnerView, OwnerLabel, value.Valid.Contains(vpOwner), value.Owner, cpOwner);
bool HasGroupOrOwner = HasGroup || HasOwner;
bool HasGroupOrOwner = GroupLabel->Visible || OwnerLabel->Visible;
bool HasAnything = HasGroupOrOwner || HasRights;
// Not necesarily true, let's find the scenario when it is not and then decide how to render that (shift rights up?)
DebugAssert(HasGroupOrOwner || !HasRights);
bool ShowGroupAndOwner = HasAnything;
OwnerComboBox->Visible = HasGroupOrOwner;
OwnerLabel->Visible = OwnerComboBox->Visible;
GroupComboBox->Visible = HasGroupOrOwner;
GroupLabel->Visible = GroupComboBox->Visible;
GroupOwnerRightsBevel->Visible = ShowGroupAndOwner;
GroupOwnerRightsBevel->Visible = HasAnything;
RecursiveCheck2->Checked = value.Recursive;
RecursiveCheck2->Visible = HasAnything && FAnyDirectories;

View File

@@ -71,26 +71,29 @@ object PropertiesDialog: TPropertiesDialog
Caption = 'Location:'
ShowAccelChar = False
end
object LocationLabel: TPathLabel
object LocationLabel: TEdit
Left = 85
Top = 58
Width = 243
Height = 13
UnixPath = True
IndentHorizontal = 0
IndentVertical = 0
Align = alNone
Width = 241
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
AutoSize = False
BorderStyle = bsNone
TabOrder = 7
Text = 'LocationLabel'
end
object FileLabel: TLabel
object FileLabel: TEdit
Left = 85
Top = 18
Width = 241
Height = 13
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = 'FileLabel'
ShowAccelChar = False
BorderStyle = bsNone
TabOrder = 8
Text = 'FileLabel'
end
object Label2: TLabel
Left = 8
@@ -100,15 +103,17 @@ object PropertiesDialog: TPropertiesDialog
Caption = 'Size:'
ShowAccelChar = False
end
object SizeLabel: TLabel
object SizeLabel: TEdit
Left = 85
Top = 80
Width = 160
Height = 13
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = 'SizeLabel'
ShowAccelChar = False
BorderStyle = bsNone
TabOrder = 9
Text = 'SizeLabel'
end
object LinksToLabelLabel: TLabel
Left = 8
@@ -118,17 +123,17 @@ object PropertiesDialog: TPropertiesDialog
Caption = 'Links to:'
ShowAccelChar = False
end
object LinksToLabel: TPathLabel
object LinksToLabel: TEdit
Left = 85
Top = 102
Width = 240
Height = 13
UnixPath = True
IndentHorizontal = 0
IndentVertical = 0
Align = alNone
Width = 241
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
AutoSize = False
BorderStyle = bsNone
TabOrder = 10
Text = 'LinksToLabel'
end
object Bevel2: TBevel
Left = 8
@@ -185,12 +190,36 @@ object PropertiesDialog: TPropertiesDialog
Anchors = [akLeft, akTop, akRight]
Shape = bsTopLine
end
object GroupView: TEdit
Left = 85
Top = 166
Width = 241
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
BorderStyle = bsNone
MaxLength = 50
TabOrder = 4
Text = 'GroupView'
end
object OwnerView: TEdit
Left = 85
Top = 138
Width = 241
Height = 17
TabStop = False
Anchors = [akLeft, akTop, akRight]
BorderStyle = bsNone
MaxLength = 50
TabOrder = 2
Text = 'OwnerView'
end
inline RightsFrame: TRightsFrame
Left = 84
Top = 200
Width = 244
Height = 109
TabOrder = 3
TabOrder = 5
end
object GroupComboBox: TComboBox
Left = 85
@@ -199,7 +228,7 @@ object PropertiesDialog: TPropertiesDialog
Height = 21
DropDownCount = 16
MaxLength = 50
TabOrder = 2
TabOrder = 3
Text = 'GroupComboBox'
OnChange = ControlChange
OnExit = GroupComboBoxExit
@@ -223,7 +252,7 @@ object PropertiesDialog: TPropertiesDialog
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Set owner, group and permissions &recursively'
TabOrder = 4
TabOrder = 6
OnClick = ControlChange
end
object CalculateSizeButton: TButton

View File

@@ -26,13 +26,13 @@ __published:
TPageControl *PageControl;
TTabSheet *CommonSheet;
TBevel *Bevel1;
TLabel *FileLabel;
TEdit *FileLabel;
TLabel *Label1;
TPathLabel *LocationLabel;
TEdit *LocationLabel;
TLabel *Label2;
TLabel *SizeLabel;
TEdit *SizeLabel;
TLabel *LinksToLabelLabel;
TPathLabel *LinksToLabel;
TEdit *LinksToLabel;
TBevel *Bevel2;
TLabel *RightsLabel;
TBevel *GroupOwnerRightsBevel;
@@ -56,6 +56,8 @@ __published:
TPopupMenu *ListViewMenu;
TMenuItem *Copy;
TLabel *ChecksumUnknownLabel;
TEdit *OwnerView;
TEdit *GroupView;
void __fastcall ControlChange(TObject *Sender);
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
void __fastcall CalculateSizeButtonClick(TObject *Sender);
@@ -103,7 +105,8 @@ protected:
void __fastcall LoadInfo();
void __fastcall LoadRemoteTokens(TComboBox * ComboBox, const TRemoteTokenList * List);
UnicodeString __fastcall LoadRemoteToken(const TRemoteToken & Token);
void __fastcall LoadRemoteToken(TComboBox * ComboBox, bool Valid, const TRemoteToken & Token);
void __fastcall LoadRemoteToken(
TComboBox * ComboBox, TEdit * View, TLabel * Label, bool Valid, const TRemoteToken & Token, int Change);
TRemoteToken __fastcall StoreRemoteToken(const TRemoteToken & Orig,
UnicodeString Text, int Message, const TRemoteTokenList * List);
void __fastcall StoreRemoteToken(TComboBox * ComboBox,