Automatically closing empty recordings menu page after delete

This commit is contained in:
Klaus Schmidinger 2002-02-10 11:36:07 +01:00
parent 9567629870
commit ba1bf3a99e
3 changed files with 18 additions and 2 deletions

View File

@ -196,3 +196,7 @@ Hannu Savolainen <hannu@opensound.com>
Jürgen Schmidt <ju@ct.heise.de> Jürgen Schmidt <ju@ct.heise.de>
for fixing a problem with 'in_addr_t' on systems with glibc < 2.2. for fixing a problem with 'in_addr_t' on systems with glibc < 2.2.
Uwe Freese <mail@uwe-freese.de>
for suggesting to automatically close an empty recordings page after deleting
an entry

View File

@ -970,7 +970,7 @@ Video Disk Recorder Revision History
- Fixed a problem with the ERR macro defined by ncurses.h (thanks to Artur - Fixed a problem with the ERR macro defined by ncurses.h (thanks to Artur
Skawina). Skawina).
2002-02-09: Version 0.99pre6 2002-02-10: Version 0.99pre6
- Fixed a bug in moving timers or channels to the last position in the list - Fixed a bug in moving timers or channels to the last position in the list
(thanks to Matthias Schniedermeyer for helping to debug this one). (thanks to Matthias Schniedermeyer for helping to debug this one).
@ -983,3 +983,5 @@ Video Disk Recorder Revision History
middle between start and end time). middle between start and end time).
- Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to - Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to
Jürgen Schmidt). Jürgen Schmidt).
- When the last entry in a "Recordings" menu page is deleted, that page is now
automatically closed (suggested by Uwe Freese).

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 1.150 2002/02/09 15:25:27 kls Exp $ * $Id: menu.c 1.151 2002/02/10 11:25:07 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1680,6 +1680,8 @@ eOSState cMenuRecordings::Del(void)
cOsdMenu::Del(Current()); cOsdMenu::Del(Current());
Recordings.Del(recording); Recordings.Del(recording);
Display(); Display();
if (!Count())
return osBack;
} }
else else
Interface->Error(tr("Error while deleting recording!")); Interface->Error(tr("Error while deleting recording!"));
@ -1707,6 +1709,7 @@ eOSState cMenuRecordings::Summary(void)
eOSState cMenuRecordings::ProcessKey(eKeys Key) eOSState cMenuRecordings::ProcessKey(eKeys Key)
{ {
bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key); eOSState state = cOsdMenu::ProcessKey(Key);
if (state == osUnknown) { if (state == osUnknown) {
@ -1720,6 +1723,13 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
default: break; default: break;
} }
} }
if (Key == kYellow && HadSubMenu && !HasSubMenu()) {
// the last recording in a subdirectory was deleted, so let's go back up
cOsdMenu::Del(Current());
if (!Count())
return osBack;
Display();
}
if (!HasSubMenu() && Key != kNone) if (!HasSubMenu() && Key != kNone)
SetHelpKeys(); SetHelpKeys();
return state; return state;