From 82668cca67c3608412a405a467df4aca0cd0c878 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 19 Jul 2012 09:08:42 +0000 Subject: [PATCH] Issue #1228: Introduce new columns in session managers list of sessions: "Last connect" and "Counter". --- source/connections.dfm | 10 ++++++++++ source/connections.pas | 2 ++ source/dbconnection.pas | 10 +++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/source/connections.dfm b/source/connections.dfm index 8c4a86ee..4de8473d 100644 --- a/source/connections.dfm +++ b/source/connections.dfm @@ -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 diff --git a/source/connections.pas b/source/connections.pas index 06db3e91..f03c6717 100644 --- a/source/connections.pas +++ b/source/connections.pas @@ -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; diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 1b300e69..bc3daecf 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -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;