Fixed positioning to the current item when changing the sort mode in the Recordings menu, in case there is a LastReplayed recording

This commit is contained in:
Klaus Schmidinger 2017-12-04 14:55:13 +01:00
parent b96277e28a
commit 0224fc5210
2 changed files with 9 additions and 5 deletions

View File

@ -9215,3 +9215,5 @@ Video Disk Recorder Revision History
- Added a note to PLUGINS.html about writing log messages in English. - Added a note to PLUGINS.html about writing log messages in English.
- Fixed a deadlock when moving a folder containing several recordings between - Fixed a deadlock when moving a folder containing several recordings between
different volumes (reported by Matthias Senzel). different volumes (reported by Matthias Senzel).
- Fixed positioning to the current item when changing the sort mode in the Recordings
menu, in case there is a LastReplayed recording.

12
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 4.46 2017/11/27 15:19:07 kls Exp $ * $Id: menu.c 4.47 2017/12/04 14:50:59 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2858,10 +2858,10 @@ public:
cMenuRecordingItem(const cRecording *Recording, int Level); cMenuRecordingItem(const cRecording *Recording, int Level);
~cMenuRecordingItem(); ~cMenuRecordingItem();
void IncrementCounter(bool New); void IncrementCounter(bool New);
const char *Name(void) { return name; } const char *Name(void) const { return name; }
int Level(void) { return level; } int Level(void) const { return level; }
const cRecording *Recording(void) { return recording; } const cRecording *Recording(void) const { return recording; }
bool IsDirectory(void) { return name != NULL; } bool IsDirectory(void) const { return name != NULL; }
void SetRecording(const cRecording *Recording) { recording = Recording; } void SetRecording(const cRecording *Recording) { recording = Recording; }
virtual void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable); virtual void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable);
}; };
@ -3167,6 +3167,8 @@ eOSState cMenuRecordings::Sort(void)
{ {
if (HasSubMenu()) if (HasSubMenu())
return osContinue; return osContinue;
if (const cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()))
SetRecording(ri->Recording()->FileName()); // makes sure the Recordings menu will reposition to the current recording
IncRecordingsSortMode(DirectoryName()); IncRecordingsSortMode(DirectoryName());
recordingsStateKey.Reset(); recordingsStateKey.Reset();
Set(true); Set(true);