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