2828#include " netcommon.h"
2929#include " rsseditor.h"
3030#include " searcheditor.h"
31+ #include " mythactions.h"
3132
3233using namespace std ;
3334
3435// ---------------------------------------------------
3536
36- NetSearch::NetSearch (MythScreenStack *parent, const char *name)
37- : MythScreenType(parent, name),
38- m_searchResultList(NULL ), m_siteList(NULL ),
39- m_search(NULL ), m_thumbImage(NULL ),
40- m_downloadable(NULL ), m_progress(NULL ),
41- m_busyPopup(NULL ), m_okPopup(NULL ),
42- m_popupStack(), m_progressDialog(NULL ),
43- m_netSearch(NULL ), m_reply(NULL ),
44- m_currentSearch(QString()), m_currentGrabber(0 ),
45- m_currentCmd(QString()), m_downloadFile(QString()),
46- m_pagenum(0 )
37+ NetSearch::NetSearch (MythScreenStack *parent, const char *name) :
38+ MythScreenType(parent, name),
39+ m_searchResultList(NULL ), m_siteList(NULL ),
40+ m_search(NULL ), m_thumbImage(NULL ),
41+ m_downloadable(NULL ), m_progress(NULL ),
42+ m_busyPopup(NULL ), m_okPopup(NULL ),
43+ m_popupStack(), m_progressDialog(NULL ),
44+ m_netSearch(NULL ), m_reply(NULL ),
45+ m_currentSearch(QString()), m_currentGrabber(0 ),
46+ m_currentCmd(QString()), m_downloadFile(QString()),
47+ m_pagenum(0 ), m_actions( NULL )
4748{
4849 m_mythXML = GetMythXMLURL ();
4950 m_playing = false ;
@@ -150,6 +151,9 @@ NetSearch::~NetSearch()
150151 }
151152
152153 gCoreContext ->removeListener (this );
154+
155+ if (m_actions)
156+ delete m_actions;
153157}
154158
155159void NetSearch::loadData (void )
@@ -165,26 +169,35 @@ void NetSearch::loadData(void)
165169 runSearchEditor ();
166170}
167171
172+ static struct ActionDefStruct <NetSearch> nsActions[] = {
173+ { " MENU" , &NetSearch::doMenu }
174+ };
175+ static int nsActionCount = NELEMS(nsActions);
176+
177+ bool NetSearch::doMenu (const QString &action)
178+ {
179+ (void )action;
180+ showMenu ();
181+ return true ;
182+ }
183+
184+
168185bool NetSearch::keyPressEvent (QKeyEvent *event)
169186{
170187 if (GetFocusWidget ()->keyPressEvent (event))
171188 return true ;
172189
173190 bool handled = false ;
174191 QStringList actions;
175- handled = GetMythMainWindow ()->TranslateKeyPress (" Internet Video" , event, actions);
192+ handled = GetMythMainWindow ()->TranslateKeyPress (" Internet Video" , event,
193+ actions);
176194
177- for ( int i = 0 ; i < actions. size () && !handled; i++ )
195+ if ( !handled)
178196 {
179- QString action = actions[i];
180- handled = true ;
181-
182- if (action == " MENU" )
183- {
184- showMenu ();
185- }
186- else
187- handled = false ;
197+ if (!m_actions)
198+ m_actions = new MythActions<NetSearch>(this , nsActions,
199+ nsActionCount);
200+ handled = m_actions->handleActions (actions);
188201 }
189202
190203 if (!handled && MythScreenType::keyPressEvent (event))
0 commit comments