<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/122249/">https://git.reviewboard.kde.org/r/122249/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 2nd, 2015, 7:47 a.m. UTC, <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/122249/diff/6/?file=351945#file351945line46" style="color: black; font-weight: bold; text-decoration: underline;">processui/keyboardshortcututil.cpp</a>
<span style="font-weight: normal;">
(Diff revision 6)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">46</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="n">QList</span><span class="o"><</span><span class="n">QKeySequence</span><span class="o">></span> <span class="n">KeyboardShortcutUtil</span><span class="o">::</span><span class="n">findKeysByComponentAndUniqueName</span><span class="p">(</span><span class="n">QString</span> <span class="n">componentPath</span><span class="p">,</span> <span class="n">QString</span> <span class="n">uniqueName</span><span class="p">,</span> <span class="n">QString</span><span class="o">*</span> <span class="n">whyEmptyMessage</span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<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;">This looks to complicated. It should be much easier to do with the KGlobalAccel API:
<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;"> create a KActionCollection for component "kwin"
</em> add a QAction with the shortcut name you want
* ask KGlobalAccel to load the shortcut for it.</p></pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; 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;">Thanks for the hint but I am not sure of how to use the API in such a way. I tried two things:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">1)
org::kde::KGlobalAccel kglobalaccel("org.kde.kglobalaccel", "/kglobalaccel", bus);</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%"><span style="color: #008000; font-weight: bold">auto</span> kwinActions <span style="color: #666666">=</span> kglobalaccel.allActionsForComponent(QStringList(<span style="color: #BA2121">"kwin"</span>));
Q_FOREACH(<span style="color: #008000; font-weight: bold">auto</span> aaa, kwinActions.value()) {
<span style="color: #408080; font-style: italic">//qDebug() << aaa; // ("kwin", "Kill Window", "KWin", "Kill Window")</span>
}
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Then I wonder how to feed the QStringList to a KActionCollection.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">2)
KActionCollection ac(nullptr, QString());
ac.setComponentName("kwin");
// ac.importGlobalShortcuts();
Q_FOREACH(auto bbb, ac.actions()) {
if (bbb->text() == "Kill Window") {
qDebug() << bbb;
}
}
But the ac.actions() list is empty.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Which of the two ways should be used?</p></pre>
<br />
<p>- Gregor</p>
<br />
<p>On February 27th, 2015, 1:18 a.m. UTC, Gregor Mi 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 Base Apps, Martin Gräßlin and John Tapsell.</div>
<div>By Gregor Mi.</div>
<p style="color: grey;"><i>Updated Feb. 27, 2015, 1:18 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
libksysguard
</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;">Current situation:
The "End Process..." button has a tooltip which says "To target a specific window to kill, press Ctrl+Alt+Esc at any time." The keyboard shortcut is hardcoded.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">RR:
Add a drop down menu to the "End Process..." button with one action:
i18n("Kill a specific window... (Global shortcut: %1)", killWindowShortcut)</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>processui/CMakeLists.txt <span style="color: grey">(7f87b85e0201e63d69070a71203bbb34851a79c6)</span></li>
<li>processui/ProcessWidgetUI.ui <span style="color: grey">(e50f55cf1813b00d49b1716023df487ffbd536e3)</span></li>
<li>processui/keyboardshortcututil.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>processui/keyboardshortcututil.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>processui/ksysguardprocesslist.cpp <span style="color: grey">(450ca600b8aed7ca611ec638610b6c524c96080c)</span></li>
<li>tests/CMakeLists.txt <span style="color: grey">(967b03fae1e460bfb22e1a07ef05cf7b49412546)</span></li>
<li>tests/keyboardshortcututiltest.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/keyboardshortcututiltest.cpp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/122249/diff/" style="margin-left: 3em;">View Diff</a></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>
<li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2015/01/28/16301e88-e21b-4358-9a63-a85dae5722bd__screenshot_default1.png">New End Process button with drop down arrow</a></li>
<li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2015/01/28/58df12c5-7350-4bb0-b602-c5716caa9836__screenshot_default2.png">Drop down shows Kill Window</a></li>
</ul>
</td>
</tr>
</table>
</div>
</body>
</html>