|
|
@ -105,12 +105,6 @@ void Folder::handleItemUnreadCountChanged() |
|
|
|
emit unreadCountChanged(this); |
|
|
|
emit unreadCountChanged(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Folder::handleItemAboutToBeDestroyed(Item *item) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (item->unreadCount() > 0) |
|
|
|
|
|
|
|
emit unreadCountChanged(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Folder::cleanup() |
|
|
|
void Folder::cleanup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (Item *item, items()) |
|
|
|
foreach (Item *item, items()) |
|
|
@ -127,14 +121,23 @@ void Folder::addItem(Item *item) |
|
|
|
connect(item, &Item::articleRead, this, &Item::articleRead); |
|
|
|
connect(item, &Item::articleRead, this, &Item::articleRead); |
|
|
|
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved); |
|
|
|
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved); |
|
|
|
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged); |
|
|
|
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged); |
|
|
|
connect(item, &Item::aboutToBeDestroyed, this, &Folder::handleItemAboutToBeDestroyed); |
|
|
|
|
|
|
|
|
|
|
|
for (auto article: item->articles()) |
|
|
|
|
|
|
|
emit newArticle(article); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item->unreadCount() > 0) |
|
|
|
emit unreadCountChanged(this); |
|
|
|
emit unreadCountChanged(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Folder::removeItem(Item *item) |
|
|
|
void Folder::removeItem(Item *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_ASSERT(m_items.contains(item)); |
|
|
|
Q_ASSERT(m_items.contains(item)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto article: item->articles()) |
|
|
|
|
|
|
|
emit articleAboutToBeRemoved(article); |
|
|
|
|
|
|
|
|
|
|
|
item->disconnect(this); |
|
|
|
item->disconnect(this); |
|
|
|
m_items.removeOne(item); |
|
|
|
m_items.removeOne(item); |
|
|
|
|
|
|
|
if (item->unreadCount() > 0) |
|
|
|
emit unreadCountChanged(this); |
|
|
|
emit unreadCountChanged(this); |
|
|
|
} |
|
|
|
} |
|
|
|