Some work...
This commit is contained in:
parent
82d3de2699
commit
bdc7aa7a31
|
@ -140,6 +140,14 @@ int FeedsModel::rowCount(const QModelIndex &parent) const {
|
||||||
return parent_item->childCount();
|
return parent_item->childCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FeedsModel::countOfAllMessages() const {
|
||||||
|
return m_rootItem->countOfAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
int FeedsModel::countOfUnreadMessages() const {
|
||||||
|
return m_rootItem->countOfUnreadMessages();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: přepsat tudle metodu,
|
// TODO: přepsat tudle metodu,
|
||||||
// vim ze to zhruba funguje ale je potreba pridat taky
|
// vim ze to zhruba funguje ale je potreba pridat taky
|
||||||
// vymazani feedu/kategorie z SQL (pridat metodu do FeedsModelRootItem
|
// vymazani feedu/kategorie z SQL (pridat metodu do FeedsModelRootItem
|
||||||
|
|
|
@ -33,6 +33,10 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
int columnCount(const QModelIndex &parent) const;
|
int columnCount(const QModelIndex &parent) const;
|
||||||
int rowCount(const QModelIndex &parent) const;
|
int rowCount(const QModelIndex &parent) const;
|
||||||
|
|
||||||
|
// Returns couns of ALL/UNREAD (non-deleted) messages for the model.
|
||||||
|
int countOfAllMessages() const;
|
||||||
|
int countOfUnreadMessages() const;
|
||||||
|
|
||||||
// Feed/category manipulators.
|
// Feed/category manipulators.
|
||||||
bool removeItems(const QModelIndexList &indexes);
|
bool removeItems(const QModelIndexList &indexes);
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,9 @@ void FeedsView::updateCountsOfSelectedFeeds(bool update_total_too) {
|
||||||
|
|
||||||
// Make sure that selected view reloads changed indexes.
|
// Make sure that selected view reloads changed indexes.
|
||||||
m_sourceModel->reloadChangedLayout(m_proxyModel->mapListToSource(selectionModel()->selectedRows()));
|
m_sourceModel->reloadChangedLayout(m_proxyModel->mapListToSource(selectionModel()->selectedRows()));
|
||||||
|
|
||||||
|
emit feedCountsChanged(m_sourceModel->countOfUnreadMessages(),
|
||||||
|
m_sourceModel->countOfAllMessages());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +182,9 @@ void FeedsView::updateCountsOfAllFeeds(bool update_total_too) {
|
||||||
|
|
||||||
// Make sure that all views reloads its data.
|
// Make sure that all views reloads its data.
|
||||||
m_sourceModel->reloadWholeLayout();
|
m_sourceModel->reloadWholeLayout();
|
||||||
|
|
||||||
|
emit feedCountsChanged(m_sourceModel->countOfUnreadMessages(),
|
||||||
|
m_sourceModel->countOfAllMessages());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed,
|
void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed,
|
||||||
|
@ -190,9 +196,8 @@ void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed,
|
||||||
m_sourceModel->reloadChangedLayout(QModelIndexList() << index);
|
m_sourceModel->reloadChangedLayout(QModelIndexList() << index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Optimize this and call the signal in all updateCounts* methods.
|
emit feedCountsChanged(m_sourceModel->countOfUnreadMessages(),
|
||||||
emit feedCountsChanged(m_sourceModel->rootItem()->countOfUnreadMessages(),
|
m_sourceModel->countOfAllMessages());
|
||||||
m_sourceModel->rootItem()->countOfAllMessages());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::initializeContextMenuCategoriesFeeds() {
|
void FeedsView::initializeContextMenuCategoriesFeeds() {
|
||||||
|
|
|
@ -47,11 +47,6 @@ FormMain::FormMain(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::FormMain
|
||||||
|
|
||||||
FormMain::~FormMain() {
|
FormMain::~FormMain() {
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
|
|
||||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
|
||||||
delete m_trayMenu;
|
|
||||||
qDebug("Deleting tray icon menu.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormMain *FormMain::instance() {
|
FormMain *FormMain::instance() {
|
||||||
|
|
|
@ -64,6 +64,7 @@ void SystemTrayIcon::onActivated(const QSystemTrayIcon::ActivationReason &reason
|
||||||
case SystemTrayIcon::DoubleClick:
|
case SystemTrayIcon::DoubleClick:
|
||||||
case SystemTrayIcon::MiddleClick:
|
case SystemTrayIcon::MiddleClick:
|
||||||
static_cast<FormMain*>(parent())->switchVisibility();
|
static_cast<FormMain*>(parent())->switchVisibility();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue