From 7271a160e46b3d29a5623a8478a335fd742f1f9a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 26 Feb 2014 11:45:28 +0100 Subject: Fixed keeping the current position in the Recordings menu if a recording was deleted in a sub folder --- HISTORY | 4 +++- menu.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 02206037..e38aa620 100644 --- a/HISTORY +++ b/HISTORY @@ -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. diff --git a/menu.c b/menu.c index 7018741d..c158f02a 100644 --- a/menu.c +++ b/menu.c @@ -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()); -- cgit v1.2.3