Index: GUIGlobalMusicSearch.cs
===================================================================
--- GUIGlobalMusicSearch.cs	(revision 51)
+++ GUIGlobalMusicSearch.cs	(working copy)
@@ -27,6 +27,7 @@
 using System.Collections.Generic;
 using System.Text;
 using MediaPortal.GUI.Library;
+using MediaPortal.Player;
 using MediaPortal.Search;
 using System.Windows.Forms;
 using MediaPortal.Playlists;
@@ -84,6 +85,9 @@
         private string currentSearchString = string.Empty;
         private SearchGlobals.SearchType currentSearchType = SearchGlobals.SearchType.Contains;
         private int previousSelectedIndex = 0;
+        private static bool _playlistIsCurrent = false;
+        private static PlayListPlayer _playListPlayer;
+        private static MusicDatabase _mdb;
         #endregion
 
         #region Overrides
@@ -120,6 +124,9 @@
 
         public override bool Init()
         {
+            LoadMPSettings();
+            _playListPlayer = PlayListPlayer.SingletonPlayer;
+            _mdb = MusicDatabase.Instance;
             Translation.Init();
             GlobalSearchSettings.Instance().LoadFromFile();
             return Load(GUIGraphicsContext.Skin + @"\GlobalSearch.Music.xml");
@@ -143,10 +150,32 @@
             GUIListItem _item = lstResults.SelectedListItem;
             GUIDialogMenu _dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
             _dlg.SetHeading(424);
+
             _dlg.AddLocalizedString(4552); // Play now
-            _dlg.AddLocalizedString(4551); // Play next
-            _dlg.AddLocalizedString(926); // Add to playlist
-            _dlg.AddLocalizedString(4557); // Add all to playlist
+            if (g_Player.Playing && g_Player.IsMusic)
+            {
+              _dlg.AddLocalizedString(4551); // Play next
+            }
+
+            // only offer to queue items if
+            // (a) playlist screen shows now playing list (_playlistIsCurrent is true) OR
+            // (b) playlist screen is showing playlist (not what is playing) but music that is being played
+            // is not from playlist (TEMP playlist is being used)
+            if (_playlistIsCurrent || _playListPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP)
+            {
+              _dlg.AddLocalizedString(1225); // Queue item
+              if (!_item.IsFolder)
+              {
+                _dlg.AddLocalizedString(1226); // Queue all items
+              }
+            }
+
+            if (!_playlistIsCurrent)
+            {
+              _dlg.AddLocalizedString(926); // add to playlist
+              _dlg.AddLocalizedString(4557); // Add all to playlist
+            }
+            
             _dlg.AddLocalizedString(33041); // Add album to playlist
             _dlg.AddLocalizedString(930); // Add to favorites
             _dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -155,7 +184,6 @@
                 return;
 
             Song _song = new Song();
-            MusicDatabase _mdb = MusicDatabase.Instance;
             _mdb.GetSongByFileName(_item.Path, ref _song);
 
             if (_song == null)
@@ -163,37 +191,49 @@
 
             switch (_dlg.SelectedId)
             {
-                case 4552:
+                case 4552: // Play Now
                     {
                         PlayNow(_song);
                         break;
                     }
 
-                case 4551:
+                case 4551: // Play Next
                     {
                         PlayNext(_song);
                         break;
                     }
 
-                case 926:
+                case 1225: // Queue Item
                     {
-                        AddSongToPlaylist(_song);
+                      AddSongToPlaylist(_song, GetPlaylistType());
+                      break;
+                    }
+
+                case 1226: // Queue All Items
+                    {
+                      AddAllToPlaylist(GetPlaylistType());
+                      break;
+                    }
+
+                case 926:  // Add To Playlist
+                    {
+                        AddSongToPlaylist(_song, PlayListType.PLAYLIST_MUSIC);
                         break;
                     }
 
-                case 4557:
+                case 4557: // Add All To Playlist
                     {
-                        AddAllToPlaylist();
+                        AddAllToPlaylist(PlayListType.PLAYLIST_MUSIC);
                         break;
                     }
 
-                case 33041:
+                case 33041: // Add Album To Playlist
                     {
                         AddAlbumToPlayList(_song);
                         break;
                     }
 
-                case 930:
+                case 930: // Add Item To Favourites
                     {
                         AddSongToFavorites(_song);
                         break;
@@ -338,78 +378,67 @@
 
         public static void ClearPlaylist()
         {
-            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
-            PlayList playList = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+            PlayList playList = _playListPlayer.GetPlaylist(GetPlaylistType());
             playList.Clear();
         }
 
-        public static void AddSongToPlaylist(Song song, bool autoPlayWhenNothingInList)
+        public static void AddSongToPlaylist(Song song, bool autoPlayWhenNothingInList, PlayListType playListType )
         {
-            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
-            PlayList playList = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
-            PlayListItem _pi = new PlayListItem(song.Title, song.FileName, song.Duration);
+            PlayList playList = _playListPlayer.GetPlaylist(playListType);
+            PlayListItem _pi = song.ToPlayListItem();
             playList.Add(_pi);
-            if ((autoPlayWhenNothingInList) && (!playListPlayer.g_Player.Playing))
+            if ((autoPlayWhenNothingInList) && (!g_Player.Playing))
             {
-                playListPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
-                playListPlayer.Play(0);
+                _playListPlayer.CurrentPlaylistType = playListType;
+                _playListPlayer.Play(0);
             }
         }
-        public static void AddSongToPlaylist(Song song)
+        public static void AddSongToPlaylist(Song song, PlayListType playListType)
         {
-            AddSongToPlaylist(song, true);
+            AddSongToPlaylist(song, true, playListType);
         }
 
         public static void PlayNow(Song song)
         {
-            PlayListPlayer.SingletonPlayer.g_Player.Stop();
+            g_Player.Stop();
             ClearPlaylist();
-            AddSongToPlaylist(song);
+            AddSongToPlaylist(song, GetPlaylistType());
         }
 
         public static void PlayNext(Song song)
         {
-            PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
-            PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+            PlayList playList = _playListPlayer.GetPlaylist(GetPlaylistType());
 
-            int index = Math.Max(playlistPlayer.CurrentSong, 0);
+            int index = Math.Max(_playListPlayer.CurrentSong, 0);
 
             if (playList.Count == 1)
             {
-                AddSongToPlaylist(song);
+                AddSongToPlaylist(song, GetPlaylistType());
             }
 
             if (playList.Count > 1)
             {
-                PlayListItem _pi = new PlayListItem(song.Title, song.FileName, song.Duration);
+                PlayListItem _pi = song.ToPlayListItem();
                 playList.Insert(_pi, index);
             }
             else
             {
-                playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
-                AddSongToPlaylist(song);
+                _playListPlayer.CurrentPlaylistType = GetPlaylistType();
+                AddSongToPlaylist(song, GetPlaylistType());
             }
-
-            if (!playlistPlayer.g_Player.Playing)
-            {
-                playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
-                playlistPlayer.Play(index);
-            }
         }
 
         public static void AddAlbumToPlayList(Song song)
         {
-            PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
-            PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+            PlayList playList = _playListPlayer.GetPlaylist(GetPlaylistType());
             if (GUIUtils.ShowYesNoDialog(GUILocalizeStrings.Get(136), Translation.ClearPlaylist, true))
             {
                 ClearPlaylist();
-                playlistPlayer.g_Player.Stop();
+                g_Player.Stop();
             }
 
             ArrayList _album = new ArrayList();
             String sAlbum = song.Album;
-            MusicDatabase _mdb = MusicDatabase.Instance;
             bool _songsFound = _mdb.GetSongsByAlbum(sAlbum, ref _album);
 
             if (_songsFound)
@@ -417,12 +446,13 @@
                 for (int i = 0; i < _album.Count; i++)
                 {
                     playList.Remove(((Song)_album[i]).FileName);
-                    AddSongToPlaylist((Song)_album[i], false);
+                    AddSongToPlaylist((Song)_album[i], false, GetPlaylistType());
                 }
 
-                if (!playlistPlayer.g_Player.Playing)
+                if (!g_Player.Playing)
                 {
-                    playlistPlayer.Play(0);
+                    _playListPlayer.CurrentPlaylistType = GetPlaylistType();
+                    _playListPlayer.Play(0);
                 }
             }
         }
@@ -430,7 +460,6 @@
         public static void AddSongToFavorites(Song song)
         {
             song.Favorite = true;
-            MusicDatabase _mdb = MusicDatabase.Instance;
             _mdb.SetFavorite(song);
         }
 
@@ -523,17 +552,15 @@
             }
         }
 
-        private void AddAllToPlaylist()
+        private void AddAllToPlaylist(PlayListType playListType)
         {
-            MusicDatabase _mdb = MusicDatabase.Instance;
-            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
-            PlayList playList = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
+            PlayList playList = _playListPlayer.GetPlaylist(playListType);
             Song firstSong = null;
 
             if (GUIUtils.ShowYesNoDialog(GUILocalizeStrings.Get(136), Translation.ClearPlaylist, true))
             {
                 ClearPlaylist();
-                playListPlayer.g_Player.Stop();
+                g_Player.Stop();
             }
 
             foreach (GUIListItem li in lastSearchResults)
@@ -541,7 +568,7 @@
                 Song _song = new Song();
                 _mdb.GetSongByFileName(li.Path, ref _song);
 
-                PlayListItem _pi = new PlayListItem(_song.Title, _song.FileName, _song.Duration);
+                PlayListItem _pi = _song.ToPlayListItem();
                 playList.Add(_pi);
 
                 if (firstSong == null)
@@ -550,10 +577,10 @@
                 }
             }
 
-            if ((firstSong != null) && (!playListPlayer.g_Player.Playing))
+            if ((firstSong != null) && (!g_Player.Playing))
             {
-                playListPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
-                playListPlayer.Play(0);
+                _playListPlayer.CurrentPlaylistType = playListType;
+                _playListPlayer.Play(0);
             }
         }
 
@@ -631,6 +658,23 @@
             return strLine;
         }
 
+        private void LoadMPSettings()
+        {
+          using (Profile.Settings xmlreader = new Profile.MPSettings())
+          {
+            _playlistIsCurrent = xmlreader.GetValueAsBool("musicfiles", "playlistIsCurrent", true);
+          }
+        }
+
+        public static PlayListType GetPlaylistType()
+        {
+          if (_playlistIsCurrent)
+          {
+            return PlayListType.PLAYLIST_MUSIC;
+          }
+          return PlayListType.PLAYLIST_MUSIC_TEMP;
+        }
+
         #endregion
 
         #region ISetupForm Members
Index: GUIGlobalMusicSearchDetails.cs
===================================================================
--- GUIGlobalMusicSearchDetails.cs	(revision 51)
+++ GUIGlobalMusicSearchDetails.cs	(working copy)
@@ -100,7 +100,7 @@
       else
       if (control == btnAddToPlayList)
       {
-        GUIGlobalMusicSearch.AddSongToPlaylist(currentSong);
+        GUIGlobalMusicSearch.AddSongToPlaylist(currentSong, GUIGlobalMusicSearch.GetPlaylistType());
         GUIWindowManager.ShowPreviousWindow();
       }
       else
@@ -186,10 +186,6 @@
         GUIUtils.SetProperty("#GlobalSearch.Music.Details.ArtistInfo.Tones", hasArtistInfo ? artistInfo.Tones : string.Empty, true);
         GUIUtils.SetProperty("#GlobalSearch.Music.Details.ArtistInfo.YearsActive", hasArtistInfo ? artistInfo.YearsActive : string.Empty, true);
 
-        PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
-        PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
-        PlayListItem pli = new PlayListItem(song.Title, song.FileName, song.Duration);
-
         string thumbnail = GetAlbumOrFolderThumb(song);
         if (!string.IsNullOrEmpty(thumbnail))
         {
