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
|
void
|
||||||
BCountView::AddFilter(const char *string)
|
BCountView::AddFilterString(const char *string)
|
||||||
{
|
{
|
||||||
fFilterString += string;
|
fFilterString += string;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@ -363,7 +363,7 @@ BCountView::AddFilter(const char *string)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCountView::RemoveFilter()
|
BCountView::RemoveFilterString()
|
||||||
{
|
{
|
||||||
fFilterString.Truncate(fFilterString.Length() - 1);
|
fFilterString.Truncate(fFilterString.Length() - 1);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
@ -63,8 +63,8 @@ public:
|
|||||||
const char *TypeAhead() const;
|
const char *TypeAhead() const;
|
||||||
bool IsTypingAhead() const;
|
bool IsTypingAhead() const;
|
||||||
|
|
||||||
void AddFilter(const char *string);
|
void AddFilterString(const char *string);
|
||||||
void RemoveFilter();
|
void RemoveFilterString();
|
||||||
void CancelFilter();
|
void CancelFilter();
|
||||||
const char *Filter() const;
|
const char *Filter() const;
|
||||||
bool IsFiltering() const;
|
bool IsFiltering() const;
|
||||||
|
@ -52,27 +52,6 @@ All rights reserved.
|
|||||||
#include "TrackerString.h"
|
#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 -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@ -175,18 +154,7 @@ void
|
|||||||
DesktopPoseView::AddPosesCompleted()
|
DesktopPoseView::AddPosesCompleted()
|
||||||
{
|
{
|
||||||
_inherited::AddPosesCompleted();
|
_inherited::AddPosesCompleted();
|
||||||
AddTrashPose();
|
CreateTrashPose();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -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
|
void
|
||||||
DesktopPoseView::StartSettingsWatch()
|
DesktopPoseView::StartSettingsWatch()
|
||||||
{
|
{
|
||||||
|
@ -43,8 +43,6 @@ All rights reserved.
|
|||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
bool ShouldShowDesktopPose(dev_t device, const Model *model, const PoseInfo *);
|
|
||||||
|
|
||||||
class DesktopPoseView : public BPoseView {
|
class DesktopPoseView : public BPoseView {
|
||||||
// overrides BPoseView to add desktop-view specific code
|
// overrides BPoseView to add desktop-view specific code
|
||||||
public:
|
public:
|
||||||
@ -65,7 +63,6 @@ protected:
|
|||||||
virtual bool FSNotification(const BMessage *);
|
virtual bool FSNotification(const BMessage *);
|
||||||
|
|
||||||
virtual bool IsDesktopView() const;
|
virtual bool IsDesktopView() const;
|
||||||
virtual bool ShouldShowPose(const Model *, const PoseInfo *);
|
|
||||||
|
|
||||||
virtual bool Represents(const node_ref *) const;
|
virtual bool Represents(const node_ref *) const;
|
||||||
virtual bool Represents(const entry_ref *) const;
|
virtual bool Represents(const entry_ref *) const;
|
||||||
@ -76,10 +73,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
typedef BPoseView _inherited;
|
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
|
void
|
||||||
BFilePanelPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
BFilePanelPoseView::AddPosesCompleted()
|
||||||
{
|
{
|
||||||
if (IsDesktopView() && !ShouldShowDesktopPose(TargetModel()->NodeRef()->device,
|
_inherited::AddPosesCompleted();
|
||||||
model, poseInfo))
|
if (IsDesktopView())
|
||||||
return false;
|
CreateTrashPose();
|
||||||
|
|
||||||
return _inherited::ShouldShowPose(model, poseInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ protected:
|
|||||||
virtual void SavePoseLocations(BRect * = NULL);
|
virtual void SavePoseLocations(BRect * = NULL);
|
||||||
|
|
||||||
virtual EntryListBase *InitDirentIterator(const entry_ref *);
|
virtual EntryListBase *InitDirentIterator(const entry_ref *);
|
||||||
virtual bool ShouldShowPose(const Model *, const PoseInfo *);
|
virtual void AddPosesCompleted();
|
||||||
virtual bool IsDesktopView() const;
|
virtual bool IsDesktopView() const;
|
||||||
|
|
||||||
void ShowVolumes(bool visible, bool showShared);
|
void ShowVolumes(bool visible, bool showShared);
|
||||||
|
@ -521,15 +521,9 @@ BNavMenu::AddNextItem()
|
|||||||
model.CloseNode();
|
model.CloseNode();
|
||||||
|
|
||||||
// item might be in invisible
|
// item might be in invisible
|
||||||
// ToDo:
|
if (size == sizeof(poseInfo)
|
||||||
// use more of PoseView's filtering here
|
&& !BPoseView::PoseVisible(&model, &poseInfo))
|
||||||
if ((size == sizeof(poseInfo)
|
|
||||||
&& !BPoseView::PoseVisible(&model, &poseInfo, false))
|
|
||||||
|| fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
|
|
||||||
&model, &poseInfo)) {
|
|
||||||
// PRINT(("not showing hidden item %s\n", model.Name()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
AddOneItem(&model);
|
AddOneItem(&model);
|
||||||
return true;
|
return true;
|
||||||
@ -588,7 +582,7 @@ BNavMenu::NewModelItem(Model *model, const BMessage *invokeMessage,
|
|||||||
result->CloseNode();
|
result->CloseNode();
|
||||||
|
|
||||||
if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result,
|
if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result,
|
||||||
&poseInfo, false)) {
|
&poseInfo)) {
|
||||||
// link target does not want to be visible
|
// link target does not want to be visible
|
||||||
delete newResolvedModel;
|
delete newResolvedModel;
|
||||||
return NULL;
|
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 *
|
BPose *
|
||||||
BPoseView::CreatePose(Model *model, PoseInfo *poseInfo, bool insertionSort,
|
BPoseView::CreatePose(Model *model, PoseInfo *poseInfo, bool insertionSort,
|
||||||
int32 *indexPtr, BRect *boundsPtr, bool forceDraw)
|
int32 *indexPtr, BRect *boundsPtr, bool forceDraw)
|
||||||
@ -1847,18 +1867,16 @@ BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count,
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo,
|
BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo)
|
||||||
bool inFilePanel)
|
|
||||||
{
|
{
|
||||||
return (!poseInfo->fInvisible
|
return !poseInfo->fInvisible;
|
||||||
|| (inFilePanel && strcmp(model->Name(), B_DESKTOP_DIR_NAME)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
|
||||||
{
|
{
|
||||||
if (!PoseVisible(model, poseInfo, IsFilePanel()))
|
if (!PoseVisible(model, poseInfo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check filter before adding item
|
// check filter before adding item
|
||||||
@ -6147,7 +6165,7 @@ BPoseView::KeyDown(const char *bytes, int32 count)
|
|||||||
} else
|
} else
|
||||||
lastString->Truncate(lastString->Length() - 1);
|
lastString->Truncate(lastString->Length() - 1);
|
||||||
|
|
||||||
fCountView->RemoveFilter();
|
fCountView->RemoveFilterString();
|
||||||
FilterChanged();
|
FilterChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -6185,12 +6203,12 @@ BPoseView::KeyDown(const char *bytes, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
fFilterStrings.AddItem(new BString());
|
fFilterStrings.AddItem(new BString());
|
||||||
fCountView->AddFilter("|");
|
fCountView->AddFilterString("|");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fFilterStrings.LastItem()->Append(searchChar);
|
fFilterStrings.LastItem()->Append(searchChar);
|
||||||
fCountView->AddFilter(searchChar);
|
fCountView->AddFilterString(searchChar);
|
||||||
FilterChanged();
|
FilterChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,8 @@ class BPoseView : public BView {
|
|||||||
void SetActivePose(BPose *);
|
void SetActivePose(BPose *);
|
||||||
BPose *ActivePose() const;
|
BPose *ActivePose() const;
|
||||||
void CommitActivePose(bool saveChanges = true);
|
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);
|
bool CreateSymlinkPoseTarget(Model *symlink);
|
||||||
// used to complete a symlink pose; returns true if
|
// used to complete a symlink pose; returns true if
|
||||||
// target symlink should not be shown
|
// target symlink should not be shown
|
||||||
@ -456,6 +457,8 @@ class BPoseView : public BView {
|
|||||||
// subclasses should always call inherited
|
// subclasses should always call inherited
|
||||||
void CreateVolumePose(BVolume *, bool watchIndividually);
|
void CreateVolumePose(BVolume *, bool watchIndividually);
|
||||||
|
|
||||||
|
void CreateTrashPose();
|
||||||
|
|
||||||
virtual bool AddPosesThreadValid(const entry_ref *) const;
|
virtual bool AddPosesThreadValid(const entry_ref *) const;
|
||||||
// verifies whether or not the current set of AddPoses threads
|
// verifies whether or not the current set of AddPoses threads
|
||||||
// are valid and allowed to be adding poses -- returns false
|
// are valid and allowed to be adding poses -- returns false
|
||||||
|
@ -344,12 +344,7 @@ BSlowContextMenu::AddNextItem()
|
|||||||
|
|
||||||
model.CloseNode();
|
model.CloseNode();
|
||||||
|
|
||||||
// item might be in invisible
|
if (!BPoseView::PoseVisible(&model, &poseInfo)) {
|
||||||
// ToDo:
|
|
||||||
// use more of PoseView's filtering here
|
|
||||||
if (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
|
|
||||||
&model, &poseInfo)) {
|
|
||||||
// PRINT(("not showing hidden item %s\n", model.Name()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user