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

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 22 Jul 2016 03:59:35 +0200 (CEST)

hrev50444 adds 2 changesets to branch 'master'
old head: 0c1281a14f4ddf0482dfa4674e42156e3b57b198
new head: c1cd54a0e1711e348a9ddd7b869303c4614a15d4
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=c1cd54a0e171+%5E0c1281a14f4d

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

e944dacae02c: Tracker: Remove special filtering case from NewFileFromTemplate.
  
  If the pose matches the current type-ahead filter, it will be added
  by the node watcher anyway, so this just created duplicate poses
  which messed up internal data structures. Fixes #11122.

c1cd54a0e171: FSUtils: Add a "bool copyTimes" argument to 
FSCopyAttributesAndStats().
  
  BPoseView::NewFileFromTemplate does not want to copy the times. Fixes #11702.
  
  We have to keep a 2-argument version of this function because it looks like
  some third-party applications might call it (e.g. Dockbert), and even
  though it's technically private API, it's easy enough to preserve binary
  compatibility.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

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

3 files changed, 14 insertions(+), 13 deletions(-)
src/kits/tracker/FSUtils.cpp  | 15 ++++++++++++---
src/kits/tracker/FSUtils.h    |  1 +
src/kits/tracker/PoseView.cpp | 11 +----------

############################################################################

Commit:      e944dacae02c0982334421006f9e5e576578abac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e944dacae02c
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Jul 22 01:12:09 2016 UTC

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

Tracker: Remove special filtering case from NewFileFromTemplate.

If the pose matches the current type-ahead filter, it will be added
by the node watcher anyway, so this just created duplicate poses
which messed up internal data structures. Fixes #11122.

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

diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index de667e5..389ebcf 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -3427,15 +3427,6 @@ BPoseView::NewFileFromTemplate(const BMessage* message)
        BPose* pose = EntryCreated(targetModel->NodeRef(), &destNodeRef,
                destEntryRef.name, &index);
 
-       if (fFiltering) {
-               if (fFilteredPoseList->FindPose(&destNodeRef, &index) == NULL) {
-                       float scrollBy = 0;
-                       BRect bounds = Bounds();
-                       AddPoseToList(fFilteredPoseList, true, true, pose, 
bounds, scrollBy,
-                               true, &index);
-               }
-       }
-
        if (pose != NULL) {
                WatchNewNode(pose->TargetModel()->NodeRef());
                UpdateScrollRange();

############################################################################

Revision:    hrev50444
Commit:      c1cd54a0e1711e348a9ddd7b869303c4614a15d4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c1cd54a0e171
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Jul 22 01:23:18 2016 UTC

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

FSUtils: Add a "bool copyTimes" argument to FSCopyAttributesAndStats().

BPoseView::NewFileFromTemplate does not want to copy the times. Fixes #11702.

We have to keep a 2-argument version of this function because it looks like
some third-party applications might call it (e.g. Dockbert), and even
though it's technically private API, it's easy enough to preserve binary
compatibility.

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

diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp
index aaca5fc..48d1b2f 100644
--- a/src/kits/tracker/FSUtils.cpp
+++ b/src/kits/tracker/FSUtils.cpp
@@ -1804,7 +1804,7 @@ FSCopyFolder(BEntry* srcEntry, BDirectory* destDir,
 
 
 status_t
-FSCopyAttributesAndStats(BNode* srcNode, BNode* destNode)
+FSCopyAttributesAndStats(BNode* srcNode, BNode* destNode, bool copyTimes)
 {
        char* buffer = new char[1024];
 
@@ -1847,13 +1847,22 @@ FSCopyAttributesAndStats(BNode* srcNode, BNode* 
destNode)
        destNode->SetPermissions(srcStat.st_mode);
        destNode->SetOwner(srcStat.st_uid);
        destNode->SetGroup(srcStat.st_gid);
-       destNode->SetModificationTime(srcStat.st_mtime);
-       destNode->SetCreationTime(srcStat.st_crtime);
+       if (copyTimes) {
+               destNode->SetModificationTime(srcStat.st_mtime);
+               destNode->SetCreationTime(srcStat.st_crtime);
+       }
 
        return B_OK;
 }
 
 
+status_t
+FSCopyAttributesAndStats(BNode* srcNode, BNode* destNode)
+{
+       return FSCopyAttributesAndStats(srcNode, destNode, true);
+}
+
+
 #if 0
 status_t
 FSCopyFile(BEntry* srcFile, StatStruct* srcStat, BDirectory* destDir,
diff --git a/src/kits/tracker/FSUtils.h b/src/kits/tracker/FSUtils.h
index 23c91e6..d0b4d4f 100644
--- a/src/kits/tracker/FSUtils.h
+++ b/src/kits/tracker/FSUtils.h
@@ -165,6 +165,7 @@ private:
 #ifndef _IMPEXP_TRACKER
 #define _IMPEXP_TRACKER
 #endif
+_IMPEXP_TRACKER status_t FSCopyAttributesAndStats(BNode*, BNode*, bool);
 _IMPEXP_TRACKER status_t FSCopyAttributesAndStats(BNode*, BNode*);
 
 _IMPEXP_TRACKER void FSDuplicate(BObjectList<entry_ref>* srcList,
diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index 389ebcf..8b82c10 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -3414,7 +3414,7 @@ BPoseView::NewFileFromTemplate(const BMessage* message)
        // copy the attributes from the template file
        BNode srcNode(&srcRef);
        BNode destNode(&destDir, fileName);
-       FSCopyAttributesAndStats(&srcNode, &destNode);
+       FSCopyAttributesAndStats(&srcNode, &destNode, false);
 
        BEntry entry(&destDir, fileName);
        entry.GetRef(&destEntryRef);


Other related posts: