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)
// RSS tab // RSS tab
if (!rssWidget) { if (!rssWidget) {
rssWidget = new RSSImp(tabs); 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")); tabs->setTabIcon(index_tab, GuiIconProvider::instance()->getIcon("application-rss+xml"));
} }
} }
@ -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) void MainWindow::displaySearchTab(bool enable)
{ {
Preferences::instance()->setSearchEnabled(enable); Preferences::instance()->setSearchEnabled(enable);

1
src/gui/mainwindow.h

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

4
src/gui/rss/rss_imp.cpp

@ -637,8 +637,10 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item)
return; return;
QString name; QString name;
if (rss_item == m_rssManager) if (rss_item == m_rssManager) {
name = tr("Unread"); name = tr("Unread");
emit updateRSSCount(rss_item->unreadCount());
}
else else
name = rss_item->displayName(); name = rss_item->displayName();
item->setText(0, name + QString::fromUtf8(" (") + QString::number(rss_item->unreadCount()) + QString(")")); 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:
void deleteSelectedItems(); void deleteSelectedItems();
void updateRefreshInterval(uint val); void updateRefreshInterval(uint val);
signals:
void updateRSSCount(int);
private slots: private slots:
void on_newFeedButton_clicked(); void on_newFeedButton_clicked();
void refreshAllFeeds(); void refreshAllFeeds();

Loading…
Cancel
Save