forked from blue/squawk
Now notifications have actions! Some more usefull functions to roster model
This commit is contained in:
parent
3916aec358
commit
e58213b294
15 changed files with 205 additions and 30 deletions
|
@ -318,12 +318,7 @@ QVariant Models::MessageFeed::data(const QModelIndex& index, int role) const
|
|||
case Bulk: {
|
||||
FeedItem item;
|
||||
item.id = msg->getId();
|
||||
|
||||
std::set<QString>::const_iterator umi = unreadMessages->find(item.id);
|
||||
if (umi != unreadMessages->end()) {
|
||||
unreadMessages->erase(umi);
|
||||
emit unreadMessagesCountChanged();
|
||||
}
|
||||
markMessageAsRead(item.id);
|
||||
|
||||
item.sentByMe = sentByMe(*msg);
|
||||
item.date = msg->getTime();
|
||||
|
@ -373,6 +368,17 @@ int Models::MessageFeed::rowCount(const QModelIndex& parent) const
|
|||
return storage.size();
|
||||
}
|
||||
|
||||
bool Models::MessageFeed::markMessageAsRead(const QString& id) const
|
||||
{
|
||||
std::set<QString>::const_iterator umi = unreadMessages->find(id);
|
||||
if (umi != unreadMessages->end()) {
|
||||
unreadMessages->erase(umi);
|
||||
emit unreadMessagesCountChanged();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int Models::MessageFeed::unreadMessagesCount() const
|
||||
{
|
||||
return unreadMessages->size();
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
void reportLocalPathInvalid(const QString& messageId);
|
||||
|
||||
unsigned int unreadMessagesCount() const;
|
||||
bool markMessageAsRead(const QString& id) const;
|
||||
void fileProgress(const QString& messageId, qreal value, bool up);
|
||||
void fileError(const QString& messageId, const QString& error, bool up);
|
||||
void fileComplete(const QString& messageId, bool up);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue