Skip to content
Snippets Groups Projects
Commit 04e73a66 authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Alexandre Lision
Browse files

TextRecording: do not save if nothing changed

Prevent an unnecessary write to disk if the setData function didn't
change anything.

Change-Id: I3e101afddd29cc1117e8b3f65a63c8b781a70ab6
Tuleap: #203
parent f32ac08b
No related branches found
No related tags found
No related merge requests found
...@@ -697,6 +697,8 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu ...@@ -697,6 +697,8 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu
if (idx.column() || !idx.isValid()) if (idx.column() || !idx.isValid())
return false; return false;
bool changed = false;
::TextMessageNode* n = m_pRecording->d_ptr->m_lNodes[idx.row()]; ::TextMessageNode* n = m_pRecording->d_ptr->m_lNodes[idx.row()];
switch (role) { switch (role) {
case (int)Media::TextRecording::Role::IsRead : case (int)Media::TextRecording::Role::IsRead :
...@@ -707,6 +709,7 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu ...@@ -707,6 +709,7 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu
emit n->m_pContactMethod->changed(); emit n->m_pContactMethod->changed();
} }
emit dataChanged(idx,idx); emit dataChanged(idx,idx);
changed = true;
} }
break; break;
default: default:
...@@ -714,6 +717,7 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu ...@@ -714,6 +717,7 @@ bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant &valu
} }
//Save the conversation //Save the conversation
if (changed)
m_pRecording->save(); m_pRecording->save();
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment