<table><tr><td style="">poboiko added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28436">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D28436#640410" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D28436#640410</a>, <a href="https://phabricator.kde.org/p/winterz/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@winterz</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>The code is ok.  I admit I don't understand how this could happen.  Google is changing the UID?</p></div>
</blockquote>

<p>Thanks!</p>

<p>Basically, yes. Google provides own UIDs to address the task via its API. <br />
It works as follows:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">First, KOrganizer creates a task, and generates some default random UID for it. This task is added to the model, and to the Akonadi DB.</li>
<li class="remarkup-list-item">Then, Akonadi calls <tt style="background: #ebebeb; font-size: 13px;">itemAdded</tt> callback for Google Resource, which sends this task to Google servers (via <tt style="background: #ebebeb; font-size: 13px;">KGAPI2::TaskCreateJob</tt>).</li>
<li class="remarkup-list-item">When this job is done, Google returns us the UID of newly added task, which will be used to work with this task via its API.</li>
<li class="remarkup-list-item">Google Resource then changes the UID of the task to the new one explicitly (<tt style="background: #ebebeb; font-size: 13px;">item.setGid(task->uid()); new ItemModifyJob(item)</tt>)</li>
<li class="remarkup-list-item">After that, the ETM gets notified of the result, and changes the UID of an item.</li>
</ol></div></div><br /><div><strong>REPOSITORY</strong><div><div>R76 PIM: Event Views</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix-id-change (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28436">https://phabricator.kde.org/D28436</a></div></div><br /><div><strong>To: </strong>poboiko, dvratil, winterz<br /><strong>Cc: </strong>winterz, kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, vkrause, mlaurent, knauss, dvratil<br /></div>