Properly reload individualy switched msg when changing importance - color of font did not change all the times.

This commit is contained in:
martinrotter 2017-05-11 06:22:38 +02:00
parent b99acea244
commit 73925b6452
3 changed files with 8 additions and 5 deletions

View File

@ -109,6 +109,7 @@ class FeedsModel : public QAbstractItemModel {
// Loads feed/categories from the database. // Loads feed/categories from the database.
void loadActivatedServiceAccounts(); void loadActivatedServiceAccounts();
// Stops all accounts before exit.
void stopServiceAccounts(); void stopServiceAccounts();
// Reloads counts of all feeds/categories/whatever in the model. // Reloads counts of all feeds/categories/whatever in the model.
@ -124,8 +125,6 @@ class FeedsModel : public QAbstractItemModel {
// Removes item with given index. // Removes item with given index.
// NOTE: Also deletes item from memory. // NOTE: Also deletes item from memory.
void removeItem(const QModelIndex &index); void removeItem(const QModelIndex &index);
// Removes given item from the model/memory.
void removeItem(RootItem *deleting_item); void removeItem(RootItem *deleting_item);
// Recycle bins operations. // Recycle bins operations.

View File

@ -399,6 +399,8 @@ bool MessagesModel::switchMessageImportance(int row_index) {
// Commit changes. // Commit changes.
if (DatabaseQueries::markMessageImportant(database(), message.m_id, next_importance)) { if (DatabaseQueries::markMessageImportant(database(), message.m_id, next_importance)) {
emit dataChanged(index(row_index, 0), index(row_index, MSG_DB_FEED_CUSTOM_ID_INDEX), QVector<int>() << Qt::FontRole);
return m_selectedItem->getParentServiceRoot()->onAfterSwitchMessageImportance(m_selectedItem, return m_selectedItem->getParentServiceRoot()->onAfterSwitchMessageImportance(m_selectedItem,
QList<QPair<Message,RootItem::Importance> >() << pair); QList<QPair<Message,RootItem::Importance> >() << pair);
} }

View File

@ -59,6 +59,7 @@ class MessagesModel : public QSqlTableModel {
void updateDateFormat(); void updateDateFormat();
void reloadWholeLayout(); void reloadWholeLayout();
// Adds this new state to queue of sort states.
void addSortState(int column, Qt::SortOrder order); void addSortState(int column, Qt::SortOrder order);
// CORE messages manipulators. // CORE messages manipulators.
@ -99,13 +100,14 @@ class MessagesModel : public QSqlTableModel {
void setupFonts(); void setupFonts();
void setupIcons(); void setupIcons();
// Fetches ALL available data to the model.
void fetchAllData();
// Direct SQL stuff.
QString orderByClause() const; QString orderByClause() const;
QString selectStatement() const; QString selectStatement() const;
QString formatFields() const; QString formatFields() const;
// Fetches ALL available data to the model.
void fetchAllData();
// NOTE: These two lists contain data for multicolumn sorting. // NOTE: These two lists contain data for multicolumn sorting.
// They are always same length. Most important sort column/order // They are always same length. Most important sort column/order
// are located at the start of lists; // are located at the start of lists;