summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2007-04-24 20:04:53 +0000
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2007-04-24 20:04:53 +0000
commitd4dcdd1b39d3bc749de5df6a3160e2997bef982d (patch)
treefd8979bd85ea6949ef5bc72dc7370ff72977d41d
parent478fff53434734e68f125a66f443644d740e6610 (diff)
downloadvdr-plugin-live-d4dcdd1b39d3bc749de5df6a3160e2997bef982d.tar.gz
vdr-plugin-live-d4dcdd1b39d3bc749de5df6a3160e2997bef982d.tar.bz2
- added deletion of search timers
-rw-r--r--epgsearch.cpp44
-rw-r--r--epgsearch.h2
-rw-r--r--i18n.cpp26
-rw-r--r--pages/searchtimers.ecpp9
4 files changed, 64 insertions, 17 deletions
diff --git a/epgsearch.cpp b/epgsearch.cpp
index 8e12e13..9ff5760 100644
--- a/epgsearch.cpp
+++ b/epgsearch.cpp
@@ -284,6 +284,11 @@ string SearchTimer::StopTimeFormatted()
SearchTimers::SearchTimers()
{
+ Reload();
+}
+
+bool SearchTimers::Reload()
+{
Epgsearch_services_v1_0 service;
if ( cPluginManager::CallFirstService("Epgsearch-services-v1.0", &service) == 0 )
throw HtmlError( tr("No searchtimers available") );
@@ -291,7 +296,8 @@ SearchTimers::SearchTimers()
ReadLock channelsLock( Channels, 0 );
list< string > timers = service.handler->SearchTimerList();
m_timers.assign( timers.begin(), timers.end() );
- m_timers.sort();
+ m_timers.sort();
+ return true;
}
bool SearchTimers::Save(SearchTimer* searchtimer)
@@ -300,18 +306,18 @@ bool SearchTimers::Save(SearchTimer* searchtimer)
if ( cPluginManager::CallFirstService("Epgsearch-services-v1.0", &service) == 0 )
throw HtmlError( tr("No searchtimers available") );
- if (!searchtimer) return false;
+ if (!searchtimer) return false;
ReadLock channelsLock( Channels, 0 );
- if (searchtimer->Id() >= 0)
- return service.handler->ModSearchTimer(searchtimer->ToText());
- else
- {
- searchtimer->SetId(0);
- int id = service.handler->AddSearchTimer(searchtimer->ToText());
- if (id >= 0)
- searchtimer->SetId(id);
- return (id >= 0);
- }
+ if (searchtimer->Id() >= 0)
+ return service.handler->ModSearchTimer(searchtimer->ToText());
+ else
+ {
+ searchtimer->SetId(0);
+ int id = service.handler->AddSearchTimer(searchtimer->ToText());
+ if (id >= 0)
+ searchtimer->SetId(id);
+ return (id >= 0);
+ }
}
SearchTimer* SearchTimers::GetByTimerId( std::string const& id )
@@ -331,6 +337,20 @@ bool SearchTimers::ToggleActive(std::string const& id)
return Save(search);
}
+bool SearchTimers::Delete(std::string const& id)
+{
+ SearchTimer* search = GetByTimerId( id );
+ if (!search) return false;
+
+ Epgsearch_services_v1_0 service;
+ if ( cPluginManager::CallFirstService("Epgsearch-services-v1.0", &service) == 0 )
+ throw HtmlError( tr("No searchtimers available") );
+
+ if (service.handler->DelSearchTimer(lexical_cast< int >( id )))
+ return Reload();
+ return false;
+}
+
bool SearchTimer::BlacklistSelected(int id) const
{
for(unsigned int i=0; i<m_blacklistIDs.size(); i++)
diff --git a/epgsearch.h b/epgsearch.h
index bbd17d6..604d328 100644
--- a/epgsearch.h
+++ b/epgsearch.h
@@ -253,6 +253,7 @@ public:
SearchTimers();
bool Save(SearchTimer* searchtimer);
+ bool Reload();
size_type size() const { return m_timers.size(); }
@@ -262,6 +263,7 @@ public:
const_iterator end() const { return m_timers.end(); }
SearchTimer* GetByTimerId( std::string const& id );
bool ToggleActive(std::string const& id);
+ bool Delete(std::string const& id);
private:
TimerList m_timers;
};
diff --git a/i18n.cpp b/i18n.cpp
index a9d505d..7c76b1b 100644
--- a/i18n.cpp
+++ b/i18n.cpp
@@ -2470,7 +2470,7 @@ const tI18nPhrase Phrases[] = {
"",
"",
},
- { "Toggle searchtimer actions (in)active",
+ { "Toggle search timer actions (in)active",
"Suchtimer (de)aktivieren",
"",
"",
@@ -2492,7 +2492,7 @@ const tI18nPhrase Phrases[] = {
"",
"",
},
- { "Browse searchtimer results",
+ { "Browse search timer results",
"Suchtimerergebnisse betrachten",
"",
"",
@@ -2514,6 +2514,28 @@ const tI18nPhrase Phrases[] = {
"",
"",
},
+ { "Delete search timer",
+ "Suchtimer löschen",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ },
{ "Expression",
"Suchbegriff",
"",
diff --git a/pages/searchtimers.ecpp b/pages/searchtimers.ecpp
index d7a5a49..b63acef 100644
--- a/pages/searchtimers.ecpp
+++ b/pages/searchtimers.ecpp
@@ -20,6 +20,8 @@ using namespace std;
if ( !searchtimerid.empty() ) {
if (action == "toggle")
timers.ToggleActive(searchtimerid);
+ if (action == "delete")
+ timers.Delete(searchtimerid);
}
</%cpp>
<& pageelems.doc_type &>
@@ -60,9 +62,10 @@ using namespace std;
<td><? timer->UseTime() ? timer->StartTimeFormatted() ?></td>
<td><? timer->UseTime() ? timer->StopTimeFormatted() ?></td>
<td>&nbsp;</td>
- <td><a href="searchtimers.html?searchtimerid=<$ timer->Id() $>&action=toggle"><img src="/<$ timer->UseAsSearchTimer() ? "active" : "inactive" $>.png" alt="" <& tooltip.hint text=(tr("Toggle searchtimer actions (in)active")) &>"/></a></td>
- <td><a href="searchresults.html?searchtimerid=<$ timer->Id() $>"><img src="/search.png" border="0" alt="" <& tooltip.hint text=(tr("Browse searchtimer results")) &> ></a></td>
- <td><a href="edit_searchtimer.html?searchtimerid=<$ timer->Id() $>"><img src="/edit.png" alt="" <& tooltip.hint text=(tr("Edit search timer")) &> ></a></td>
+ <td><a href="searchtimers.html?searchtimerid=<$ timer->Id() $>&action=toggle"><img src="/<$ timer->UseAsSearchTimer() ? "active" : "inactive" $>.png" alt="" <& tooltip.hint text=(tr("Toggle search timer actions (in)active")) &>/></a></td>
+ <td><a href="searchresults.html?searchtimerid=<$ timer->Id() $>"><img src="/search.png" border="0" alt="" <& tooltip.hint text=(tr("Browse search timer results")) &> ></a></td>
+ <td><a href="edit_searchtimer.html?searchtimerid=<$ timer->Id() $>"><img src="/edit.png" alt="" <& tooltip.hint text=(tr("Edit search timer")) &>/></a></td>
+ <td><a href="searchtimers.html?searchtimerid=<$ timer->Id() $>&action=delete"><img src="/del.png" alt="" <& tooltip.hint text=(tr("Delete search timer")) &>/></a></td>
<td class="border" style="border-right: 1px solid black"></td>
</tr>
<{