View Issue Details

IDProjectCategoryView StatusLast Update
0002358Double CommanderGraphical user interfacepublic2021-10-29 23:21
Reporterliquidvacuum Assigned ToAlexx2000  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
ProjectionnoneETAnone 
Target Version1.0.0Fixed in Version1.0.0 
Summary0002358: Add copy to clipboard is Syncronize directories dialog
DescriptionНеобходимо добавить копирование выделенных строк в буфер обмена по сочетаниям клавиш Ctrl+Ins и Ctrl+C в диалоге "Синхронизировать каталоги".
Патч приложен.

There is need to add copying of the selected lines to the clipboard by keyboard shortcuts Ctrl+Ins and Ctrl+C in the "Synchronize directories" dialog.
Patch attached.
TagsNo tags attached.
Attached Files
02-sync-clipboard.diff (3,915 bytes)   
diff --git a/doublecmd-0.9.6.orig/src/fsyncdirsdlg.pas b/doublecmd-0.9.6/src/fsyncdirsdlg.pas
index 346b2f5..a86dda8 100644
--- a/doublecmd-0.9.6.orig/src/fsyncdirsdlg.pas
+++ b/doublecmd-0.9.6/src/fsyncdirsdlg.pas
@@ -175,6 +175,8 @@ type
     constructor Create(AOwner: TComponent;
       FileView1, FileView2: TFileView); reintroduce;
     destructor Destroy; override;
+  public
+    procedure CopyToClipboard;
   published
     procedure cm_SelectClear(const {%H-}Params:array of string);
     procedure cm_SelectDeleteLeft(const {%H-}Params:array of string);
@@ -203,7 +205,7 @@ uses
   fMain, uDebug, fDiffer, fSyncDirsPerformDlg, uGlobs, LCLType, LazUTF8, LazFileUtils,
   DCClassesUtf8, uFileSystemFileSource, uFileSourceOperationOptions, DCDateTimeUtils,
   uDCUtils, uFileSourceUtil, uFileSourceOperationTypes, uShowForm,
-  uFileSourceDeleteOperation, uOSUtils, uLng, uMasks;
+  uFileSourceDeleteOperation, uOSUtils, uLng, uMasks, uClipboard, IntegerList;

 {$R *.lfm}

@@ -877,6 +879,16 @@ begin
         MainDrawGrid.Selection:= ASelection;
       end;
     end;
+    VK_C:
+      if (Shift = [ssModifier]) then
+      begin
+        CopyToClipboard;
+      end;
+    VK_INSERT:
+      if (Shift = [ssModifier]) then
+      begin
+        CopyToClipboard;
+      end;
   end;
 end;

@@ -1649,6 +1661,109 @@ begin
   inherited Destroy;
 end;

+procedure TfrmSyncDirsDlg.CopyToClipboard;
+var
+  sl: TStringList;
+  RowList: TIntegerList;
+  I: Integer;
+
+  procedure FillRowList(RowList: TIntegerList);
+  var
+    R, Y: Integer;
+    Selection: TGridRect;
+  begin
+    Selection := MainDrawGrid.Selection;
+    if (MainDrawGrid.HasMultiSelection) or (Selection.Bottom <> Selection.Top) then
+    begin
+      for Y:= 0 to MainDrawGrid.SelectedRangeCount - 1 do
+      begin
+        Selection:= MainDrawGrid.SelectedRange[Y];
+        for R := Selection.Top to Selection.Bottom do
+        begin
+          if RowList.IndexOf(R) = -1 then
+          begin
+            RowList.Add(R);
+          end;
+        end;
+      end;
+    end
+    else
+    begin
+      R := MainDrawGrid.Row;
+      if RowList.IndexOf(R) = -1 then
+      begin
+        RowList.Add(R);
+      end;
+    end;
+    RowList.Sort;
+  end;
+
+  procedure PrintRow(R: Integer);
+  var
+    s: string;
+    SyncRec: TFileSyncRec;
+  begin
+    s := '';
+    SyncRec := TFileSyncRec(FVisibleItems.Objects[R]);
+    if not Assigned(SyncRec) then
+    begin
+      s := s + FVisibleItems[R];
+    end
+    else
+    begin
+      if Assigned(SyncRec.FFileL) then
+      begin
+        s := s + FVisibleItems[R];
+        s := s + #9;
+        s := s + IntToStr(SyncRec.FFileL.Size);
+        s := s + #9;
+        s := s + DateTimeToStr(SyncRec.FFileL.ModificationTime);
+      end;
+      if Length(s) <> 0 then
+        s := s + #9;
+      case SyncRec.FState of
+        srsUnknown:
+          s := s + '?';
+        srsEqual:
+          s := s + '=';
+        srsNotEq:
+          s := s + '!=';
+        srsCopyLeft:
+          s := s + '<-';
+        srsCopyRight:
+          s := s + '->';
+      end;
+      if Length(s) <> 0 then
+        s := s + #9;
+      if Assigned(SyncRec.FFileR) then
+      begin
+        s := s + DateTimeToStr(SyncRec.FFileR.ModificationTime);
+        s := s + #9;
+        s := s + IntToStr(SyncRec.FFileR.Size);
+        s := s + #9;
+        s := s + FVisibleItems[R];
+      end;
+    end;
+    sl.Add(s);
+  end;
+begin
+  sl := TStringList.Create;
+  RowList := TIntegerList.Create;
+  try
+    FillRowList(RowList);
+    for I := 0 to RowList.Count - 1 do
+    begin
+      PrintRow(RowList[I]);
+    end;
+    ClipboardSetText(sl.Text);
+  finally
+    if Assigned(sl) then
+      FreeAndNil(sl);
+    if Assigned(RowList) then
+      FreeAndNil(RowList);
+  end;
+end;
+
 procedure TfrmSyncDirsDlg.cm_SelectClear(const Params: array of string);
 begin
   SetSyncRecState(srsDoNothing);
02-sync-clipboard.diff (3,915 bytes)   
Fixed in Revision9055
Operating system
Widgetset
Architecture

Activities

Issue History

Date Modified Username Field Change
2019-09-18 13:27 liquidvacuum New Issue
2019-09-18 13:27 liquidvacuum File Added: 02-sync-clipboard.diff
2019-09-18 20:03 Alexx2000 Fixed in Revision => 9055
2019-09-18 20:03 Alexx2000 Assigned To => Alexx2000
2019-09-18 20:03 Alexx2000 Status new => resolved
2019-09-18 20:03 Alexx2000 Resolution open => fixed
2019-09-18 20:03 Alexx2000 Fixed in Version => 1.0.0
2019-09-18 20:03 Alexx2000 Target Version => 1.0.0
2021-10-29 23:21 Alexx2000 Status resolved => closed