Browse Source

Merge pull request #2702 from pmzqla/rss-count

Add count of unread items to RSS tab label
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
c7fa778732
  1. 8
      src/gui/mainwindow.cpp
  2. 1
      src/gui/mainwindow.h
  3. 4
      src/gui/rss/rss_imp.cpp
  4. 3
      src/gui/rss/rss_imp.h

8
src/gui/mainwindow.cpp

@ -503,7 +503,8 @@ void MainWindow::displayRSSTab(bool enable) @@ -503,7 +503,8 @@ void MainWindow::displayRSSTab(bool enable)
// RSS tab
if (!rssWidget) {
rssWidget = new RSSImp(tabs);
int index_tab = tabs->addTab(rssWidget, tr("RSS"));
connect(rssWidget, SIGNAL(updateRSSCount(int)), this, SLOT(updateRSSTabLabel(int)));
int index_tab = tabs->addTab(rssWidget, tr("RSS (%1)").arg(0));
tabs->setTabIcon(index_tab, GuiIconProvider::instance()->getIcon("application-rss+xml"));
}
}
@ -513,6 +514,11 @@ void MainWindow::displayRSSTab(bool enable) @@ -513,6 +514,11 @@ void MainWindow::displayRSSTab(bool enable)
}
void MainWindow::updateRSSTabLabel(int count)
{
tabs->setTabText(tabs->indexOf(rssWidget), tr("RSS (%1)").arg(count));
}
void MainWindow::displaySearchTab(bool enable)
{
Preferences::instance()->setSearchEnabled(enable);

1
src/gui/mainwindow.h

@ -138,6 +138,7 @@ protected slots: @@ -138,6 +138,7 @@ protected slots:
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
void handleUpdateCheckFinished(bool update_available, QString new_version, bool invokedByUser);
#endif
void updateRSSTabLabel(int count);
protected:
void dropEvent(QDropEvent *event);

4
src/gui/rss/rss_imp.cpp

@ -637,8 +637,10 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item) @@ -637,8 +637,10 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item)
return;
QString name;
if (rss_item == m_rssManager)
if (rss_item == m_rssManager) {
name = tr("Unread");
emit updateRSSCount(rss_item->unreadCount());
}
else
name = rss_item->displayName();
item->setText(0, name + QString::fromUtf8(" (") + QString::number(rss_item->unreadCount()) + QString(")"));

3
src/gui/rss/rss_imp.h

@ -57,6 +57,9 @@ public slots: @@ -57,6 +57,9 @@ public slots:
void deleteSelectedItems();
void updateRefreshInterval(uint val);
signals:
void updateRSSCount(int);
private slots:
void on_newFeedButton_clicked();
void refreshAllFeeds();

Loading…
Cancel
Save