diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-05-28 10:48:50 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-05-28 10:48:50 +0200 |
commit | e892171736157127d1ca8fd6b5c6193eb5b55c53 (patch) | |
tree | f0896244778df5d2129753d88b1f497b8a4e8fcb /menu.c | |
parent | 39162a98f081d997ad34c1d8dfb48111176eac15 (diff) | |
download | vdr-e892171736157127d1ca8fd6b5c6193eb5b55c53.tar.gz vdr-e892171736157127d1ca8fd6b5c6193eb5b55c53.tar.bz2 |
Fixed deleting channels in case the current channel's number changes1.4.0-2
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.437 2006/05/28 09:17:25 kls Exp $ + * $Id: menu.c 1.438 2006/05/28 10:47:40 kls Exp $ */ #include "menu.h" @@ -499,6 +499,8 @@ eOSState cMenuChannels::New(void) eOSState cMenuChannels::Delete(void) { if (!HasSubMenu() && Count() > 0) { + int CurrentChannelNr = cDevice::CurrentChannel(); + cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr); int Index = Current(); cChannel *channel = GetChannel(Current()); int DeletedChannel = channel->Number(); @@ -508,10 +510,38 @@ eOSState cMenuChannels::Delete(void) return osContinue; } if (Interface->Confirm(tr("Delete channel?"))) { + if (CurrentChannel && channel == CurrentChannel) { + int n = Channels.GetNextNormal(CurrentChannel->Index()); +#if APIVERSNUM == 10400 + if (n < 0) { + int Idx = CurrentChannel->Index(); + cChannel *channel = Channels.Get(--Idx); + while (channel && channel->GroupSep()) + channel = Channels.Get(--Idx); + if (channel) + n = Idx; + } +#else +#warning ******* API version changed - remove old stuff + if (n < 0) + n = Channels.GetPrevNormal(CurrentChannel->Index()); +#endif + CurrentChannel = Channels.Get(n); + CurrentChannelNr = 0; // triggers channel switch below + } Channels.Del(channel); cOsdMenu::Del(Index); Propagate(); isyslog("channel %d deleted", DeletedChannel); + if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { + if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring()) + Channels.SwitchTo(CurrentChannel->Number()); +#if APIVERSNUM != 10400 +#warning ******* API version changed - activate new code + else + cDevice::SetCurrentChannel(CurrentChannel); +#endif + } } } return osContinue; |