1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed setting the current item and counter values in the Recordings menu after deleting the last recording in a subfolder

This commit is contained in:
Klaus Schmidinger 2016-12-09 15:00:55 +01:00
parent d6c26af696
commit 031bbcef40
2 changed files with 22 additions and 18 deletions

View File

@ -8828,7 +8828,7 @@ Video Disk Recorder Revision History
- Empty adaptation field TS packets are now skipped when recording (thanks to
Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel).
2016-12-08: Version 2.3.2
2016-12-09: Version 2.3.2
- Fixed a crash when deleting a recording (reported by Oliver Endriss).
- Fixed an overflow of PIDs in a receiver (thanks to Robert Hannebauer).
@ -8844,3 +8844,5 @@ Video Disk Recorder Revision History
the menu or through SVDRP (as well as other operations that try to acquire a
read lock within a write lock).
- Fixed a crash when trying to delete a channel that is being used by a timer.
- Fixed setting the current item and counter values in the Recordings menu after
deleting the last recording in a subfolder.

20
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 4.15 2016/12/08 10:48:16 kls Exp $
* $Id: menu.c 4.16 2016/12/09 14:54:24 kls Exp $
*/
#include "menu.h"
@ -2954,10 +2954,9 @@ void cMenuRecordings::Set(bool Refresh)
const char *CurrentRecording = *fileName ? *fileName : cReplayControl::LastReplayed();
cRecordings *Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); // write access is necessary for sorting!
cMenuRecordingItem *LastItem = NULL;
if (Refresh) {
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()))
CurrentRecording = ri->Recording()->FileName();
}
int current = Current();
Clear();
GetRecordingsSortMode(DirectoryName());
Recordings->Sort();
@ -2994,12 +2993,14 @@ void cMenuRecordings::Set(bool Refresh)
LastDir->IncrementCounter(Recording->IsNew());
}
}
if (Current() < 0)
SetCurrent(Get(current)); // last resort, in case the recording was deleted
SetMenuSortMode(RecordingsSortMode == rsmName ? msmName : msmTime);
recordingsStateKey.Remove(false); // sorting doesn't count as a real modification
}
if (Refresh)
Display();
}
}
void cMenuRecordings::SetPath(const char *Path)
{
@ -3172,8 +3173,6 @@ eOSState cMenuRecordings::Sort(void)
eOSState cMenuRecordings::ProcessKey(eKeys Key)
{
if (!HasSubMenu())
Set(); // react on any changes to the recordings list
bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key);
@ -3199,6 +3198,7 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
return state; // closes all recording menus except for the top one
Set(); // this is the top level menu, so we refresh it...
Open(true); // ...and open any necessary submenus to show the new name
if (!HasSubMenu())
Display();
path = NULL;
fileName = NULL;
@ -3211,14 +3211,16 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
ri->SetRecording(riSub->Recording());
}
}
if (Key == kYellow && HadSubMenu && !HasSubMenu()) {
if (!HasSubMenu()) {
if (HadSubMenu) {
if (Key == kYellow) {
// the last recording in a subdirectory was deleted, so let's go back up
cOsdMenu::Del(Current());
if (!Count())
return osBack;
Display();
}
if (!HasSubMenu()) {
}
Set(true);
if (Key != kNone)
SetHelpKeys();
}