[haiku-commits] haiku: hrev53329 - src/kits/tracker

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 2 Aug 2019 20:39:08 -0400 (EDT)

hrev53329 adds 1 changeset to branch 'master'
old head: 7451b647db26af0fedf1e07c2cfdf09ec28f1293
new head: 5e7114c1e43f2b1b9e918ba1be896750ab7fc9ec
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=5e7114c1e43f+%5E7451b647db26

----------------------------------------------------------------------------

5e7114c1e43f: Tracker: Do a duplicate when pasting files into their own 
directory
  
  Fixes #2755 (blast from the past!)
  
  Change-Id: I5faff0563ca8c65cd78c8d1414517a652223d0fd
  Reviewed-on: https://review.haiku-os.org/c/1673
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                  [ Ryan Leavengood <leavengood@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53329
Commit:      5e7114c1e43f2b1b9e918ba1be896750ab7fc9ec
URL:         https://git.haiku-os.org/haiku/commit/?id=5e7114c1e43f
Author:      Ryan Leavengood <leavengood@xxxxxxxxx>
Date:        Fri Aug  2 02:37:03 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Aug  3 00:39:05 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/2755

----------------------------------------------------------------------------

1 file changed, 18 insertions(+), 7 deletions(-)
src/kits/tracker/FSClipboard.cpp | 25 ++++++++++++++++++-------

----------------------------------------------------------------------------

diff --git a/src/kits/tracker/FSClipboard.cpp b/src/kits/tracker/FSClipboard.cpp
index d0373180bd..a363bbbe05 100644
--- a/src/kits/tracker/FSClipboard.cpp
+++ b/src/kits/tracker/FSClipboard.cpp
@@ -375,6 +375,7 @@ FSClipboardPaste(Model* model, uint32 linksMode)
        // these will be passed to the asynchronous copy/move process
        BObjectList<entry_ref>* moveList = new BObjectList<entry_ref>(0, true);
        BObjectList<entry_ref>* copyList = new BObjectList<entry_ref>(0, true);
+       BObjectList<entry_ref>* duplicateList = new BObjectList<entry_ref>(0, 
true);
 
        if ((be_clipboard->Lock())) {
                BMessage* clip = be_clipboard->Data();
@@ -444,14 +445,19 @@ FSClipboardPaste(Model* model, uint32 linksMode)
                                                        moveList->AddItem(new 
entry_ref(ref));
                                                } else if (moveMode == 
kCopySelectionTo)
                                                        copyList->AddItem(new 
entry_ref(ref));
+                                       } else {
+                                               // if the entry should have 
been removed from its
+                                               // directory, we want to copy 
that entry next time, no
+                                               // matter if the items don't 
have to be moved at all
+                                               // (source == target)
+                                               if (moveMode == 
kMoveSelectionTo)
+                                                       newMoveMode = 
kCopySelectionTo;
+                                               else {
+                                                       // we are copying a 
file into its same directory, do
+                                                       // a duplicate
+                                                       
duplicateList->AddItem(new entry_ref(ref));
+                                               }
                                        }
-
-                                       // if the entry should have been 
removed from its
-                                       // directory, we want to copy that 
entry next time, no
-                                       // matter if the items don't have to be 
moved at all
-                                       // (source == target)
-                                       if (moveMode == kMoveSelectionTo)
-                                               newMoveMode = kCopySelectionTo;
                                }
 
                                // add the change to the update message (if 
necessary)
@@ -522,6 +528,11 @@ FSClipboardPaste(Model* model, uint32 linksMode)
        else
                delete copyList;
 
+       if (duplicateList->CountItems() > 0)
+               FSMoveToFolder(duplicateList, new BEntry(entry), 
kDuplicateSelection);
+       else
+               delete duplicateList;
+
        return true;
 }
 


Other related posts:

  • » [haiku-commits] haiku: hrev53329 - src/kits/tracker - waddlesplash