Issue #1228: Introduce new columns in session managers list of sessions: "Last connect" and "Counter".

This commit is contained in:
Ansgar Becker
2012-07-19 09:08:42 +00:00
parent 796dbb1a05
commit 82668cca67
3 changed files with 21 additions and 1 deletions

View File

@@ -134,6 +134,16 @@ object connform: Tconnform
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
Position = 3
WideText = 'Version'
end
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
Position = 4
WideText = 'Last connect'
end
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coAllowFocus]
Position = 5
WideText = 'Counter'
end>
end
object btnNew: TButton

View File

@@ -547,6 +547,8 @@ begin
1: CellText := Sess.Hostname;
2: CellText := Sess.Username;
3: CellText := Sess.ServerVersion;
4: CellText := DateTimeToStr(Sess.LastConnect);
5: CellText := FormatNumber(Sess.Counter);
end;
end;

View File

@@ -158,9 +158,10 @@ type
FHostname, FUsername, FPassword, FAllDatabases, FStartupScriptFilename,
FSessionName, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FServerVersion,
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout: Integer;
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter: Integer;
FLoginPrompt, FCompressed, FLocalTimeZone, FWindowsAuth, FWantSSL: Boolean;
FSessionColor: TColor;
FLastConnect: TDateTime;
function GetImageIndex: Integer;
public
constructor Create;
@@ -179,6 +180,8 @@ type
property NetType: TNetType read FNetType write FNetType;
property NetTypeGroup: TNetTypeGroup read GetNetTypeGroup;
property ServerVersion: String read FServerVersion write FServerVersion;
property Counter: Integer read FCounter write FCounter;
property LastConnect: TDateTime read FLastConnect write FLastConnect;
property SessionName: String read FSessionName write FSessionName;
property SessionColor: TColor read FSessionColor write FSessionColor;
property Hostname: String read FHostname write FHostname;
@@ -747,6 +750,8 @@ end;
class function TConnectionParameters.ReadFromRegistry(Session: String): TConnectionParameters;
var
DummyDate: TDateTime;
begin
if not Mainreg.KeyExists(REGPATH + REGKEY_SESSIONS + Session) then
raise Exception.Create('Error: Session "'+Session+'" not found in registry.')
@@ -779,6 +784,9 @@ begin
Result.Compressed := GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, Session);
Result.LocalTimeZone := GetRegValue(REGNAME_LOCALTIMEZONE, DEFAULT_LOCALTIMEZONE, Session);
Result.ServerVersion := GetRegValue(REGNAME_SERVERVERSION_FULL, '', Session);
DummyDate := StrToDateTime('2000-01-01');
Result.LastConnect := StrToDateTimeDef(GetRegValue(REGNAME_LASTCONNECT, '', Session), DummyDate);
Result.Counter := GetRegValue(REGNAME_CONNECTCOUNT, 0, Session);
end;
end;