-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepgsearch-exttimeredit-0.0.2.diff
111 lines (106 loc) · 3.2 KB
/
epgsearch-exttimeredit-0.0.2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff -Nur vdr-1.7.35.orig/menu.c vdr-1.7.35/menu.c
--- vdr-1.7.35.orig/menu.c 2013-01-06 16:08:44.714520666 +0100
+++ vdr-1.7.35/menu.c 2013-01-06 16:12:28.784593797 +0100
@@ -1028,6 +1028,7 @@
class cMenuTimerItem : public cOsdItem {
private:
cTimer *timer;
+ void DoSet(void);
char diskStatus;
public:
cMenuTimerItem(cTimer *Timer);
@@ -1042,7 +1043,7 @@
{
timer = Timer;
diskStatus = ' ';
- Set();
+ DoSet();
}
int cMenuTimerItem::Compare(const cListObject &ListObject) const
@@ -1052,6 +1053,18 @@
void cMenuTimerItem::Set(void)
{
+ // check for deleted timer
+ for (cTimer *t = Timers.First(); ; t = Timers.Next(t)) {
+ if (t == timer)
+ break; // timer still there
+ if (t == NULL)
+ return; // no matching timer found
+ }
+ DoSet();
+}
+
+void cMenuTimerItem::DoSet(void)
+{
cString day, name("");
if (timer->WeekDays())
day = timer->PrintDay(0, timer->WeekDays(), false);
@@ -1150,8 +1163,7 @@
class cMenuTimers : public cOsdMenu {
private:
int helpKeys;
- eOSState Edit(void);
- eOSState New(void);
+ eOSState Edit(bool New = false);
eOSState Delete(void);
eOSState OnOff(void);
eOSState Info(void);
@@ -1229,19 +1241,30 @@
return osContinue;
}
-eOSState cMenuTimers::Edit(void)
+eOSState cMenuTimers::Edit(bool New)
{
- if (HasSubMenu() || Count() == 0)
+ if (HasSubMenu() || (Count() == 0 && !New))
return osContinue;
- isyslog("editing timer %s", *CurrentTimer()->ToDescr());
- return AddSubMenu(new cMenuEditTimer(CurrentTimer()));
-}
+ if (!New)
+ isyslog("editing timer %s", *CurrentTimer()->ToDescr());
-eOSState cMenuTimers::New(void)
-{
- if (HasSubMenu())
- return osContinue;
- return AddSubMenu(new cMenuEditTimer(new cTimer, true));
+ // Data structure for service "Epgsearch-exttimeredit-v1.0"
+ struct Epgsearch_exttimeredit_v1_0
+ {
+ // in
+ cTimer* timer; // pointer to the timer to edit
+ bool bNew; // flag that indicates, if this is a new timer or an existing one
+ const cEvent* event; // pointer to the event corresponding to this timer (may be NULL)
+ // out
+ cOsdMenu* pTimerMenu; // pointer to the menu of results
+ } exttimeredit;
+ exttimeredit.timer = New ? (new cTimer) : CurrentTimer();
+ exttimeredit.bNew = New;
+ exttimeredit.event = exttimeredit.timer->Event();
+ if (cPluginManager::CallFirstService("Epgsearch-exttimeredit-v1.0", &exttimeredit))
+ return AddSubMenu(exttimeredit.pTimerMenu);
+
+ return AddSubMenu(new cMenuEditTimer(exttimeredit.timer, New));
}
eOSState cMenuTimers::Delete(void)
@@ -1349,7 +1372,7 @@
case kOk: return Edit();
case kRed: actualiseDiskStatus = true;
state = OnOff(); break; // must go through SetHelpKeys()!
- case kGreen: return New();
+ case kGreen: return Edit(true);
case kYellow: actualiseDiskStatus = true;
state = Delete(); break;
case kInfo:
@@ -1365,6 +1388,11 @@
actualiseDiskStatus = true;
Display();
}
+ if (!HasSubMenu() && Timers.Count()<Count()) {
+ // timer was deleted
+ cOsdMenu::Del(Current());
+ Display();
+ }
if (Key != kNone)
SetHelpKeys();
return state;