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:45:28 +01:00
parent 1c47cf37ca
commit 7271a160e4
2 changed files with 14 additions and 2 deletions

View File

@ -7870,7 +7870,7 @@ Video Disk Recorder Revision History
and also to use the correct directory with --edit (the latter reported by Marko
Mäkelä).
2014-02-21: Version 2.0.6
2014-02-26: Version 2.0.6
- Updated 'sources.conf' (thanks to Antti Hartikainen).
- cFont::CreateFont() now returns a dummy font in case there are no fonts installed.
@ -7896,3 +7896,5 @@ Video Disk Recorder Revision History
transponders with many PAT entries (reported by Mariusz Bialonczyk).
- Fixed detecting broken video data streams when recording.
- Fixed handling frame detection buffer length (reported by Eike Sauer).
- 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 2.82.1.7 2014/01/30 09:11:46 kls Exp $
* $Id: menu.c 2.82.1.8 2014/02/26 11:42:28 kls Exp $
*/
#include "menu.h"
@ -2189,6 +2189,7 @@ public:
const char *Name(void) { return name; }
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);
};
@ -2420,6 +2421,7 @@ eOSState cMenuRecordings::Delete(void)
Display();
if (!Count())
return osBack;
return osUser2;
}
else
Skins.Message(mtError, tr("Error while deleting recording!"));
@ -2485,6 +2487,14 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
default: break;
}
}
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());