Skip to content

Commit

Permalink
MythNews: try to keep the same item selected in the articles list aft…
Browse files Browse the repository at this point in the history
…er update

This fixes the annoying behaviour of the selection moving to the first item in
the articles list after the list is refreshed. It will now try to
keep the same item selected after the articles list is updated.
  • Loading branch information
Paul Harrison committed Jun 15, 2013
1 parent d107852 commit 0cbca16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mythplugins/mythnews/mythnews/mythnews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ void MythNews::processAndShowNews(NewsSite *site)
if (site != qVariantValue<NewsSite*>(siteUIItem->GetData()))
return;

QString currItem = m_articlesList->GetValue();
int topPos = m_articlesList->GetTopItemPos();

m_articlesList->Reset();
m_articles.clear();

Expand All @@ -662,6 +665,9 @@ void MythNews::processAndShowNews(NewsSite *site)
new MythUIButtonListItem(m_articlesList, (*it).title());
m_articles[item] = *it;
}

if (m_articlesList->MoveToNamedPosition(currItem))
m_articlesList->SetItemCurrent(m_articlesList->GetCurrentPos(), topPos);
}

void MythNews::slotSiteSelected(MythUIButtonListItem *item)
Expand Down

0 comments on commit 0cbca16

Please sign in to comment.