From 20adee5bf5c714302d20ac053d41593f73c6569a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 23 Jan 2012 17:03:35 +0000 Subject: [PATCH] Add the mythnews feed config to the context menu so that users can select feeds more easily --- mythplugins/mythnews/mythnews/mythnews.cpp | 32 ++++++++++++++++++---- mythplugins/mythnews/mythnews/mythnews.h | 1 + 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/mythplugins/mythnews/mythnews/mythnews.cpp b/mythplugins/mythnews/mythnews/mythnews.cpp index 954bea2b402..cb7a8dfa4e6 100644 --- a/mythplugins/mythnews/mythnews/mythnews.cpp +++ b/mythplugins/mythnews/mythnews/mythnews.cpp @@ -30,6 +30,7 @@ #include "mythnews.h" #include "mythnewseditor.h" #include "newsdbutil.h" +#include "mythnewsconfig.h" #define LOC QString("MythNews: ") #define LOC_WARN QString("MythNews, Warning: ") @@ -880,6 +881,22 @@ void MythNews::ShowEditDialog(bool edit) delete mythnewseditor; } +void MythNews::ShowFeedManager() +{ + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + + MythNewsConfig *mythnewsconfig = new MythNewsConfig(mainStack, + "mythnewsconfig"); + + if (mythnewsconfig->Create()) + { + connect(mythnewsconfig, SIGNAL(Exiting()), SLOT(loadSites())); + mainStack->AddScreen(mythnewsconfig); + } + else + delete mythnewsconfig; +} + void MythNews::ShowMenu(void) { QMutexLocker locker(&m_lock); @@ -897,12 +914,13 @@ void MythNews::ShowMenu(void) m_menuPopup->SetReturnEvent(this, "options"); + m_menuPopup->AddButton(tr("Manage Feeds")); + m_menuPopup->AddButton(tr("Add Feed")); if (m_NewsSites.size() > 0) - m_menuPopup->AddButton(tr("Edit News Site")); - m_menuPopup->AddButton(tr("Add News Site")); - if (m_NewsSites.size() > 0) - m_menuPopup->AddButton(tr("Delete News Site")); - m_menuPopup->AddButton(tr("Cancel")); + { + m_menuPopup->AddButton(tr("Edit Feed")); + m_menuPopup->AddButton(tr("Delete Feed")); + } } else { @@ -954,10 +972,12 @@ void MythNews::customEvent(QEvent *event) if (m_NewsSites.size() > 0) { if (buttonnum == 0) - ShowEditDialog(true); + ShowFeedManager(); else if (buttonnum == 1) ShowEditDialog(false); else if (buttonnum == 2) + ShowEditDialog(true); + else if (buttonnum == 3) deleteNewsSite(); } else diff --git a/mythplugins/mythnews/mythnews/mythnews.h b/mythplugins/mythnews/mythnews/mythnews.h index 60c0e508b57..bc8a45e1f18 100644 --- a/mythplugins/mythnews/mythnews/mythnews.h +++ b/mythplugins/mythnews/mythnews/mythnews.h @@ -47,6 +47,7 @@ class MythNews : public MythScreenType void ShowMenu(void); void deleteNewsSite(void); void ShowEditDialog(bool edit); + void ShowFeedManager(); mutable QMutex m_lock; NewsSite::List m_NewsSites;