Ticket #11405: patch-03.txt

File patch-03.txt, 4.0 KB (added by Mike Kutner <videoguy1080@…>, 11 years ago)

Patch

Line 
1diff --git a/mythtv/programs/mythfrontend/programrecpriority.cpp b/mythtv/programs/mythfrontend/programrecpriority.cpp
2index efb5759..dda7ffd 100644
3--- a/mythtv/programs/mythfrontend/programrecpriority.cpp
4+++ b/mythtv/programs/mythfrontend/programrecpriority.cpp
5@@ -1470,17 +1470,28 @@ void ProgramRecPriority::UpdateList()
6         item->SetText(QString::number(progRecPriority), "recpriority", state);
7         item->SetText(QString::number(progRecPriority), "recpriorityB", state);
8 
9-        QString tempDateTime = MythDate::toString(progInfo->last_record,
10-                                                    MythDate::kDateTimeFull | MythDate::kSimplify |
11+        // if never recorded then date is invalid and time is 00:00:00 UTC
12+        if (progInfo->last_record.isValid())
13+        {
14+            QString tempDateTime = MythDate::toString(progInfo->last_record,
15+                                                        MythDate::kDateTimeFull | MythDate::kSimplify |
16+                                                        MythDate::kAddYear);
17+            item->SetText(tempDateTime, "lastrecorded", state);
18+            QString tempDate = MythDate::toString(progInfo->last_record,
19+                                                    MythDate::kDateFull | MythDate::kSimplify |
20                                                     MythDate::kAddYear);
21-        item->SetText(tempDateTime, "lastrecorded", state);
22-        QString tempDate = MythDate::toString(progInfo->last_record,
23-                                                MythDate::kDateFull | MythDate::kSimplify |
24-                                                MythDate::kAddYear);
25-        item->SetText(tempDate, "lastrecordeddate", state);
26-        QString tempTime = MythDate::toString(
27-            progInfo->last_record, MythDate::kTime);
28-        item->SetText(tempTime, "lastrecordedtime", state);
29+            item->SetText(tempDate, "lastrecordeddate", state);
30+            QString tempTime = MythDate::toString(
31+                progInfo->last_record, MythDate::kTime);
32+            item->SetText(tempTime, "lastrecordedtime", state);
33+        }
34+        else
35+        {
36+            QString nullValue;
37+            item->SetText(nullValue, "lastrecorded", state);
38+            item->SetText(nullValue, "lastrecordeddate", state);
39+            item->SetText(nullValue, "lastrecordedtime", state);
40+        }
41 
42         QString channame = progInfo->channame;
43         if ((progInfo->recType == kAllRecord) ||
44@@ -1579,24 +1590,43 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item)
45 
46     if (m_lastRecordedText)
47     {
48-        QString tempDateTime = MythDate::toString(pgRecInfo->last_record,
49+        QString tempDateTime;
50+
51+        // if never recorded then date is invalid and time is 00:00:00 UTC
52+        if (pgRecInfo->last_record.isValid())
53+        {
54+            tempDateTime = MythDate::toString(pgRecInfo->last_record,
55                                                     MythDate::kDateTimeFull | MythDate::kSimplify |
56                                                     MythDate::kAddYear);
57+        }
58+
59         m_lastRecordedText->SetText(tempDateTime);
60     }
61 
62     if (m_lastRecordedDateText)
63     {
64-        QString tempDate = MythDate::toString(pgRecInfo->last_record,
65+        QString tempDate;
66+
67+        if (pgRecInfo->last_record.isValid())
68+        {
69+            tempDate = MythDate::toString(pgRecInfo->last_record,
70                                                 MythDate::kDateFull | MythDate::kSimplify |
71                                                 MythDate::kAddYear);
72+        }
73+
74         m_lastRecordedDateText->SetText(tempDate);
75     }
76 
77     if (m_lastRecordedTimeText)
78     {
79-        QString tempTime = MythDate::toString(
80-            pgRecInfo->last_record, MythDate::kTime);
81+        QString tempTime;
82+
83+        if (pgRecInfo->last_record.isValid())
84+        {
85+            tempTime =  MythDate::toString(
86+                pgRecInfo->last_record, MythDate::kTime);
87+        }
88+
89         m_lastRecordedTimeText->SetText(tempTime);
90     }
91