More cleanups:
- remove some more leftover desktop integration-related code. - remove special case that would hide the Desktop folder in file panels. - fixed BFilePanel to correctly filter out the trash from the volume root and show it on the desktop like everywhere else. - renamed CountView::Add/RemoveFilter so they don't hide BHandler::Add/RemoveFilter (gcc4 warning). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35368 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
859d808fb7
commit
ef9c0b6a51
@ -355,7 +355,7 @@ BCountView::IsTypingAhead() const
|
||||
|
||||
|
||||
void
|
||||
BCountView::AddFilter(const char *string)
|
||||
BCountView::AddFilterString(const char *string)
|
||||
{
|
||||
fFilterString += string;
|
||||
Invalidate();
|
||||
@ -363,7 +363,7 @@ BCountView::AddFilter(const char *string)
|
||||
|
||||
|
||||
void
|
||||
BCountView::RemoveFilter()
|
||||
BCountView::RemoveFilterString()
|
||||
{
|
||||
fFilterString.Truncate(fFilterString.Length() - 1);
|
||||
Invalidate();
|
||||
|
@ -63,8 +63,8 @@ public:
|
||||
const char *TypeAhead() const;
|
||||
bool IsTypingAhead() const;
|
||||
|
||||
void AddFilter(const char *string);
|
||||
void RemoveFilter();
|
||||
void AddFilterString(const char *string);
|
||||
void RemoveFilterString();
|
||||
void CancelFilter();
|
||||
const char *Filter() const;
|
||||
bool IsFiltering() const;
|
||||
|
@ -52,27 +52,6 @@ All rights reserved.
|
||||
#include "TrackerString.h"
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
bool
|
||||
ShouldShowDesktopPose(dev_t device, const Model *model, const PoseInfo *)
|
||||
{
|
||||
if (model->NodeRef()->device != device) {
|
||||
// avoid having more than one Trash
|
||||
BDirectory remoteTrash;
|
||||
if (FSGetTrashDir(&remoteTrash, model->NodeRef()->device) == B_OK) {
|
||||
node_ref remoteTrashNodeRef;
|
||||
remoteTrash.GetNodeRef(&remoteTrashNodeRef);
|
||||
if (remoteTrashNodeRef == *model->NodeRef())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@ -175,18 +154,7 @@ void
|
||||
DesktopPoseView::AddPosesCompleted()
|
||||
{
|
||||
_inherited::AddPosesCompleted();
|
||||
AddTrashPose();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DesktopPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
||||
{
|
||||
ASSERT(TargetModel());
|
||||
if (!ShouldShowDesktopPose(TargetModel()->NodeRef()->device, model, poseInfo))
|
||||
return false;
|
||||
|
||||
return _inherited::ShouldShowPose(model, poseInfo);
|
||||
CreateTrashPose();
|
||||
}
|
||||
|
||||
|
||||
@ -224,26 +192,6 @@ DesktopPoseView::ShowVolumes(bool visible, bool showShared)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DesktopPoseView::AddTrashPose()
|
||||
{
|
||||
BVolume volume;
|
||||
if (BVolumeRoster().GetBootVolume(&volume) == B_OK) {
|
||||
BDirectory trash;
|
||||
BEntry entry;
|
||||
node_ref ref;
|
||||
if (FSGetTrashDir(&trash, volume.Device()) == B_OK
|
||||
&& trash.GetEntry(&entry) == B_OK && entry.GetNodeRef(&ref) == B_OK) {
|
||||
WatchNewNode(&ref);
|
||||
Model *model = new Model(&entry);
|
||||
PoseInfo info;
|
||||
ReadPoseInfo(model, &info);
|
||||
CreatePose(model, &info, false, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DesktopPoseView::StartSettingsWatch()
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ All rights reserved.
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
bool ShouldShowDesktopPose(dev_t device, const Model *model, const PoseInfo *);
|
||||
|
||||
class DesktopPoseView : public BPoseView {
|
||||
// overrides BPoseView to add desktop-view specific code
|
||||
public:
|
||||
@ -65,7 +63,6 @@ protected:
|
||||
virtual bool FSNotification(const BMessage *);
|
||||
|
||||
virtual bool IsDesktopView() const;
|
||||
virtual bool ShouldShowPose(const Model *, const PoseInfo *);
|
||||
|
||||
virtual bool Represents(const node_ref *) const;
|
||||
virtual bool Represents(const entry_ref *) const;
|
||||
@ -76,10 +73,6 @@ protected:
|
||||
private:
|
||||
typedef BPoseView _inherited;
|
||||
|
||||
friend bool ShouldShowDesktopPose(dev_t device, const Model *,
|
||||
const PoseInfo *);
|
||||
|
||||
void AddTrashPose();
|
||||
};
|
||||
|
||||
|
||||
|
@ -1595,14 +1595,12 @@ BFilePanelPoseView::InitDirentIterator(const entry_ref *ref)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BFilePanelPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
||||
void
|
||||
BFilePanelPoseView::AddPosesCompleted()
|
||||
{
|
||||
if (IsDesktopView() && !ShouldShowDesktopPose(TargetModel()->NodeRef()->device,
|
||||
model, poseInfo))
|
||||
return false;
|
||||
|
||||
return _inherited::ShouldShowPose(model, poseInfo);
|
||||
_inherited::AddPosesCompleted();
|
||||
if (IsDesktopView())
|
||||
CreateTrashPose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,7 +174,7 @@ protected:
|
||||
virtual void SavePoseLocations(BRect * = NULL);
|
||||
|
||||
virtual EntryListBase *InitDirentIterator(const entry_ref *);
|
||||
virtual bool ShouldShowPose(const Model *, const PoseInfo *);
|
||||
virtual void AddPosesCompleted();
|
||||
virtual bool IsDesktopView() const;
|
||||
|
||||
void ShowVolumes(bool visible, bool showShared);
|
||||
|
@ -521,15 +521,9 @@ BNavMenu::AddNextItem()
|
||||
model.CloseNode();
|
||||
|
||||
// item might be in invisible
|
||||
// ToDo:
|
||||
// use more of PoseView's filtering here
|
||||
if ((size == sizeof(poseInfo)
|
||||
&& !BPoseView::PoseVisible(&model, &poseInfo, false))
|
||||
|| fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
|
||||
&model, &poseInfo)) {
|
||||
// PRINT(("not showing hidden item %s\n", model.Name()));
|
||||
if (size == sizeof(poseInfo)
|
||||
&& !BPoseView::PoseVisible(&model, &poseInfo))
|
||||
return true;
|
||||
}
|
||||
|
||||
AddOneItem(&model);
|
||||
return true;
|
||||
@ -588,7 +582,7 @@ BNavMenu::NewModelItem(Model *model, const BMessage *invokeMessage,
|
||||
result->CloseNode();
|
||||
|
||||
if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result,
|
||||
&poseInfo, false)) {
|
||||
&poseInfo)) {
|
||||
// link target does not want to be visible
|
||||
delete newResolvedModel;
|
||||
return NULL;
|
||||
|
@ -1592,6 +1592,26 @@ BPoseView::CreateVolumePose(BVolume *volume, bool watchIndividually)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BPoseView::CreateTrashPose()
|
||||
{
|
||||
BVolume volume;
|
||||
if (BVolumeRoster().GetBootVolume(&volume) == B_OK) {
|
||||
BDirectory trash;
|
||||
BEntry entry;
|
||||
node_ref ref;
|
||||
if (FSGetTrashDir(&trash, volume.Device()) == B_OK
|
||||
&& trash.GetEntry(&entry) == B_OK && entry.GetNodeRef(&ref) == B_OK) {
|
||||
WatchNewNode(&ref);
|
||||
Model *model = new Model(&entry);
|
||||
PoseInfo info;
|
||||
ReadPoseInfo(model, &info);
|
||||
CreatePose(model, &info, false, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BPose *
|
||||
BPoseView::CreatePose(Model *model, PoseInfo *poseInfo, bool insertionSort,
|
||||
int32 *indexPtr, BRect *boundsPtr, bool forceDraw)
|
||||
@ -1847,18 +1867,16 @@ BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count,
|
||||
|
||||
|
||||
bool
|
||||
BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo,
|
||||
bool inFilePanel)
|
||||
BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo)
|
||||
{
|
||||
return (!poseInfo->fInvisible
|
||||
|| (inFilePanel && strcmp(model->Name(), B_DESKTOP_DIR_NAME)));
|
||||
return !poseInfo->fInvisible;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
||||
{
|
||||
if (!PoseVisible(model, poseInfo, IsFilePanel()))
|
||||
if (!PoseVisible(model, poseInfo))
|
||||
return false;
|
||||
|
||||
// check filter before adding item
|
||||
@ -6147,7 +6165,7 @@ BPoseView::KeyDown(const char *bytes, int32 count)
|
||||
} else
|
||||
lastString->Truncate(lastString->Length() - 1);
|
||||
|
||||
fCountView->RemoveFilter();
|
||||
fCountView->RemoveFilterString();
|
||||
FilterChanged();
|
||||
break;
|
||||
}
|
||||
@ -6185,12 +6203,12 @@ BPoseView::KeyDown(const char *bytes, int32 count)
|
||||
break;
|
||||
|
||||
fFilterStrings.AddItem(new BString());
|
||||
fCountView->AddFilter("|");
|
||||
fCountView->AddFilterString("|");
|
||||
break;
|
||||
}
|
||||
|
||||
fFilterStrings.LastItem()->Append(searchChar);
|
||||
fCountView->AddFilter(searchChar);
|
||||
fCountView->AddFilterString(searchChar);
|
||||
FilterChanged();
|
||||
break;
|
||||
}
|
||||
|
@ -323,7 +323,8 @@ class BPoseView : public BView {
|
||||
void SetActivePose(BPose *);
|
||||
BPose *ActivePose() const;
|
||||
void CommitActivePose(bool saveChanges = true);
|
||||
static bool PoseVisible(const Model *, const PoseInfo *, bool inFilePanel);bool FrameForPose(BPose *targetpose, bool convert, BRect *poseRect);
|
||||
static bool PoseVisible(const Model *, const PoseInfo *);
|
||||
bool FrameForPose(BPose *targetpose, bool convert, BRect *poseRect);
|
||||
bool CreateSymlinkPoseTarget(Model *symlink);
|
||||
// used to complete a symlink pose; returns true if
|
||||
// target symlink should not be shown
|
||||
@ -456,6 +457,8 @@ class BPoseView : public BView {
|
||||
// subclasses should always call inherited
|
||||
void CreateVolumePose(BVolume *, bool watchIndividually);
|
||||
|
||||
void CreateTrashPose();
|
||||
|
||||
virtual bool AddPosesThreadValid(const entry_ref *) const;
|
||||
// verifies whether or not the current set of AddPoses threads
|
||||
// are valid and allowed to be adding poses -- returns false
|
||||
|
@ -344,12 +344,7 @@ BSlowContextMenu::AddNextItem()
|
||||
|
||||
model.CloseNode();
|
||||
|
||||
// item might be in invisible
|
||||
// ToDo:
|
||||
// use more of PoseView's filtering here
|
||||
if (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
|
||||
&model, &poseInfo)) {
|
||||
// PRINT(("not showing hidden item %s\n", model.Name()));
|
||||
if (!BPoseView::PoseVisible(&model, &poseInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user