Login.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. //----------------------------------------------------------------------------
  2. #ifndef LoginH
  3. #define LoginH
  4. //----------------------------------------------------------------------------
  5. #include <vcl\System.hpp>
  6. #include <vcl\Windows.hpp>
  7. #include <vcl\SysUtils.hpp>
  8. #include <vcl\Classes.hpp>
  9. #include <vcl\Graphics.hpp>
  10. #include <vcl\StdCtrls.hpp>
  11. #include <vcl\Forms.hpp>
  12. #include <vcl\Controls.hpp>
  13. #include <vcl\Buttons.hpp>
  14. #include <vcl\ExtCtrls.hpp>
  15. #include <ComCtrls.hpp>
  16. #include <Mask.hpp>
  17. #include <ComboEdit.hpp>
  18. #include <ActnList.hpp>
  19. #include <UpDownEdit.hpp>
  20. #include <PasswordEdit.hpp>
  21. #include <Menus.hpp>
  22. //----------------------------------------------------------------------------
  23. #include <Configuration.h>
  24. #include <SessionData.h>
  25. #include "LogSettings.h"
  26. #include "GeneralSettings.h"
  27. #include <ImgList.hpp>
  28. //----------------------------------------------------------------------------
  29. class TLoginDialog : public TForm
  30. {
  31. __published:
  32. TButton *LoginButton;
  33. TButton *CloseButton;
  34. TButton *AboutButton;
  35. TActionList *ActionList;
  36. TAction *EditSessionAction;
  37. TAction *SaveSessionAction;
  38. TAction *DeleteSessionAction;
  39. TAction *ImportSessionsAction;
  40. TAction *LoginAction;
  41. TAction *AboutAction;
  42. TAction *CleanUpAction;
  43. TAction *NewSessionAction;
  44. TPanel *MainPanel;
  45. TPageControl *PageControl;
  46. TTabSheet *SessionListSheet;
  47. TButton *LoadButton;
  48. TButton *DeleteButton;
  49. TListView *SessionListView;
  50. TButton *NewButton;
  51. TTabSheet *BasicSheet;
  52. TTabSheet *AdvancedSheet;
  53. TGroupBox *ProtocolGroup;
  54. TLabel *Label7;
  55. TRadioButton *SshProt1Button;
  56. TRadioButton *SshProt2Button;
  57. TCheckBox *CompressionCheck;
  58. TTabSheet *EnvironmentSheet;
  59. TTabSheet *ScpSheet;
  60. TGroupBox *OtherShellOptionsGroup;
  61. TCheckBox *LookupUserGroupsCheck;
  62. TCheckBox *ClearAliasesCheck;
  63. TCheckBox *UnsetNationalVarsCheck;
  64. TCheckBox *Scp1CompatibilityCheck;
  65. TGroupBox *ShellGroup;
  66. TComboBox *ShellEdit;
  67. TTabSheet *LogSheet;
  68. TLoggingFrame *LoggingFrame;
  69. TTabSheet *GeneralSheet;
  70. TLabel *Label13;
  71. TButton *PreferencesButton;
  72. TGeneralSettingsFrame *GeneralSettingsFrame;
  73. TPanel *LeftPanel;
  74. TTreeView *NavigationTree;
  75. TCheckBox *ShowAdvancedLoginOptionsCheck;
  76. TGroupBox *BasicGroup;
  77. TLabel *Label1;
  78. TLabel *Label2;
  79. TLabel *Label3;
  80. TLabel *Label4;
  81. TLabel *PrivateKeyLabel;
  82. TEdit *HostNameEdit;
  83. TEdit *UserNameEdit;
  84. TPasswordEdit *PasswordEdit;
  85. TUpDownEdit *PortNumberEdit;
  86. TFilenameEdit *PrivateKeyEdit;
  87. TTabSheet *ConnSheet;
  88. TGroupBox *TimeoutGroup;
  89. TLabel *Label11;
  90. TLabel *Label12;
  91. TUpDownEdit *TimeoutEdit;
  92. TTabSheet *ProxySheet;
  93. TGroupBox *ProxyTypeGroup;
  94. TRadioButton *ProxyNoneButton;
  95. TRadioButton *ProxyHTTPButton;
  96. TRadioButton *ProxySocks4Button;
  97. TRadioButton *ProxyTelnetButton;
  98. TLabel *ProxyHostLabel;
  99. TLabel *ProxyPortLabel;
  100. TUpDownEdit *ProxyPortEdit;
  101. TEdit *ProxyHostEdit;
  102. TEdit *ProxyUsernameEdit;
  103. TLabel *ProxyUsernameLabel;
  104. TLabel *ProxyPasswordLabel;
  105. TPasswordEdit *ProxyPasswordEdit;
  106. TGroupBox *ProxySettingsGroup;
  107. TLabel *ProxyTelnetCommandLabel;
  108. TEdit *ProxyTelnetCommandEdit;
  109. TTabSheet *BugsSheet;
  110. TGroupBox *BugsGroupBox;
  111. TLabel *BugIgnore1Label;
  112. TComboBox *BugIgnore1Combo;
  113. TLabel *BugPlainPW1Label;
  114. TComboBox *BugPlainPW1Combo;
  115. TLabel *BugRSA1Label;
  116. TComboBox *BugRSA1Combo;
  117. TLabel *BugHMAC2Label;
  118. TComboBox *BugHMAC2Combo;
  119. TLabel *BugDeriveKey2Label;
  120. TComboBox *BugDeriveKey2Combo;
  121. TLabel *BugRSAPad2Label;
  122. TComboBox *BugRSAPad2Combo;
  123. TRadioButton *SshProt1onlyButton;
  124. TRadioButton *SshProt2onlyButton;
  125. TTabSheet *AuthSheet;
  126. TGroupBox *AuthenticationGroup;
  127. TCheckBox *AuthTISCheck;
  128. TCheckBox *AuthKICheck;
  129. TGroupBox *EncryptionGroup;
  130. TListBox *CipherListBox;
  131. TLabel *Label8;
  132. TCheckBox *Ssh2LegacyDESCheck;
  133. TButton *CipherUpButton;
  134. TButton *CipherDownButton;
  135. TButton *SetDefaultSessionButton;
  136. TAction *SetDefaultSessionAction;
  137. TButton *ToolsMenuButton;
  138. TPopupMenu *ToolsPopupMenu;
  139. TMenuItem *Import1;
  140. TMenuItem *Cleanup1;
  141. TButton *ShellIconsButton;
  142. TAction *DesktopIconAction;
  143. TGroupBox *EOLTypeGroup;
  144. TRadioButton *EOLTypeLFButton;
  145. TRadioButton *EOLTypeCRLFButton;
  146. TGroupBox *TransferProtocolGroup;
  147. TPopupMenu *IconsPopupMenu;
  148. TMenuItem *Desktopicon1;
  149. TAction *SendToHookAction;
  150. TMenuItem *ExplorersSendtoshortcut1;
  151. TLabel *BugPKSessID2Label;
  152. TComboBox *BugPKSessID2Combo;
  153. TRadioButton *ProxySocks5Button;
  154. TCheckBox *ProxyLocalhostCheck;
  155. TLabel *Label17;
  156. TRadioButton *ProxyDNSOffButton;
  157. TRadioButton *ProxyDNSAutoButton;
  158. TRadioButton *ProxyDNSOnButton;
  159. TUpDownEdit *TimeDifferenceEdit;
  160. TLabel *Label29;
  161. TLabel *Label30;
  162. TAction *CheckForUpdatesAction;
  163. TMenuItem *CheckForUpdates1;
  164. TButton *SaveButton;
  165. TButton *LanguagesButton;
  166. TGroupBox *PingGroup;
  167. TLabel *PingIntervalLabel;
  168. TUpDownEdit *PingIntervalSecEdit;
  169. TRadioButton *PingOffButton;
  170. TRadioButton *PingNullPacketButton;
  171. TRadioButton *PingDummyCommandButton;
  172. TUpDownEdit *TimeDifferenceMinutesEdit;
  173. TLabel *Label9;
  174. TCheckBox *AuthKIPasswordCheck;
  175. TTabSheet *DirectoriesSheet;
  176. TGroupBox *DirectoriesGroup;
  177. TLabel *LocalDirectoryLabel;
  178. TLabel *RemoteDirectoryLabel;
  179. TLabel *LocalDirectoryDescLabel;
  180. TDirectoryEdit *LocalDirectoryEdit;
  181. TEdit *RemoteDirectoryEdit;
  182. TCheckBox *UpdateDirectoriesCheck;
  183. TCheckBox *CacheDirectoriesCheck;
  184. TCheckBox *ResolveSymlinksCheck;
  185. TCheckBox *CacheDirectoryChangesCheck;
  186. TCheckBox *PreserveDirectoryChangesCheck;
  187. TGroupBox *DSTModeGroup;
  188. TRadioButton *DSTModeUnixCheck;
  189. TRadioButton *DSTModeWinCheck;
  190. TCheckBox *AuthGSSAPICheck;
  191. TGroupBox *RecycleBinGroup;
  192. TCheckBox *DeleteToRecycleBinCheck;
  193. TCheckBox *OverwrittenToRecycleBinCheck;
  194. TLabel *RecycleBinPathLabel;
  195. TEdit *RecycleBinPathEdit;
  196. TGroupBox *ScpLsOptionsGroup;
  197. TCheckBox *IgnoreLsWarningsCheck;
  198. TCheckBox *AliasGroupListCheck;
  199. TCheckBox *SCPLsFullTimeAutoCheck;
  200. TTabSheet *SftpSheet;
  201. TGroupBox *SFTPBugsGroupBox;
  202. TLabel *Label10;
  203. TLabel *Label36;
  204. TComboBox *SFTPBugSymlinkCombo;
  205. TTabSheet *KexSheet;
  206. TGroupBox *KexOptionsGroup;
  207. TLabel *Label28;
  208. TListBox *KexListBox;
  209. TButton *KexUpButton;
  210. TButton *KexDownButton;
  211. TGroupBox *KexReexchangeGroup;
  212. TLabel *Label31;
  213. TUpDownEdit *RekeyTimeEdit;
  214. TLabel *Label32;
  215. TEdit *RekeyDataEdit;
  216. TGroupBox *IPvGroup;
  217. TRadioButton *IPAutoButton;
  218. TRadioButton *IPv4Button;
  219. TRadioButton *IPv6Button;
  220. TLabel *BugRekey2Label;
  221. TComboBox *BugRekey2Combo;
  222. TGroupBox *SFTPProtocolGroup;
  223. TLabel *Label34;
  224. TLabel *Label35;
  225. TComboBox *SFTPMaxVersionCombo;
  226. TComboBox *SFTPBugUtfCombo;
  227. TComboBox *SFTPBugSignedTSCombo;
  228. TButton *HelpButton;
  229. TButton *ColorButton;
  230. TPopupMenu *ColorPopupMenu;
  231. TMenuItem *ColorDefaultItem;
  232. TMenuItem *PickColorItem;
  233. TImageList *ColorImageList;
  234. TButton *RenameButton;
  235. TAction *RenameSessionAction;
  236. TGroupBox *DirectoryOptionsGroup;
  237. TTabSheet *TunnelSheet;
  238. TGroupBox *TunnelSessionGroup;
  239. TLabel *Label6;
  240. TLabel *Label14;
  241. TLabel *Label15;
  242. TLabel *Label16;
  243. TLabel *Label18;
  244. TEdit *TunnelHostNameEdit;
  245. TEdit *TunnelUserNameEdit;
  246. TPasswordEdit *TunnelPasswordEdit;
  247. TUpDownEdit *TunnelPortNumberEdit;
  248. TFilenameEdit *TunnelPrivateKeyEdit;
  249. TLabel *Label19;
  250. TComboBox *ReturnVarEdit;
  251. TLabel *Label20;
  252. TGroupBox *AuthenticationParamsGroup;
  253. TCheckBox *GSSAPIFwdTGTCheck;
  254. TCheckBox *AgentFwdCheck;
  255. TLabel *GSSAPIServerRealmLabel;
  256. TEdit *GSSAPIServerRealmEdit;
  257. TCheckBox *TunnelCheck;
  258. TGroupBox *TunnelOptionsGroup;
  259. TLabel *Label21;
  260. TComboBox *TunnelLocalPortNumberEdit;
  261. TRadioButton *DSTModeKeepCheck;
  262. TButton *UnixEnvironmentButton;
  263. TButton *WindowsEnvironmentButton;
  264. TComboBox *TransferProtocolCombo;
  265. TLabel *Label22;
  266. TCheckBox *AllowScpFallbackCheck;
  267. TLabel *InsecureLabel;
  268. TGroupBox *ConnectionGroup;
  269. TCheckBox *FtpPasvModeCheck;
  270. TAction *ShellIconSessionAction;
  271. void __fastcall DataChange(TObject *Sender);
  272. void __fastcall FormShow(TObject *Sender);
  273. void __fastcall SessionListViewSelectItem(TObject *Sender,
  274. TListItem *Item, bool Selected);
  275. void __fastcall SessionListViewDblClick(TObject *Sender);
  276. void __fastcall SessionListViewInfoTip(TObject *Sender,
  277. TListItem *Item, AnsiString &InfoTip);
  278. void __fastcall SessionListViewKeyDown(TObject *Sender, WORD &Key,
  279. TShiftState Shift);
  280. void __fastcall EditSessionActionExecute(TObject *Sender);
  281. void __fastcall SaveSessionActionExecute(TObject *Sender);
  282. void __fastcall DeleteSessionActionExecute(TObject *Sender);
  283. void __fastcall ImportSessionsActionExecute(TObject *Sender);
  284. void __fastcall CleanUpActionExecute(TObject *Sender);
  285. void __fastcall AboutActionExecute(TObject *Sender);
  286. void __fastcall ActionListUpdate(TBasicAction *Action,
  287. bool &Handled);
  288. void __fastcall PreferencesButtonClick(TObject *Sender);
  289. void __fastcall NewSessionActionExecute(TObject *Sender);
  290. void __fastcall NavigationTreeChange(TObject *Sender, TTreeNode *Node);
  291. void __fastcall PageControlChange(TObject *Sender);
  292. void __fastcall AlgListBoxStartDrag(TObject *Sender,
  293. TDragObject *&DragObject);
  294. void __fastcall AlgListBoxDragOver(TObject *Sender, TObject *Source,
  295. int X, int Y, TDragState State, bool &Accept);
  296. void __fastcall AlgListBoxDragDrop(TObject *Sender, TObject *Source,
  297. int X, int Y);
  298. void __fastcall CipherButtonClick(TObject *Sender);
  299. void __fastcall SetDefaultSessionActionExecute(TObject *Sender);
  300. void __fastcall ToolsMenuButtonClick(TObject *Sender);
  301. void __fastcall DesktopIconActionExecute(TObject *Sender);
  302. void __fastcall SessionListViewCustomDrawItem(TCustomListView *Sender,
  303. TListItem *Item, TCustomDrawState State, bool &DefaultDraw);
  304. void __fastcall SendToHookActionExecute(TObject *Sender);
  305. void __fastcall CheckForUpdatesActionExecute(TObject *Sender);
  306. void __fastcall LanguagesButtonClick(TObject *Sender);
  307. void __fastcall AuthGSSAPICheckClick(TObject *Sender);
  308. void __fastcall KexButtonClick(TObject *Sender);
  309. void __fastcall HelpButtonClick(TObject *Sender);
  310. void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
  311. TShiftState Shift);
  312. void __fastcall PrivateKeyEditAfterDialog(TObject *Sender,
  313. AnsiString &Name, bool &Action);
  314. void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
  315. void __fastcall ColorButtonClick(TObject *Sender);
  316. void __fastcall ColorDefaultItemClick(TObject *Sender);
  317. void __fastcall PickColorItemClick(TObject *Sender);
  318. void __fastcall SessionListViewEditing(TObject * Sender, TListItem * Item,
  319. bool & AllowEdit);
  320. void __fastcall RenameSessionActionExecute(TObject * Sender);
  321. void __fastcall SessionListViewEdited(TObject * Sender, TListItem * Item,
  322. AnsiString & S);
  323. void __fastcall SessionListViewCompare(TObject * Sender, TListItem * Item1,
  324. TListItem * Item2, int Data, int & Compare);
  325. void __fastcall UnixEnvironmentButtonClick(TObject *Sender);
  326. void __fastcall WindowsEnvironmentButtonClick(TObject *Sender);
  327. void __fastcall PathEditBeforeDialog(TObject *Sender, AnsiString &Name,
  328. bool &Action);
  329. void __fastcall TransferProtocolComboChange(TObject *Sender);
  330. void __fastcall NavigationTreeCollapsing(TObject *Sender,
  331. TTreeNode *Node, bool &AllowCollapse);
  332. void __fastcall ShellIconSessionActionExecute(TObject *Sender);
  333. private:
  334. int NoUpdate;
  335. TSessionData * FSessionData;
  336. TSessionData * FEditingSessionData;
  337. TStoredSessionList * FStoredSessions;
  338. int FAlgDragSource, FAlgDragDest;
  339. int FOptions;
  340. TPopupMenu * FLanguagesPopupMenu;
  341. AnsiString FOrigCaption;
  342. bool FInitialized;
  343. TTabSheet * FSavedTab;
  344. int FSavedSession;
  345. bool FLocaleChanging;
  346. void * FSystemSettings;
  347. AnsiString FCurrentSessionName;
  348. TColor FColor;
  349. AnsiString FBeforeDialogPath;
  350. TStringList * FTreeLabels;
  351. TFSProtocol FFSProtocol;
  352. void __fastcall LoadSession(TSessionData * aSessionData);
  353. void __fastcall UpdateControls();
  354. void __fastcall SetSessionData(TSessionData * value);
  355. TSessionData * __fastcall GetSessionData();
  356. void __fastcall SaveSession(TSessionData * aStoredSession);
  357. void __fastcall SetStoredSessions(TStoredSessionList * value);
  358. void __fastcall LoadSessions();
  359. void __fastcall LoadSessionItem(TListItem * Item);
  360. void __fastcall SetSelectedSession(TSessionData * value);
  361. TSessionData * __fastcall GetSelectedSession();
  362. void __fastcall CMDialogKey(TWMKeyDown & Message);
  363. void __fastcall WMHelp(TWMHelp & Message);
  364. void __fastcall InitializeBugsCombo(TComboBox * BugsCombo);
  365. int __fastcall FSProtocolToIndex(TFSProtocol FSProtocol, bool & AllowScpFallback);
  366. TFSProtocol __fastcall IndexToFSProtocol(int Index, bool AllowScpFallback);
  367. void __fastcall UpdateNavigationTree();
  368. void __fastcall LoadPing(TSessionData * aSessionData);
  369. void __fastcall SavePing(TSessionData * aSessionData);
  370. protected:
  371. void __fastcall Default();
  372. void __fastcall LoadConfiguration();
  373. void __fastcall SaveConfiguration();
  374. void __fastcall ShowPreferencesDialog();
  375. void __fastcall ChangePage(TTabSheet * Tab);
  376. virtual void __fastcall Dispatch(void * Message);
  377. bool __fastcall AllowAlgDrag(TListBox * AlgListBox, int X, int Y);
  378. void __fastcall AlgMove(TListBox * AlgListBox, int Source, int Dest);
  379. void __fastcall SetOptions(int value);
  380. void __fastcall LocaleClick(TObject * Sender);
  381. void __fastcall LocaleGetClick(TObject * Sender);
  382. void __fastcall Init();
  383. void __fastcall InitControls();
  384. void __fastcall ShowTabs(bool Show);
  385. void __fastcall VerifyKey(AnsiString FileName, bool TypeOnly);
  386. void __fastcall EditSession();
  387. public:
  388. virtual __fastcall TLoginDialog(TComponent* AOwner);
  389. __fastcall ~TLoginDialog();
  390. bool __fastcall Execute();
  391. __property TSessionData * SessionData = { read=GetSessionData, write=SetSessionData };
  392. __property TStoredSessionList * StoredSessions = { read=FStoredSessions, write=SetStoredSessions };
  393. __property TSessionData * SelectedSession = { read=GetSelectedSession, write=SetSelectedSession };
  394. __property int Options = { read=FOptions, write=SetOptions };
  395. };
  396. //----------------------------------------------------------------------------
  397. #endif