Skip to content
Snippets Groups Projects
Commit ab154eac authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Edric Milaret
Browse files

TextRecording: add helper to mark all read

So that we can mark all messages as being read without having to
re-save the recording on disk for each message.

Change-Id: I698dbacd0a3f5b2040bdb3a340d1e8bca4e94508
Tuleap: #203
parent 86d690c4
Branches
Tags
No related merge requests found
......@@ -181,6 +181,24 @@ QAbstractItemModel* Media::TextRecording::instantMessagingModel() const
return d_ptr->m_pImModel;
}
///Set all messages as read and then save the recording
void Media::TextRecording::setAllRead()
{
bool changed = false;
for(int row = 0; row < d_ptr->m_lNodes.size(); ++row) {
if (!d_ptr->m_lNodes[row]->m_pMessage->isRead) {
d_ptr->m_lNodes[row]->m_pMessage->isRead = true;
if (d_ptr->m_pImModel) {
auto idx = d_ptr->m_pImModel->index(row, 0);
emit d_ptr->m_pImModel->dataChanged(idx,idx);
}
changed = true;
}
}
if (changed)
save();
}
/**
* I (Emmanuel Lepage) is in the process of writing a better one for this that
* can be upstreamed into Qt (there is interest in merging a generic QVariant
......
......@@ -73,6 +73,9 @@ public:
bool hasMimeType ( const QString& mimeType ) const;
QStringList mimeTypes ( ) const;
//Helper
void setAllRead();
Q_SIGNALS:
void messageInserted(const QMap<QString,QString>& message, ContactMethod* cm, Media::Media::Direction direction);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment