<table><tr><td style="">kmaterka 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/D24667">View Revision</a></tr></table><br /><div><div><p>This fixes issue from first <a href="https://bugs.kde.org/show_bug.cgi?id=365105#c6" class="remarkup-link" target="_blank" rel="noreferrer">comment</a> made by <a href="https://phabricator.kde.org/p/davidedmundson/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@davidedmundson</a> . <a href="https://bugs.kde.org/show_bug.cgi?id=365105#c7" class="remarkup-link" target="_blank" rel="noreferrer">Second</a> is still not fixed. Let me copy it here:</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>We have one menu for the whole tray instance<br />
We create and delete KSNI object in init() and cleanup() which are called on show() hide()</p>
<p>The SNI takes ownership of the menu</p>
<p>so for the the second init, we set the SNI to a now deleted menu.</p></blockquote>
<p>The assumption in QPA is that context menu is persistent, tray icon is not.</p>
<p>There are few way to fix that, but I don't like any of these:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">create new QMenu when old one is destroyed, try to recover menu content<ul class="remarkup-list">
<li class="remarkup-list-item">menu actions are stored safely in m_items, but title, icon and other flags are not</li>
<li class="remarkup-list-item">we can have two menus, one for KSNI, second to store values for recovery but this is silly</li>
</ul></li>
<li class="remarkup-list-item">create a proxy/delegate to internal QMenu, so that the internal QMenu won't be deleted<ul class="remarkup-list">
<li class="remarkup-list-item">overkill? a lot of methods/signals/slots to delegate</li>
</ul></li>
<li class="remarkup-list-item">do not delete menu in KSNI<ul class="remarkup-list">
<li class="remarkup-list-item">not possible, other apps are relaying on this behavior</li>
<li class="remarkup-list-item">add new parameter to skip menu deletion? Isn't it another overkill ad unnecessary API change?</li>
</ul></li>
<li class="remarkup-list-item">remove SystemTray support from KdePlatformTheme<ul class="remarkup-list">
<li class="remarkup-list-item">easiest, but...</li>
<li class="remarkup-list-item">Qt has implementation based on DBus, but it behaves differently to KSNI: different position of context menu, different implementation of activated, scroll is not supported etc</li>
</ul></li>
</ul>
<p>What do you think?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R289 KNotifications</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24667">https://phabricator.kde.org/D24667</a></div></div><br /><div><strong>To: </strong>kmaterka, davidedmundson, broulik, nicolasfella<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>