From 686831caf5e314c424e1411f2c33df7e25c9b695 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 20 Apr 2017 10:08:04 +0200 Subject: Fixed editing a remote timer immediately after it has been created --- HISTORY | 1 + menu.c | 10 +++++++--- timers.c | 10 ++++++---- timers.h | 6 +++--- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index 0c41c12f..28151aa8 100644 --- a/HISTORY +++ b/HISTORY @@ -8982,3 +8982,4 @@ Video Disk Recorder Revision History statistics about the currently received signal. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed displaying remote timers in the main menu of skin LCARS. +- Fixed editing a remote timer immediately after it has been created. diff --git a/menu.c b/menu.c index ba468095..357aaf83 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 4.24 2017/04/03 12:26:23 kls Exp $ + * $Id: menu.c 4.25 2017/04/20 09:15:49 kls Exp $ */ #include "menu.h" @@ -1088,8 +1088,12 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key) case kOk: if (timer) { LOCK_TIMERS_WRITE; if (!addIfConfirmed && !Timers->Contains(timer)) { - Skins.Message(mtWarning, tr("Timer has been deleted!")); - break; + if (cTimer *t = Timers->GetById(timer->Id(), timer->Remote())) + timer = t; + else { + Skins.Message(mtWarning, tr("Timer has been deleted!")); + break; + } } LOCK_CHANNELS_READ; if (const cChannel *Channel = Channels->GetByNumber(channel)) diff --git a/timers.c b/timers.c index 917be80c..4cf8fb7f 100644 --- a/timers.c +++ b/timers.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 4.8 2017/03/30 15:08:11 kls Exp $ + * $Id: timers.c 4.9 2017/04/20 09:15:06 kls Exp $ */ #include "timers.h" @@ -739,11 +739,13 @@ int cTimers::NewTimerId(void) return ++lastTimerId; // no need for locking, the caller must have a lock on the global Timers list } -const cTimer *cTimers::GetById(int Id) const +const cTimer *cTimers::GetById(int Id, const char *Remote) const { for (const cTimer *ti = First(); ti; ti = Next(ti)) { - if (!ti->Remote() && ti->Id() == Id) - return ti; + if (ti->Id() == Id) { + if (!Remote && !ti->Remote() || Remote && ti->Remote() && strcmp(Remote, ti->Remote()) == 0) + return ti; + } } return NULL; } diff --git a/timers.h b/timers.h index 1bffa84f..c4932ba6 100644 --- a/timers.h +++ b/timers.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 4.7 2017/03/30 15:22:36 kls Exp $ + * $Id: timers.h 4.8 2017/04/20 09:09:45 kls Exp $ */ #ifndef __TIMERS_H @@ -168,8 +168,8 @@ public: ///< } static bool Load(const char *FileName); static int NewTimerId(void); - const cTimer *GetById(int Id) const; - cTimer *GetById(int Id) { return const_cast(static_cast(this)->GetById(Id)); }; + const cTimer *GetById(int Id, const char *Remote = NULL) const; + cTimer *GetById(int Id, const char *Remote = NULL) { return const_cast(static_cast(this)->GetById(Id, Remote)); }; const cTimer *GetTimer(const cTimer *Timer) const; cTimer *GetTimer(const cTimer *Timer) { return const_cast(static_cast(this)->GetTimer(Timer)); }; const cTimer *GetMatch(time_t t) const; -- cgit v1.2.3