summaryrefslogtreecommitdiff
path: root/UMain.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-07 20:40:48 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-07 20:40:48 +0200
commita0f1e0e9db4b0edee45018c47a08761916af0ce6 (patch)
treedc9d05f5772442f61ec913631540b24cf67d5e8a /UMain.pas
parentecde167da74c86bc047aaf84c5e548cf65a5da98 (diff)
downloadtuxcmd-0.6.38.tar.xz
Revised UTF-8 filenames supportv0.6.38
Diffstat (limited to 'UMain.pas')
-rw-r--r--UMain.pas323
1 files changed, 175 insertions, 148 deletions
diff --git a/UMain.pas b/UMain.pas
index 3fb485a..68558a5 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -1528,7 +1528,7 @@ begin
DeactivateQuickFind(LeftPanel);
if Application.GTKVersion_2_0_5_Up then Data := DataList[ItemIndex]
else Data := AListView.Items[ItemIndex].AsPointer(0);
- DebugMsg(['Selected:', Data^.AName]);
+ DebugMsg(['Selected:', Data^.FDisplayName]);
if not Assigned(Data) then Exit;
if Data^.UpDir then ChangingDir(LeftPanel, '..') else
if Data^.IsDir then begin
@@ -1536,16 +1536,16 @@ begin
if AListView.Items.Count > 0 then AListView.Items[0].Selected := True;
Application.ProcessMessages;
end;
- ChangingDir(LeftPanel, String(Data^.AName));
+ ChangingDir(LeftPanel, Data^.FName);
end else begin
- Ext := ANSIUpperCase(Trim(Copy(String(Data^.AName), LastDelimiter('.', String(Data^.AName)) + 1, Length(String(Data^.AName)) - LastDelimiter('.', String(Data^.AName)))));
+ Ext := WideUpperCase(Trim(Copy(String(Data^.FDisplayName), LastDelimiter('.', String(Data^.FDisplayName)) + 1, Length(String(Data^.FDisplayName)) - LastDelimiter('.', String(Data^.FDisplayName)))));
// Test for known internal functions
if (Ext = 'SFV') or (Ext = 'MD5') then miVerifyChecksumsClick(Self) else
if (Ext = 'CRC') or (Ext = '001') then miMergeFilesClick(Self) else
- if not ((Engine is TLocalTreeEngine) and HandleVFSArchive(Ext, IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.AName), String(Data^.AName), '/')) then
+ if not ((Engine is TLocalTreeEngine) and HandleVFSArchive(Ext, IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), String(Data^.FName), '/')) then
if (not ConfUseURI) or ((Engine is TVFSEngine) and TVFSEngine(Engine).ArchiveMode)
- then RunFile(IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.AName), Engine, -1)
- else RunFile(ExcludeTrailingPathDelimiter(Engine.GetPrefix) + IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.AName), Engine, -1);
+ then RunFile(IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), Engine, -1)
+ else RunFile(ExcludeTrailingPathDelimiter(Engine.GetPrefix) + IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), Engine, -1);
end;
end;
@@ -1568,8 +1568,8 @@ var ListView: TGTKListView;
begin
Result := False;
for i := 0 to DataList.Count - 1 do
- if (CaseSensitive and (ANSICompareStr(string(PDataItem(DataList[i])^.AName), AName) = 0)) or
- ((not CaseSensitive) and (ANSICompareText(string(PDataItem(DataList[i])^.AName), AName) = 0)) then
+ if (CaseSensitive and (WideCompareStr(string(PDataItem(DataList[i])^.FDisplayName), AName) = 0)) or
+ ((not CaseSensitive) and (WideCompareText(string(PDataItem(DataList[i])^.FDisplayName), AName) = 0)) then
begin
Sel := i;
Result := True;
@@ -1647,7 +1647,7 @@ begin
if DataList.Count > 0 then
for i := 0 to DataList.Count - 1 do
if PDataItem(DataList[i])^.Selected and (not PDataItem(DataList[i])^.UpDir)
- then SelectedFiles.Add(PDataItem(DataList[i])^.AName);
+ then SelectedFiles.Add(PDataItem(DataList[i])^.FName);
end;
Editing := False;
DeactivateQuickFind(LeftPanel);
@@ -1687,12 +1687,12 @@ begin
end else
if OpenDirThread.ChDirResult <> 0 then begin
if OpenDirThread.ChDirResult = 1 then Application.MessageBox(Format(LANGErrorGettingListingForSPanelNoPath, [LANGPanelStrings[LeftPanel], 'Exception']), [mbOK], mbError, mbNone, mbOK)
- else Application.MessageBox(Format(LANGErrorGettingListingForSPanel, [LANGPanelStrings[LeftPanel], ANSIToUTF8(GetErrorString(OpenDirThread.ChDirResult)), ANSIToUTF8(NewPath)]), [mbOK], mbError, mbNone, mbOK);
+ else Application.MessageBox(Format(LANGErrorGettingListingForSPanel, [LANGPanelStrings[LeftPanel], GetErrorString(OpenDirThread.ChDirResult), NewPath]), [mbOK], mbError, mbNone, mbOK);
DebugMsg(['TFMain.ChangingDir: Freeing thread...']);
OpenDirThread.Free;
end else begin
if OpenDirThread.ListingResult <> 0 then begin
- Application.MessageBox(Format(LANGErrorGettingListingForSPanel, [LANGPanelStrings[LeftPanel], ANSIToUTF8(GetErrorString(OpenDirThread.ListingResult)), Engine.Path]), [mbOK], mbError, mbNone, mbOK);
+ Application.MessageBox(Format(LANGErrorGettingListingForSPanel, [LANGPanelStrings[LeftPanel], GetErrorString(OpenDirThread.ListingResult), Engine.Path]), [mbOK], mbError, mbNone, mbOK);
Exit;
end;
s := OpenDirThread.ASelItem;
@@ -1707,15 +1707,16 @@ begin
if DataList.Count > 0 then begin
if PreserveSelection and (SelectedFiles.Count > 0) and (DataList.Count > 0) then
for i := 0 to DataList.Count - 1 do
- if (not PDataItem(DataList[i])^.UpDir) and (SelectedFiles.IndexOf(PDataItem(DataList[i])^.AName) >= 0)
+ if (not PDataItem(DataList[i])^.UpDir) and (SelectedFiles.IndexOf(PDataItem(DataList[i])^.FName) >= 0)
then PDataItem(DataList[i])^.Selected := True;
Sel := 0;
- b := (NewPath = '..') and (Length(Trim(s)) > 0) and LookupItem(s, True);
+ b := (NewPath = '..') and (Length(Trim(s)) > 0) and LookupItem(StrToUTF8(s), True);
if not b then b := (HiliString1 <> '') and LookupItem(HiliString1, True);
- if (not b) and (HiliString1 <> '') then LookupItem(HiliString1, False);
- if (not b) and (HiliString2 <> '') then LookupItem(HiliString2, True);
- if (not b) and (HiliString2 <> '') then LookupItem(HiliString2, False);
- if (Engine.Path = '/') and (NewPath = '/') then Sel := ListView.ConvertFromSorted(0);
+ if (not b) and (HiliString1 <> '') then b := LookupItem(HiliString1, False);
+ if (not b) and (HiliString2 <> '') then b := LookupItem(HiliString2, True);
+ if (not b) and (HiliString2 <> '') then b := LookupItem(HiliString2, False);
+// DebugMsg(['TFMain.ChangingDir: Engine.Path = "', Engine.Path, '", NewPath = "', NewPath, '", HiliString1 = "', HiliString1, '", HiliString2 = "', HiliString2, '"']);
+ if (not b) and ((Engine.Path = '/') or (NewPath = '/')) and (HiliString1 = '') and (HiliString2 = '') then Sel := ListView.ConvertFromSorted(0);
ListView.Items[Sel].Selected := True;
// Application.ProcessMessages;
ListView.Items[Sel].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
@@ -1729,7 +1730,7 @@ begin
TabEngines[ANotebook.PageIndex] := Engine;
s := ExtractFileName(ExcludeTrailingPathDelimiter(Engine.Path));
if s = '' then s := '/';
- SetTabLabel(ANotebook, ANotebook.PageIndex, ANSIToUTF8(s), ANSIToUTF8(Engine.Path));
+ SetTabLabel(ANotebook, ANotebook.PageIndex, StrToUTF8(s), StrToUTF8(Engine.Path));
end;
end; // of Chdir, Listing, ...
Engine.ExplicitChDir('/');
@@ -1769,12 +1770,12 @@ begin
if RightListView.Focused then LeftPanel := False else
LeftPanel := LeftLastFocused;
if LeftPanel then begin
- if LeftPanelEngine.GetPrefix <> '' then s := ANSIToUTF8(Format(ConstFullPathFormatStr, [LeftPanelEngine.GetPrefix, LeftPanelEngine.Path]))
- else s := ANSIToUTF8(LeftPanelEngine.Path);
+ if LeftPanelEngine.GetPrefix <> '' then s := Format(ConstFullPathFormatStr, [LeftPanelEngine.GetPrefix, LeftPanelEngine.Path])
+ else s := LeftPanelEngine.Path;
end else
- if RightPanelEngine.GetPrefix <> '' then s := ANSIToUTF8(Format(ConstFullPathFormatStr, [RightPanelEngine.GetPrefix, RightPanelEngine.Path]))
- else s := ANSIToUTF8(RightPanelEngine.Path);
- Caption := Format('Tux Commander [%s]', [s]);
+ if RightPanelEngine.GetPrefix <> '' then s := Format(ConstFullPathFormatStr, [RightPanelEngine.GetPrefix, RightPanelEngine.Path])
+ else s := RightPanelEngine.Path;
+ Caption := Format('Tux Commander [%s]', [StrToUTF8(s)]);
end;
procedure TFMain.UpdatePanelInfo;
@@ -1785,11 +1786,11 @@ begin
UpdateCaption;
Time1 := Now;
if LeftPanelEngine.GetPrefix <> ''
- then LeftPathLabel.Caption := ANSIToUTF8(Format(ConstFullPathFormatStr, [LeftPanelEngine.GetPrefix, LeftPanelEngine.Path]))
- else LeftPathLabel.Caption := ANSIToUTF8(LeftPanelEngine.Path);
+ then LeftPathLabel.Caption := StrToUTF8(Format(ConstFullPathFormatStr, [LeftPanelEngine.GetPrefix, LeftPanelEngine.Path]))
+ else LeftPathLabel.Caption := StrToUTF8(LeftPanelEngine.Path);
if RightPanelEngine.GetPrefix <> ''
- then RightPathLabel.Caption := ANSIToUTF8(Format(ConstFullPathFormatStr, [RightPanelEngine.GetPrefix, RightPanelEngine.Path]))
- else RightPathLabel.Caption := ANSIToUTF8(RightPanelEngine.Path);
+ then RightPathLabel.Caption := StrToUTF8(Format(ConstFullPathFormatStr, [RightPanelEngine.GetPrefix, RightPanelEngine.Path]))
+ else RightPathLabel.Caption := StrToUTF8(RightPanelEngine.Path);
LeftPathLabel.UseMarkup := True;
RightPathLabel.UseMarkup := True;
if LeftLastFocused then s := LeftPathLabel.Caption
@@ -1798,19 +1799,19 @@ begin
LeftPanelEngine.GetFileSystemInfo(LeftPanelEngine.Path, FSSize, FSFree, FSName);
if FSName <> ''
then LeftDiskInfoLabel.Caption := Format(LANGDiskStatVolNameFmt, [FSName,
- ANSIToUTF8(FormatSize(FSFree, 1024)),
- ANSIToUTF8(FormatSize(FSSize, 1024))])
+ FormatSize(FSFree, 1024),
+ FormatSize(FSSize, 1024)])
else LeftDiskInfoLabel.Caption := Format(LANGDiskStatFmt,
- [ANSIToUTF8(FormatSize(FSFree, 1024)),
- ANSIToUTF8(FormatSize(FSSize, 1024))]);
+ [FormatSize(FSFree, 1024),
+ FormatSize(FSSize, 1024)]);
RightPanelEngine.GetFileSystemInfo(RightPanelEngine.Path, FSSize, FSFree, FSName);
if FSName <> ''
then RightDiskInfoLabel.Caption := Format(LANGDiskStatVolNameFmt, [FSName,
- ANSIToUTF8(FormatSize(FSFree, 1024)),
- ANSIToUTF8(FormatSize(FSSize, 1024))])
+ FormatSize(FSFree, 1024),
+ FormatSize(FSSize, 1024)])
else RightDiskInfoLabel.Caption := Format(LANGDiskStatFmt,
- [ANSIToUTF8(FormatSize(FSFree, 1024)),
- ANSIToUTF8(FormatSize(FSSize, 1024))]);
+ [FormatSize(FSFree, 1024),
+ FormatSize(FSSize, 1024)]);
LeftDiskInfoLabel.UseMarkup := True;
RightDiskInfoLabel.UseMarkup := True;
@@ -1853,8 +1854,8 @@ begin
end;
end;
end;
- s := Format(LANGStatusLineFmt, [ANSIToUTF8(FormatSize(Size, 1024)),
- ANSIToUTF8(FormatSize(TotalSize, 1024)), NumSel, TotalFiles]);
+ s := Format(LANGStatusLineFmt, [FormatSize(Size, 1024),
+ FormatSize(TotalSize, 1024), NumSel, TotalFiles]);
if LeftPanel then LeftStatusLine.Caption := s
else RightStatusLine.Caption := s;
end;
@@ -1981,7 +1982,7 @@ begin
if Assigned(Data) and (not Data^.UpDir) and (ConfSelectAllDirs or (not Data^.IsDir)) {and (Data^.Selected <> ExpandSel)} then begin
b := False;
for j := 0 to Length(Wilds) - 1 do
- b := b or IsWild(String(Data^.AName), Wilds[j], True);
+ b := b or IsWild(String(Data^.FDisplayName), Wilds[j], True);
if b then begin
Data^.Selected := ExpandSel;
Found := True;
@@ -2114,7 +2115,7 @@ begin
if not ImageCol then begin
if Editing and (InplaceEditItem.Data = Data) and (ColumnID < 3) and ((ColumnID = 0) or (ColumnID = 1) or Assigned(tree_column^.editable_widget))
then begin
- if (ColumnID = 0) or (ColumnID = 1) then s := PChar(ANSIToUTF8(string(AName))) else s := nil;
+ if (ColumnID = 0) or (ColumnID = 1) then s := FDisplayName else s := nil;
g_object_set(cell, 'text', s, 'foreground-gdk', AFGColor, nil);
if Application.GTKVersion_2_2_0_Up or (not ConfUseFileTypeIcons) then
g_object_set(cell, 'background-gdk', ABGColor, nil);
@@ -2162,7 +2163,7 @@ begin
try
FNewDir := TFNewDir.Create(Self);
if FNewDir.Run = mbOK
- then NewDir := Utf8ToAnsi(FNewDir.Entry.Text)
+ then NewDir := UTF8ToStr(FNewDir.Entry.Text)
else Exit;
finally
FNewDir.Free;
@@ -2170,7 +2171,7 @@ begin
if NewDir = '' then Exit;
if not MakeDirectory(ListView, Engine, LeftPanel, NewDir) then Exit;
- ChangingDir(LeftPanel, Engine.Path, NewDir);
+ ChangingDir(LeftPanel, Engine.Path, StrToUTF8(NewDir));
DoRefresh(not LeftPanel, True, True);
except end;
finally
@@ -2233,7 +2234,7 @@ begin
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if Selected and (not UpDir) then begin
- s2 := s2 + #10 + AName;
+ s2 := s2 + #10 + FDisplayName;
Inc(j);
if j = 5 then Break;
end;
@@ -2242,8 +2243,8 @@ begin
smsg := Format(LANGDoYouReallyWantToDeleteTheSS, [s, s2]);
end else begin
if Assigned(Data) then
- if Data^.IsDir then s := Format(LANGDirectoryS, [ANSIToUTF8(string(Data^.AName))])
- else s := Format(LANGFileS, [ANSIToUTF8(string(Data^.AName))]);
+ if Data^.IsDir then s := Format(LANGDirectoryS, [string(Data^.FDisplayName)])
+ else s := Format(LANGFileS, [string(Data^.FDisplayName)]);
smsg := Format(LANGDoYouReallyWantToDeleteTheS, [s]);
end;
if Application.MessageBox(QuotePercentStr(smsg), [mbYes, mbNo], mbQuestion, mbNone, mbNo) <> mbYes then Exit;
@@ -2370,7 +2371,7 @@ end;
procedure TFMain.DoCopyMove(LeftPanel, CopyMode, ShiftPressed: boolean; ListView: TGTKListView; Engine: TPanelEngine; DataList: TList);
var i: integer;
SelCount: longint;
- NewPath, SelSingle, NextItem1, NextItem2: string;
+ NewPath, NewPathx, SelSingle, NextItem1, NextItem2: string;
AWorkingThread: TWorkerThread;
AFProgress: TFProgress;
CurrentEngine, OppositeEngine: TPanelEngine;
@@ -2392,7 +2393,7 @@ begin
SelSingle := '';
if SelCount = 0 then begin
SelCount := 1;
- SelSingle := PDataItem(ListView.Selected.Data)^.AName;
+ SelSingle := PDataItem(ListView.Selected.Data)^.FDisplayName;
end;
if LeftPanel then begin
@@ -2413,17 +2414,19 @@ begin
FCopyMove.Label1.Caption := Format(LANGMoveRenameDFileDirectoriesTo, [SelCount]);
end;
if ShiftPressed then begin
- if SelSingle <> '' then FCopyMove.Entry.Text := ANSIToUTF8(SelSingle)
+ if SelSingle <> '' then FCopyMove.Entry.Text := SelSingle
else FCopyMove.Entry.Text := '*.*';
end else
- if OppositeEngine is TLocalTreeEngine then FCopyMove.Entry.Text := ANSIToUTF8(OppositeEngine.Path)
- else FCopyMove.Entry.Text := ANSIToUTF8(Format(ConstFullPathFormatStr, [OppositeEngine.GetPrefix, OppositeEngine.Path]));
+ if OppositeEngine is TLocalTreeEngine then FCopyMove.Entry.Text := OppositeEngine.Path
+ else FCopyMove.Entry.Text := Format(ConstFullPathFormatStr, [OppositeEngine.GetPrefix, OppositeEngine.Path]);
FCopyMove.Entry.SelectAll;
if FCopyMove.Run <> mbOK then Exit;
- NewPath := UTF8ToANSI(FCopyMove.Entry.Text);
+ NewPathx := FCopyMove.Entry.Text;
+ NewPath := UTF8ToStr(FCopyMove.Entry.Text);
finally
FCopyMove.Free;
end;
+ DebugMsg(['TFMain.DoCopyMove: NewPath = "', NewPath, '"']);
// Handle password in archives
if (CurrentEngine is TVFSEngine) and (CurrentEngine as TVFSEngine).GetPasswordRequired and (Length((CurrentEngine as TVFSEngine).Password) < 1) then
@@ -2431,7 +2434,11 @@ begin
if (OppositeEngine is TVFSEngine) and (OppositeEngine as TVFSEngine).GetPasswordRequired and (Length((OppositeEngine as TVFSEngine).Password) < 1) then
if not HandleSetPassword(OppositeEngine) then Exit;
+ NextItem1 := ''; NextItem2 := '';
FindNextSelected(ListView, DataList, NextItem1, NextItem2);
+ DebugMsg(['TFMain.DoCopyMove: FindNextSelected, NextItem1 = "', NextItem1, '", NextItem2 = "', NextItem2, '"']);
+ if ShiftPressed then NextItem1 := NewPathx;
+
AWorkingThread := TWorkerThread.Create;
DebugMsg(['TFMain.DoCopyMove: Creating thread...']);
AFProgress := TFProgress.Create(Self);
@@ -2620,8 +2627,9 @@ begin
DataList := RightPanelData;
end;
Editing := False;
+ DebugMsg(['TFMain.ListViewEdited: FDisplayName = "', String(PDataItem(InplaceEditItem.Data)^.FDisplayName), '", NewText = "', NewText, '"']);
if (AListView.Selected = InplaceEditItem) and (AListView.Selected.Data = InplaceEditItem.Data) and
- (String(PDataItem(InplaceEditItem.Data)^.AName) <> NewText) then
+ (String(PDataItem(InplaceEditItem.Data)^.FDisplayName) <> NewText) then
begin
AWorkingThread := TWorkerThread.Create;
DebugMsg(['TFMain.ListViewEdited: Creating thread...']);
@@ -2639,7 +2647,7 @@ begin
AWorkingThread.WorkerProcedure := CopyFilesWorker;
AWorkingThread.ParamBool3 := False;
AWorkingThread.ParamBool4 := True;
- AWorkingThread.ParamString1 := UTF8ToANSI(NewText);
+ AWorkingThread.ParamString1 := UTF8ToStr(NewText);
AWorkingThread.ParamDataItem1 := InplaceEditItem.Data;
AWorkingThread.Resume;
// AWorkingThread.WorkerProcedure(AWorkingThread);
@@ -2654,6 +2662,7 @@ begin
end;
s1 := ''; s2 := '';
FindNextSelected(AListView, DataList, s1, s2);
+ DebugMsg(['TFMain.ListViewEdited: FindNextSelected, s1 = "', s1, '", s2 = "', s2, '"']);
ChangingDir(AListView = LeftListView, Engine.Path, {String(PDataItem(InplaceEditItem.Data)^.AName),} NewText, s2);
DoRefresh(AListView <> LeftListView, True, True);
end;
@@ -2680,11 +2689,11 @@ begin
if Sender = LeftListView then begin
if LeftPanelNotebook.Visible and (LeftPathsHighlight.Count > LeftPanelNotebook.PageIndex) and (LeftPanelNotebook.PageIndex >= 0) and
Assigned(LeftListView.Selected) and Assigned(LeftListView.Selected.Data)
- then LeftPathsHighlight[LeftPanelNotebook.PageIndex] := PDataItem(LeftListView.Selected.Data)^.AName;
+ then LeftPathsHighlight[LeftPanelNotebook.PageIndex] := PDataItem(LeftListView.Selected.Data)^.FName;
end else
if RightPanelNotebook.Visible and (RightPathsHighlight.Count > RightPanelNotebook.PageIndex) and (RightPanelNotebook.PageIndex >= 0) and
Assigned(RightListView.Selected) and Assigned(RightListView.Selected.Data)
- then RightPathsHighlight[RightPanelNotebook.PageIndex] := PDataItem(RightListView.Selected.Data)^.AName;
+ then RightPathsHighlight[RightPanelNotebook.PageIndex] := PDataItem(RightListView.Selected.Data)^.FName;
{ if Application.GTKVersion_2_6_0_Up then begin
AListView := Sender as TGTKListView;
if Assigned(AListView) and Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and Assigned(PDataItem(AListView.Selected.Data)^.ItemColor)
@@ -2728,6 +2737,7 @@ var Entry: TGTKEntry;
Data: PDataItem;
Found: boolean;
OldSelectionChangedEvent: TNotifyEvent;
+ g: PChar;
begin
Result := False;
if not QuickFind then Exit;
@@ -2741,18 +2751,26 @@ begin
DataList := RightPanelData;
end;
if Key = GDK_BACKSPACE then begin
- if Length(Entry.Text) > 0 then Entry.Text := AnsiToUTF8(Copy(UTF8ToAnsi(Entry.Text), 1, Length(UTF8ToAnsi(Entry.Text)) - 1));
- NewText := UTF8ToAnsi(Entry.Text);
+ if g_utf8_strlen(PChar(Entry.Text), -1) > 0 then begin
+// DebugMsg(['TFMain.QuickFindSendKey: before delete: "', Entry.Text, '", ansi = "', UTF8ToStr(Entry.Text), '"']);
+ g := malloc(Length(Entry.Text));
+ memset(g, 0, Length(Entry.Text));
+ g_utf8_strncpy(g, PChar(Entry.Text), g_utf8_strlen(PChar(Entry.Text), -1) - 1);
+// DebugMsg(['TFMain.QuickFindSendKey: after delete: "', g, '", ansi = "', UTF8ToStr(g), '"']);
+ Entry.Text := g;
+ Libc.free(g);
+ end;
+ NewText := Entry.Text;
end else begin
- s := UTF8ToANSI(UTF8Encode(WideChar(KeyValToUnicode(Key))));
+ s := UTF8Encode(WideChar(KeyValToUnicode(Key)));
if (Length(s) = 0) or (s = #0) then Exit;
- NewText := UTF8ToAnsi(Entry.Text) + s;
+ NewText := Entry.Text + s;
end;
if (DataList.Count > 0) and (Length(NewText) > 0) then begin
Found := False;
for i := 0 to DataList.Count - 1 do begin
Data := DataList[AListView.ConvertFromSorted(i)];
- if Assigned(Data) and (not Data^.UpDir) and (Pos(AnsiUpperCase(NewText), AnsiUpperCase(Data^.AName)) = 1) then begin
+ if Assigned(Data) and (not Data^.UpDir) and (Pos(WideUpperCase(NewText), WideUpperCase(Data^.FDisplayName)) = 1) then begin
Found := True;
OldSelectionChangedEvent := AListView.OnSelectionChanged;
AListView.OnSelectionChanged := nil;
@@ -2762,7 +2780,7 @@ begin
Break;
end;
end;
- if Found then Entry.Text := AnsiToUTF8(NewText)
+ if Found then Entry.Text := NewText
else Beep;
Result := True;
end;
@@ -2807,13 +2825,13 @@ begin
FChecksum.Engine := Engine;
FChecksum.DataList := DataList;
FChecksum.AListView := AListView;
- if SelCount = 0 then b := FChecksum.ProcessFile(IncludeTrailingPathDelimiter(Engine.Path) + string(PDataItem(AListView.Selected.Data)^.AName))
+ if SelCount = 0 then b := FChecksum.ProcessFile(IncludeTrailingPathDelimiter(Engine.Path) + string(PDataItem(AListView.Selected.Data)^.FName))
else begin
b := False;
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if (not UpDir) and (not IsDir) and Selected then {$B+}
- b := b or FChecksum.ProcessFile(IncludeTrailingPathDelimiter(Engine.Path) + string(AName));
+ b := b or FChecksum.ProcessFile(IncludeTrailingPathDelimiter(Engine.Path) + string(FName));
{$B-}
end;
if b and (FChecksum.List.Count > 0) then FChecksum.Run;
@@ -2865,17 +2883,17 @@ begin
FChecksumDruid.Engine := Engine;
if Engine.Path = '/' then FChecksumDruid.DirName := 'root'
else FChecksumDruid.DirName := ExtractFileName(ExcludeTrailingPathDelimiter(Engine.Path));
- if SelCount = 0 then FChecksumDruid.FileNames.Add(IncludeTrailingPathDelimiter(Engine.Path) + string(PDataItem(AListView.Selected.Data)^.AName))
+ if SelCount = 0 then FChecksumDruid.FileNames.Add(IncludeTrailingPathDelimiter(Engine.Path) + string(PDataItem(AListView.Selected.Data)^.FName))
else
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if (not UpDir) and (not IsDir) and Selected then
- FChecksumDruid.FileNames.Add(IncludeTrailingPathDelimiter(Engine.Path) + string(AName));
+ FChecksumDruid.FileNames.Add(IncludeTrailingPathDelimiter(Engine.Path) + string(FName));
FChecksumDruid.Run;
finally
if FChecksumDruid.SeparateFileCheckBox.Checked
then DoRefresh(AListView = LeftListView, True, True)
- else ChangingDir(AListView = LeftListView, Engine.Path, FChecksumDruid.FileNameEntry.Text, PDataItem(AListView.Selected.Data)^.AName);
+ else ChangingDir(AListView = LeftListView, Engine.Path, FChecksumDruid.FileNameEntry.Text, PDataItem(AListView.Selected.Data)^.FName);
DoRefresh(AListView <> LeftListView, True, True);
FChecksumDruid.Free;
Engine.ExplicitChDir('/');
@@ -2923,12 +2941,12 @@ begin
FNewDir := TFNewDir.Create(Self);
FNewDir.Caption := LANGMergeCaption;
FNewDir.Label1.SetSizeRequest(500, -1);
- FNewDir.Label1.Caption := Format(LANGMergeSAndAllFilesWithAscendingNamesToTheFollowingDirectory, [ANSIToUTF8(PDataItem(AListView.Selected.Data)^.AName)]);
- if LeftPanel then FNewDir.Entry.Text := ANSIToUTF8(RightPanelEngine.Path)
- else FNewDir.Entry.Text := ANSIToUTF8(LeftPanelEngine.Path);
+ FNewDir.Label1.Caption := Format(LANGMergeSAndAllFilesWithAscendingNamesToTheFollowingDirectory, [PDataItem(AListView.Selected.Data)^.FDisplayName]);
+ if LeftPanel then FNewDir.Entry.Text := StrToUTF8(RightPanelEngine.Path)
+ else FNewDir.Entry.Text := StrToUTF8(LeftPanelEngine.Path);
FNewDir.Entry.SelectAll;
if FNewDir.Run = mbOK
- then FilePath := UTF8ToAnsi(FNewDir.Entry.Text)
+ then FilePath := UTF8ToStr(FNewDir.Entry.Text)
else Exit;
finally
FNewDir.Free;
@@ -2940,7 +2958,7 @@ begin
AFProgress := TFProgress.Create(Self);
try
AWorkingThread.ParamString1 := FilePath;
- AWorkingThread.ParamString2 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.AName;
+ AWorkingThread.ParamString2 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName;
HasInitialCRC := CRCGetInfo(AWorkingThread.ParamString2, Engine, TargetName, TargetCRC, TargetSize);
AWorkingThread.ParamString3 := TargetName;
AWorkingThread.ParamBool1 := HasInitialCRC;
@@ -2965,7 +2983,7 @@ begin
AWorkingThread.Free;
end;
- ChangingDir(LeftPanel, Engine.Path, s, PDataItem(AListView.Selected.Data)^.AName);
+ ChangingDir(LeftPanel, Engine.Path, s, PDataItem(AListView.Selected.Data)^.FName);
DoRefresh(not LeftPanel, True, True);
finally
Application.ProcessMessages;
@@ -3008,23 +3026,23 @@ begin
FilePath := '';
try
FSplitFile := TFSplitFile.Create(Self);
- FSplitFile.Label1.Caption := Format(LANGSplitTheFileSToDirectory, [ANSIToUTF8(PDataItem(AListView.Selected.Data)^.AName)]);
+ FSplitFile.Label1.Caption := Format(LANGSplitTheFileSToDirectory, [PDataItem(AListView.Selected.Data)^.FDisplayName]);
FSplitFile.Label1.UseUnderline := True;
- if LeftPanel then FSplitFile.Entry.Text := AnsiToUtf8(RightPanelEngine.Path)
- else FSplitFile.Entry.Text := AnsiToUtf8(LeftPanelEngine.Path);
+ if LeftPanel then FSplitFile.Entry.Text := StrToUTF8(RightPanelEngine.Path)
+ else FSplitFile.Entry.Text := StrToUTF8(LeftPanelEngine.Path);
FSplitFile.Entry.SelectAll;
if FSplitFile.Run = mbOK
- then FilePath := UTF8ToAnsi(FSplitFile.Entry.Text)
+ then FilePath := UTF8ToStr(FSplitFile.Entry.Text)
else Exit;
DeleteTarget := FSplitFile.DeleteTargetCheckBox.Checked;
MaxSize := 0;
for i := 1 to Length(SplitConsts) do
- if Trim(AnsiUpperCase(SplitConsts[i].Title)) = Trim(AnsiUpperCase(FSplitFile.SizeCombo.Entry.Text)) then
+ if Trim(WideUpperCase(SplitConsts[i].Title)) = Trim(WideUpperCase(FSplitFile.SizeCombo.Entry.Text)) then
begin
MaxSize := SplitConsts[i].PartSize;
Break;
end;
- if MaxSize = 0 then MaxSize := GetStrSize(UTF8ToANSI(FSplitFile.SizeCombo.Entry.Text));
+ if MaxSize = 0 then MaxSize := GetStrSize(FSplitFile.SizeCombo.Entry.Text);
finally
FSplitFile.Free;
end;
@@ -3034,7 +3052,7 @@ begin
DebugMsg(['TFMain.miSplitFileClick: Creating thread...']);
AFProgress := TFProgress.Create(Self);
try
- AWorkingThread.ParamString1 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.AName;
+ AWorkingThread.ParamString1 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName;
AWorkingThread.ParamString2 := FilePath;
AWorkingThread.ParamBool1 := DeleteTarget;
AWorkingThread.ParamInt64 := MaxSize;
@@ -3105,7 +3123,7 @@ begin
if (not Assigned(AListView.Selected)) or (not Assigned(AListView.Selected.Data)) or PDataItem(AListView.Selected.Data)^.UpDir or
(not PDataItem(AListView.Selected.Data)^.IsDir)
then begin if Length(s) > 1 then s := IncludeTrailingPathDelimiter(Copy(s, 1, LastDelimiter(PathDelim, s))); end
- else s := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(s) + PDataItem(AListView.Selected.Data)^.AName);
+ else s := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(s) + PDataItem(AListView.Selected.Data)^.FName);
end;
if IncludeTrailingPathDelimiter(TargetEngine.Path) <> s then begin
if LeftPanel then RightPanelEngine := TargetEngine
@@ -3182,15 +3200,15 @@ begin
ANewDir.Label1.FocusControl := ANewDir.Entry;
if Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and (not PDataItem(AListView.Selected.Data)^.IsDir) and
(not PDataItem(AListView.Selected.Data)^.UpDir)
- then ANewDir.Entry.Text := AnsiToUTF8(PDataItem(AListView.Selected.Data)^.AName)
+ then ANewDir.Entry.Text := PDataItem(AListView.Selected.Data)^.FDisplayName
else ANewDir.Entry.Text := '';
if Length(ANewDir.Entry.Text) > 0 then ANewDir.Entry.SelectAll;
if ANewDir.Run <> mbOK then Exit;
- AFile := IncludeTrailingPathDelimiter(Engine.Path) + UTF8ToAnsi(ANewDir.Entry.Text);
+ AFile := IncludeTrailingPathDelimiter(Engine.Path) + UTF8ToStr(ANewDir.Entry.Text);
finally
ANewDir.Free;
end;
- end else AFile := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.AName;
+ end else AFile := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName;
EditViewFileInternal(Self, AFile, Engine, View, NewFile);
@@ -3226,7 +3244,7 @@ begin
end else AViewer.Resume; *)
AViewer := TFViewer.Create(ParentWindow);
if not AViewer.LoadFile(Filename) then begin
- Application.MessageBox(Format(LANGCannotLoadFile, [ANSIToUTF8(Filename)]), [mbOK], mbError, mbNone, mbOK);
+ Application.MessageBox(Format(LANGCannotLoadFile, [Filename]), [mbOK], mbError, mbNone, mbOK);
AViewer.Free;
end else begin
// gtk_window_set_transient_for(PGtkWindow(AViewer.FWidget), PGtkWindow(ParentWindow.FWidget));
@@ -3236,7 +3254,7 @@ begin
if View then x := ConfViewerTerminalBehaviour
else x := ConfEditorTerminalBehaviour;
if not ExecuteProgram(Format('%s %s', [s, QuoteStr(Filename)]), ExtractFilePath(Filename), x = 0, x = 1, Error) then
- Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [ANSIToUTF8(s)]), [mbOK], mbError, mbNone, mbOK);
+ Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [s]), [mbOK], mbError, mbNone, mbOK);
end;
end;
@@ -3285,24 +3303,24 @@ begin
AutodetectGUI := True;
RunInTerminal := False;
if (Pos('.', ExtractFileName(Path)) > 0) and (LastDelimiter('.', ExtractFileName(Path)) < Length(ExtractFileName(Path))) then begin
- Ext := ANSIUpperCase(Trim(Copy(ExtractFileName(Path), LastDelimiter('.', ExtractFileName(Path)) + 1, Length(ExtractFileName(Path)) - LastDelimiter('.', ExtractFileName(Path)))));
+ Ext := WideUpperCase(Trim(Copy(ExtractFileName(Path), LastDelimiter('.', ExtractFileName(Path)) + 1, Length(ExtractFileName(Path)) - LastDelimiter('.', ExtractFileName(Path)))));
// Search in the association list
if AssocList.Count > 0 then
for i := 0 to AssocList.Count - 1 do
with TFileAssoc(AssocList[i]) do
if (ActionList.Count > 0) and (Length(Trim(Extensions)) > 0) then begin
b := False;
- if Pos(';', Extensions) = 0 then b := ANSIUpperCase(Trim(Extensions)) = Ext else begin
+ if Pos(';', Extensions) = 0 then b := WideUpperCase(Trim(Extensions)) = Ext else begin
Last := 0;
for j := 1 to Length(Extensions) do
if Extensions[j] = ';' then begin
- if ANSIUpperCase(Trim(Copy(Extensions, Last + 1, j - Last - 1))) = Ext then begin
+ if WideUpperCase(Trim(Copy(Extensions, Last + 1, j - Last - 1))) = Ext then begin
b := True;
Break;
end;
Last := j;
end;
- if not b then b := ANSIUpperCase(Trim(Copy(Extensions, LastDelimiter(';', Extensions) + 1, Length(Extensions) - LastDelimiter(';', Extensions)))) = Ext;
+ if not b then b := WideUpperCase(Trim(Copy(Extensions, LastDelimiter(';', Extensions) + 1, Length(Extensions) - LastDelimiter(';', Extensions)))) = Ext;
end;
if b then begin
FileTypeDesc := FileTypeName;
@@ -3311,7 +3329,7 @@ begin
else ac := CustomAction;
if ac > ActionList.Count - 1 then ac := 0;
if ActionList.Count >= ac then begin
- Command := Trim(TAssocAction(ActionList[ac]).ActionCommand);
+ Command := UTF8ToStr(Trim(TAssocAction(ActionList[ac]).ActionCommand));
AutodetectGUI := TAssocAction(ActionList[ac]).AutodetectGUI;
RunInTerminal := TAssocAction(ActionList[ac]).RunInTerminal;
end;
@@ -3341,7 +3359,7 @@ begin
HandleRunFromArchive(Path, Engine, Command, FileTypeDesc, False);
b := True;
end else
- if Application.MessageBox(Format(LANGThereIsNoApplicationAssociatedWithS, [ANSIToUTF8(ExtractFileName(Path))]), [mbYes, mbNo], mbQuestion, mbNone, mbNo) = mbYes
+ if Application.MessageBox(Format(LANGThereIsNoApplicationAssociatedWithS, [StrToUTF8(ExtractFileName(Path))]), [mbYes, mbNo], mbQuestion, mbNone, mbNo) = mbYes
then miFileTypesClick(Self);
Exit;
end;
@@ -3360,7 +3378,7 @@ begin
Libc.__chdir(PChar('/'));
end else b := True; // Mask cancelled extraction from VFS
end;
- if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [ANSIToUTF8(s)]), [mbOK], mbError, mbNone, mbOK);
+ if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [s]), [mbOK], mbError, mbNone, mbOK);
finally
Application.ProcessMessages;
InternalUnLock;
@@ -3385,7 +3403,7 @@ begin
if LeftLastFocused then AListView := LeftListView
else AListView := RightListView;
if Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and (not PDataItem(AListView.Selected.Data)^.UpDir) then begin
- s2 := QuoteStr(String(PDataItem(AListView.Selected.Data)^.AName)) + ' ';
+ s2 := QuoteStr(String(PDataItem(AListView.Selected.Data)^.FDisplayName)) + ' ';
if Length(CommandLineCombo.Entry.Text) = 0 then begin
CommandLineCombo.Entry.Text := Format('./%s', [s2]);
CommandLineCombo.Entry.CursorPosition := Length(s2);
@@ -3402,16 +3420,16 @@ begin
Orig := Trim(CommandLineCombo.Entry.Text);
if Length(Orig) > 0 then begin
- if ANSIUpperCase(Orig) = 'CD' then begin
+ if WideUpperCase(Orig) = 'CD' then begin
if LeftLastFocused then PathButtonClick(LeftHomeButton)
else PathButtonClick(RightHomeButton);
end else
- if (Length(Orig) > 3) and (ANSIUpperCase(Copy(Orig, 1, 3)) = 'CD ') then begin
- ChangingDir(LeftLastFocused, ProcessPattern(Engine, Copy(Orig, 4, Length(Orig) - 3), Engine.Path, '', True));
+ if (Length(Orig) > 3) and (WideUpperCase(Copy(Orig, 1, 3)) = 'CD ') then begin
+ ChangingDir(LeftLastFocused, ProcessPattern(Engine, UTF8ToStr(Copy(Orig, 4, Length(Orig) - 3)), Engine.Path, '', True));
end else begin
while not (Engine is TLocalTreeEngine) do Engine := Engine.ParentEngine;
ChDir(Engine.Path);
- if not ExecuteProgram(Orig, Engine.Path, ConfCmdLineTerminalBehaviour = 0 , ConfCmdLineTerminalBehaviour = 1, Error) then
+ if not ExecuteProgram(UTF8ToStr(Orig), Engine.Path, ConfCmdLineTerminalBehaviour = 0 , ConfCmdLineTerminalBehaviour = 1, Error) then
Application.MessageBox(LANGErrorExecutingCommand, [mbOK], mbError, mbNone, mbOK);
ChDir('/');
end;
@@ -3515,7 +3533,7 @@ begin
if ActualPosition and CommandLineCombo.Entry.Focused then begin
OldPos := CommandLineCombo.Entry.CursorPosition;
s2 := CommandLineCombo.Entry.Text;
- Insert(s, s2, Length(ANSILeftStr(s2, OldPos)) + 1);
+ Insert(s, s2, Length(LeftStr(s2, OldPos)) + 1);
CommandLineCombo.Entry.Text := s2;
CommandLineCombo.Entry.CursorPosition := OldPos + 1;
end else begin
@@ -3683,11 +3701,11 @@ begin
end;
AFile := '';
- if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.AName else
+ if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.FName else
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if Selected and (not UpDir) then begin
- AFile := AName;
+ AFile := FName;
Break;
end;
@@ -3783,11 +3801,11 @@ begin
end;
AFile := '';
- if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.AName else
+ if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.FName else
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if Selected and (not UpDir) then begin
- AFile := AName;
+ AFile := FName;
Break;
end;
@@ -3865,9 +3883,9 @@ begin
if (not Assigned(AListView.Selected)) or (not Assigned(AListView.Selected.Data)) or PDataItem(AListView.Selected.Data)^.UpDir
then s1 := ExcludeTrailingPathDelimiter(Engine.Path)
- else s1 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.AName;
+ else s1 := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName;
if Engine.Path <> EngineOpposite.Path
- then s2 := IncludeTrailingPathDelimiter(EngineOpposite.Path) + PDataItem(AListView.Selected.Data)^.AName
+ then s2 := IncludeTrailingPathDelimiter(EngineOpposite.Path) + PDataItem(AListView.Selected.Data)^.FName
else s2 := '';
// Handle password
@@ -3913,7 +3931,7 @@ begin
if (Engine is TVFSEngine) and TVFSEngine(Engine).GetPasswordRequired and (Length(TVFSEngine(Engine).Password) < 1) then
if not HandleSetPassword(Engine) then Exit;
- if EditSymlink(IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.AName, Engine) then begin
+ if EditSymlink(IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName, Engine) then begin
DoRefresh(LeftPanel, True, True);
DoRefresh(not LeftPanel, True, True);
end;
@@ -3953,7 +3971,7 @@ begin
end;
FileName := IncludeTrailingPathDelimiter(Engine.Path);
if Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and (not PDataItem(AListView.Selected.Data)^.UpDir)
- then FileName := FileName + PDataItem(AListView.Selected.Data)^.AName;
+ then FileName := FileName + PDataItem(AListView.Selected.Data)^.FName;
ShortFName := ExtractFileName(ExcludeTrailingPathDelimiter(FileName));
DataItem := Engine.GetFileInfoSL(FileName);
if not Assigned(DataItem) then begin
@@ -3964,7 +3982,7 @@ begin
if not DataItem^.IsDir then begin
Item := TGTKMenuItem.CreateTyped(Self, itImageText);
- Item.Caption := Format(LANGPopupRunS, [ANSIToUTF8(QuoteMarkupStr(ShortFName))]);
+ Item.Caption := Format(LANGPopupRunS, [QuoteMarkupStr(StrToUTF8(ShortFName), True)]);
Item.StockIcon := 'gtk-execute';
Item.Data := Pointer(1);
Item.OnClick := FilePopupMenuItemClick;
@@ -3973,7 +3991,7 @@ begin
end else begin
Item := TGTKMenuItem.CreateTyped(Self, itImageText);
if UpDir then Item.Caption := LANGPopupGoUp
- else Item.Caption := Format(LANGPopupOpenS, [ANSIToUTF8(QuoteMarkupStr(ShortFName))]);
+ else Item.Caption := Format(LANGPopupOpenS, [QuoteMarkupStr(StrToUTF8(ShortFName), True)]);
Item.StockIcon := 'gtk-open';
Item.Data := Pointer(1);
Item.OnClick := FilePopupMenuItemClick;
@@ -4002,23 +4020,23 @@ begin
// Find and add actions for this file type
Found := False;
if Pos('.', ShortFName) > 0 then begin
- Ext := ANSIUpperCase(Trim(Copy(ShortFName, LastDelimiter('.', ShortFName) + 1, Length(ShortFName) - LastDelimiter('.', ShortFName))));
+ Ext := WideUpperCase(Trim(Copy(ShortFName, LastDelimiter('.', ShortFName) + 1, Length(ShortFName) - LastDelimiter('.', ShortFName))));
if AssocList.Count > 0 then
for i := 0 to AssocList.Count - 1 do
with TFileAssoc(AssocList[i]) do
if (ActionList.Count > 0) and (Length(Trim(Extensions)) > 0) then begin
b := False;
- if Pos(';', Extensions) = 0 then b := ANSIUpperCase(Trim(Extensions)) = Ext else begin
+ if Pos(';', Extensions) = 0 then b := Trim(Extensions) = Ext else begin
Last := 0;
for j := 1 to Length(Extensions) do
if Extensions[j] = ';' then begin
- if ANSIUpperCase(Trim(Copy(Extensions, Last + 1, j - Last - 1))) = Ext then begin
+ if WideUpperCase(Trim(Copy(Extensions, Last + 1, j - Last - 1))) = Ext then begin
b := True;
Break;
end;
Last := j;
end;
- if not b then b := ANSIUpperCase(Trim(Copy(Extensions, LastDelimiter(';', Extensions) + 1, Length(Extensions) - LastDelimiter(';', Extensions)))) = Ext;
+ if not b then b := WideUpperCase(Trim(Copy(Extensions, LastDelimiter(';', Extensions) + 1, Length(Extensions) - LastDelimiter(';', Extensions)))) = Ext;
end;
if b and (ActionList.Count > 0) then begin
Found := True;
@@ -4126,7 +4144,7 @@ begin
end;
FileName := IncludeTrailingPathDelimiter(Engine.Path);
if Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and (not PDataItem(AListView.Selected.Data)^.UpDir)
- then FileName := FileName + PDataItem(AListView.Selected.Data)^.AName;
+ then FileName := FileName + PDataItem(AListView.Selected.Data)^.FName;
ShortFName := ExtractFileName(ExcludeTrailingPathDelimiter(FileName));
DataItem := Engine.GetFileInfoSL(FileName);
if not Assigned(DataItem) then begin
@@ -4148,11 +4166,11 @@ begin
end else b := True; // Mask cancelled extraction from VFS
if not b then Application.MessageBox(LANGErrorExecutingCommand, [mbOK], mbError, mbNone, mbOK);
end;
- 2: if Application.MessageBox(Format(LANGThereIsNoApplicationAssociatedWithS, [ANSIToUTF8(ShortFName)]), [mbYes, mbNo], mbQuestion, mbNone, mbNo) = mbYes
+ 2: if Application.MessageBox(Format(LANGThereIsNoApplicationAssociatedWithS, [ShortFName]), [mbYes, mbNo], mbQuestion, mbNone, mbNo) = mbYes
then miFileTypesClick(Self);
else begin
b := True;
- s := TAssocAction((Sender as TGTKMenuItem).Data).ActionCommand;
+ s := UTF8ToStr(Trim(TAssocAction((Sender as TGTKMenuItem).Data).ActionCommand));
if Engine is TVFSEngine then b := HandleRunFromArchive(FileName, Engine, s, '', False); // not a local engine, extract to local first
if Pos('%s', s) > 0 then s := Format(s, ['''' + QuoteStr(FileName) + ''''])
else s := Format('%s %s', [s, QuoteStr(FileName)]);
@@ -4162,7 +4180,7 @@ begin
TAssocAction((Sender as TGTKMenuItem).Data).RunInTerminal, Error);
Libc.__chdir(PChar('/'));
end else b := True; // Mask cancelled extraction from VFS
- if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [ANSIToUTF8(FileName)]), [mbOK], mbError, mbNone, mbOK);
+ if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [FileName]), [mbOK], mbError, mbNone, mbOK);
end;
end;
finally
@@ -4323,8 +4341,8 @@ const ShortcutKeys = '1234567890';
var i: integer;
Item: TGTKMenuItem;
begin
- if mnuBookmarks.Count > 4 then
- for i := mnuBookmarks.Count - 1 downto 4 do begin
+ if mnuBookmarks.Count > 3 then
+ for i := mnuBookmarks.Count - 1 downto 3 do begin
mnuBookmarks.Items[i].Free;
mnuBookmarks.Delete(i);
end;
@@ -4335,8 +4353,9 @@ begin
if Bookmarks.Count > 0 then begin
miBookmarksSeparator.Visible := True;
for i := 0 to Bookmarks.Count - 1 do begin
+ if Length(Trim(Bookmarks[i])) = 0 then Continue;
Item := TGTKMenuItem.CreateTyped(Self, itLabel);
- Item.Caption := Format('_%s %s', [Chr(Ord('a') + i), ANSIToUTF8(QuoteMarkupStr(Bookmarks[i]))]);
+ Item.Caption := Format('_%s %s', [Chr(Ord('a') + i), StrToUTF8(QuoteMarkupStr(Bookmarks[i]))]);
Item.Data := Pointer(i);
Item.OnClick := miBookmarkClick;
Item.OnMouseUp := BookmarkItemMouseUp;
@@ -4359,7 +4378,7 @@ begin
else s := RightPanelEngine.Path;
s := ExcludeTrailingPathDelimiter(s);
if Bookmarks.IndexOf(s) > -1 then begin
- Application.MessageBox(LANGTheCurrentDirectoryAlreadyExistsInTheBookmarksList, [mbOK], mbError);
+ Application.MessageBox(LANGTheCurrentDirectoryAlreadyExistsInTheBookmarksList, [mbOK], mbWarning);
Exit;
end;
Bookmarks.Add(s);
@@ -4604,7 +4623,7 @@ begin
s := ExcludeTrailingPathDelimiter(SrcEngine.Path);
if (OrigSrcEngine = SrcEngine) and Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and
(not PDataItem(AListView.Selected.Data)^.UpDir) and PDataItem(AListView.Selected.Data)^.IsDir
- then s := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(s) + PDataItem(AListView.Selected.Data)^.AName);
+ then s := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(s) + PDataItem(AListView.Selected.Data)^.FName);
if IncludeTrailingPathDelimiter(TargetEngine.Path) <> s then begin
if LeftPanel then RightPanelEngine := TargetEngine
else LeftPanelEngine := TargetEngine;
@@ -4663,7 +4682,7 @@ procedure TFMain.FillMounterBar;
{$ELSE}
Button.Tag := Longint(MounterList[i]);
{$ENDIF}
- Button.Tooltip := Format(LANGMountPointDevice, [ANSIToUTF8(MountPath), ANSIToUTF8(Device)]);
+ Button.Tooltip := Format(LANGMountPointDevice, [StrToUTF8(MountPath), StrToUTF8(Device)]);
Button.BorderStyle := bsNone;
Button.PopupMenu := MounterButtonPopupMenu;
Button.OnMouseDown := MounterButtonMouseDown;
@@ -4988,7 +5007,7 @@ begin
end else
for i := 0 to PluginList.Count - 1 do begin
MenuItem1 := TGTKMenuItem.CreateTyped(Self, itImageText);
- MenuItem1.Caption := ANSIToUTF8(TVFSPlugin(PluginList[i]).VFSName);
+ MenuItem1.Caption := TVFSPlugin(PluginList[i]).VFSName;
MenuItem2 := TGTKMenuItem.CreateTyped(Self, itImageText);
MenuItem2.Caption := LANGPluginAbout;
MenuItem2.Tag := i;
@@ -5007,7 +5026,7 @@ begin
FTestPlugin := TFTestPlugin.Create(Self);
if (FTestPlugin.Run = mbOK) and (PluginList.Count > 0) then begin
Engine := TVFSEngine.Create(PluginList[FTestPlugin.PluginOptionMenu.ItemIndex]);
- if not Engine.VFSOpenURI(UTF8ToANSI(FTestPlugin.CommandEntry.Text)) then begin
+ if not Engine.VFSOpenURI(FTestPlugin.CommandEntry.Text) then begin
Application.MessageBox(LANGCouldntOpenURI, [mbOK], mbError, mbOK, mbOK);
Exit;
end;
@@ -5108,22 +5127,22 @@ begin
if i = 0 then APathSave := APath;
VBox := TGTKVBox.Create(Self);
AVBoxList.Insert(InsertPos, VBox);
- PathsHighlight.Insert(InsertPos, PDataItem(AListView.Selected.Data)^.AName);
+ PathsHighlight.Insert(InsertPos, PDataItem(AListView.Selected.Data)^.FName);
TabSortIDs.Insert(InsertPos, Pointer(AListView.SortColumnID));
TabSortTypes.Insert(InsertPos, Pointer(Integer(AListView.SortOrder)));
TabEngines.Insert(InsertPos, AEngine);
end;
if not DockedToNotebook then begin
- ANotebook.InsertPage(0, AVBoxList[0], APathSave);
- SetTabLabel(ANotebook, 0, APathSave, ATabList[0]);
+ ANotebook.InsertPage(0, AVBoxList[0], StrToUTF8(APathSave));
+ SetTabLabel(ANotebook, 0, StrToUTF8(APathSave), StrToUTF8(ATabList[0]));
end;
InsertPos := NewTabPosition;
if InsertPos > ATabList.Count then InsertPos := ATabList.Count;
if not ANotebook.Visible then ANotebook.Visible := True;
- i := ANotebook.InsertPage(InsertPos, VBox, APath);
- SetTabLabel(ANotebook, i, APath, ATabList[InsertPos]);
+ i := ANotebook.InsertPage(InsertPos, VBox, StrToUTF8(APath));
+ SetTabLabel(ANotebook, i, StrToUTF8(APath), StrToUTF8(ATabList[InsertPos]));
ANotebook.PageIndex := i;
end;
@@ -5408,8 +5427,8 @@ begin
ATabSortTypes.Add(TabSortTypes[i]);
if LeftPanel then TabEngines.Add(LeftPanelEngine)
else TabEngines.Add(RightPanelEngine);
- ANotebook.AppendPage(VBox, APath);
- SetTabLabel(ANotebook, ANotebook.ChildrenCount - 1, APath, TabList[i]);
+ ANotebook.AppendPage(VBox, StrToUTF8(APath));
+ SetTabLabel(ANotebook, ANotebook.ChildrenCount - 1, StrToUTF8(APath), StrToUTF8(TabList[i]));
end;
if not ANotebook.Visible then ANotebook.Visible := True;
@@ -5418,9 +5437,15 @@ begin
end;
procedure TFMain.SetTabLabel(Notebook: TEphyNotebook; PageIndex: integer; ALabel, Tooltip: string);
+var g: PChar;
begin
- if (ConfTabMaxLength > 0) and (Length(ALabel) > ConfTabMaxLength) then
- ALabel := Copy(ALabel, 1, ConfTabMaxLength) + '...';
+ if (ConfTabMaxLength > 0) and (g_utf8_strlen(PChar(ALabel), -1) > ConfTabMaxLength) then begin
+ g := malloc(Length(ALabel) + 4);
+ memset(g, 0, Length(ALabel) + 4);
+ g_utf8_strncpy(g, PChar(ALabel), ConfTabMaxLength);
+ ALabel := g + '...';
+ Libc.free(g);
+ end;
Notebook.SetTabCaption(PageIndex, ALabel);
Notebook.SetTabTooltip(PageIndex, Tooltip);
end;
@@ -5602,7 +5627,7 @@ begin
if Length(Plugin.Extensions) > 0 then
for j := 0 to Length(Plugin.Extensions) - 1 do begin
// DebugMsg(['Extension = "', Plugin.Extensions[j], '", Ext = "', Ext, '"']);
- if AnsiCompareText(Plugin.Extensions[j], Ext) = 0 then begin
+ if WideCompareText(Plugin.Extensions[j], Ext) = 0 then begin
Result := True;
Break;
end;
@@ -5623,7 +5648,8 @@ begin
if not Assigned(Engine.ParentEngine) or (not (Engine is TVFSEngine)) then Exit;
if LeftPanel then LeftPanelEngine := Engine.ParentEngine
else RightPanelEngine := Engine.ParentEngine;
- if not SurpressRefresh then ChangingDir(LeftPanel, Engine.SavePath, Engine.ParentEngine.LastHighlightItem, '', False, True);
+ if not SurpressRefresh then ChangingDir(LeftPanel, Engine.SavePath, StrToUTF8(Engine.ParentEngine.LastHighlightItem),
+ Engine.ParentEngine.LastHighlightItem, False, True);
if not TVFSEngine(Engine).VFSClose then DebugMsg(['Error closing the engine...']);
Engine.Free;
@@ -5667,13 +5693,14 @@ begin
FSearch := TFSearch.Create(Self);
FSearch.ParentForm := FMain;
FSearch.Engine := Engine;
- FSearch.SearchInEntry.Text := ANSIToUTF8(ExcludeTrailingPathDelimiter(Engine.Path));
+ FSearch.SearchInEntry.Text := StrToUTF8(ExcludeTrailingPathDelimiter(Engine.Path));
if Length(FSearch.SearchInEntry.Text) < 1 then FSearch.SearchInEntry.Text := '/';
case FSearch.Run of
mbOK: ;
mbApply: begin
+ DebugMsg(['TFMain.miSearchClick: FSearch.GoToFileArchive = "', FSearch.GoToFileArchive, '", FSearch.GoToFile = "', FSearch.GoToFile, '"']);
if Length(FSearch.GoToFileArchive) > 0 then begin
- Ext := ANSIUpperCase(Trim(Copy(FSearch.GoToFileArchive, LastDelimiter('.', FSearch.GoToFileArchive) + 1, Length(FSearch.GoToFileArchive) - LastDelimiter('.', FSearch.GoToFileArchive))));
+ Ext := WideUpperCase(Trim(Copy(FSearch.GoToFileArchive, LastDelimiter('.', FSearch.GoToFileArchive) + 1, Length(FSearch.GoToFileArchive) - LastDelimiter('.', FSearch.GoToFileArchive))));
HandleVFSArchive(Ext, FSearch.GoToFileArchive, ExtractFileName(FSearch.GoToFileArchive), ExtractFilePath(FSearch.GoToFile));
if LeftLastFocused then begin
@@ -5690,13 +5717,13 @@ begin
Engine.SavePath := ExtractFilePath(FSearch.GoToFileArchive);
// (Engine as TVFSEngine).ParentEngine.LastHighlightItem := ExtractFileName(FSearch.GoToFileArchive);
for i := 0 to DataList.Count - 1 do
- if ANSICompareText(string(PDataItem(DataList[i])^.AName), ExtractFileName(FSearch.GoToFile)) = 0 then begin
+ if WideCompareText(string(PDataItem(DataList[i])^.FName), ExtractFileName(FSearch.GoToFile)) = 0 then begin
AListView.Items[i].Selected := True;
AListView.Items[i].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
Break;
end;
end;
- end else ChangingDir(LeftLastFocused, ExtractFilePath(FSearch.GoToFile), ExtractFileName(FSearch.GoToFile));
+ end else ChangingDir(LeftLastFocused, ExtractFilePath(FSearch.GoToFile), StrToUTF8(ExtractFileName(FSearch.GoToFile)));
end;
end;
finally
@@ -5743,7 +5770,7 @@ begin
for i := 0 to PluginList.Count - 1 do begin
if Length(TVFSPlugin(PluginList[i]).Services) > 0 then
for j := 0 to Length(TVFSPlugin(PluginList[i]).Services) - 1 do
- if AnsiCompareText(TVFSPlugin(PluginList[i]).Services[j], ConnInfo.ServiceType) = 0 then begin
+ if WideCompareText(TVFSPlugin(PluginList[i]).Services[j], ConnInfo.ServiceType) = 0 then begin
VFSPlugin := PluginList[i];
Break;
end;
@@ -5764,7 +5791,7 @@ begin
Engine := TVFSEngine.Create(VFSPlugin);
Engine.ParentEngine := SourceEngine;
Engine.SavePath := SourceEngine.Path;
- if not Engine.VFSOpenURI(ConnInfo.URI) then begin
+ if not Engine.VFSOpenURI(UTF8ToStr(ConnInfo.URI)) then begin
Application.MessageBox(LANGCouldntOpenURI, [mbOK], mbError, mbOK, mbOK);
Exit;
end;
@@ -5853,11 +5880,11 @@ begin
end;
AFile := '';
- if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.AName else
+ if SelCount = 0 then AFile := PDataItem(AListView.Selected.Data)^.FName else
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if Selected and (not UpDir) then begin
- AFile := AName;
+ AFile := FName;
Break;
end;
@@ -5939,7 +5966,7 @@ begin
then Exit; // Silently do nothing
if SelCount = 0 then begin
- s := PDataItem(AListView.Selected.Data)^.AName;
+ s := PDataItem(AListView.Selected.Data)^.FName;
if FullPaths then s := IncludeTrailingPathDelimiter(Engine.GetPath) + s;
end else begin
s := '';
@@ -5948,13 +5975,13 @@ begin
x := AListView.ConvertFromSorted(i);
if (x >= 0) and (x < DataList.Count) and PDataItem(DataList[x])^.Selected then begin
if FullPaths then s := s + IncludeTrailingPathDelimiter(Engine.GetPath);
- s := s + PDataItem(DataList[x])^.AName + #10;
+ s := s + PDataItem(DataList[x])^.FName + #10;
end;
end;
end;
clip := gtk_clipboard_get(gdk_atom_intern('CLIPBOARD', False));
- gtk_clipboard_set_text(clip, StringToPgchar(s), Length(s));
+ gtk_clipboard_set_text(clip, PChar(StrToUTF8(s)), Length(StrToUTF8(s)));
end;
@@ -5976,14 +6003,14 @@ begin
if not BypassDialog then begin
Stat := Engine.GetFileInfoSL(APath);
FRunFromVFS := TFRunFromVFS.Create(Self);
- FRunFromVFS.FileNameLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [APath]);
+ FRunFromVFS.FileNameLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [StrToUTF8(APath)]);
if FileTypeDesc = '' then FileTypeDesc := LANGHandleRunFromArchive_FileTypeDesc_Unknown;
FRunFromVFS.FileTypeLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [FileTypeDesc]);
if Assigned(Stat) then begin
if (ConfSizeFormat < 5) or (Stat^.Size < 1024) then s := Format(' %s', [LANGHandleRunFromArchive_Bytes]);
- FRunFromVFS.SizeLabel2.Caption := Format('%s%s<span weight="ultrabold"> </span>', [ANSIToUTF8(FormatSize(Stat^.Size, 0)), s]);
+ FRunFromVFS.SizeLabel2.Caption := Format('%s%s<span weight="ultrabold"> </span>', [FormatSize(Stat^.Size, 0), s]);
if (ConfSizeFormat < 5) or (Stat^.Size < 1024) then s := Format(' %s', [LANGHandleRunFromArchive_Bytes]);
- FRunFromVFS.PackedSizeLabel2.Caption := Format('%s%s<span weight="ultrabold"> </span>', [ANSIToUTF8(FormatSize(Stat^.Size, 0)), s]);
+ FRunFromVFS.PackedSizeLabel2.Caption := Format('%s%s<span weight="ultrabold"> </span>', [FormatSize(Stat^.Size, 0), s]);
FRunFromVFS.DateLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [FormatDateTime('ddddd tt', Stat^.ModifyTime)]);
if (Command = '') and (not Stat^.IsExecutable) then begin
FRunFromVFS.OpensWithLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [LANGHandleRunFromArchive_NotAssociated]);