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>
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
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
(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).
- Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to
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
* 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"
@ -1680,6 +1680,8 @@ eOSState cMenuRecordings::Del(void)
cOsdMenu::Del(Current());
Recordings.Del(recording);
Display();
if (!Count())
return osBack;
}
else
Interface->Error(tr("Error while deleting recording!"));
@ -1707,6 +1709,7 @@ eOSState cMenuRecordings::Summary(void)
eOSState cMenuRecordings::ProcessKey(eKeys Key)
{
bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key);
if (state == osUnknown) {
@ -1720,6 +1723,13 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
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)
SetHelpKeys();
return state;