diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-11-15 13:30:43 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-11-15 13:30:43 +0100 |
| commit | 7f89810e3c6ff92b0771ca11a817b82e081ccfa5 (patch) | |
| tree | b9dfae2f0e7c19e4aa4ba12af5a51fbf0a59e010 /UConnectionManager.pas | |
| parent | f51fc44e0d479335b68650016b40813129039322 (diff) | |
| download | tuxcmd-7f89810e3c6ff92b0771ca11a817b82e081ccfa5.tar.xz | |
Connection Manager: Add ability not to save any passwords
Diffstat (limited to 'UConnectionManager.pas')
| -rw-r--r-- | UConnectionManager.pas | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/UConnectionManager.pas b/UConnectionManager.pas index 86f3bd7..3703b02 100644 --- a/UConnectionManager.pas +++ b/UConnectionManager.pas @@ -40,6 +40,7 @@ type ButtonBox: TGTKVButtonBox; ActionButtonBox: TGTKHButtonBox; ConnectButton, CloseButton: TGTKButton; + DoNotSavePasswordsCheckBox, DoNotSynchronizeKeyringCheckBox: TGTKCheckButton; procedure FormCreate(Sender: TObject); override; procedure ListViewSelectionChanged(Sender: TObject); procedure FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); @@ -74,7 +75,7 @@ procedure TFConnectionManager.FormCreate(Sender: TObject); var Column: TGTKTreeViewColumn; begin ConnectedEngine := nil; - SetDefaultSize(550, 450); + SetDefaultSize(650, 500); Caption := LANGConnMgr_Caption; Buttons := []; ShowSeparator := False; @@ -126,7 +127,7 @@ begin Column := ListView.Columns.Add; Column.AddAttribute('text', 1); Column.Resizable := True; - Column.FixedWidth := 200; + Column.FixedWidth := 230; Column.SizingMode := smFixed; Column.Caption := LANGConnMgr_NameColumn; Column.Clickable := True; @@ -165,7 +166,14 @@ begin ButtonBox.AddControl(EditButton); ButtonBox.AddControl(RemoveButton); + DoNotSavePasswordsCheckBox := TGTKCheckButton.CreateWithLabel(Self, '_Do not store passwords internally (but still use gnome-keyring)'); + DoNotSavePasswordsCheckBox.Tooltip := 'By checking this option on, Tux Commander will never save passwords into its connection list. Due to the GVFS nature, gnome-keyring will still be used to retrieve stored passwords from your desktop session.'; + DoNotSynchronizeKeyringCheckBox := TGTKCheckButton.CreateWithLabel(Self, 'Do not synchronize passwords to _gnome-keyring'); + DoNotSynchronizeKeyringCheckBox.Tooltip := 'Don''t tell gnome-keyring to save any passwords.'; + ListViewTable.AddControlEx(0, 1, 3, 5, ListViewScrolledWindow, [taoExpand, taoFill], [taoExpand, taoFill], 0, 5); + ListViewTable.AddControlEx(0, 6, 3, 1, DoNotSavePasswordsCheckBox, [taoExpand, taoFill], [taoShrink], 10, 0); + ListViewTable.AddControlEx(0, 7, 3, 1, DoNotSynchronizeKeyringCheckBox, [taoExpand, taoFill], [taoShrink], 10, 2); ListViewTable.AddControlEx(3, 2, 1, 3, ButtonBox, [taoShrink, taoFill], [taoShrink], 5, 5); { ListViewTable.AddControlEx(3, 2, 1, 1, AddConnectionButton, [taoShrink, taoFill], [taoShrink], 5, 5); ListViewTable.AddControlEx(3, 3, 1, 1, EditButton, [taoShrink, taoFill], [taoShrink], 5, 5); @@ -329,6 +337,8 @@ begin end; if (ConfConnMgrActiveItem < 0) or (ConfConnMgrActiveItem > ConnectionMgrList.Count) then ConfConnMgrActiveItem := 0; + DoNotSavePasswordsCheckBox.Checked := ConfConnMgrDoNotSavePasswords; + DoNotSynchronizeKeyringCheckBox.Checked := ConfConnMgrDoNotSynchronizeKeyring; end; @@ -373,7 +383,15 @@ begin Inc(ConnMgr.FVFSAskPasswordTry); if ConnMgr.AFRemoteWait <> nil then DialogParent := ConnMgr.AFRemoteWait.FWidget else DialogParent := ConnMgr.FWidget; - flags := flags or VFS_ASK_PASSWORD_SAVE_INTERNAL; + + if not ConnMgr.DoNotSavePasswordsCheckBox.Checked then + flags := flags or VFS_ASK_PASSWORD_SAVE_INTERNAL; + + // Disable password saving if requested + if ConnMgr.DoNotSynchronizeKeyringCheckBox.Checked then begin + flags := flags and (not VFS_ASK_PASSWORD_SAVING_SUPPORTED); + if password_save <> nil then password_save^ := VFS_PASSWORD_SAVE_NEVER; + end; end; // First pass, supply stored password if we have one @@ -384,7 +402,10 @@ begin DebugMsg(['(II) vfs_ask_password_callback: Supplying stored password from Connection Manager']); Result := True; password^ := g_strdup(PChar(ConnMgr.FActiveConnInfo.Password)); - if (password_save <> nil) { and ConfGnomeKeyringEnabled} then password_save^ := VFS_PASSWORD_SAVE_PERMANENTLY; + if password_save <> nil then + if ConnMgr.DoNotSynchronizeKeyringCheckBox.Checked + then password_save^ := VFS_PASSWORD_SAVE_NEVER + else password_save^ := VFS_PASSWORD_SAVE_PERMANENTLY; end else begin // Show password dialog and continue in loop Result := HandleVFSAskPasswordCallback(DialogParent, AMessage, default_user, default_domain, default_password, flags, username, password, anonymous, domain, password_save); @@ -392,13 +413,18 @@ begin ConnMgr.FSilenceError := Result = False; // Save password back to Connection Manager if Result and (password_save <> nil) and (password_save^ = VFS_PASSWORD_SAVE_PERMANENTLY) and - (ConnMgr.FActiveConnInfo <> nil) and (password <> nil) and (strlen(password^) > 0) then + (ConnMgr.FActiveConnInfo <> nil) and (password <> nil) and (strlen(password^) > 0) and + (not ConnMgr.DoNotSavePasswordsCheckBox.Checked) then begin DebugMsg(['(II) vfs_ask_password_callback: Saving password to Connection Manager']); ConnMgr.FActiveConnInfo.Password := password^; end; end; end; + + // Strip password saving if requested + if (ConnMgr is TFConnectionManager) and ConnMgr.DoNotSynchronizeKeyringCheckBox.Checked and (password_save <> nil) then + password_save^ := VFS_PASSWORD_SAVE_NEVER; end; procedure TFConnectionManager.DoConnect; |
