diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index dd3a47aef6..3ee240fe94 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -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. diff --git a/src/apps/mediaplayer/playlist/Playlist.cpp b/src/apps/mediaplayer/playlist/Playlist.cpp index 8180eefdaa..2494f02492 100644 --- a/src/apps/mediaplayer/playlist/Playlist.cpp +++ b/src/apps/mediaplayer/playlist/Playlist.cpp @@ -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; diff --git a/src/apps/mediaplayer/playlist/Playlist.h b/src/apps/mediaplayer/playlist/Playlist.h index 4f8e12c21c..b73c859442 100644 --- a/src/apps/mediaplayer/playlist/Playlist.h +++ b/src/apps/mediaplayer/playlist/Playlist.h @@ -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();