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:
parent
7dd65803e7
commit
f4dc59983b
@ -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
|
@ -100,6 +100,7 @@ const uint32 kPasteAttributes = 'Tpat';
|
||||
const uint32 kAttributeItem = 'Tatr';
|
||||
const uint32 kMIMETypeItem = 'Tmim';
|
||||
const uint32 kAddCurrentDir = 'Tadd';
|
||||
const uint32 kEditFavorites = 'Tedf';
|
||||
const uint32 kSwitchDirectory = 'Tswd';
|
||||
const uint32 kQuitTracker = 'Tqit';
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -137,9 +137,7 @@ FavoritesMenu::AddNextItem()
|
||||
|
||||
if (fState == kAddingFavorites) {
|
||||
entry_ref ref;
|
||||
// limit nav menus to 20 items only
|
||||
if (fContainer
|
||||
&& fSectionItemCount < 20
|
||||
&& fContainer->GetNextRef(&ref) == B_OK) {
|
||||
Model model(&ref, true);
|
||||
if (model.InitCheck() != B_OK)
|
||||
@ -153,7 +151,7 @@ FavoritesMenu::AddNextItem()
|
||||
|
||||
if (!fAddedSeparatorForSection) {
|
||||
fAddedSeparatorForSection = true;
|
||||
AddItem(new TitledSeparatorItem("Favorite Folders"));
|
||||
AddItem(new TitledSeparatorItem("Favorites"));
|
||||
}
|
||||
fUniqueRefCheck.push_back(*model.EntryRef());
|
||||
AddItem(item);
|
||||
|
@ -39,7 +39,6 @@ All rights reserved.
|
||||
#include "Commands.h"
|
||||
#include "DesktopPoseView.h"
|
||||
#include "DirMenu.h"
|
||||
#include "FavoritesConfig.h"
|
||||
#include "FavoritesMenu.h"
|
||||
#include "FilePanelPriv.h"
|
||||
#include "FSUtils.h"
|
||||
@ -146,8 +145,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
|
||||
fSelectionIterator(0),
|
||||
fMessage(NULL),
|
||||
fHideWhenDone(hideWhenDone),
|
||||
fIsTrackingMenu(false),
|
||||
fConfigWindow(NULL)
|
||||
fIsTrackingMenu(false)
|
||||
{
|
||||
InitIconPreloader();
|
||||
|
||||
@ -229,16 +227,6 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
|
||||
|
||||
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);
|
||||
BHandler::StopWatching(tracker, kDesktopFilePanelRootChanged);
|
||||
|
||||
@ -610,8 +598,8 @@ TFilePanel::Init(const BMessage *)
|
||||
BMessenger(this), IsSavePanel());
|
||||
favorites->AddItem(new BMenuItem("Add Current Folder",
|
||||
new BMessage(kAddCurrentDir)));
|
||||
favorites->AddItem(new BMenuItem("Configure Favorites"B_UTF8_ELLIPSIS,
|
||||
new BMessage(kConfigShow)));
|
||||
favorites->AddItem(new BMenuItem("Edit Favorites"B_UTF8_ELLIPSIS,
|
||||
new BMessage(kEditFavorites)));
|
||||
|
||||
fMenuBar->AddItem(favorites);
|
||||
|
||||
@ -1132,77 +1120,21 @@ TFilePanel::MessageReceived(BMessage *message)
|
||||
break;
|
||||
}
|
||||
|
||||
case kConfigShow:
|
||||
case kEditFavorites:
|
||||
{
|
||||
if (fConfigWindow) {
|
||||
fConfigWindow->Activate();
|
||||
break;
|
||||
}
|
||||
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||
break;
|
||||
|
||||
path.Append(kGoDirectory);
|
||||
BDirectory goDirectory(path.Path());
|
||||
|
||||
if (goDirectory.InitCheck() == B_OK) {
|
||||
entry_ref startref;
|
||||
BEntry entry;
|
||||
goDirectory.GetEntry(&entry);
|
||||
entry.GetRef(&startref);
|
||||
|
||||
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);
|
||||
BMessenger msgr(kTrackerSignature);
|
||||
if (msgr.IsValid()) {
|
||||
BMessage message(B_REFS_RECEIVED);
|
||||
entry_ref ref;
|
||||
if (get_ref_for_path(path.Path(), &ref) == B_OK) {
|
||||
message.AddRef("refs", &ref);
|
||||
msgr.SendMessage(&message);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ class BackgroundView;
|
||||
class BDirMenu;
|
||||
class AttributeStreamNode;
|
||||
class BFilePanelPoseView;
|
||||
class TFavoritesConfigWindow;
|
||||
|
||||
class TFilePanel : public BContainerWindow {
|
||||
public:
|
||||
@ -149,7 +148,6 @@ private:
|
||||
BString fButtonText;
|
||||
bool fHideWhenDone;
|
||||
bool fIsTrackingMenu;
|
||||
TFavoritesConfigWindow *fConfigWindow;
|
||||
|
||||
typedef BContainerWindow _inherited;
|
||||
|
||||
|
@ -38,7 +38,6 @@ SharedLibrary libtracker.so :
|
||||
FSClipboard.cpp
|
||||
FSUndoRedo.cpp
|
||||
FSUtils.cpp
|
||||
FavoritesConfig.cpp
|
||||
FavoritesMenu.cpp
|
||||
FilePanel.cpp
|
||||
FilePanelPriv.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user