Fixed keeping the current position in the Recordings menu if a recording was deleted in a sub folder

This commit is contained in:
Klaus Schmidinger 2014-02-26 11:39:06 +01:00
parent de1ce0b27d
commit 927aa49576
2 changed files with 14 additions and 2 deletions

View File

@ -8203,7 +8203,9 @@ Video Disk Recorder Revision History
- Fixed detecting broken video data streams when recording.
- Fixed handling frame detection buffer length (reported by Eike Sauer).
2014-02-25: Version 2.1.6
2014-02-26: Version 2.1.6
- Revoked "Fixed some compiler warnings with Clang 3.4.1" from ci.c, because this
did not compile with older versions of gcc (thanks to Sören Moch).
- Fixed keeping the current position in the Recordings menu if a recording was
deleted in a sub folder.

12
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 3.19 2014/02/08 12:36:12 kls Exp $
* $Id: menu.c 3.20 2014/02/26 11:23:28 kls Exp $
*/
#include "menu.h"
@ -2533,6 +2533,7 @@ public:
int Level(void) { return level; }
cRecording *Recording(void) { return recording; }
bool IsDirectory(void) { return name != NULL; }
void SetRecording(cRecording *Recording) { recording = Recording; }
virtual void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable);
};
@ -2782,6 +2783,7 @@ eOSState cMenuRecordings::Delete(void)
Display();
if (!Count())
return osBack;
return osUser2;
}
else
Skins.Message(mtError, tr("Error while deleting recording!"));
@ -2861,6 +2863,14 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
path = NULL;
fileName = NULL;
}
else if (state == osUser2) {
// a recording in a sub folder was deleted, so update the current item
cOsdMenu *m = HasSubMenu() ? SubMenu() : this;
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current())) {
if (cMenuRecordingItem *riSub = (cMenuRecordingItem *)m->Get(m->Current()))
ri->SetRecording(riSub->Recording());
}
}
if (Key == kYellow && HadSubMenu && !HasSubMenu()) {
// the last recording in a subdirectory was deleted, so let's go back up
cOsdMenu::Del(Current());