<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/119087/">https://git.reviewboard.kde.org/r/119087/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On July 28th, 2014, 9:43 p.m. CEST, <b>Kai Uwe Broulik</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/119087/diff/1/?file=286670#file286670line286" style="color: black; font-weight: bold; text-decoration: underline;">daemon/powerdevilcore.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void Core::loadProfile(bool force)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">286</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kt">int</span> <span class="n">percent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">286</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="kt">int</span> <span class="n">percent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">287</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">for</span> <span class="p">(</span><span class="n">QHash</span><span class="o"><</span><span class="n">QString</span><span class="p">,</span><span class="kt">int</span><span class="o">>::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constBegin</span><span class="p">();</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">287</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">for</span> <span class="p">(</span><span class="n">QHash</span><span class="o"><</span><span class="n">QString</span><span class="p">,</span><span class="kt">int</span><span class="o">>::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constBegin</span><span class="p">();</span></pre></td>
</tr>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">288</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">i</span> <span class="o">!=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constEnd</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">288</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">i</span> <span class="o">!=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constEnd</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">289</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">percent</span> <span class="o">+=</span> <span class="n">i</span><span class="p">.</span><span class="n">value</span><span class="p">();</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">289</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">percent</span> <span class="o">+=</span> <span class="n">i</span><span class="p">.</span><span class="n">value</span><span class="p">();</span></pre></td>
</tr>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">290</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="p">}</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">290</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <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;">If you're already at it, you could use the currentChargePercent() method here, no?</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;">Yep, good catch!</p></pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On July 28th, 2014, 9:43 p.m. CEST, <b>Kai Uwe Broulik</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/119087/diff/1/?file=286670#file286670line700" style="color: black; font-weight: bold; text-decoration: underline;">daemon/powerdevilcore.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</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">697</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">for</span> <span class="p">(</span><span class="n">QHash</span><span class="o"><</span><span class="n">QString</span><span class="p">,</span><span class="kt">int</span><span class="o">>::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constBegin</span><span class="p">();</span> <span class="n">i</span> <span class="o">!=</span> <span class="n">m_batteriesPercent</span><span class="p">.</span><span class="n">constEnd</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</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;">That's where "auto" comes in handy ;)</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;">Changed :)</p></pre>
<br />
<p>- Emmanuel</p>
<br />
<p>On July 29th, 2014, 9:49 p.m. CEST, Emmanuel Pescosta 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 Solid.</div>
<div>By Emmanuel Pescosta.</div>
<p style="color: grey;"><i>Updated July 29, 2014, 9:49 p.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=325707">325707</a>,
<a href="https://bugs.kde.org/show_bug.cgi?id=329537">329537</a>,
<a href="https://bugs.kde.org/show_bug.cgi?id=337414">337414</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
powerdevil
</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;">(kde:powerdevil version of review 118801)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">After resuming from suspend, all batteries are added<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
to powerdevil. When a battery, with charge lower or<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
equal than the critical charge percentage is added, the<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
critical battery timer will be started.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">In the current version the critical battery timeout can<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
only be interrupted by plugging in AC.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">But if the system has more than one battery, the global<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
charge percentage can be greater than the critical charge<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
percentage and so the system shouldn't suspend. To achive<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
this behaviour, we calculate the global charge percentage<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
whenever a new battery was added and if the critical<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
battery timer is running and the global charge is high<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
enough, we stop the timer.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Also we use the already calculated global charge percentage<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
for the battery charge percentage notification instead of<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
the charge of each individual battery.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With this patch, the user can not only interrupt the critical<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
timer by plugging in the AC but also by plugging in a new or<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
additional battery (if the battery has enough charge).</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;">Testing was done by Philipp Paris on his Thinkpad T440s (two<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
batteries).</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Two batteries above critical section:<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
Resume after suspend works without the 30 sec timeout. (as current version)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">One battery in critical section and the other above:<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
Resume after suspend works without the 30 sec timeout. (changed behaviour)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Both in critical section:<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
Resume after suspend without plugged in AC will go sleeping<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
in 30 sec. (as current version)</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>daemon/powerdevilcore.h <span style="color: grey">(dc2ba7e)</span></li>
<li>daemon/powerdevilcore.cpp <span style="color: grey">(64791d6)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/119087/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>