From c977b8dd20d6f606f692efcd72e916fc020138f3 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Wed, 3 Sep 2008 15:16:10 +0200 Subject: Retain list selection in Connection Manager Read/write connections on demand only --- UConfig.pas | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'UConfig.pas') diff --git a/UConfig.pas b/UConfig.pas index f95321e..5e13616 100644 --- a/UConfig.pas +++ b/UConfig.pas @@ -107,6 +107,7 @@ var ConfPanelSep, ConfRowHeight, ConfRowHeightReal, ConfNumHistoryItems, ConfUseSmoothScrolling: boolean; ApplicationShuttingDown: boolean; + ConfConnMgrActiveItem: integer; @@ -246,6 +247,7 @@ begin ConfQuickSearchActivationKey := 0; ConfSortDirectoriesLikeFiles := False; ConfQuickRenameSkipExt := True; + ConfConnMgrActiveItem := 0; // Setup default values for colors @@ -921,23 +923,22 @@ begin IniFile.ReadSections(Sections); if Sections.Count > 0 then for i := 0 to Sections.Count - 1 do -{ if Sections[i] = 'General' then begin - ConfMounterUseFSTab := IniFile.ReadBool('General', 'MounterUseFSTab', ConfMounterUseFSTab); - ConfMounterPushDown := IniFile.ReadBool('General', 'MounterPushDown', ConfMounterPushDown); - end else} begin - Item := TConnMgrItem.Create; - with Item do begin - ConnectionName := Sections[i]; - ServiceType := IniFile.ReadString(Sections[i], 'ServiceType', ''); - Server := IniFile.ReadString(Sections[i], 'Server', ''); - Username := IniFile.ReadString(Sections[i], 'Username', ''); - Password := IniFile.ReadString(Sections[i], 'Password', ''); - TargetDir := IniFile.ReadString(Sections[i], 'TargetDir', ''); - PluginID := IniFile.ReadString(Sections[i], 'PluginID', ''); - URI := ConstructURI(False, ServiceType, Server, Username, Password, TargetDir); + if Sections[i] = '__General' then begin + ConfConnMgrActiveItem := IniFile.ReadInteger('__General', 'ConfConnMgrActiveItem', ConfConnMgrActiveItem); + end else begin + Item := TConnMgrItem.Create; + with Item do begin + ConnectionName := Sections[i]; + ServiceType := IniFile.ReadString(Sections[i], 'ServiceType', ''); + Server := IniFile.ReadString(Sections[i], 'Server', ''); + Username := IniFile.ReadString(Sections[i], 'Username', ''); + Password := IniFile.ReadString(Sections[i], 'Password', ''); + TargetDir := IniFile.ReadString(Sections[i], 'TargetDir', ''); + PluginID := IniFile.ReadString(Sections[i], 'PluginID', ''); + URI := ConstructURI(False, ServiceType, Server, Username, Password, TargetDir); + end; + ConnectionMgrList.Add(Item); end; - ConnectionMgrList.Add(Item); - end; Sections.Free; finally try IniFile.Free; except end; @@ -964,7 +965,7 @@ begin IniFile := TMyIniFile.Create(s, False); try try -// IniFile.WriteBool('General', 'MounterUseFSTab', ConfMounterUseFSTab); + IniFile.WriteInteger('__General', 'ConnMgrActiveItem', ConfConnMgrActiveItem); if ConnectionMgrList.Count > 0 then for i := 0 to ConnectionMgrList.Count - 1 do with TConnMgrItem(ConnectionMgrList[i]) do begin @@ -1150,7 +1151,6 @@ initialization ReadAssoc; ReadBookmarks; ReadMounter; - ReadConnections; // Apply the settings LoadIcons; @@ -1158,7 +1158,6 @@ initialization finalization // Save the settings WriteBookmarks; -// WriteConnections; -- not needed, saving when Connection Manager closes WriteMainSettings; if ConfSavePanelTabs then begin WriteTabs(True, LeftPanelTabs, LeftTabSortIDs, LeftTabSortTypes); -- cgit v1.2.3