Added recycle bin initially to TT-RSS.

This commit is contained in:
Martin Rotter 2015-12-12 18:27:54 +01:00
parent bfa177a32d
commit a212c44ad2
2 changed files with 19 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include "network-web/networkfactory.h"
#include "services/tt-rss/ttrssserviceentrypoint.h"
#include "services/tt-rss/ttrssfeed.h"
#include "services/tt-rss/ttrssrecyclebin.h"
#include "services/tt-rss/ttrsscategory.h"
#include "services/tt-rss/definitions.h"
#include "services/tt-rss/network/ttrssnetworkfactory.h"
@ -36,7 +37,7 @@
TtRssServiceRoot::TtRssServiceRoot(RootItem *parent)
: ServiceRoot(parent), m_actionSyncIn(NULL), m_serviceMenu(QList<QAction*>()), m_network(new TtRssNetworkFactory) {
: ServiceRoot(parent), m_recycleBin(new TtRssRecycleBin(this)), m_actionSyncIn(NULL), m_serviceMenu(QList<QAction*>()), m_network(new TtRssNetworkFactory) {
setIcon(TtRssServiceEntryPoint().icon());
setCreationDate(QDateTime::currentDateTime());
}
@ -133,7 +134,7 @@ QList<QAction*> TtRssServiceRoot::addItemMenu() {
}
RecycleBin *TtRssServiceRoot::recycleBin() {
return NULL;
return m_recycleBin;
}
bool TtRssServiceRoot::loadMessagesForItem(RootItem *item, QSqlTableModel *model) {
@ -442,6 +443,10 @@ void TtRssServiceRoot::loadFromDatabase() {
// All data are now obtained, lets create the hierarchy.
assembleCategories(categories);
assembleFeeds(feeds);
// As the last item, add recycle bin, which is needed.
appendChild(m_recycleBin);
m_recycleBin->updateCounts(true);
}
void TtRssServiceRoot::updateTitle() {
@ -549,7 +554,9 @@ void TtRssServiceRoot::removeOldFeedTree(bool including_messages) {
void TtRssServiceRoot::cleanAllItems() {
foreach (RootItem *top_level_item, childItems()) {
requestItemRemoval(top_level_item);
if (top_level_item->kind() != RootItemKind::Bin) {
requestItemRemoval(top_level_item);
}
}
}
@ -596,4 +603,10 @@ void TtRssServiceRoot::storeNewFeedTree(RootItem *root) {
}
}
}
if (!childItems().contains(m_recycleBin)) {
// As the last item, add recycle bin, which is needed.
appendChild(m_recycleBin);
m_recycleBin->updateCounts(true);
}
}

View File

@ -26,6 +26,7 @@
class TtRssCategory;
class TtRssFeed;
class TtRssNetworkFactory;
class TtRssRecycleBin;
class TtRssServiceRoot : public ServiceRoot {
Q_OBJECT
@ -95,6 +96,8 @@ class TtRssServiceRoot : public ServiceRoot {
void storeNewFeedTree(RootItem *root);
void loadFromDatabase();
TtRssRecycleBin *m_recycleBin;
QAction *m_actionSyncIn;
QList<QAction*> m_serviceMenu;