* Do not add documents to the recent list in _UpdatePlaylistItemFile(), but do
so when the items are added to the playlist. This has the added advantage of being able to easily reselect sub-folders (an album for example). * Enabled navigating folders in the recent item list. * Added Playlist::IsEmpty() method. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38897 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1423,19 +1423,13 @@ MainWin::_CreateMenu()
|
||||
fFileMenu->AddItem(item);
|
||||
item->SetTarget(be_app);
|
||||
|
||||
#if 0
|
||||
// Plain "Open File" entry
|
||||
fFileMenu->AddItem(new BMenuItem("Open File"B_UTF8_ELLIPSIS,
|
||||
new BMessage(M_FILE_OPEN), 'O'));
|
||||
#else
|
||||
// Add recent files to "Open File" entry as sub-menu.
|
||||
BRecentFilesList recentFiles(10, false, NULL, kAppSig);
|
||||
item = new BMenuItem(recentFiles.NewFileListMenu(
|
||||
"Open file"B_UTF8_ELLIPSIS, new BMessage(B_REFS_RECEIVED),
|
||||
NULL, this, 10, false, NULL, 0, kAppSig), new BMessage(M_FILE_OPEN));
|
||||
"Open file"B_UTF8_ELLIPSIS, NULL, NULL, this, 10, true, NULL, kAppSig),
|
||||
new BMessage(M_FILE_OPEN));
|
||||
item->SetShortcut('O', 0);
|
||||
fFileMenu->AddItem(item);
|
||||
#endif
|
||||
|
||||
fFileMenu->AddSeparatorItem();
|
||||
|
||||
@@ -2397,9 +2391,6 @@ MainWin::_UpdatePlaylistItemFile()
|
||||
if (node.InitCheck())
|
||||
return;
|
||||
|
||||
// Add to recent documents
|
||||
be_roster->AddToRecentDocuments(&item->Ref(), kAppSig);
|
||||
|
||||
locker.Unlock();
|
||||
|
||||
// Set some standard attributes of the currently played file.
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "FilePlaylistItem.h"
|
||||
#include "FileReadWrite.h"
|
||||
#include "MainApp.h"
|
||||
|
||||
using std::nothrow;
|
||||
|
||||
@@ -247,6 +248,13 @@ Playlist::CountItems() const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Playlist::IsEmpty() const
|
||||
{
|
||||
return fItems.IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::Sort()
|
||||
{
|
||||
@@ -439,6 +447,7 @@ Playlist::AppendRefs(const BMessage* refsReceivedMessage, int32 appendIndex)
|
||||
i++) {
|
||||
Playlist subPlaylist;
|
||||
BString type = _MIMEString(&ref);
|
||||
|
||||
if (_IsPlaylist(type)) {
|
||||
AppendPlaylistToPlaylist(ref, &subPlaylist);
|
||||
// Do not sort the whole playlist anymore, as that
|
||||
@@ -455,6 +464,16 @@ Playlist::AppendRefs(const BMessage* refsReceivedMessage, int32 appendIndex)
|
||||
if (!sortPlaylist)
|
||||
subPlaylist.Sort();
|
||||
}
|
||||
|
||||
if (!subPlaylist.IsEmpty()) {
|
||||
// Add to recent documents
|
||||
BEntry entry(&ref, true);
|
||||
if (entry.IsDirectory())
|
||||
be_roster->AddToRecentFolders(&ref, kAppSig);
|
||||
else
|
||||
be_roster->AddToRecentDocuments(&ref, kAppSig);
|
||||
}
|
||||
|
||||
int32 subPlaylistCount = subPlaylist.CountItems();
|
||||
AdoptPlaylist(subPlaylist, subAppendIndex);
|
||||
subAppendIndex += subPlaylistCount;
|
||||
|
||||
@@ -46,17 +46,17 @@ class Playlist : public BLocker {
|
||||
public:
|
||||
class Listener {
|
||||
public:
|
||||
Listener();
|
||||
virtual ~Listener();
|
||||
Listener();
|
||||
virtual ~Listener();
|
||||
|
||||
virtual void ItemAdded(PlaylistItem* item, int32 index);
|
||||
virtual void ItemRemoved(int32 index);
|
||||
virtual void ItemAdded(PlaylistItem* item, int32 index);
|
||||
virtual void ItemRemoved(int32 index);
|
||||
|
||||
virtual void ItemsSorted();
|
||||
virtual void ItemsSorted();
|
||||
|
||||
virtual void CurrentItemChanged(int32 newIndex);
|
||||
virtual void CurrentItemChanged(int32 newIndex);
|
||||
|
||||
virtual void ImportFailed();
|
||||
virtual void ImportFailed();
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
// list functionality
|
||||
void MakeEmpty(bool deleteItems = true);
|
||||
int32 CountItems() const;
|
||||
bool IsEmpty() const;
|
||||
|
||||
void Sort();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user