<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/123508/">https://git.reviewboard.kde.org/r/123508/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The conditional comes from 50a2283112225e2db4673e41d12411e8664865fa in kdelibs.git where qMetaTypeId<KShortcut> was ported to qMetaTypeId<QList<QKeySequence> >. However that porting looks wrong indeed, KShortcut was UserType in QVariant while, from what you say, the property is now just one QKeySequence, and QKeySequence is a builtin QVariant type.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">So it seems to me that you can remove the old conditional and just use yours instead. That works in your tests, right?
No point in keeping possibly-wrongly-ported unused code.</p></pre>
<br />
<p>- David Faure</p>
<br />
<p>On May 1st, 2015, 9:17 a.m. UTC, Lindsay Roberts wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for KDE Frameworks and David Faure.</div>
<div>By Lindsay Roberts.</div>
<p style="color: grey;"><i>Updated May 1, 2015, 9:17 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=337131">337131</a>,
<a href="https://bugs.kde.org/show_bug.cgi?id=339243">339243</a>,
<a href="https://bugs.kde.org/show_bug.cgi?id=340803">340803</a>,
<a href="https://bugs.kde.org/show_bug.cgi?id=345411">345411</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kxmlgui
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">When a user configures both a primary and alternate shortcut for an action, they were lost on subsequent load of the app/part .rc file.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">These values are persisted in the .rc file as two key sequence strings separated by "; " -- the format understood by <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">QKeySequence::listFromString</code>. When these files are reparsed, the current execution flow simply calls <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">QObject::setProperty("shortcut", semicolonSeparatedString)</code>, which is <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">Q_PROPERTY</code> bound in QAction to <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">setShortcut(QKeySequence)</code> -- invoking the (single) QKeySequence constructor. The embedded semicolon and secondary shortcut seem to break this constructor.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">There is another specific flow in <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">KXMLGUIFactoryPrivate::configureAction</code>; one that specifically calls
action->setShortcuts(QKeySequence::listFromString(attribute.value()));</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">but it was conditionalised by: </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">propertyType == QVariant::UserType && action->property(attrName.toLatin1().constData()).userType() == qMetaTypeId<QList<QKeySequence> >()
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I have not been able to track down in history when that conditional would've run true for the QAction property <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">"shortcut"</code>, QVariant::KeySequence was added Nov 2011, and the conditional has been there since at least the monolithic git split Dec 2013.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Nor have I been able to track down any recent changes on the Qt side that would've implied the QKeySequence string constructor would've worked for multiple shortcuts in the recent past.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">In any case, the fix is simply to add a second conditional - matching on QVariant::KeySequence.</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Primarily using trunk Konsole - saving/loading/using multiple/single shortcuts.</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>autotests/kxmlgui_unittest.h <span style="color: grey">(fa2d7fb)</span></li>
<li>autotests/kxmlgui_unittest.cpp <span style="color: grey">(404d304)</span></li>
<li>src/kxmlguifactory.cpp <span style="color: grey">(aeeb242)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/123508/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>