View Issue Details

IDProjectCategoryView StatusLast Update
0000542Double CommanderLogicpublic2014-10-26 18:14
Reportervitaliyg Assigned ToAlexx2000  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
ProjectionnoneETAnone 
Product Version0.6.0 (trunk) 
Fixed in Version0.5.5 
Summary0000542: [PATCH] Don't create new tab when there is already opened
DescriptionWhen entering some folder in locked tab - new tab is created with destination folder (depends on lock type)
When repeating this - new tab is created again with same location.

So I suggest to check if destination tab with required location already exists and activate it instead of creating new tab.

This will help to keep only unique tabs (I guess this is what most users want).
TagsNo tags attached.
Attached Files
fmain.pas.patch (3,136 bytes)   
Index: src/fmain.pas
===================================================================
--- src/fmain.pas	(revision 5115)
+++ src/fmain.pas	(working copy)
@@ -2267,32 +2267,33 @@
     if not mbDirectoryExists(iconsDir) then Exit;
 
     iconImg := TPicture.Create;
+    try
+      imgLstActions.Width := gIconsInMenusSize;
+      imgLstActions.Height := gIconsInMenusSize;
 
-    imgLstActions.Width := gIconsInMenusSize;
-    imgLstActions.Height := gIconsInMenusSize;
+      actionLst.Images := imgLstActions;
+      pmTabMenu.Images := imgLstActions;
+      mnuMain.Images := imgLstActions;
 
-    actionLst.Images := imgLstActions;
-    pmTabMenu.Images := imgLstActions;
-    mnuMain.Images := imgLstActions;
-
-    for I:= 0 to actionLst.ActionCount - 1 do
-    begin
-      actionName := UTF8LowerCase(actionLst.Actions[I].Name);
-      fileName := iconsDir + PathDelim + 'cm_' + UTF8Copy(actionName, 4, Length(actionName) - 3) + '.png';
-      if mbFileExists(fileName) then
-      try
-        iconImg.LoadFromFile(fileName);
-        imgIndex := imgLstActions.Add(iconImg.Bitmap, nil);
-        if imgIndex >= 0 then
-        begin
-           TAction(actionLst.Actions[I]).ImageIndex := imgIndex;
+      for I:= 0 to actionLst.ActionCount - 1 do
+      begin
+        actionName := UTF8LowerCase(actionLst.Actions[I].Name);
+        fileName := iconsDir + PathDelim + 'cm_' + UTF8Copy(actionName, 4, Length(actionName) - 3) + '.png';
+        if mbFileExists(fileName) then
+        try
+          iconImg.LoadFromFile(fileName);
+          imgIndex := imgLstActions.Add(iconImg.Bitmap, nil);
+          if imgIndex >= 0 then
+          begin
+             TAction(actionLst.Actions[I]).ImageIndex := imgIndex;
+          end;
+        except
+          // Skip
         end;
-      except
-        // Skip
       end;
+    finally
+      FreeAndNil(iconImg);
     end;
-
-    FreeAndNil(iconImg);
   end;
 end;
 
@@ -3270,6 +3271,8 @@
 var
   ANoteBook: TFileViewNotebook;
   Page, NewPage: TFileViewPage;
+  PageAlreadyExists: Boolean = False;
+  i: Integer;
 begin
   Result:= True;
   if FileView.NotebookPage is TFileViewPage then
@@ -3288,9 +3291,22 @@
           begin
             ANoteBook := Page.Notebook;
 
-            // Open in a new page, cloned view.
-            NewPage := ANotebook.NewPage(Page.FileView);
-            NewPage.FileView.AddFileSource(NewFileSource, NewPath);
+            { TODO -oVG : add option to turn on/off this feature }
+            for i := 0 to ANotebook.PageCount - 1 do
+            begin
+              NewPage := ANotebook.Page[i];
+              PageAlreadyExists := Assigned(NewPage.FileView) and
+                (NewPage.FileView.CurrentPath = NewPath);
+              if PageAlreadyExists then
+                Break;
+            end;
+
+            if not PageAlreadyExists then
+            begin
+              // Open in a new page, cloned view.
+              NewPage := ANotebook.NewPage(Page.FileView);
+              NewPage.FileView.AddFileSource(NewFileSource, NewPath);
+            end;
             NewPage.MakeActive;
           end;
         end;
fmain.pas.patch (3,136 bytes)   
Fixed in Revision5118
Operating system
Widgetset
Architecture

Activities

vitaliyg

2013-02-28 19:57

developer   ~0001008

Attached patch contains updates to apply suggested behavior (and small update at begining)

Alexx2000

2013-03-02 12:26

administrator   ~0001009

Thanks, added to SVN

Issue History

Date Modified Username Field Change
2012-08-20 14:27 vitaliyg New Issue
2013-02-28 19:53 vitaliyg File Added: fmain.pas.patch
2013-02-28 19:57 vitaliyg Note Added: 0001008
2013-02-28 20:43 vitaliyg Category Graphical user interface => Logic
2013-02-28 20:43 vitaliyg Summary Don't create new tab when there is already opened => [PATCH] Don't create new tab when there is already opened
2013-03-02 12:19 Alexx2000 Assigned To => Alexx2000
2013-03-02 12:19 Alexx2000 Status new => assigned
2013-03-02 12:26 Alexx2000 Fixed in Revision => 5118
2013-03-02 12:26 Alexx2000 Note Added: 0001009
2013-03-02 12:26 Alexx2000 Status assigned => resolved
2013-03-02 12:26 Alexx2000 Fixed in Version => 0.5.5
2013-03-02 12:26 Alexx2000 Resolution open => fixed
2014-10-26 18:14 Alexx2000 Status resolved => closed