Fix typeahead cancellation in file panels.

- Add accessor to PoseView that reports whether the view is currently
  typeahead filtering.
- Use said accessor in the file panel's filter in order to detect whether
  to tell the latter to cancel filtering vs closing the panel.

Fixes #8140.
This commit is contained in:
Rene Gollent 2012-04-07 20:20:39 -04:00
parent eb78be9b27
commit 3da13b8038
3 changed files with 14 additions and 2 deletions

View File

@ -101,7 +101,7 @@ GetLinkFlavor(const Model *model, bool resolve = true)
static filter_result
key_down_filter(BMessage *message, BHandler **, BMessageFilter *filter)
key_down_filter(BMessage *message, BHandler **handler, BMessageFilter *filter)
{
TFilePanel *panel = dynamic_cast<TFilePanel *>(filter->Looper());
ASSERT(panel);
@ -119,6 +119,8 @@ key_down_filter(BMessage *message, BHandler **, BMessageFilter *filter)
if (!modifier && key == B_ESCAPE) {
if (view->ActivePose())
view->CommitActivePose(false);
else if (view->IsFiltering())
filter->Looper()->PostMessage(B_CANCEL, *handler);
else
filter->Looper()->PostMessage(kCancelButton);
return B_SKIP_MESSAGE;

View File

@ -2413,7 +2413,7 @@ BPoseView::MessageReceived(BMessage *message)
if (PrimarySort() == attrHash)
attrHash = 0;
SetPrimarySort(attrHash);
SetSecondarySort(0);
Cleanup(true);
@ -9801,6 +9801,13 @@ BPoseView::StartFiltering()
}
bool
BPoseView::IsFiltering() const
{
return fFiltering;
}
void
BPoseView::StopFiltering()
{

View File

@ -402,6 +402,9 @@ class BPoseView : public BView {
void StartWatchDateFormatChange();
void StopWatchDateFormatChange();
// type ahead filtering
bool IsFiltering() const;
void UpdateDateColumns(BMessage *);
virtual void AdaptToVolumeChange(BMessage *);
virtual void AdaptToDesktopIntegrationChange(BMessage *);