FileSystemInfo.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //---------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <Terminal.h>
  6. #include <VCLCommon.h>
  7. #include "WinInterface.h"
  8. #include "FileSystemInfo.h"
  9. //---------------------------------------------------------------------
  10. #pragma link "XPThemes"
  11. #pragma resource "*.dfm"
  12. //---------------------------------------------------------------------
  13. void __fastcall DoFileSystemInfoDialog(TTerminal * Terminal)
  14. {
  15. TFileSystemInfoDialog * Dialog = new TFileSystemInfoDialog(Application);
  16. try
  17. {
  18. Dialog->Terminal = Terminal;
  19. Dialog->ShowModal();
  20. }
  21. __finally
  22. {
  23. delete Dialog;
  24. }
  25. }
  26. //---------------------------------------------------------------------
  27. __fastcall TFileSystemInfoDialog::TFileSystemInfoDialog(TComponent* AOwner)
  28. : TForm(AOwner)
  29. {
  30. UseSystemSettings(this);
  31. }
  32. //---------------------------------------------------------------------
  33. AnsiString __fastcall TFileSystemInfoDialog::CapabilityStr(TFSCapability Capability)
  34. {
  35. assert(FTerminal);
  36. return BooleanToStr(FTerminal->IsCapable[Capability]);
  37. }
  38. //---------------------------------------------------------------------
  39. AnsiString __fastcall TFileSystemInfoDialog::CapabilityStr(TFSCapability Capability1,
  40. TFSCapability Capability2)
  41. {
  42. return FORMAT("%s/%s", (CapabilityStr(Capability1), CapabilityStr(Capability2)));
  43. }
  44. //---------------------------------------------------------------------
  45. void __fastcall TFileSystemInfoDialog::UpdateControls()
  46. {
  47. assert(Terminal);
  48. SshVersionEdit->Text = FORMAT("SSH-%d", (Terminal->SshVersion));
  49. SshImplementationEdit->Text = Terminal->SshImplementation;
  50. AnsiString Str = CipherNames[Terminal->CSCipher];
  51. if (Terminal->CSCipher != Terminal->SCCipher)
  52. {
  53. Str += FORMAT("/%s", (CipherNames[Terminal->SCCipher]));
  54. }
  55. CipherEdit->Text = Str;
  56. Str = BooleanToStr(Terminal->CSCompression != ctNone);
  57. if (Terminal->CSCompression != Terminal->SCCompression)
  58. {
  59. Str += FORMAT("/%s", (BooleanToStr(Terminal->SCCompression != ctNone)));
  60. }
  61. CompressionEdit->Text = Str;
  62. HostKeyFingerprintEdit->Text = Terminal->HostKeyFingerprint;
  63. FSProtocolEdit->Text = Terminal->ProtocolName;
  64. ModeChangingEdit->Text = CapabilityStr(fcModeChanging);
  65. OwnerGroupChangingEdit->Text = CapabilityStr(fcOwnerChanging, fcGroupChanging);
  66. AnyCommandEdit->Text = CapabilityStr(fcAnyCommand);
  67. SymbolicHardLinkEdit->Text = CapabilityStr(fcSymbolicLink, fcHardLink);
  68. UserGroupListingEdit->Text = CapabilityStr(fcUserGroupListing);
  69. RemoteCopyEdit->Text = CapabilityStr(fcRemoteCopy);
  70. NativeTextModeEdit->Text = CapabilityStr(fcNativeTextMode);
  71. InfoMemo->Lines = Terminal->AdditionalInfo;
  72. }
  73. //---------------------------------------------------------------------
  74. void __fastcall TFileSystemInfoDialog::SetTerminal(TTerminal * value)
  75. {
  76. if (Terminal != value)
  77. {
  78. FTerminal = value;
  79. UpdateControls();
  80. }
  81. }
  82. //---------------------------------------------------------------------
  83. void __fastcall TFileSystemInfoDialog::HelpButtonClick(TObject * /*Sender*/)
  84. {
  85. FormHelp(this);
  86. }
  87. //---------------------------------------------------------------------------