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 (addShortcuts) {
|
||||||
if (FSIsDeskDir(entry))
|
if (model.IsDesktop())
|
||||||
item->SetShortcut('D', B_COMMAND_KEY);
|
item->SetShortcut('D', B_COMMAND_KEY);
|
||||||
else if (FSIsHomeDir(entry))
|
else if (FSIsHomeDir(entry))
|
||||||
item->SetShortcut('H', B_COMMAND_KEY);
|
item->SetShortcut('H', B_COMMAND_KEY);
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||||||
if (model->IsVolume()
|
if (model->IsVolume()
|
||||||
|| model->IsRoot()
|
|| model->IsRoot()
|
||||||
|| model->IsTrash()
|
|| model->IsTrash()
|
||||||
|| FSIsDeskDir(&entry))
|
|| model->IsDesktop())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MakeRefName(refName, node);
|
MakeRefName(refName, node);
|
||||||
|
|||||||
@@ -1251,8 +1251,7 @@ TFilePanel::CanOpenParent() const
|
|||||||
{
|
{
|
||||||
if (TrackerSettings().DesktopFilePanelRoot()) {
|
if (TrackerSettings().DesktopFilePanelRoot()) {
|
||||||
// don't allow opening Desktop folder's parent
|
// don't allow opening Desktop folder's parent
|
||||||
BEntry entry(TargetModel()->EntryRef());
|
if (TargetModel()->IsDesktop())
|
||||||
if (FSIsDeskDir(&entry))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1504,11 +1503,9 @@ TFilePanel::WindowActivated(bool active)
|
|||||||
|
|
||||||
|
|
||||||
BFilePanelPoseView::BFilePanelPoseView(Model *model, BRect frame, uint32 resizeMask)
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ Model::Name() const
|
|||||||
case kTrashNode:
|
case kTrashNode:
|
||||||
return "Trash";
|
return "Trash";
|
||||||
|
|
||||||
|
case kDesktopNode:
|
||||||
|
return "Desktop";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -411,6 +414,7 @@ Model::OpenNodeCommon(bool writable)
|
|||||||
case kVolumeNode:
|
case kVolumeNode:
|
||||||
case kRootNode:
|
case kRootNode:
|
||||||
case kTrashNode:
|
case kTrashNode:
|
||||||
|
case kDesktopNode:
|
||||||
if (!IsNodeOpen())
|
if (!IsNodeOpen())
|
||||||
fNode = new BDirectory(&fEntryRef);
|
fNode = new BDirectory(&fEntryRef);
|
||||||
|
|
||||||
@@ -598,8 +602,12 @@ Model::FinishSettingUpType()
|
|||||||
switch (fBaseType) {
|
switch (fBaseType) {
|
||||||
case kDirectoryNode:
|
case kDirectoryNode:
|
||||||
entry.SetTo(&fEntryRef);
|
entry.SetTo(&fEntryRef);
|
||||||
if (entry.InitCheck() == B_OK && FSIsTrashDir(&entry))
|
if (entry.InitCheck() == B_OK) {
|
||||||
fBaseType = kTrashNode;
|
if (FSIsTrashDir(&entry))
|
||||||
|
fBaseType = kTrashNode;
|
||||||
|
else if (FSIsDeskDir(&entry))
|
||||||
|
fBaseType = kDesktopNode;
|
||||||
|
}
|
||||||
|
|
||||||
fMimeType = B_DIR_MIMETYPE; // should use a shared string here
|
fMimeType = B_DIR_MIMETYPE; // should use a shared string here
|
||||||
if (IsNodeOpen()) {
|
if (IsNodeOpen()) {
|
||||||
@@ -687,7 +695,7 @@ Model::ResetIconFrom()
|
|||||||
|
|
||||||
// mirror the logic from FinishSettingUpType
|
// mirror the logic from FinishSettingUpType
|
||||||
if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
||||||
|| fBaseType == kTrashNode)
|
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
||||||
&& !CheckNodeIconHintPrivate(fNode, dynamic_cast<TTracker *>(be_app) == NULL)) {
|
&& !CheckNodeIconHintPrivate(fNode, dynamic_cast<TTracker *>(be_app) == NULL)) {
|
||||||
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
||||||
fIconFrom = kTrackerSupplied;
|
fIconFrom = kTrackerSupplied;
|
||||||
@@ -1265,6 +1273,7 @@ Model::PrintToStream(int32 level, bool deep)
|
|||||||
|
|
||||||
case kDirectoryNode:
|
case kDirectoryNode:
|
||||||
case kTrashNode:
|
case kTrashNode:
|
||||||
|
case kDesktopNode:
|
||||||
PRINT(("dir\n"));
|
PRINT(("dir\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ class Model {
|
|||||||
bool IsSymLink() const;
|
bool IsSymLink() const;
|
||||||
bool IsRoot() const;
|
bool IsRoot() const;
|
||||||
bool IsTrash() const;
|
bool IsTrash() const;
|
||||||
|
bool IsDesktop() const;
|
||||||
bool IsVolume() const;
|
bool IsVolume() const;
|
||||||
|
|
||||||
IconSource IconFrom() const;
|
IconSource IconFrom() const;
|
||||||
@@ -229,6 +230,7 @@ class Model {
|
|||||||
kVolumeNode,
|
kVolumeNode,
|
||||||
kRootNode,
|
kRootNode,
|
||||||
kTrashNode,
|
kTrashNode,
|
||||||
|
kDesktopNode,
|
||||||
kUnknownNode
|
kUnknownNode
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -382,7 +384,8 @@ Model::IsDirectory() const
|
|||||||
return fBaseType == kDirectoryNode
|
return fBaseType == kDirectoryNode
|
||||||
|| fBaseType == kVolumeNode
|
|| fBaseType == kVolumeNode
|
||||||
|| fBaseType == kRootNode
|
|| 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
|
inline bool
|
||||||
Model::IsExecutable() const
|
Model::IsExecutable() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ BNavMenu::StartBuildingItemList()
|
|||||||
|
|
||||||
if (startModel.IsQuery())
|
if (startModel.IsQuery())
|
||||||
fContainer = new QueryEntryListCollection(&startModel);
|
fContainer = new QueryEntryListCollection(&startModel);
|
||||||
else if (FSIsDeskDir(&entry)) {
|
else if (startModel.IsDesktop()) {
|
||||||
fIteratingDesktop = true;
|
fIteratingDesktop = true;
|
||||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef());
|
fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef());
|
||||||
AddRootItemsIfNeeded();
|
AddRootItemsIfNeeded();
|
||||||
|
|||||||
@@ -259,11 +259,12 @@ BSlowContextMenu::StartBuildingItemList()
|
|||||||
|
|
||||||
if (startModel.IsQuery())
|
if (startModel.IsQuery())
|
||||||
fContainer = new QueryEntryListCollection(&startModel);
|
fContainer = new QueryEntryListCollection(&startModel);
|
||||||
else if (FSIsDeskDir(&entry)) {
|
else if (startModel.IsDesktop()) {
|
||||||
fIteratingDesktop = true;
|
fIteratingDesktop = true;
|
||||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
||||||
startModel.EntryRef());
|
startModel.EntryRef());
|
||||||
AddRootItemsIfNeeded();
|
AddRootItemsIfNeeded();
|
||||||
|
AddTrashItem();
|
||||||
} else
|
} else
|
||||||
fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory *>
|
fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory *>
|
||||||
(startModel.Node()));
|
(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
|
bool
|
||||||
BSlowContextMenu::AddNextItem()
|
BSlowContextMenu::AddNextItem()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ protected:
|
|||||||
|
|
||||||
void AddOneItem(Model *);
|
void AddOneItem(Model *);
|
||||||
void AddRootItemsIfNeeded();
|
void AddRootItemsIfNeeded();
|
||||||
|
void AddTrashItem();
|
||||||
static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *);
|
static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *);
|
||||||
|
|
||||||
bool fMenuBuilt;
|
bool fMenuBuilt;
|
||||||
|
|||||||
Reference in New Issue
Block a user