Employ a similar naming abstraction for the desktop as has been done for Trash to allow that name to be localized visually later (same on-disk location though).
SlowContextPopup also needed to be adjusted to account for trash's new location. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35137 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -217,7 +217,7 @@ BDirMenu::AddItemToDirMenu(const BEntry *entry, BWindow *originatingWindow,
|
||||
}
|
||||
|
||||
if (addShortcuts) {
|
||||
if (FSIsDeskDir(entry))
|
||||
if (model.IsDesktop())
|
||||
item->SetShortcut('D', B_COMMAND_KEY);
|
||||
else if (FSIsHomeDir(entry))
|
||||
item->SetShortcut('H', B_COMMAND_KEY);
|
||||
|
||||
@@ -229,7 +229,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
||||
if (model->IsVolume()
|
||||
|| model->IsRoot()
|
||||
|| model->IsTrash()
|
||||
|| FSIsDeskDir(&entry))
|
||||
|| model->IsDesktop())
|
||||
continue;
|
||||
|
||||
MakeRefName(refName, node);
|
||||
|
||||
@@ -1251,8 +1251,7 @@ TFilePanel::CanOpenParent() const
|
||||
{
|
||||
if (TrackerSettings().DesktopFilePanelRoot()) {
|
||||
// don't allow opening Desktop folder's parent
|
||||
BEntry entry(TargetModel()->EntryRef());
|
||||
if (FSIsDeskDir(&entry))
|
||||
if (TargetModel()->IsDesktop())
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1504,11 +1503,9 @@ TFilePanel::WindowActivated(bool active)
|
||||
|
||||
|
||||
BFilePanelPoseView::BFilePanelPoseView(Model *model, BRect frame, uint32 resizeMask)
|
||||
: BPoseView(model, frame, kListMode, resizeMask)
|
||||
: BPoseView(model, frame, kListMode, resizeMask),
|
||||
fIsDesktop(model->IsDesktop())
|
||||
{
|
||||
BEntry entry;
|
||||
model->GetEntry(&entry);
|
||||
fIsDesktop = FSIsDeskDir(&entry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -339,6 +339,9 @@ Model::Name() const
|
||||
|
||||
case kTrashNode:
|
||||
return "Trash";
|
||||
|
||||
case kDesktopNode:
|
||||
return "Desktop";
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -411,6 +414,7 @@ Model::OpenNodeCommon(bool writable)
|
||||
case kVolumeNode:
|
||||
case kRootNode:
|
||||
case kTrashNode:
|
||||
case kDesktopNode:
|
||||
if (!IsNodeOpen())
|
||||
fNode = new BDirectory(&fEntryRef);
|
||||
|
||||
@@ -598,8 +602,12 @@ Model::FinishSettingUpType()
|
||||
switch (fBaseType) {
|
||||
case kDirectoryNode:
|
||||
entry.SetTo(&fEntryRef);
|
||||
if (entry.InitCheck() == B_OK && FSIsTrashDir(&entry))
|
||||
fBaseType = kTrashNode;
|
||||
if (entry.InitCheck() == B_OK) {
|
||||
if (FSIsTrashDir(&entry))
|
||||
fBaseType = kTrashNode;
|
||||
else if (FSIsDeskDir(&entry))
|
||||
fBaseType = kDesktopNode;
|
||||
}
|
||||
|
||||
fMimeType = B_DIR_MIMETYPE; // should use a shared string here
|
||||
if (IsNodeOpen()) {
|
||||
@@ -687,7 +695,7 @@ Model::ResetIconFrom()
|
||||
|
||||
// mirror the logic from FinishSettingUpType
|
||||
if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
||||
|| fBaseType == kTrashNode)
|
||||
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
||||
&& !CheckNodeIconHintPrivate(fNode, dynamic_cast<TTracker *>(be_app) == NULL)) {
|
||||
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
||||
fIconFrom = kTrackerSupplied;
|
||||
@@ -1265,6 +1273,7 @@ Model::PrintToStream(int32 level, bool deep)
|
||||
|
||||
case kDirectoryNode:
|
||||
case kTrashNode:
|
||||
case kDesktopNode:
|
||||
PRINT(("dir\n"));
|
||||
break;
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ class Model {
|
||||
bool IsSymLink() const;
|
||||
bool IsRoot() const;
|
||||
bool IsTrash() const;
|
||||
bool IsDesktop() const;
|
||||
bool IsVolume() const;
|
||||
|
||||
IconSource IconFrom() const;
|
||||
@@ -229,6 +230,7 @@ class Model {
|
||||
kVolumeNode,
|
||||
kRootNode,
|
||||
kTrashNode,
|
||||
kDesktopNode,
|
||||
kUnknownNode
|
||||
};
|
||||
|
||||
@@ -382,7 +384,8 @@ Model::IsDirectory() const
|
||||
return fBaseType == kDirectoryNode
|
||||
|| fBaseType == kVolumeNode
|
||||
|| fBaseType == kRootNode
|
||||
|| fBaseType == kTrashNode;
|
||||
|| fBaseType == kTrashNode
|
||||
|| fBaseType == kDesktopNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -423,6 +426,13 @@ Model::IsTrash() const
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
Model::IsDesktop() const
|
||||
{
|
||||
return fBaseType == kDesktopNode;
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
Model::IsExecutable() const
|
||||
{
|
||||
|
||||
@@ -408,7 +408,7 @@ BNavMenu::StartBuildingItemList()
|
||||
|
||||
if (startModel.IsQuery())
|
||||
fContainer = new QueryEntryListCollection(&startModel);
|
||||
else if (FSIsDeskDir(&entry)) {
|
||||
else if (startModel.IsDesktop()) {
|
||||
fIteratingDesktop = true;
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef());
|
||||
AddRootItemsIfNeeded();
|
||||
|
||||
@@ -259,11 +259,12 @@ BSlowContextMenu::StartBuildingItemList()
|
||||
|
||||
if (startModel.IsQuery())
|
||||
fContainer = new QueryEntryListCollection(&startModel);
|
||||
else if (FSIsDeskDir(&entry)) {
|
||||
else if (startModel.IsDesktop()) {
|
||||
fIteratingDesktop = true;
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
||||
startModel.EntryRef());
|
||||
AddRootItemsIfNeeded();
|
||||
AddTrashItem();
|
||||
} else
|
||||
fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory *>
|
||||
(startModel.Node()));
|
||||
@@ -299,6 +300,18 @@ BSlowContextMenu::AddRootItemsIfNeeded()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BSlowContextMenu::AddTrashItem()
|
||||
{
|
||||
BPath path;
|
||||
if (find_directory(B_TRASH_DIRECTORY, &path) == B_OK) {
|
||||
BEntry entry(path.Path());
|
||||
Model model(&entry);
|
||||
AddOneItem(&model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BSlowContextMenu::AddNextItem()
|
||||
{
|
||||
|
||||
@@ -83,6 +83,7 @@ protected:
|
||||
|
||||
void AddOneItem(Model *);
|
||||
void AddRootItemsIfNeeded();
|
||||
void AddTrashItem();
|
||||
static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *);
|
||||
|
||||
bool fMenuBuilt;
|
||||
|
||||
Reference in New Issue
Block a user