mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #12: On "Host" tab, prefer visible filename over visible file path
This commit is contained in:
@@ -271,7 +271,7 @@ type
|
||||
function implodestr(seperator: String; a: TStrings) :String;
|
||||
function Explode(Separator, Text: String) :TStringList;
|
||||
procedure ExplodeQuotedList(Text: String; var List: TStringList);
|
||||
function StrEllipsis(const S: String; MaxLen: Integer): String;
|
||||
function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True): String;
|
||||
function encrypt(str: String): String;
|
||||
function decrypt(str: String): String;
|
||||
function HTMLSpecialChars(str: String): String;
|
||||
@@ -456,13 +456,18 @@ end;
|
||||
@param integer Wished Length of string
|
||||
@return string
|
||||
}
|
||||
function StrEllipsis(const S: String; MaxLen: Integer): String;
|
||||
function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True): String;
|
||||
begin
|
||||
Result := S;
|
||||
if Length(Result) <= MaxLen then
|
||||
Exit;
|
||||
SetLength(Result, MaxLen);
|
||||
Result[MaxLen] := '<27>';
|
||||
if FromLeft then begin
|
||||
SetLength(Result, MaxLen);
|
||||
Result[MaxLen] := '<27>';
|
||||
end else begin
|
||||
Result := Copy(Result, Length(Result)-MaxLen, Length(Result));
|
||||
Result := '<27>' + Result;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@ type
|
||||
function IsMySQL: Boolean;
|
||||
function IsMSSQL: Boolean;
|
||||
function IsPostgreSQL: Boolean;
|
||||
function IsSQLite: Boolean;
|
||||
function IsMariaDB: Boolean;
|
||||
function IsPercona: Boolean;
|
||||
function IsTokudb: Boolean;
|
||||
@@ -1456,6 +1457,12 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TConnectionParameters.IsSQLite;
|
||||
begin
|
||||
Result := NetTypeGroup = ngSQLite;
|
||||
end;
|
||||
|
||||
|
||||
function TConnectionParameters.IsMariaDB: Boolean;
|
||||
begin
|
||||
Result := IsMySQL and (Pos('-mariadb', LowerCase(ServerVersion)) > 0);
|
||||
|
||||
@@ -8551,7 +8551,7 @@ procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualN
|
||||
var
|
||||
DBObj, PrevDBObj, ParentDBObj: PDBObject;
|
||||
MainTabToActivate: TTabSheet;
|
||||
DummyStr: String;
|
||||
DummyStr, TabHostName: String;
|
||||
begin
|
||||
// Set wanted main tab and call SetMainTab later, when all lists have been invalidated
|
||||
MainTabToActivate := nil;
|
||||
@@ -8664,7 +8664,11 @@ begin
|
||||
InvalidateVT(ListTables, VTREE_NOTLOADED, True);
|
||||
if FActiveDbObj.NodeType = lntGroup then
|
||||
InvalidateVT(ListTables, VTREE_NOTLOADED, True);
|
||||
SetTabCaption(tabHost.PageIndex, _('Host')+': '+FActiveDbObj.Connection.Parameters.HostName);
|
||||
if FActiveDbObj.Connection.Parameters.IsSQLite then // Prefer visible filename over visible left part of path
|
||||
TabHostName := StrEllipsis(FActiveDbObj.Connection.Parameters.HostName, 60, False)
|
||||
else
|
||||
TabHostName := FActiveDbObj.Connection.Parameters.HostName;
|
||||
SetTabCaption(tabHost.PageIndex, _('Host')+': '+TabHostName);
|
||||
SetTabCaption(tabDatabase.PageIndex, _('Database')+': '+FActiveDbObj.Connection.Database);
|
||||
ShowStatusMsg(FActiveDbObj.Connection.Parameters.NetTypeName(False)+' '+FActiveDbObj.Connection.ServerVersionStr, 3);
|
||||
end else begin
|
||||
|
||||
Reference in New Issue
Block a user