Partially implement ticket #4916:

- Rename "Configure Favorites..." to "Edit Favorites...".
	- Remove the old-style Configure Favorites dialog in favor of simply
	  opening the favorites folder (~/config/settings/Tracker/go) in a
	  Tracker window for the user to manipulate.
	- Rename the "Favorite Folders" section to simply "Favorites" as files
 	  are also allowed (i.e. to easily open a template document).
 	- Removed completely arbitrary (and silent) 20 item limit to favorites
 	  list.
 	- Automatic whitespace cleanup
Still to do: Grab the ref filter from the file panel (if any) and run the
favorites through it as well, since we want to filter out any non-folder
favorites that the app is incapable of handling. Also, the setting for
the favorites menu to show recent documents needs a new home, as it was
previously in the no longer existing Configure Favorites window. Suggestions
welcome, as I'm not currently seeing a spot in the Tracker prefs that would
make good sense.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34071 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2009-11-16 01:07:40 +00:00
parent 7dd65803e7
commit f4dc59983b
7 changed files with 131 additions and 2773 deletions
-275
View File
@@ -1,275 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#ifndef FAVORITES_CONFIG_H
#define FAVORITES_CONFIG_H
#include <Control.h>
#include <Window.h>
#include "Model.h"
class BBox;
class BButton;
class BCheckBox;
class BFilePanel;
class BMenuField;
class BPopUpMenu;
class BTextControl;
class BMessageRunner;
namespace BPrivate {
const uint32 kConfigShow = 'show';
const uint32 kConfigClose = 'canc';
//
// your app will get one of these messages when
// the count has changed
// FindInt32("count", &count)
//
const uint32 kUpdateAppsCount = 'upac';
const uint32 kUpdateDocsCount = 'updc';
const uint32 kUpdateFolderCount = 'upfl';
class NameItemPanel : public BWindow {
public:
NameItemPanel(BWindow *parent, const char *initialText);
virtual ~NameItemPanel();
virtual void MessageReceived(BMessage *);
private:
void AddParts(const char *initialText);
BWindow *fParent;
BBox *fBG;
BTextControl *fNameFld;
BButton *fCancelBtn;
BButton *fDoneBtn;
};
class TDraggableIconButton : public BControl {
public:
TDraggableIconButton(BRect , const char *label, BMessage *,
uint32 resizemask, uint32 flags);
virtual ~TDraggableIconButton();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect);
virtual void MouseDown(BPoint);
virtual void MouseUp(BPoint);
virtual void MouseMoved(BPoint , uint32 , const BMessage *);
virtual void GetPreferredSize(float *, float *);
virtual void ResizeToPreferred();
private:
bool fDragging;
BRect fInitialClickRect;
BBitmap *fIcon;
BRect fIconRect;
BRect fLabelRect;
};
class TScrollerButton : public BControl {
public:
TScrollerButton(BRect , BMessage *, bool direction);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect);
virtual void MouseDown(BPoint);
virtual void MouseUp(BPoint);
virtual void MouseMoved(BPoint , uint32 , const BMessage *);
private:
bool fDirection;
rgb_color fSelectedColor;
BRect fHiliteFrame;
BMessageRunner *fTicker;
};
class TContentsMenu : public BControl {
public:
TContentsMenu(BRect , BMessage *singleClick, BMessage *doubleClick,
int32 visibleItemCount, const entry_ref *startRef);
virtual ~TContentsMenu();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect );
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void MessageReceived(BMessage *);
virtual void MouseDown(BPoint );
virtual void MouseUp(BPoint );
virtual void MouseMoved(BPoint , uint32 , const BMessage *);
virtual void GetPreferredSize(float *, float *);
virtual void ResizeToPreferred();
void StartTracking(BPoint);
void StopTracking();
#ifdef ITEM_EDIT
void BeginItemEdit(BPoint);
void StopItemEdit();
#endif
void SetStartRef(const entry_ref *);
void FillMenu(const entry_ref *);
void EmptyMenu();
bool ItemFrame(int32 index, BRect *iconFrame, BRect *textFrame, BRect *itemFrame) const;
void InvalidateItem(int32 index);
void InvalidateAbsoluteItem(int32 index);
int32 ItemAt(BPoint, BRect *textFrame, BRect *itemFrame, BRect *iconFrame);
const Model *ItemAt(int32) const;
void SelectItemAt(BPoint where);
void Select(const entry_ref *);
void OpenItem(int32);
int32 ItemCount() const;
void RemoveItem(int32);
void AddTempItem(BPoint where);
private:
void UpdateScrollers();
void Scroll(bool);
BMessage *fDoubleClickMessage;
int32 fVisibleItemCount;
entry_ref fStartRef;
BFont *fMenuFont;
float fFontHeight;
float fItemHeight;
rgb_color fHiliteColor;
BRect fInitialClickRect;
bigtime_t fInitialClickTime;
#ifdef ITEM_EDIT
BPoint fInitialClickLoc;
bool fEditingItem;
BTextView *fEditingFld;
int32 fItemIndex;
#endif
int32 fFirstItem;
BObjectList<Model> *fContentsList;
BBitmap *fSmallGroupIcon;
BBitmap *fSymlinkIcon;
TScrollerButton *fUpBtn;
TScrollerButton *fDownBtn;
};
// pass -1 to max apps/docs/folders to not have it show
class TFavoritesConfigWindow : public BWindow {
public:
TFavoritesConfigWindow(BRect frame, const char *title,
bool modal, uint32 filePanelNodeFlavors,
BMessenger parent, const entry_ref *startRef,
int32 maxApps = -1, int32 maxDocs = -1, int32 maxFolders = -1);
~TFavoritesConfigWindow();
void MessageReceived(BMessage *);
bool QuitRequested();
void AddNewGroup();
void AddRefs(BMessage *);
private:
void AddParts(int32 maxApps, int32 maxDocs, int32 maxFolders);
void AddBeMenuPane(int32 maxApps, int32 maxDocs, int32 maxFolders);
void OpenGroup(const entry_ref *);
void ShowGroup(const entry_ref *);
void PromptForAdd();
void UpdateButtons();
void UpdateFoldersCount(int32 = -1, bool notifyTracker = true);
void UpdateDocsCount(int32 = -1, bool notifyTracker = true);
void UpdateAppsCount(int32 = -1, bool notifyTracker = true);
static void BuildCommon(BRect *frame, int32 count, const char *string, uint32 btnWhat,
uint32 fldWhat, BCheckBox **button, BTextControl **field, BBox *parent);
static void AddNewGroup(entry_ref *, entry_ref *);
static void AddSymLink(const entry_ref *, const entry_ref *);
uint32 fFilePanelNodeFlavors;
BMessenger fParent;
entry_ref fCurrentRef;
BFilePanel *fAddPanel;
// Favorites Menu Config controls
BBox *fBeMenuPaneBG;
BPopUpMenu *fGroupMenu;
BMenuField *fGroupBtn;
BPopUpMenu *fSortMenu;
BMenuField *fSortBtn;
TDraggableIconButton *fNewGroupBtn;
BCheckBox *fRecentAppsBtn;
BTextControl *fRecentAppsFld;
BCheckBox *fRecentFoldersBtn;
BTextControl *fRecentFoldersFld;
BCheckBox *fRecentDocsBtn;
BTextControl *fRecentDocsFld;
TContentsMenu *fMenuThing;
BButton *fAddBtn;
BButton *fRemoveBtn;
BButton *fEditBtn;
BButton *fOpenBtn;
};
} // namespace BPrivate
using namespace BPrivate;
#endif
+1
View File
@@ -100,6 +100,7 @@ const uint32 kPasteAttributes = 'Tpat';
const uint32 kAttributeItem = 'Tatr'; const uint32 kAttributeItem = 'Tatr';
const uint32 kMIMETypeItem = 'Tmim'; const uint32 kMIMETypeItem = 'Tmim';
const uint32 kAddCurrentDir = 'Tadd'; const uint32 kAddCurrentDir = 'Tadd';
const uint32 kEditFavorites = 'Tedf';
const uint32 kSwitchDirectory = 'Tswd'; const uint32 kSwitchDirectory = 'Tswd';
const uint32 kQuitTracker = 'Tqit'; const uint32 kQuitTracker = 'Tqit';
File diff suppressed because it is too large Load Diff
+29 -31
View File
@@ -74,18 +74,18 @@ FavoritesMenu::~FavoritesMenu()
} }
bool bool
FavoritesMenu::StartBuildingItemList() FavoritesMenu::StartBuildingItemList()
{ {
// initialize the menu building state // initialize the menu building state
if (!fInitialItemCount) if (!fInitialItemCount)
fInitialItemCount = CountItems(); fInitialItemCount = CountItems();
else { else {
// strip the old items so we can add new fresh ones // strip the old items so we can add new fresh ones
int32 count = CountItems() - fInitialItemCount; int32 count = CountItems() - fInitialItemCount;
// keep the items that were added by the FavoritesMenu creator // keep the items that were added by the FavoritesMenu creator
while (count--) while (count--)
delete RemoveItem(fInitialItemCount); delete RemoveItem(fInitialItemCount);
} }
@@ -95,11 +95,11 @@ FavoritesMenu::StartBuildingItemList()
} }
bool bool
FavoritesMenu::AddNextItem() FavoritesMenu::AddNextItem()
{ {
// run the next chunk of code for a given item adding state // run the next chunk of code for a given item adding state
if (fState == kStart) { if (fState == kStart) {
fState = kAddingFavorites; fState = kAddingFavorites;
fSectionItemCount = 0; fSectionItemCount = 0;
@@ -118,13 +118,13 @@ FavoritesMenu::AddNextItem()
if (!startModel.IsContainer()) if (!startModel.IsContainer())
throw B_ERROR; throw B_ERROR;
if (startModel.IsQuery()) if (startModel.IsQuery())
fContainer = new QueryEntryListCollection(&startModel); fContainer = new QueryEntryListCollection(&startModel);
else else
fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory *> fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory *>
(startModel.Node())); (startModel.Node()));
ThrowOnInitCheckError(fContainer); ThrowOnInitCheckError(fContainer);
ThrowOnError( fContainer->Rewind() ); ThrowOnError( fContainer->Rewind() );
@@ -133,13 +133,11 @@ FavoritesMenu::AddNextItem()
fContainer = NULL; fContainer = NULL;
} }
} }
if (fState == kAddingFavorites) {
if (fState == kAddingFavorites) {
entry_ref ref; entry_ref ref;
// limit nav menus to 20 items only
if (fContainer if (fContainer
&& fSectionItemCount < 20
&& fContainer->GetNextRef(&ref) == B_OK) { && fContainer->GetNextRef(&ref) == B_OK) {
Model model(&ref, true); Model model(&ref, true);
if (model.InitCheck() != B_OK) if (model.InitCheck() != B_OK)
@@ -153,19 +151,19 @@ FavoritesMenu::AddNextItem()
if (!fAddedSeparatorForSection) { if (!fAddedSeparatorForSection) {
fAddedSeparatorForSection = true; fAddedSeparatorForSection = true;
AddItem(new TitledSeparatorItem("Favorite Folders")); AddItem(new TitledSeparatorItem("Favorites"));
} }
fUniqueRefCheck.push_back(*model.EntryRef()); fUniqueRefCheck.push_back(*model.EntryRef());
AddItem(item); AddItem(item);
fSectionItemCount++; fSectionItemCount++;
return true; return true;
} }
// done with favorites, set up for adding recent files // done with favorites, set up for adding recent files
fState = kAddingFiles; fState = kAddingFiles;
fAddedSeparatorForSection = false; fAddedSeparatorForSection = false;
app_info info; app_info info;
be_app->GetAppInfo(&info); be_app->GetAppInfo(&info);
fItems.MakeEmpty(); fItems.MakeEmpty();
@@ -177,7 +175,7 @@ FavoritesMenu::AddNextItem()
fIndex = 0; fIndex = 0;
fSectionItemCount = 0; fSectionItemCount = 0;
} }
if (fState == kAddingFiles) { if (fState == kAddingFiles) {
// if this is a Save panel, not an Open panel // if this is a Save panel, not an Open panel
// then don't add the recent documents // then don't add the recent documents
@@ -189,7 +187,7 @@ FavoritesMenu::AddNextItem()
Model model(&ref, true); Model model(&ref, true);
if (model.InitCheck() != B_OK) if (model.InitCheck() != B_OK)
return true; return true;
BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFileMessage, fTarget); BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFileMessage, fTarget);
if (item) { if (item) {
if (!fAddedSeparatorForSection) { if (!fAddedSeparatorForSection) {
@@ -202,10 +200,10 @@ FavoritesMenu::AddNextItem()
} }
} }
} }
// done with recent files, set up for adding recent folders // done with recent files, set up for adding recent folders
fState = kAddingFolders; fState = kAddingFolders;
fAddedSeparatorForSection = false; fAddedSeparatorForSection = false;
app_info info; app_info info;
@@ -218,16 +216,16 @@ FavoritesMenu::AddNextItem()
BRoster().GetRecentFolders(&fItems, folders, info.signature); BRoster().GetRecentFolders(&fItems, folders, info.signature);
fIndex = 0; fIndex = 0;
} }
if (fState == kAddingFolders) { if (fState == kAddingFolders) {
for (;;) { for (;;) {
entry_ref ref; entry_ref ref;
if (fItems.FindRef("refs", fIndex++, &ref) != B_OK) if (fItems.FindRef("refs", fIndex++, &ref) != B_OK)
break; break;
// don't add folders that are already in the GoTo section // don't add folders that are already in the GoTo section
if (find_if(fUniqueRefCheck.begin(), fUniqueRefCheck.end(), if (find_if(fUniqueRefCheck.begin(), fUniqueRefCheck.end(),
bind2nd(std::equal_to<entry_ref>(), ref)) != fUniqueRefCheck.end()) bind2nd(std::equal_to<entry_ref>(), ref)) != fUniqueRefCheck.end())
continue; continue;
Model model(&ref, true); Model model(&ref, true);
@@ -253,14 +251,14 @@ FavoritesMenu::AddNextItem()
} }
void void
FavoritesMenu::DoneBuildingItemList() FavoritesMenu::DoneBuildingItemList()
{ {
SetTargetForItems(fTarget); SetTargetForItems(fTarget);
} }
void void
FavoritesMenu::ClearMenuBuildingState() FavoritesMenu::ClearMenuBuildingState()
{ {
delete fContainer; delete fContainer;
@@ -300,12 +298,12 @@ RecentsMenu::DetachedFromWindow()
{ {
// //
// BNavMenu::DetachedFromWindow sets the TypesList to NULL // BNavMenu::DetachedFromWindow sets the TypesList to NULL
// //
BMenu::DetachedFromWindow(); BMenu::DetachedFromWindow();
} }
bool bool
RecentsMenu::StartBuildingItemList() RecentsMenu::StartBuildingItemList()
{ {
int32 count = CountItems()-1; int32 count = CountItems()-1;
@@ -327,7 +325,7 @@ RecentsMenu::StartBuildingItemList()
} }
bool bool
RecentsMenu::AddNextItem() RecentsMenu::AddNextItem()
{ {
if (fRecentsCount > 0 && AddRecents(fRecentsCount)) if (fRecentsCount > 0 && AddRecents(fRecentsCount))
@@ -344,7 +342,7 @@ RecentsMenu::AddRecents(int32 count)
if (fItemIndex == 0) { if (fItemIndex == 0) {
fRecentList.MakeEmpty(); fRecentList.MakeEmpty();
BRoster roster; BRoster roster;
switch(fWhich) { switch(fWhich) {
case 0: case 0:
roster.GetRecentDocuments(&fRecentList, count); roster.GetRecentDocuments(&fRecentList, count);
@@ -388,7 +386,7 @@ RecentsMenu::AddRecents(int32 count)
} }
void void
RecentsMenu::DoneBuildingItemList() RecentsMenu::DoneBuildingItemList()
{ {
// //
@@ -407,7 +405,7 @@ RecentsMenu::DoneBuildingItemList()
} }
void void
RecentsMenu::ClearMenuBuildingState() RecentsMenu::ClearMenuBuildingState()
{ {
fMenuBuilt = false; fMenuBuilt = false;
+92 -160
View File
@@ -39,7 +39,6 @@ All rights reserved.
#include "Commands.h" #include "Commands.h"
#include "DesktopPoseView.h" #include "DesktopPoseView.h"
#include "DirMenu.h" #include "DirMenu.h"
#include "FavoritesConfig.h"
#include "FavoritesMenu.h" #include "FavoritesMenu.h"
#include "FilePanelPriv.h" #include "FilePanelPriv.h"
#include "FSUtils.h" #include "FSUtils.h"
@@ -90,7 +89,7 @@ GetLinkFlavor(const Model *model, bool resolve = true)
} }
if (!model) if (!model)
return 0; return 0;
if (model->IsDirectory()) if (model->IsDirectory())
return B_DIRECTORY_NODE; return B_DIRECTORY_NODE;
@@ -146,8 +145,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
fSelectionIterator(0), fSelectionIterator(0),
fMessage(NULL), fMessage(NULL),
fHideWhenDone(hideWhenDone), fHideWhenDone(hideWhenDone),
fIsTrackingMenu(false), fIsTrackingMenu(false)
fConfigWindow(NULL)
{ {
InitIconPreloader(); InitIconPreloader();
@@ -176,7 +174,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
bool useRoot = true; bool useRoot = true;
if (startDir) { if (startDir) {
if (model->SetTo(startDir) == B_OK && model->IsDirectory()) if (model->SetTo(startDir) == B_OK && model->IsDirectory())
useRoot = false; useRoot = false;
else { else {
delete model; delete model;
@@ -199,7 +197,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
BVolumeRoster volumeRoster; BVolumeRoster volumeRoster;
volumeRoster.GetBootVolume(&volume); volumeRoster.GetBootVolume(&volume);
volume.GetRootDirectory(&root); volume.GetRootDirectory(&root);
BEntry entry; BEntry entry;
root.GetEntry(&entry); root.GetEntry(&entry);
model->SetTo(&entry); model->SetTo(&entry);
@@ -229,16 +227,6 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
TFilePanel::~TFilePanel() TFilePanel::~TFilePanel()
{ {
// regardless of the hide/close method
// always get rid of the config window
if (fConfigWindow) {
// moved from QuitRequested to ensure that
// if the config window is showing that
// it gets closed as well
fConfigWindow->Lock();
fConfigWindow->Quit();
}
BMessenger tracker(kTrackerSignature); BMessenger tracker(kTrackerSignature);
BHandler::StopWatching(tracker, kDesktopFilePanelRootChanged); BHandler::StopWatching(tracker, kDesktopFilePanelRootChanged);
@@ -302,7 +290,7 @@ TFilePanel::MessageDropFilter(BMessage *message, BHandler **, BMessageFilter *fi
panel->fTaskLoop->RunLater(NewMemberFunctionObjectWithResult panel->fTaskLoop->RunLater(NewMemberFunctionObjectWithResult
(&TFilePanel::SelectChildInParent, panel, (&TFilePanel::SelectChildInParent, panel,
const_cast<const entry_ref *>(&ref), const_cast<const entry_ref *>(&ref),
const_cast<const node_ref *>(&child)), const_cast<const node_ref *>(&child)),
ref == *panel->TargetModel()->EntryRef() ? 0 : 100000, 200000, 5000000); ref == *panel->TargetModel()->EntryRef() ? 0 : 100000, 200000, 5000000);
// if the target directory is already current, we won't // if the target directory is already current, we won't
// delay the initial selection try // delay the initial selection try
@@ -327,7 +315,7 @@ TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter)
node_ref itemNode; node_ref itemNode;
node_ref dirNode; node_ref dirNode;
TFilePanel *panel = dynamic_cast<TFilePanel *>(filter->Looper()); TFilePanel *panel = dynamic_cast<TFilePanel *>(filter->Looper());
message->FindInt32("device", &dirNode.device); message->FindInt32("device", &dirNode.device);
itemNode.device = dirNode.device; itemNode.device = dirNode.device;
message->FindInt64("to directory", (int64 *)&dirNode.node); message->FindInt64("to directory", (int64 *)&dirNode.node);
@@ -335,8 +323,8 @@ TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter)
const char *name; const char *name;
if (message->FindString("name", &name) != B_OK) if (message->FindString("name", &name) != B_OK)
break; break;
// if current directory moved, update entry ref and menu // if current directory moved, update entry ref and menu
// but not wind title // but not wind title
if (*(panel->TargetModel()->NodeRef()) == itemNode) { if (*(panel->TargetModel()->NodeRef()) == itemNode) {
panel->TargetModel()->UpdateEntryRef(&dirNode, name); panel->TargetModel()->UpdateEntryRef(&dirNode, name);
@@ -351,7 +339,7 @@ TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter)
TFilePanel *panel = dynamic_cast<TFilePanel *>(filter->Looper()); TFilePanel *panel = dynamic_cast<TFilePanel *>(filter->Looper());
message->FindInt32("device", &itemNode.device); message->FindInt32("device", &itemNode.device);
message->FindInt64("node", (int64 *)&itemNode.node); message->FindInt64("node", (int64 *)&itemNode.node);
// if folder we're watching is deleted, switch to root // if folder we're watching is deleted, switch to root
// or Desktop // or Desktop
if (*(panel->TargetModel()->NodeRef()) == itemNode) { if (*(panel->TargetModel()->NodeRef()) == itemNode) {
@@ -438,7 +426,7 @@ TFilePanel::SetTarget(BMessenger target)
void void
TFilePanel::SetMessage(BMessage *message) TFilePanel::SetMessage(BMessage *message)
{ {
delete fMessage; delete fMessage;
fMessage = new BMessage(*message); fMessage = new BMessage(*message);
} }
@@ -449,7 +437,7 @@ TFilePanel::SetRefFilter(BRefFilter *filter)
{ {
if (!filter) if (!filter)
return; return;
fPoseView->SetRefFilter(filter); fPoseView->SetRefFilter(filter);
fPoseView->CommitActivePose(); fPoseView->CommitActivePose();
fPoseView->Refresh(); fPoseView->Refresh();
@@ -542,7 +530,7 @@ TFilePanel::AdjustButton()
// selection mode then we don't disable button ever // selection mode then we don't disable button ever
if ((modelFlavor == B_DIRECTORY_NODE if ((modelFlavor == B_DIRECTORY_NODE
|| linkFlavor == B_DIRECTORY_NODE) || linkFlavor == B_DIRECTORY_NODE)
&& count == 1) && count == 1)
break; break;
if ((fNodeFlavors & modelFlavor) == 0 if ((fNodeFlavors & modelFlavor) == 0
@@ -554,7 +542,7 @@ TFilePanel::AdjustButton()
} }
} }
button->SetLabel(buttonText); button->SetLabel(buttonText);
button->SetEnabled(enabled); button->SetEnabled(enabled);
} }
@@ -576,7 +564,7 @@ TFilePanel::GetNextEntryRef(entry_ref *ref)
return B_ERROR; return B_ERROR;
BPose *pose = fPoseView->SelectionList()->ItemAt(fSelectionIterator++); BPose *pose = fPoseView->SelectionList()->ItemAt(fSelectionIterator++);
if (!pose) if (!pose)
return B_ERROR; return B_ERROR;
*ref = *pose->TargetModel()->EntryRef(); *ref = *pose->TargetModel()->EntryRef();
@@ -610,9 +598,9 @@ TFilePanel::Init(const BMessage *)
BMessenger(this), IsSavePanel()); BMessenger(this), IsSavePanel());
favorites->AddItem(new BMenuItem("Add Current Folder", favorites->AddItem(new BMenuItem("Add Current Folder",
new BMessage(kAddCurrentDir))); new BMessage(kAddCurrentDir)));
favorites->AddItem(new BMenuItem("Configure Favorites"B_UTF8_ELLIPSIS, favorites->AddItem(new BMenuItem("Edit Favorites"B_UTF8_ELLIPSIS,
new BMessage(kConfigShow))); new BMessage(kEditFavorites)));
fMenuBar->AddItem(favorites); fMenuBar->AddItem(favorites);
// configure menus // configure menus
@@ -695,7 +683,7 @@ TFilePanel::Init(const BMessage *)
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
DisallowMetaKeys(fTextControl->TextView()); DisallowMetaKeys(fTextControl->TextView());
DisallowFilenameKeys(fTextControl->TextView()); DisallowFilenameKeys(fTextControl->TextView());
fBackView->AddChild(fTextControl); fBackView->AddChild(fTextControl);
fTextControl->SetDivider(0.0f); fTextControl->SetDivider(0.0f);
fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1); fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1);
@@ -743,24 +731,24 @@ TFilePanel::Init(const BMessage *)
rect.right -= 25; rect.right -= 25;
float default_width = be_plain_font->StringWidth(fButtonText.String()) + 20; float default_width = be_plain_font->StringWidth(fButtonText.String()) + 20;
rect.left = (default_width > 75) ? (rect.right - default_width) : (rect.right - 75); rect.left = (default_width > 75) ? (rect.right - default_width) : (rect.right - 75);
BButton *default_button = new BButton(rect, "default button", fButtonText.String(), BButton *default_button = new BButton(rect, "default button", fButtonText.String(),
new BMessage(kDefaultButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); new BMessage(kDefaultButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
fBackView->AddChild(default_button); fBackView->AddChild(default_button);
rect.right = rect.left -= 10; rect.right = rect.left -= 10;
float cancel_width = be_plain_font->StringWidth("Cancel") + 20; float cancel_width = be_plain_font->StringWidth("Cancel") + 20;
rect.left = (cancel_width > 75) ? (rect.right - cancel_width) : (rect.right - 75); rect.left = (cancel_width > 75) ? (rect.right - cancel_width) : (rect.right - 75);
BButton *cancel_button = new BButton(rect, "cancel button", "Cancel", BButton *cancel_button = new BButton(rect, "cancel button", "Cancel",
new BMessage(kCancelButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); new BMessage(kCancelButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
fBackView->AddChild(cancel_button); fBackView->AddChild(cancel_button);
if (!fIsSavePanel) if (!fIsSavePanel)
default_button->SetEnabled(false); default_button->SetEnabled(false);
default_button->MakeDefault(true); default_button->MakeDefault(true);
RestoreState(); RestoreState();
PoseView()->ScrollTo(B_ORIGIN); PoseView()->ScrollTo(B_ORIGIN);
@@ -768,16 +756,16 @@ TFilePanel::Init(const BMessage *)
PoseView()->ScrollTo(B_ORIGIN); PoseView()->ScrollTo(B_ORIGIN);
if (fTextControl) { if (fTextControl) {
fTextControl->MakeFocus(); fTextControl->MakeFocus();
fTextControl->TextView()->SelectAll(); fTextControl->TextView()->SelectAll();
} else } else
PoseView()->MakeFocus(); PoseView()->MakeFocus();
app_info info; app_info info;
BString title; BString title;
if (be_app->GetAppInfo(&info) == B_OK) if (be_app->GetAppInfo(&info) == B_OK)
title << info.ref.name << ": "; title << info.ref.name << ": ";
title << fButtonText; // Open or Save title << fButtonText; // Open or Save
SetTitle(title.String()); SetTitle(title.String());
@@ -786,7 +774,7 @@ TFilePanel::Init(const BMessage *)
} }
void void
TFilePanel::RestoreState() TFilePanel::RestoreState()
{ {
BNode defaultingNode; BNode defaultingNode;
@@ -801,7 +789,7 @@ TFilePanel::RestoreState()
} }
void void
TFilePanel::SaveState(bool) TFilePanel::SaveState(bool)
{ {
BNode defaultingNode; BNode defaultingNode;
@@ -817,21 +805,21 @@ TFilePanel::SaveState(bool)
void void
TFilePanel::SaveState(BMessage &message) const TFilePanel::SaveState(BMessage &message) const
{ {
_inherited::SaveState(message); _inherited::SaveState(message);
} }
void void
TFilePanel::RestoreWindowState(AttributeStreamNode *node) TFilePanel::RestoreWindowState(AttributeStreamNode *node)
{ {
SetSizeLimits(360, 10000, 200, 10000); SetSizeLimits(360, 10000, 200, 10000);
if (!node) if (!node)
return; return;
const char *rectAttributeName = kAttrWindowFrame; const char *rectAttributeName = kAttrWindowFrame;
BRect frame(Frame()); BRect frame(Frame());
if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame)
== sizeof(BRect)) { == sizeof(BRect)) {
MoveTo(frame.LeftTop()); MoveTo(frame.LeftTop());
ResizeTo(frame.Width(), frame.Height()); ResizeTo(frame.Width(), frame.Height());
} }
@@ -841,18 +829,18 @@ TFilePanel::RestoreWindowState(AttributeStreamNode *node)
void void
TFilePanel::RestoreState(const BMessage &message) TFilePanel::RestoreState(const BMessage &message)
{ {
_inherited::RestoreState(message); _inherited::RestoreState(message);
} }
void void
TFilePanel::RestoreWindowState(const BMessage &message) TFilePanel::RestoreWindowState(const BMessage &message)
{ {
_inherited::RestoreWindowState(message); _inherited::RestoreWindowState(message);
} }
void void
TFilePanel::AddFileContextMenus(BMenu *menu) TFilePanel::AddFileContextMenus(BMenu *menu)
{ {
menu->AddItem(new BMenuItem("Get Info", new BMessage(kGetInfo), 'I')); menu->AddItem(new BMenuItem("Get Info", new BMessage(kGetInfo), 'I'));
@@ -869,9 +857,9 @@ TFilePanel::AddFileContextMenus(BMenu *menu)
} }
void void
TFilePanel::AddVolumeContextMenus(BMenu *menu) TFilePanel::AddVolumeContextMenus(BMenu *menu)
{ {
menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O')); menu->AddItem(new BMenuItem("Open", new BMessage(kOpenSelection), 'O'));
menu->AddItem(new BMenuItem("Get Info", new BMessage(kGetInfo), 'I')); menu->AddItem(new BMenuItem("Get Info", new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem("Edit Name", new BMessage(kEditItem), 'E')); menu->AddItem(new BMenuItem("Edit Name", new BMessage(kEditItem), 'E'));
@@ -916,7 +904,7 @@ TFilePanel::AddWindowContextMenus(BMenu *menu)
} }
void void
TFilePanel::AddDropContextMenus(BMenu *) TFilePanel::AddDropContextMenus(BMenu *)
{ {
} }
@@ -940,7 +928,7 @@ TFilePanel::MenusBeginning()
} }
void void
TFilePanel::MenusEnded() TFilePanel::MenusEnded()
{ {
fIsTrackingMenu = false; fIsTrackingMenu = false;
@@ -974,7 +962,7 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char *text)
BButton *button = dynamic_cast<BButton *>(FindView("cancel button")); BButton *button = dynamic_cast<BButton *>(FindView("cancel button"));
if (!button) if (!button)
break; break;
float old_width = button->StringWidth(button->Label()); float old_width = button->StringWidth(button->Label());
button->SetLabel(text); button->SetLabel(text);
float delta = old_width - button->StringWidth(text); float delta = old_width - button->StringWidth(text);
@@ -999,7 +987,7 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char *text)
button->ResizeBy(-delta, 0); button->ResizeBy(-delta, 0);
} }
} }
// now must move cancel button // now must move cancel button
button = dynamic_cast<BButton *>(FindView("cancel button")); button = dynamic_cast<BButton *>(FindView("cancel button"));
if (button) if (button)
@@ -1045,7 +1033,7 @@ TFilePanel::MessageReceived(BMessage *message)
PoseView()->SwitchDir(&ref); PoseView()->SwitchDir(&ref);
SwitchDirMenuTo(&ref); SwitchDirMenuTo(&ref);
} else { } else {
// Otherwise, we have a file or a link to a file. // Otherwise, we have a file or a link to a file.
// AdjustButton has already tested the flavor; // AdjustButton has already tested the flavor;
// all we have to do is see if the button is enabled. // all we have to do is see if the button is enabled.
BButton *button = dynamic_cast<BButton *>(FindView("default button")); BButton *button = dynamic_cast<BButton *>(FindView("default button"));
@@ -1056,7 +1044,7 @@ TFilePanel::MessageReceived(BMessage *message)
int32 count = 0; int32 count = 0;
type_code type; type_code type;
message->GetInfo("refs", &type, &count); message->GetInfo("refs", &type, &count);
// Don't allow saves of multiple files // Don't allow saves of multiple files
if (count > 1) { if (count > 1) {
ShowCenteredAlert("Sorry, saving of more than one item is not allowed.", ShowCenteredAlert("Sorry, saving of more than one item is not allowed.",
@@ -1074,15 +1062,15 @@ TFilePanel::MessageReceived(BMessage *message)
HandleSaveButton(); HandleSaveButton();
} }
break; break;
} }
// send handler a message and close // send handler a message and close
BMessage openMessage(*fMessage); BMessage openMessage(*fMessage);
for (int32 index = 0; ; index++) { for (int32 index = 0; ; index++) {
if (message->FindRef("refs", index, &ref) != B_OK) if (message->FindRef("refs", index, &ref) != B_OK)
break; break;
openMessage.AddRef("refs", &ref); openMessage.AddRef("refs", &ref);
} }
OpenSelectionCommon(&openMessage); OpenSelectionCommon(&openMessage);
} }
} }
@@ -1108,7 +1096,7 @@ TFilePanel::MessageReceived(BMessage *message)
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
|| get_ref_for_path(homePath.Path(), &ref) != B_OK) || get_ref_for_path(homePath.Path(), &ref) != B_OK)
break; break;
SetTo(&ref); SetTo(&ref);
break; break;
} }
@@ -1132,77 +1120,21 @@ TFilePanel::MessageReceived(BMessage *message)
break; break;
} }
case kConfigShow: case kEditFavorites:
{ {
if (fConfigWindow) {
fConfigWindow->Activate();
break;
}
BPath path; BPath path;
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
break; break;
path.Append(kGoDirectory); path.Append(kGoDirectory);
BDirectory goDirectory(path.Path()); BMessenger msgr(kTrackerSignature);
if (msgr.IsValid()) {
if (goDirectory.InitCheck() == B_OK) { BMessage message(B_REFS_RECEIVED);
entry_ref startref; entry_ref ref;
BEntry entry; if (get_ref_for_path(path.Path(), &ref) == B_OK) {
goDirectory.GetEntry(&entry); message.AddRef("refs", &ref);
entry.GetRef(&startref); msgr.SendMessage(&message);
}
int32 apps, docs, folders;
TrackerSettings().RecentCounts(&apps, &docs, &folders);
// if this is a save panel
// then don't show recent docs controls
if (fIsSavePanel)
docs = -1;
fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 24),
"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
B_DIRECTORY_NODE, BMessenger(this), &startref, -1, docs, folders);
}
break;
}
case kConfigClose:
{
int32 count = 0;
TrackerSettings settings;
// save off whatever was last in the fields
// do this just in case someone didn't tab out
if (message->FindInt32("applications", &count) == B_OK)
settings.SetRecentApplicationsCount(count);
if (message->FindInt32("folders", &count) == B_OK)
settings.SetRecentFoldersCount(count);
if (message->FindInt32("documents", &count) == B_OK)
settings.SetRecentDocumentsCount(count);
settings.SaveSettings(false);
fConfigWindow = NULL;
break;
}
case kUpdateAppsCount:
case kUpdateDocsCount:
case kUpdateFolderCount:
{
// messages sent when the user changes the count
int32 count;
TrackerSettings settings;
if (message->FindInt32("count", &count) == B_OK) {
if (message->what == kUpdateAppsCount)
settings.SetRecentApplicationsCount(count);
else if (message->what == kUpdateDocsCount)
settings.SetRecentDocumentsCount(count);
else if (message->what == kUpdateFolderCount)
settings.SetRecentFoldersCount(count);
settings.SaveSettings(false);
} }
break; break;
} }
@@ -1250,7 +1182,7 @@ TFilePanel::MessageReceived(BMessage *message)
break; break;
} }
} }
} }
break; break;
} }
@@ -1260,7 +1192,7 @@ TFilePanel::MessageReceived(BMessage *message)
} }
void void
TFilePanel::OpenDirectory() TFilePanel::OpenDirectory()
{ {
BObjectList<BPose> *list = PoseView()->SelectionList(); BObjectList<BPose> *list = PoseView()->SelectionList();
@@ -1276,7 +1208,7 @@ TFilePanel::OpenDirectory()
} }
void void
TFilePanel::OpenParent() TFilePanel::OpenParent()
{ {
if (!CanOpenParent()) if (!CanOpenParent())
@@ -1287,15 +1219,15 @@ TFilePanel::OpenParent()
Model oldModel(*PoseView()->TargetModel()); Model oldModel(*PoseView()->TargetModel());
BEntry entry(oldModel.EntryRef()); BEntry entry(oldModel.EntryRef());
if (entry.InitCheck() == B_OK if (entry.InitCheck() == B_OK
&& entry.GetParent(&dir) == B_OK && entry.GetParent(&dir) == B_OK
&& dir.GetEntry(&parentEntry) == B_OK && dir.GetEntry(&parentEntry) == B_OK
&& entry != parentEntry) { && entry != parentEntry) {
entry_ref ref; entry_ref ref;
parentEntry.GetRef(&ref); parentEntry.GetRef(&ref);
PoseView()->SetIsDesktop(SwitchDirToDesktopIfNeeded(ref)); PoseView()->SetIsDesktop(SwitchDirToDesktopIfNeeded(ref));
PoseView()->SwitchDir(&ref); PoseView()->SwitchDir(&ref);
SwitchDirMenuTo(&ref); SwitchDirMenuTo(&ref);
@@ -1310,7 +1242,7 @@ TFilePanel::OpenParent()
} }
bool bool
TFilePanel::CanOpenParent() const TFilePanel::CanOpenParent() const
{ {
if (TrackerSettings().DesktopFilePanelRoot()) { if (TrackerSettings().DesktopFilePanelRoot()) {
@@ -1318,7 +1250,7 @@ TFilePanel::CanOpenParent() const
BEntry entry(TargetModel()->EntryRef()); BEntry entry(TargetModel()->EntryRef());
if (FSIsDeskDir(&entry, TargetModel()->NodeRef()->device)) if (FSIsDeskDir(&entry, TargetModel()->NodeRef()->device))
return false; return false;
} }
// block on "/" // block on "/"
BEntry root("/"); BEntry root("/");
@@ -1329,7 +1261,7 @@ TFilePanel::CanOpenParent() const
} }
bool bool
TFilePanel::SwitchDirToDesktopIfNeeded(entry_ref &ref) TFilePanel::SwitchDirToDesktopIfNeeded(entry_ref &ref)
{ {
// support showing Desktop as root of everything // support showing Desktop as root of everything
@@ -1339,7 +1271,7 @@ TFilePanel::SwitchDirToDesktopIfNeeded(entry_ref &ref)
if (!settings.DesktopFilePanelRoot()) if (!settings.DesktopFilePanelRoot())
// Tracker isn't set up that way, just let Disks show // Tracker isn't set up that way, just let Disks show
return false; return false;
BEntry entry(&ref); BEntry entry(&ref);
BEntry root("/"); BEntry root("/");
@@ -1361,7 +1293,7 @@ TFilePanel::SwitchDirToDesktopIfNeeded(entry_ref &ref)
} }
bool bool
TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child) TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child)
{ {
AutoLock<TFilePanel> lock(this); AutoLock<TFilePanel> lock(this);
@@ -1371,7 +1303,7 @@ TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child)
int32 index; int32 index;
BPose *pose = PoseView()->FindPose(child, &index); BPose *pose = PoseView()->FindPose(child, &index);
if (!pose) if (!pose)
return false; return false;
PoseView()->UpdateScrollRange(); PoseView()->UpdateScrollRange();
@@ -1396,7 +1328,7 @@ TFilePanel::ShowCenteredAlert(const char *text, const char *button1,
else if (button2 != NULL && !strncmp(button2, "Cancel", 7)) else if (button2 != NULL && !strncmp(button2, "Cancel", 7))
alert->SetShortcut(1, B_ESCAPE); alert->SetShortcut(1, B_ESCAPE);
else if (button3 != NULL && !strncmp(button3, "Cancel", 7)) else if (button3 != NULL && !strncmp(button3, "Cancel", 7))
alert->SetShortcut(2, B_ESCAPE); alert->SetShortcut(2, B_ESCAPE);
#endif #endif
return alert->Go(); return alert->Go();
@@ -1450,7 +1382,7 @@ TFilePanel::HandleSaveButton()
// user selected "Replace" - let app deal with it // user selected "Replace" - let app deal with it
} }
} }
BMessage message(*fMessage); BMessage message(*fMessage);
message.AddRef("directory", TargetModel()->EntryRef()); message.AddRef("directory", TargetModel()->EntryRef());
message.AddString("name", fTextControl->Text()); message.AddString("name", fTextControl->Text());
@@ -1485,9 +1417,9 @@ TFilePanel::OpenSelectionCommon(BMessage *openMessage)
BRoster().AddToRecentDocuments(&ref); BRoster().AddToRecentDocuments(&ref);
} }
} }
BRoster().AddToRecentFolders(TargetModel()->EntryRef()); BRoster().AddToRecentFolders(TargetModel()->EntryRef());
if (fClientObject) if (fClientObject)
fClientObject->SendMessage(&fTarget, openMessage); fClientObject->SendMessage(&fTarget, openMessage);
else else
@@ -1513,7 +1445,7 @@ TFilePanel::HandleOpenButton()
if (model->IsDirectory() if (model->IsDirectory()
|| (model->IsSymLink() && !(fNodeFlavors & B_SYMLINK_NODE) || (model->IsSymLink() && !(fNodeFlavors & B_SYMLINK_NODE)
&& model->ResolveIfLink()->IsDirectory())) { && model->ResolveIfLink()->IsDirectory())) {
BMessage message(B_REFS_RECEIVED); BMessage message(B_REFS_RECEIVED);
message.AddRef("refs", model->EntryRef()); message.AddRef("refs", model->EntryRef());
PostMessage(&message); PostMessage(&message);
@@ -1524,11 +1456,11 @@ TFilePanel::HandleOpenButton()
// don't do anything unless there are items selected // don't do anything unless there are items selected
// message->fMessage->message from here to end // message->fMessage->message from here to end
if (selection->CountItems()) { if (selection->CountItems()) {
BMessage message(*fMessage); BMessage message(*fMessage);
// go through selection and add appropriate items // go through selection and add appropriate items
for (int32 index = 0; index < selection->CountItems(); index++) { for (int32 index = 0; index < selection->CountItems(); index++) {
Model *model = selection->ItemAt(index)->TargetModel(); Model *model = selection->ItemAt(index)->TargetModel();
if (((fNodeFlavors & B_DIRECTORY_NODE) != 0 if (((fNodeFlavors & B_DIRECTORY_NODE) != 0
&& model->ResolveIfLink()->IsDirectory()) && model->ResolveIfLink()->IsDirectory())
|| ((fNodeFlavors & B_SYMLINK_NODE) != 0 && model->IsSymLink()) || ((fNodeFlavors & B_SYMLINK_NODE) != 0 && model->IsSymLink())
@@ -1558,11 +1490,11 @@ TFilePanel::SwitchDirMenuTo(const entry_ref *ref)
} }
void void
TFilePanel::WindowActivated(bool active) TFilePanel::WindowActivated(bool active)
{ {
// force focus to update properly // force focus to update properly
fBackView->Invalidate(); fBackView->Invalidate();
_inherited::WindowActivated(active); _inherited::WindowActivated(active);
} }
@@ -1579,7 +1511,7 @@ BFilePanelPoseView::BFilePanelPoseView(Model *model, BRect frame, uint32 resizeM
} }
void void
BFilePanelPoseView::StartWatching() BFilePanelPoseView::StartWatching()
{ {
TTracker::WatchNode(0, B_WATCH_MOUNT, this); TTracker::WatchNode(0, B_WATCH_MOUNT, this);
@@ -1591,7 +1523,7 @@ BFilePanelPoseView::StartWatching()
} }
void void
BFilePanelPoseView::StopWatching() BFilePanelPoseView::StopWatching()
{ {
stop_watching(this); stop_watching(this);
@@ -1639,7 +1571,7 @@ BFilePanelPoseView::FSNotification(const BMessage *message)
&& otherDesktop.GetEntry(&entry) == B_OK) { && otherDesktop.GetEntry(&entry) == B_OK) {
// place desktop items from the mounted volume onto the desktop // place desktop items from the mounted volume onto the desktop
Model model(&entry); Model model(&entry);
if (model.InitCheck() == B_OK) if (model.InitCheck() == B_OK)
AddPoses(&model); AddPoses(&model);
} }
} }
@@ -1650,7 +1582,7 @@ BFilePanelPoseView::FSNotification(const BMessage *message)
} }
void void
BFilePanelPoseView::RestoreState(AttributeStreamNode *node) BFilePanelPoseView::RestoreState(AttributeStreamNode *node)
{ {
_inherited::RestoreState(node); _inherited::RestoreState(node);
@@ -1658,14 +1590,14 @@ BFilePanelPoseView::RestoreState(AttributeStreamNode *node)
} }
void void
BFilePanelPoseView::RestoreState(const BMessage &message) BFilePanelPoseView::RestoreState(const BMessage &message)
{ {
_inherited::RestoreState(message); _inherited::RestoreState(message);
} }
void void
BFilePanelPoseView::SavePoseLocations(BRect *) BFilePanelPoseView::SavePoseLocations(BRect *)
{ {
} }
@@ -1674,14 +1606,14 @@ BFilePanelPoseView::SavePoseLocations(BRect *)
EntryListBase * EntryListBase *
BFilePanelPoseView::InitDirentIterator(const entry_ref *ref) BFilePanelPoseView::InitDirentIterator(const entry_ref *ref)
{ {
if (IsDesktopView()) if (IsDesktopView())
return DesktopPoseView::InitDesktopDirentIterator(this, ref); return DesktopPoseView::InitDesktopDirentIterator(this, ref);
return _inherited::InitDirentIterator(ref); return _inherited::InitDirentIterator(ref);
} }
bool bool
BFilePanelPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) BFilePanelPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo)
{ {
if (IsDesktopView() && !ShouldShowDesktopPose(TargetModel()->NodeRef()->device, if (IsDesktopView() && !ShouldShowDesktopPose(TargetModel()->NodeRef()->device,
@@ -1699,7 +1631,7 @@ BFilePanelPoseView::SetIsDesktop(bool on)
} }
bool bool
BFilePanelPoseView::IsDesktopView() const BFilePanelPoseView::IsDesktopView() const
{ {
return fIsDesktop; return fIsDesktop;
@@ -1713,10 +1645,10 @@ BFilePanelPoseView::ShowVolumes(bool visible, bool showShared)
if (!visible) if (!visible)
RemoveRootPoses(); RemoveRootPoses();
else else
AddRootPoses(true, showShared); AddRootPoses(true, showShared);
} }
TFilePanel *filepanel = dynamic_cast<TFilePanel*>(Window()); TFilePanel *filepanel = dynamic_cast<TFilePanel*>(Window());
if (filepanel) if (filepanel)
filepanel->SetTo(TargetModel()->EntryRef()); filepanel->SetTo(TargetModel()->EntryRef());
@@ -1739,7 +1671,7 @@ BFilePanelPoseView::AdaptToVolumeChange(BMessage *message)
if (model.InitCheck() == B_OK) { if (model.InitCheck() == B_OK) {
BMessage monitorMsg; BMessage monitorMsg;
monitorMsg.what = B_NODE_MONITOR; monitorMsg.what = B_NODE_MONITOR;
if (showDisksIcon) if (showDisksIcon)
monitorMsg.AddInt32("opcode", B_ENTRY_CREATED); monitorMsg.AddInt32("opcode", B_ENTRY_CREATED);
else else
@@ -1753,7 +1685,7 @@ BFilePanelPoseView::AdaptToVolumeChange(BMessage *message)
if (Window()) if (Window())
Window()->PostMessage(&monitorMsg, this); Window()->PostMessage(&monitorMsg, this);
} }
ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop); ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop);
} }
+9 -11
View File
@@ -53,7 +53,6 @@ class BackgroundView;
class BDirMenu; class BDirMenu;
class AttributeStreamNode; class AttributeStreamNode;
class BFilePanelPoseView; class BFilePanelPoseView;
class TFavoritesConfigWindow;
class TFilePanel : public BContainerWindow { class TFilePanel : public BContainerWindow {
public: public:
@@ -67,7 +66,7 @@ public:
bool hideWhenDone = true); bool hideWhenDone = true);
virtual ~TFilePanel(); virtual ~TFilePanel();
BFilePanelPoseView *PoseView() const; BFilePanelPoseView *PoseView() const;
virtual bool QuitRequested(); virtual bool QuitRequested();
@@ -89,13 +88,13 @@ public:
void Refresh(); void Refresh();
const BMessenger *Target() const; const BMessenger *Target() const;
BRefFilter *Filter() const; BRefFilter *Filter() const;
void SetTarget(BMessenger); void SetTarget(BMessenger);
void SetMessage(BMessage *message); void SetMessage(BMessage *message);
virtual status_t GetNextEntryRef(entry_ref *); virtual status_t GetNextEntryRef(entry_ref *);
virtual void MessageReceived(BMessage *); virtual void MessageReceived(BMessage *);
void SetHideWhenDone(bool); void SetHideWhenDone(bool);
bool HidesWhenDone(void); bool HidesWhenDone(void);
@@ -125,8 +124,8 @@ protected:
static filter_result MessageDropFilter(BMessage *, BHandler **, BMessageFilter *); static filter_result MessageDropFilter(BMessage *, BHandler **, BMessageFilter *);
int32 ShowCenteredAlert(const char *text, const char *button1, const char *button2 = NULL, int32 ShowCenteredAlert(const char *text, const char *button1, const char *button2 = NULL,
const char *button3 = NULL); const char *button3 = NULL);
private: private:
bool SwitchDirToDesktopIfNeeded(entry_ref &ref); bool SwitchDirToDesktopIfNeeded(entry_ref &ref);
bool CanOpenParent() const; bool CanOpenParent() const;
@@ -145,11 +144,10 @@ private:
BMessenger fTarget; BMessenger fTarget;
BFilePanel *fClientObject; BFilePanel *fClientObject;
int32 fSelectionIterator; int32 fSelectionIterator;
BMessage *fMessage; BMessage *fMessage;
BString fButtonText; BString fButtonText;
bool fHideWhenDone; bool fHideWhenDone;
bool fIsTrackingMenu; bool fIsTrackingMenu;
TFavoritesConfigWindow *fConfigWindow;
typedef BContainerWindow _inherited; typedef BContainerWindow _inherited;
@@ -163,7 +161,7 @@ public:
virtual bool IsFilePanel() const; virtual bool IsFilePanel() const;
virtual bool FSNotification(const BMessage *); virtual bool FSNotification(const BMessage *);
void SetIsDesktop(bool); void SetIsDesktop(bool);
protected: protected:
@@ -189,7 +187,7 @@ private:
// this flags makes the distinction between the Desktop as the Root of // this flags makes the distinction between the Desktop as the Root of
// the world and "/boot/home/Desktop" to which we might have navigated // the world and "/boot/home/Desktop" to which we might have navigated
// from the home dir // from the home dir
typedef BPoseView _inherited; typedef BPoseView _inherited;
}; };
-1
View File
@@ -38,7 +38,6 @@ SharedLibrary libtracker.so :
FSClipboard.cpp FSClipboard.cpp
FSUndoRedo.cpp FSUndoRedo.cpp
FSUtils.cpp FSUtils.cpp
FavoritesConfig.cpp
FavoritesMenu.cpp FavoritesMenu.cpp
FilePanel.cpp FilePanel.cpp
FilePanelPriv.cpp FilePanelPriv.cpp