Patch by Takashi Murai: Style cleanup and fix an untranslated string in the navigation context menus.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2010-09-30 00:37:52 +00:00
parent 9cdd37b474
commit 7c8978a92c
+36 -23
View File
@@ -26,10 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated. this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
of Be Incorporated in the United States and other countries. Other brand product trademarks of Be Incorporated in the United States and other countries.
names are registered trademarks or trademarks of their respective holders. Other brand product names are registered trademarks or trademarks of
All rights reserved. their respective holders. All rights reserved.
*/ */
// NavMenu is a hierarchical menu of volumes, folders, files and queries // NavMenu is a hierarchical menu of volumes, folders, files and queries
@@ -77,7 +77,8 @@ enum nav_flags {
bool bool
SpringLoadedFolderCompareMessages(const BMessage *incoming, const BMessage *dragmessage) SpringLoadedFolderCompareMessages(const BMessage* incoming,
const BMessage* dragmessage)
{ {
if (!dragmessage || !incoming) if (!dragmessage || !incoming)
return false; return false;
@@ -91,7 +92,8 @@ SpringLoadedFolderCompareMessages(const BMessage *incoming, const BMessage *drag
} }
bool inRefMatch = false; bool inRefMatch = false;
for (int32 dragIndex=0; dragmessage->HasRef("refs", dragIndex); dragIndex++) { for (int32 dragIndex = 0; dragmessage->HasRef("refs", dragIndex);
dragIndex++) {
entry_ref dragRef; entry_ref dragRef;
if (dragmessage->FindRef("refs", dragIndex, &dragRef) != B_OK) { if (dragmessage->FindRef("refs", dragIndex, &dragRef) != B_OK) {
inRefMatch = false; inRefMatch = false;
@@ -125,7 +127,8 @@ SpringLoadedFolderCompareMessages(const BMessage *incoming, const BMessage *drag
void void
SpringLoadedFolderSetMenuStates(const BMenu* menu, const BObjectList<BString> *typeslist) SpringLoadedFolderSetMenuStates(const BMenu* menu,
const BObjectList<BString> *typeslist)
{ {
if (!menu || !typeslist) if (!menu || !typeslist)
return; return;
@@ -173,7 +176,8 @@ SpringLoadedFolderSetMenuStates(const BMenu* menu, const BObjectList<BString> *t
void void
SpringLoadedFolderAddUniqueTypeToList(entry_ref *ref, BObjectList<BString> *typeslist) SpringLoadedFolderAddUniqueTypeToList(entry_ref* ref,
BObjectList<BString> *typeslist)
{ {
if (!ref || !typeslist) if (!ref || !typeslist)
return; return;
@@ -217,7 +221,8 @@ SpringLoadedFolderAddUniqueTypeToList(entry_ref *ref, BObjectList<BString> *type
void void
SpringLoadedFolderCacheDragData(const BMessage *incoming, BMessage **message, BObjectList<BString> **typeslist) SpringLoadedFolderCacheDragData(const BMessage* incoming, BMessage* *message,
BObjectList<BString> **typeslist)
{ {
if (!incoming) if (!incoming)
return; return;
@@ -266,7 +271,8 @@ BNavMenu::BNavMenu(const char *title, uint32 message, const BHandler *target,
// add the parent window to the invocation message so that it // add the parent window to the invocation message so that it
// can be closed if option modifier held down during invocation // can be closed if option modifier held down during invocation
BContainerWindow *originatingWindow = dynamic_cast<BContainerWindow *>(fParentWindow); BContainerWindow* originatingWindow =
dynamic_cast<BContainerWindow *>(fParentWindow);
if (originatingWindow) if (originatingWindow)
fMessage.AddData("nodeRefsToClose", B_RAW_TYPE, fMessage.AddData("nodeRefsToClose", B_RAW_TYPE,
originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref)); originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref));
@@ -276,8 +282,9 @@ BNavMenu::BNavMenu(const char *title, uint32 message, const BHandler *target,
} }
BNavMenu::BNavMenu(const char *title, uint32 message, const BMessenger &messenger, BNavMenu::BNavMenu(const char* title, uint32 message,
BWindow *parentWindow, const BObjectList<BString> *list) const BMessenger& messenger, BWindow* parentWindow,
const BObjectList<BString> *list)
: BSlowMenu(title), : BSlowMenu(title),
fMessage(message), fMessage(message),
fMessenger(messenger), fMessenger(messenger),
@@ -293,7 +300,8 @@ BNavMenu::BNavMenu(const char *title, uint32 message, const BMessenger &messenge
// add the parent window to the invocation message so that it // add the parent window to the invocation message so that it
// can be closed if option modifier held down during invocation // can be closed if option modifier held down during invocation
BContainerWindow *originatingWindow = dynamic_cast<BContainerWindow *>(fParentWindow); BContainerWindow* originatingWindow =
dynamic_cast<BContainerWindow *>(fParentWindow);
if (originatingWindow) if (originatingWindow)
fMessage.AddData("nodeRefsToClose", B_RAW_TYPE, fMessage.AddData("nodeRefsToClose", B_RAW_TYPE,
originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref)); originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref));
@@ -403,7 +411,8 @@ BNavMenu::StartBuildingItemList()
status_t status = entry.GetParent(&parent); status_t status = entry.GetParent(&parent);
// if ref is the root item then build list of volume root dirs // if ref is the root item then build list of volume root dirs
fFlags = uint8((fFlags & ~kVolumesOnly) | (status == B_ENTRY_NOT_FOUND ? kVolumesOnly : 0)); fFlags = uint8((fFlags & ~kVolumesOnly)
| (status == B_ENTRY_NOT_FOUND ? kVolumesOnly : 0));
if (fFlags & kVolumesOnly) if (fFlags & kVolumesOnly)
return true; return true;
@@ -415,7 +424,8 @@ BNavMenu::StartBuildingItemList()
fContainer = new QueryEntryListCollection(&startModel); fContainer = new QueryEntryListCollection(&startModel);
else if (startModel.IsDesktop()) { else if (startModel.IsDesktop()) {
fIteratingDesktop = true; fIteratingDesktop = true;
fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef()); fContainer = DesktopPoseView::InitDesktopDirentIterator(
0, startModel.EntryRef());
AddRootItemsIfNeeded(); AddRootItemsIfNeeded();
AddTrashItem(); AddTrashItem();
} else if (startModel.IsTrash()) { } else if (startModel.IsTrash()) {
@@ -717,7 +727,8 @@ BNavMenu::DoneBuildingItemList()
&& entry.GetParent(&entry) == B_OK) { && entry.GetParent(&entry) == B_OK) {
Model model(&entry, true); Model model(&entry, true);
BLooper* looper; BLooper* looper;
AddNavParentDir(&model,fMessage.what,fMessenger.Target(&looper)); AddNavParentDir(&model, fMessage.what,
fMessenger.Target(&looper));
} }
} }
@@ -755,8 +766,8 @@ BNavMenu::AddNavDir(const Model *model, uint32 what, BHandler *target,
if (populateSubmenu) { if (populateSubmenu) {
BNavMenu* navMenu = new BNavMenu(model->Name(), what, target); BNavMenu* navMenu = new BNavMenu(model->Name(), what, target);
navMenu->SetNavDir(model->EntryRef()); navMenu->SetNavDir(model->EntryRef());
navMenu->InitTrackingHook(fTrackingHook.fTrackingHook, &(fTrackingHook.fTarget), navMenu->InitTrackingHook(fTrackingHook.fTrackingHook,
fTrackingHook.fDragMessage); &(fTrackingHook.fTarget), fTrackingHook.fDragMessage);
item = new ModelMenuItem(model, navMenu); item = new ModelMenuItem(model, navMenu);
item->SetMessage(message); item->SetMessage(message);
} else } else
@@ -767,7 +778,8 @@ BNavMenu::AddNavDir(const Model *model, uint32 what, BHandler *target,
void void
BNavMenu::AddNavParentDir(const char *name,const Model *model,uint32 what,BHandler *target) BNavMenu::AddNavParentDir(const char* name,const Model* model,
uint32 what, BHandler* target)
{ {
BNavMenu* menu = new BNavMenu(name, what, target); BNavMenu* menu = new BNavMenu(name, what, target);
menu->SetNavDir(model->EntryRef()); menu->SetNavDir(model->EntryRef());
@@ -788,7 +800,7 @@ BNavMenu::AddNavParentDir(const char *name,const Model *model,uint32 what,BHandl
void void
BNavMenu::AddNavParentDir(const Model* model, uint32 what, BHandler* target) BNavMenu::AddNavParentDir(const Model* model, uint32 what, BHandler* target)
{ {
AddNavParentDir("parent folder",model,what,target); AddNavParentDir(B_TRANSLATE("parent folder"),model, what, target);
} }
@@ -828,8 +840,8 @@ BNavMenu::Target()
TrackingHookData* TrackingHookData*
BNavMenu::InitTrackingHook(bool (*hook)(BMenu *, void *), const BMessenger *target, BNavMenu::InitTrackingHook(bool (*hook)(BMenu*, void*),
const BMessage *dragMessage) const BMessenger* target, const BMessage* dragMessage)
{ {
fTrackingHook.fTrackingHook = hook; fTrackingHook.fTrackingHook = hook;
if (target) if (target)
@@ -841,7 +853,8 @@ BNavMenu::InitTrackingHook(bool (*hook)(BMenu *, void *), const BMessenger *targ
void void
BNavMenu::SetTrackingHookDeep(BMenu *menu, bool (*func)(BMenu *, void *), void *state) BNavMenu::SetTrackingHookDeep(BMenu* menu, bool (*func)(BMenu*, void*),
void* state)
{ {
menu->SetTrackingHook(func, state); menu->SetTrackingHook(func, state);
int32 count = menu->CountItems(); int32 count = menu->CountItems();