hrev44495 adds 3 changesets to branch 'master' old head: e21fe3ff3303b21bf93780b3c07227daa3b12862 new head: 5489384d4538de742017aa912222e4921b4673bb ---------------------------------------------------------------------------- ea8b1e1: OpenWithWindow: Fix crash at closing, and fix filtering Following hrev44493, the way ShouldShowPose was used changed a bit, to harmonize with type ahead filtering. This updates OpenWithWindow to use a BRefFilter to do its filtering rather than overloading ShouldShowPose. 7d460e3: PoseList: fix an assertion failure 5489384: Tracker: crash fix in FilePanel Regression of hrev44493, file panel crashed when changing dir and filtering being disabled (sorry!) Also fix the widget editing when filtering is activated. Now renaming a file/folder and causing it to 'fall off' the filter does work. [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ] ---------------------------------------------------------------------------- 4 files changed, 64 insertions(+), 14 deletions(-) src/kits/tracker/OpenWithWindow.cpp | 27 +++++++++++++++++++-------- src/kits/tracker/OpenWithWindow.h | 17 +++++++++++++++-- src/kits/tracker/PoseList.cpp | 5 ++++- src/kits/tracker/PoseView.cpp | 29 ++++++++++++++++++++++++++--- ############################################################################ Commit: ea8b1e14f9519b9aaca6e6ddea8b01babc311beb URL: http://cgit.haiku-os.org/haiku/commit/?id=ea8b1e1 Author: Philippe Saint-Pierre <stpere@xxxxxxxxx> Date: Wed Aug 8 16:25:51 2012 UTC OpenWithWindow: Fix crash at closing, and fix filtering Following hrev44493, the way ShouldShowPose was used changed a bit, to harmonize with type ahead filtering. This updates OpenWithWindow to use a BRefFilter to do its filtering rather than overloading ShouldShowPose. ---------------------------------------------------------------------------- diff --git a/src/kits/tracker/OpenWithWindow.cpp b/src/kits/tracker/OpenWithWindow.cpp index f14f599..0238a46 100644 --- a/src/kits/tracker/OpenWithWindow.cpp +++ b/src/kits/tracker/OpenWithWindow.cpp @@ -648,6 +648,8 @@ OpenWithPoseView::InitDirentIterator(const entry_ref*) HideBarberPole(); return NULL; } + SetRefFilter(new OpenWithRefFilter(fIterator, entryList, + (fHaveCommonPreferredApp ? &fPreferredRef : 0))); return fIterator; } @@ -935,16 +937,25 @@ OpenWithPoseView::OpenWithRelationDescription(const Model* model, } -bool -OpenWithPoseView::ShouldShowPose(const Model* model, const PoseInfo* poseInfo) +// #pragma mark - + + +OpenWithRefFilter::OpenWithRefFilter(SearchForSignatureEntryList* iterator, + const BMessage *entryList, entry_ref* preferredRef) + : + fIterator(iterator), + fEntryList(entryList), + fPreferredRef(preferredRef) { - OpenWithContainerWindow* window = ContainerWindow(); - // filter for add_poses - if (!fIterator->CanOpenWithFilter(model, window->EntryList(), - fHaveCommonPreferredApp ? &fPreferredRef : 0)) - return false; +} + - return _inherited::ShouldShowPose(model, poseInfo); +bool +OpenWithRefFilter::Filter(const entry_ref* ref, BNode* node, stat_beos* st, + const char* filetype) +{ + Model *model = new Model(ref, true, true); + return fIterator->CanOpenWithFilter(model, fEntryList, fPreferredRef); } diff --git a/src/kits/tracker/OpenWithWindow.h b/src/kits/tracker/OpenWithWindow.h index 21baf58..e3a4c6f 100644 --- a/src/kits/tracker/OpenWithWindow.h +++ b/src/kits/tracker/OpenWithWindow.h @@ -252,8 +252,6 @@ class OpenWithPoseView : public BPoseView { // override to add selecting the default handling app // for selection - virtual bool ShouldShowPose(const Model*, const PoseInfo*); - virtual void Pulse(); virtual void KeyDown(const char* bytes, int32 count); @@ -269,6 +267,21 @@ class OpenWithPoseView : public BPoseView { }; +class OpenWithRefFilter: public BRefFilter +{ + public: + OpenWithRefFilter(SearchForSignatureEntryList*, const BMessage*, + entry_ref*); + bool Filter(const entry_ref* ref, BNode* node, stat_beos* st, + const char* filetype); + + private: + SearchForSignatureEntryList* fIterator; + const BMessage *fEntryList; + entry_ref* fPreferredRef; +}; + + class RelationCachingModelProxy { public: RelationCachingModelProxy(Model* model); ############################################################################ Commit: 7d460e3bb9b7635d77992c2fe7e424de8dee0c5c URL: http://cgit.haiku-os.org/haiku/commit/?id=7d460e3 Author: Philippe Saint-Pierre <stpere@xxxxxxxxx> Date: Wed Aug 8 16:31:02 2012 UTC PoseList: fix an assertion failure ---------------------------------------------------------------------------- diff --git a/src/kits/tracker/PoseList.cpp b/src/kits/tracker/PoseList.cpp index 75d639e..4e5d8fd 100644 --- a/src/kits/tracker/PoseList.cpp +++ b/src/kits/tracker/PoseList.cpp @@ -127,13 +127,16 @@ PoseList::FindAllPoses(const node_ref *node) const continue; } + if (!model->IsSymLink()) + continue; + model = model->LinkTo(); if (model && *model->NodeRef() == *node) { result->AddItem(pose); continue; } - if (!model && pose->TargetModel()->IsSymLink()) { + if (!model) { model = new Model(pose->TargetModel()->EntryRef(), true); if (*model->NodeRef() == *node) result->AddItem(pose); ############################################################################ Revision: hrev44495 Commit: 5489384d4538de742017aa912222e4921b4673bb URL: http://cgit.haiku-os.org/haiku/commit/?id=5489384 Author: Philippe Saint-Pierre <stpere@xxxxxxxxx> Date: Wed Aug 8 17:04:49 2012 UTC Tracker: crash fix in FilePanel Regression of hrev44493, file panel crashed when changing dir and filtering being disabled (sorry!) Also fix the widget editing when filtering is activated. Now renaming a file/folder and causing it to 'fall off' the filter does work. ---------------------------------------------------------------------------- diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index ca8354b..9e6987f 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -1078,6 +1078,8 @@ BPoseView::CommitActivePose(bool saveChanges) { if (ActivePose()) { int32 index = fPoseList->IndexOf(ActivePose()); + if (fFiltering) + index = fFilteredPoseList->IndexOf(ActivePose()); BPoint loc(0, index * fListElemHeight); if (ViewMode() != kListMode) loc = ActivePose()->Location(this); @@ -1456,7 +1458,7 @@ BPoseView::AddPosesTask(void* castToParams) return B_ERROR; } - ASSERT(!modelChunkIndex); + ASSERT(modelChunkIndex == -1); delete posesResult; delete container; @@ -3315,6 +3317,15 @@ 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) { WatchNewNode(pose->TargetModel()->NodeRef()); UpdateScrollRange(); @@ -3339,7 +3350,18 @@ BPoseView::NewFolder(const BMessage* message) PlaceFolder(&ref, message); int32 index; - BPose* pose = EntryCreated(TargetModel()->NodeRef(), &nodeRef, ref.name, &index); + BPose* pose = EntryCreated(TargetModel()->NodeRef(), &nodeRef, ref.name, + &index); + + if (fFiltering) { + if (fFilteredPoseList->FindPose(&nodeRef, &index) == NULL) { + float scrollBy = 0; + BRect bounds = Bounds(); + AddPoseToList(fFilteredPoseList, true, true, pose, bounds, + scrollBy, true, &index); + } + } + if (pose) { UpdateScrollRange(); CommitActivePose(); @@ -8008,7 +8030,8 @@ BPoseView::ClearPoses() // clear all pose lists fPoseList->MakeEmpty(); - fFilteredPoseList->MakeEmpty(); + if (fFiltering) + fFilteredPoseList->MakeEmpty(); fMimeTypeListIsDirty = true; fVSPoseList->MakeEmpty(); fZombieList->MakeEmpty();