Commit a53e22c3 authored by Igor Poboiko's avatar Igor Poboiko
Browse files

[IncidenceTreeModel] Update UID if it was changed

If one creates a Todo inside KOrganizer, it sets some default generated UID.
Such UID can be changed by the resource afterwards. The model should handle this case.

This patch adds a simple check: if the uid has changed inside `onDataChange, then just update the hashes.

Test Plan:
1) Add a Todo to Google Tasklist
2) Add a subtodo instantly (without reloading the view)
3) (without patch) Subtodo is added at the top level (parent was not recognized)
4) (with patch) Subtodo is added below the parent todo

Reviewers: dvratil

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision:
parent 68507724
......@@ -202,6 +202,15 @@ void IncidenceTreeModel::Private::onDataChanged(const QModelIndex &begin, const
// An UID could have changed, update hashes!
if (node->uid != incidence->instanceIdentifier()) {
qCDebug(CALENDARVIEW_LOG) << "Incidence UID has changed" << node->uid << incidence->instanceIdentifier();
node->uid = incidence->instanceIdentifier();
m_uidMap.insert(node->uid, node);
m_itemByUid.insert(incidence->instanceIdentifier(), item);
Node::Ptr newParentNode;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment