<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/126650/">https://git.reviewboard.kde.org/r/126650/</a>
     </td>
    </tr>
   </table>
   <br />











<div>



<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/126650/diff/2/?file=441687#file441687line136" style="color: black; font-weight: bold; text-decoration: underline;">src/inhibition.h</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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">136</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">Private</span> <span class="o">*</span><span class="k">const</span> <span class="n">d</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">QScopedPointer?</p></pre>
 </div>
</div>
<br />

<div>



<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/126650/diff/2/?file=441688#file441688line96" style="color: black; font-weight: bold; text-decoration: underline;">src/inhibition.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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">96</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">qWarning</span><span class="p">()</span> <span class="o"><<</span> <span class="s">"Cannot connect to D-BUS session bus, inhibitions won't work!"</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">please use categorized logging</p></pre>
 </div>
</div>
<br />

<div>



<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/126650/diff/2/?file=441688#file441688line101" style="color: black; font-weight: bold; text-decoration: underline;">src/inhibition.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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">101</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">QDBusReply</span><span class="o"><</span><span class="kt">bool</span><span class="o">></span> <span class="n">solidReply</span> <span class="o">=</span> <span class="n">sessionBus</span><span class="p">.</span><span class="n">interface</span><span class="p">()</span><span class="o">-></span><span class="n">isServiceRegistered</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span class="s">"org.kde.Solid.PowerManagement.PolicyAgent"</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">I'm sure you are aware of it: this is blocking</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">A non blocking variant is:</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">QDBusMessage</span> <span style="color: #008000; font-weight: bold">message</span> <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">QDBusMessage</span><span style="color: #666666">:</span><span style="color: #AA22FF">:createMethodCall</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">QStringLiteral</span><span style="color: #666666">(</span><span style="color: #BA2121">"org.freedesktop.DBus"</span><span style="color: #666666">),</span>
                                                      <span style="color: #008000; font-weight: bold">QStringLiteral</span><span style="color: #666666">(</span><span style="color: #BA2121">"/"</span><span style="color: #666666">),</span>
                                                      <span style="color: #008000; font-weight: bold">QStringLiteral</span><span style="color: #666666">(</span><span style="color: #BA2121">"org.freedesktop.DBus"</span><span style="color: #666666">),</span>
                                                      <span style="color: #008000; font-weight: bold">QStringLiteral</span><span style="color: #666666">(</span><span style="color: #BA2121">"ListNames"</span><span style="color: #666666">));</span>
<span style="color: #008000; font-weight: bold">QDBusPendingReply</span><span style="color: #666666"><</span><span style="color: #008000; font-weight: bold">QStringList</span><span style="color: #666666">></span> <span style="color: #008000; font-weight: bold">async</span> <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">QDBusConnection</span><span style="color: #666666">:</span><span style="color: #AA22FF">:sessionBus</span><span style="color: #666666">()</span><span style="color: #0000FF; font-weight: bold">.asyncCall</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">message</span><span style="color: #666666">);</span>
<span style="color: #008000; font-weight: bold">QDBusPendingCallWatcher</span> <span style="color: #666666">*</span><span style="color: #008000; font-weight: bold">callWatcher</span> <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> <span style="color: #008000; font-weight: bold">QDBusPendingCallWatcher</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">async</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">this</span><span style="color: #666666">);</span>
<span style="color: #008000; font-weight: bold">connect</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">callWatcher</span><span style="color: #666666">,</span> <span style="color: #666666">&</span><span style="color: #008000; font-weight: bold">QDBusPendingCallWatcher</span><span style="color: #666666">:</span><span style="color: #AA22FF">:finished</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">this</span><span style="color: #666666">,</span>
    <span style="color: #BC7A00">[</span>this<span style="color: #BC7A00">]</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">QDBusPendingCallWatcher</span> <span style="color: #666666">*</span><span style="color: #008000; font-weight: bold">self</span><span style="color: #666666">)</span> {
        QDBusPendingReply<span style="color: #666666"><</span>QStringList<span style="color: #666666">></span> reply <span style="color: #666666">=</span> <span style="color: #666666">*</span>self;
        self<span style="color: #666666">-></span>deleteLater();
        if (<span style="color: #666666">!</span>reply<span style="color: #666666">.</span>isValid()) <span style="border: 1px solid #FF0000">{</span>
            return;
        }
        <span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">reply</span><span style="color: #0000FF; font-weight: bold">.value</span><span style="color: #666666">()</span><span style="color: #0000FF; font-weight: bold">.contains</span><span style="color: #666666">(</span><span style="color: #008000; font-weight: bold">QStringLiteral</span><span style="color: #666666">(</span><span style="color: #BA2121">"ord.kde.Solid..."</span><span style="color: #666666">)))</span> {
            <span style="color: #666666">//</span> Whatever needs to be done
        }
    <span style="border: 1px solid #FF0000">}</span>
<span style="color: #666666">);</span>
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">What could be considered is also adding a service watcher to check whether it becomes available later on. But I'd say that's outside the scope of this class.</p></pre>
 </div>
</div>
<br />



<p>- Martin Gräßlin</p>


<br />
<p>On January 26th, 2016, 7:13 p.m. CET, Martin Klapetek 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 Kai Uwe Broulik.</div>
<div>By Martin Klapetek.</div>


<p style="color: grey;"><i>Updated Jan. 26, 2016, 7:13 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kidletime
</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;">This is a work-in-progress, but I'm putting it up for a feedback now
as most people are gone for the day when I wake up :)

---

After some discussion in https://git.reviewboard.kde.org/r/126627/
and then with Kai Uwe Broulik, I've added a PM/ScreenSaver inhibition
capabilities to KIdleItem.

We decided with Kai that we want simple stuff, encapsulated away for
the client as much as possible. So the Inhibition class has a static
"constructors" which make the usage as easy as follows:

KIdleTime::Inhibition::createInhibition(KIdleTime::Inhibition::InhibitScreen, QStringLiteral("Playing Movie"), mainWindow);

That call would return an Inhibition* object which has methods to set
the inhibition type and reason and to activate/deactivate the inhibition.
The static method above would activate() on the Inhibition right away;
this allows a simple fire-and-forget usage. The Inhibition object can
be parented to any other object; the inhibition will be deactivated when
the Inhibition object is destroyed. The user can also keep the pointer
around and call deactivate() whenever actually needed.

The inhibition itself first looks for Solid and if present, it uses the
Solid interface. If not present, it goes for the FDO interfaces.

It comes with an autotest.</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;">Everything works as expected, plus there's an autotest.</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>CMakeLists.txt <span style="color: grey">(ed5dc0c)</span></li>

 <li>autotests/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>

 <li>autotests/fakePMServer.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>autotests/fakePMServer.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>autotests/inhibition_test.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>autotests/qtest_dbus.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/CMakeLists.txt <span style="color: grey">(23e5e29)</span></li>

 <li>src/inhibition.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/inhibition.cpp <span style="color: grey">(PRE-CREATION)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/126650/diff/" style="margin-left: 3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>