Skip to content

Commit

Permalink
Add the mythnews feed config to the context menu so that users can se…
Browse files Browse the repository at this point in the history
…lect feeds more easily
  • Loading branch information
stuartm committed Jan 23, 2012
1 parent 341682a commit 20adee5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
32 changes: 26 additions & 6 deletions mythplugins/mythnews/mythnews/mythnews.cpp
Expand Up @@ -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: ")
Expand Down Expand Up @@ -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);
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mythplugins/mythnews/mythnews/mythnews.h
Expand Up @@ -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;
Expand Down

0 comments on commit 20adee5

Please sign in to comment.