<table><tr><td style="">michalhumpula updated this revision to Diff 58675.<br />michalhumpula 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/D21409">View Revision</a></tr></table><br /><div><div><p>Uh, this is getting more complicated then I though it would be.</p>

<p>So, if I call <tt style="background: #ebebeb; font-size: 13px;">QApplication::quit()</tt> from the <tt style="background: #ebebeb; font-size: 13px;">KWrite::quit</tt> the ktexteditor doesn't even get a chance to notify user about unsaved changes. For the specific vi-mode usecase I think calling close on active window is perfectly ok.</p>

<p>But... since the KTextEditor::Application object is registered multiple times when KWrite object is created , then this patch creates a mayhem when multiple windows are open. So the only way out I can see is to create the regular KWrite Application as in kate. And that is this update</p>

<p>Good part:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">there are no static properties in KWrite anymore.</li>
</ul>

<p>Bad part:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">ktexteditor vi-mode close command is unable to handle dummy main window correctly and causes segfault</li>
</ul>

<p>Ugly:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">in order to implement KTextEditor::Application properly the kwrite would have to track which KWrite is active and all the other stuff.</li>
</ul>

<p>So apparently this went quickly over my paygrade. No idea where to go from here.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R40 Kate</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D21409?vs=58659&id=58675">https://phabricator.kde.org/D21409?vs=58659&id=58675</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21409">https://phabricator.kde.org/D21409</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kwrite/CMakeLists.txt<br />
kwrite/kwrite.cpp<br />
kwrite/kwrite.h<br />
kwrite/kwriteapplication.cpp<br />
kwrite/kwriteapplication.h<br />
kwrite/main.cpp</div></div></div><br /><div><strong>To: </strong>michalhumpula, cullmann<br /><strong>Cc: </strong>loh.tar, dhaumann, kwrite-devel, domson, michaelh, ngraham, demsking, cullmann, sars<br /></div>