Add virtual directory feature to Tracker

Similar to stored queries, files of the virtual directory type behave
like directories -- i.e. they open in a list-mode Tracker window and
show up as an item with submenu in navigation menus. The file itself is
a plain text file in driver settings format. It can have an arbitrary
number of "directory" entries, which specify the paths of (actual)
directories for which the virtual directory provides a merged view. The
view will not show duplicate entries. For non-directory entries the
first one encountered (according to the order the directory paths are
specified in the file) will be shown. A subdirectory entry will again
behave like a virtual directory.

The support in Tracker isn't perfect yet. I'm afraid major refactoring
would be necessary to get it there.

The virtual directory file type uses a differently colored version of
the folder icon. Alternatives welcome.
This commit is contained in:
Ingo Weinhold
2013-06-29 14:58:51 +02:00
parent de85051c81
commit 1c29b26e7c
28 changed files with 2175 additions and 24 deletions
+8 -4
View File
@@ -1507,7 +1507,8 @@ BContainerWindow::MessageReceived(BMessage* message)
PoseView()->MoveSelectionInto(&model, this, false, false,
message->what == kCreateLink,
message->what == kCreateRelativeLink);
} else if (!TargetModel()->IsQuery()) {
} else if (!TargetModel()->IsQuery()
&& !TargetModel()->IsVirtualDirectory()) {
// no destination specified, create link in same dir as item
PoseView()->MoveSelectionInto(TargetModel(), this, false, false,
message->what == kCreateLink,
@@ -1895,7 +1896,8 @@ BContainerWindow::AddFileMenu(BMenu* menu)
new BMessage(kFindButton), 'F'));
}
if (!TargetModel()->IsQuery() && !IsTrash() && !IsPrintersDir()) {
if (!TargetModel()->IsQuery() && !TargetModel()->IsVirtualDirectory()
&& !IsTrash() && !IsPrintersDir()) {
if (!PoseView()->IsFilePanel()) {
TemplatesMenu* templateMenu = new TemplatesMenu(PoseView(),
B_TRANSLATE("New"));
@@ -2108,6 +2110,7 @@ BContainerWindow::AddShortcuts()
ASSERT(!IsTrash());
ASSERT(!PoseView()->IsFilePanel());
ASSERT(!TargetModel()->IsQuery());
ASSERT(!TargetModel()->IsVirtualDirectory());
AddShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(kCutMoreSelectionToClipboard), this);
@@ -3772,8 +3775,9 @@ BContainerWindow::SetUpDefaultState()
// try copying state from our parent directory, unless it is the
// desktop folder
BEntry entry(TargetModel()->EntryRef());
BDirectory parent;
if (entry.GetParent(&parent) == B_OK && parent != desktop) {
BNode parent;
if (FSGetParentVirtualDirectoryAware(entry, parent) == B_OK
&& parent != desktop) {
PRINT(("looking at parent for state\n"));
if (NodeHasSavedState(&parent)) {
PRINT(("got state from parent\n"));