<table><tr><td style="">poboiko edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-eyz3ievi634cab4/">(Show Details)</a>
</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/D29148">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">It's reasonable to switch focus to `KJotsEdit` when user changes selection,<br />
so it's possible to start editing the note immediately after selecting it.<br />
<br />
However, it's unreasonable to do it on `dataChange`, as it's not necessarily associated<br />
with some explicit user action (and we don't want focus to randomly jump unless user exlicitly wants it).<br />
<br />
This fixes following frustrating issue:<br />
 1) User tries to switch focus i.e. to `KFontChooser` to pick font he wants<br />
 2) `KJotsEdit` catches `focusOutEvent` and does the autosave (`savePage` call)<br />
 3) Autosave modifies the underlying data in the model via `model()->setData()`<br />
 4) Selection model inside `KJotsWidget` catches `dataChanged` signal and calls `renderSelection` slot<br />
 5) It switches focus back to `KJotsEdit`<br />
so user has to press onto the `KFontChooser` second time (the same issue does not trigger again<br />
because autosave is skipped when document is not modified)<br />
<br />
</span>This patch also fixes a race condition that could happen due to the `focusOutEvent`. When user changes the document via KJotsTreeView, there are several places which react to this change:<div style="padding: 8px 0;">...</div>    - tries to `setReadOnly` based on `NoteLockAttribute`<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
<br />
This patch also fixes visual glitch: <br />
 1) User tries to switch focus i.e. to `KFontChooser` to pick font he wants<br />
 2) `KJotsEdit` catches `focusOutEvent` and does the autosave (`savePage` call)<br />
 3) Autosave modifies the underlying data in the model via `model()->setData()`<br />
 4) Selection model inside `KJotsWidget` catches `dataChanged` signal and calls `renderSelection` slot<br />
 5) It switches focus back to `KJotsEdit`<br />
so user has to press onto the `KFontChooser` second time (the same issue does not trigger again because autosave is skipped when document is not modified)<br />
The fix is that `KJotsEdit` decides it should grab the focus only when the new document was opened explicitly.</span><br />
<br />
Also, remove `selectionModel` from `KJotsBrowser` as it's not used there anyways.</div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R573 KJots</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29148">https://phabricator.kde.org/D29148</a></div></div><br /><div><strong>To: </strong>poboiko, dvratil<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>