[pvr] fix hiding the "go to parent directory" item in the root of the
[vuplus_xbmc] / xbmc / pvr / windows / GUIWindowPVRBase.cpp
index 96df614..8164493 100644 (file)
@@ -103,6 +103,8 @@ void CGUIWindowPVRBase::OnInitWindow(void)
     return;
   }
 
+  m_vecItems->SetPath(GetDirectoryPath());
+
   CGUIMediaWindow::OnInitWindow();
 }
 
@@ -131,6 +133,48 @@ bool CGUIWindowPVRBase::OnMessage(CGUIMessage& message)
   return CGUIMediaWindow::OnMessage(message);
 }
 
+bool CGUIWindowPVRBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
+{
+  bool bReturn = false;
+
+  switch(button)
+  {
+    case CONTEXT_BUTTON_MENU_HOOKS:
+      if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
+      {
+        CFileItemPtr item = m_vecItems->Get(itemNumber);
+
+        if (item->IsEPG() && item->GetEPGInfoTag()->HasPVRChannel())
+          g_PVRClients->ProcessMenuHooks(item->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG, item.get());
+        else if (item->IsPVRChannel())
+          g_PVRClients->ProcessMenuHooks(item->GetPVRChannelInfoTag()->ClientID(), PVR_MENUHOOK_CHANNEL, item.get());
+        else if (item->IsPVRRecording())
+          g_PVRClients->ProcessMenuHooks(item->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING, item.get());
+        else if (item->IsPVRTimer())
+          g_PVRClients->ProcessMenuHooks(item->GetPVRTimerInfoTag()->m_iClientId, PVR_MENUHOOK_TIMER, item.get());
+
+        bReturn = true;
+      }
+      break;
+    case CONTEXT_BUTTON_FIND:
+    {
+      int windowSearchId = m_bRadio ? WINDOW_RADIO_SEARCH : WINDOW_TV_SEARCH;
+      CGUIWindowPVRBase *windowSearch = (CGUIWindowPVRBase*) g_windowManager.GetWindow(windowSearchId);
+      if (windowSearch && itemNumber >= 0 && itemNumber < m_vecItems->Size())
+      {
+        CFileItemPtr item = m_vecItems->Get(itemNumber);
+        g_windowManager.ActivateWindow(windowSearchId);
+        bReturn = windowSearch->OnContextButton(*item.get(), button);
+      }
+      break;
+    }
+    default:
+      bReturn = false;
+  }
+
+  return bReturn || CGUIMediaWindow::OnContextButton(itemNumber, button);
+}
+
 void CGUIWindowPVRBase::SetInvalid()
 {
   VECFILEITEMS items = m_vecItems->GetList();
@@ -187,7 +231,7 @@ void CGUIWindowPVRBase::SetGroup(CPVRChannelGroupPtr group)
     // we need to register the window to receive changes from the new group
     m_group->RegisterObserver(this);
     g_PVRManager.SetPlayingGroup(m_group);
-    Refresh();
+    Update(GetDirectoryPath());
   }
 }
 
@@ -629,6 +673,7 @@ bool CGUIWindowPVRBase::UpdateEpgForChannel(CFileItem *item)
 
 bool CGUIWindowPVRBase::Update(const std::string &strDirectory, bool updateFilterPath /* = true */)
 {
+  m_vecItems->SetPath(strDirectory);
   return CGUIMediaWindow::Update(strDirectory, updateFilterPath);
 }