<table><tr><td style="">dkurz updated this revision to Diff 5889.<br />dkurz 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/D2423" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>I tried to implement all of knauss' remarks, but I encountered a race condition problem:</p>

<p>I connected the CreateTagJob's result with my own onMissingCategoryCreated, extracted the new tag there, added it to the selected tags and set the selected tags of the TagWidget. This approach makes editting of selected tags work: When I click on the "..." button, all the tags are there, and the correct ones are selected. The text field next to the "..." button, however, is not updated correctly, because the TagWidget's TagModel gets notified *after* I update its selected tags. TagWidget, however, only displays names of tags that are already in the model.</p>

<p>Instead, I chose to add the newly created tags directly to the selected tags (without waiting for akonadi to tell me that the creation succeeded). This has the positive effects of the approach above, and allows us to fix the race condition in TagWidget itself, see <a href="https://phabricator.kde.org/D2433" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">D2433</a></p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rINCIDENCEEDITOR PIM: Incidence Editor</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D2423?vs=5872&id=5889" rel="noreferrer">https://phabricator.kde.org/D2423?vs=5872&id=5889</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D2423" rel="noreferrer">https://phabricator.kde.org/D2423</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/incidencecategories.cpp<br />
src/incidencecategories.h</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>dkurz, KDE PIM<br /><strong>Cc: </strong>knauss, kde-pim, spencerb, dvasin, winterz, smartins, vkrause, mlaurent, dvratil<br /></div>