[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request: Plasmate:migrate timeline.cpp from Q classes to K
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2011-07-22 8:39:21
Message-ID: 20110722083921.19457.98952 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102027/#review4957
-----------------------------------------------------------
savesystem/timeline.cpp
<http://git.reviewboard.kde.org/r/102027/#comment4345>
unless you are using the features from KAction or KMenu, there is no reason to \
make this change. KMenu provides titles and KAction is used for advanced shortcuts \
and system authentication integration.
this change doesn't hurt anything, but just so you don't invest too much of your \
time in making changes that don't result in actual benefits. :)
savesystem/timeline.cpp
<http://git.reviewboard.kde.org/r/102027/#comment4348>
was there a particular reason why this message box was removed?
savesystem/timeline.cpp
<http://git.reviewboard.kde.org/r/102027/#comment4347>
Yes/No buttons are not great usuability; it is usually preferred to have them \
describe the action.
e.g. in this case the Yes button could be set to say "Remove the selected \
section." and no should probably be "Cancel"
savesystem/timeline.cpp
<http://git.reviewboard.kde.org/r/102027/#comment4346>
while not your fault (the code was already there), there's a common mistake here: \
using dynamic_cast, which can return NULL, and then not checking the value before \
use. this should either be written as:
KAction *sender = static_cast<KAction *>(this->sender());
const QString branch = sender->text();
or:
KAction *sender = dynamic_cast<KAction *>(this->sender());
if (sender) {
const QString branch = sender->text();
....
}
also, in this case, using a qobject_cast rather than dynamic_cast is also usually \
prefered.
- Aaron J.
On July 21, 2011, 3:44 p.m., Giorgos Tsiapaliwkas wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102027/
> -----------------------------------------------------------
>
> (Updated July 21, 2011, 3:44 p.m.)
>
>
> Review request for Plasma.
>
>
> Summary
> -------
>
> hello,
>
> the patch migrates the timeline.cpp from the Q classes to K classes.
> Also adds a KMessageBox::information in the newsavepoint(),in order to inform the \
> user that he can't create a new save point without any changes being made
>
> Diffs
> -----
>
> savesystem/timeline.cpp 1d7bf03
>
> Diff: http://git.reviewboard.kde.org/r/102027/diff
>
>
> Testing
> -------
>
> no issues.
>
>
> Thanks,
>
> Giorgos
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/102027/">http://git.reviewboard.kde.org/r/102027/</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="http://git.reviewboard.kde.org/r/102027/diff/1/?file=27777#file27777line253" \
style="color: black; font-weight: bold; text-decoration: \
underline;">savesystem/timeline.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 \
TimeLine::showContextMenu(QTableWidgetItem *item)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">249</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">Q</span>Action</span> <span class="o">*</span><span \
class="n">createBranch</span> <span class="o">=</span> <span class="n"><span \
class="hl">menu</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">add</span>Action</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Create new \
Section"</span><span class="p">));</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">252</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">K</span>Action</span> <span class="o">*</span><span \
class="n">createBranch</span> <span class="o">=</span> <span class="k"><span \
class="hl">new</span></span><span class="hl"> </span><span class="n"><span \
class="hl">K</span>Action</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Create new \
Section"</span><span class="p">)<span class="hl">,</span></span><span \
class="hl"> </span><span class="k"><span class="hl">this</span></span><span \
class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">250</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">Q</span>Menu</span> <span class="o">*</span><span \
class="n">switchBranchMenu</span> <span class="o">=</span> <span class="n"><span \
class="hl">menu</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">add</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Switch to \
Section"</span><span class="p">));</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">253</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">K</span>Menu</span> <span class="o">*</span><span \
class="n">switchBranchMenu</span> <span class="o">=</span> <span class="k"><span \
class="hl">new</span></span><span class="hl"> </span><span class="n"><span \
class="hl">K</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Switch to \
Section"</span><span class="p">)<span class="hl">,</span></span><span \
class="hl"> </span><span class="k"><span class="hl">this</span></span><span \
class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">251</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">Q</span>Menu</span> <span class="o">*</span><span \
class="n">mergeBranchMenu</span> <span class="o">=</span> <span class="n"><span \
class="hl">menu</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">add</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Combine into \
Section"</span><span class="p">));</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">254</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">K</span>Menu</span> <span class="o">*</span><span \
class="n">mergeBranchMenu</span> <span class="o">=</span> <span class="k"><span \
class="hl">new</span></span><span class="hl"> </span><span class="n"><span \
class="hl">K</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Combine into \
Section"</span><span class="p">)<span class="hl">,</span></span><span \
class="hl"> </span><span class="k"><span class="hl">this</span></span><span \
class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">252</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">Q</span>Action</span> <span class="o">*</span><span \
class="n">renameBranch</span> <span class="o">=</span> <span class="n"><span \
class="hl">menu</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">add</span>Action</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Rename current \
Section"</span><span class="p">));</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">255</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">K</span>Action</span> <span class="o">*</span><span \
class="n">renameBranch</span> <span class="o">=</span> <span class="k"><span \
class="hl">new</span></span><span class="hl"> </span><span class="n"><span \
class="hl">K</span>Action</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Rename current \
Section"</span><span class="p">)<span class="hl">,</span></span><span \
class="hl"> </span><span class="k"><span class="hl">this</span></span><span \
class="p">);</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">253</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">menu</span><span class="p">.</span><span class="n">addSeparator</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">256</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">menu</span><span \
class="p">.</span><span class="n">addSeparator</span><span \
class="p">();</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">254</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">Q</span>Menu</span> <span class="o">*</span><span \
class="n">deleteBranchMenu</span> <span class="o">=</span> <span class="n"><span \
class="hl">menu</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">add</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Delete \
Section"</span><span class="p">));</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">257</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">K</span>Menu</span> <span class="o">*</span><span \
class="n">deleteBranchMenu</span> <span class="o">=</span> <span class="k"><span \
class="hl">new</span></span><span class="hl"> </span><span class="n"><span \
class="hl">K</span>Menu</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"Delete \
Section"</span><span class="p">)<span class="hl">,</span></span><span \
class="k"><span class="hl">this</span></span><span class="p">);</span></pre></td> \
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">unless you \
are using the features from KAction or KMenu, there is no reason to make this change. \
KMenu provides titles and KAction is used for advanced shortcuts and system \
authentication integration.
this change doesn't hurt anything, but just so you don't invest too much of \
your time in making changes that don't result in actual benefits. :)</pre> </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="http://git.reviewboard.kde.org/r/102027/diff/1/?file=27777#file27777line355" \
style="color: black; font-weight: bold; text-decoration: \
underline;">savesystem/timeline.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 \
TimeLine::newSavePoint()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">349</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setWindowTitle</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span \
class="s">"Information"</span><span class="p">));</span></pre></td> <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> \
</tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">350</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setText</span><span class="p">(</span><span class="n">i18n</span><span \
class="p">(</span><span class="s">"You are restoring the selected \
SavePoint."</span><span class="p">));</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">351</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setInformativeText</span><span class="p">(</span><span \
class="n">i18n</span><span class="p">(</span><span class="s">"With this \
operation, all the SavePoints and Sections created starting from it, will be \
deleted.</span><span class="se">\n</span><span class="s">Continue \
anyway?"</span><span class="p">));</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">352</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setStandardButtons</span><span class="p">(</span><span \
class="n">QMessageBox</span><span class="o">::</span><span class="n">Ok</span> <span \
class="o">|</span> <span class="n">QMessageBox</span><span class="o">::</span><span \
class="n">Discard</span><span class="p">);</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">353</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setDefaultButton</span><span class="p">(</span><span \
class="n">QMessageBox</span><span class="o">::</span><span \
class="n">Discard</span><span class="p">);</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">354</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> \
<span class="p">(</span><span class="n">warningMB</span><span \
class="o">-></span><span class="n">exec</span><span class="p">()</span> <span \
class="o">==</span> <span class="n">QMessageBox</span><span class="o">::</span><span \
class="n">Discard</span><span class="p">)</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">355</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">return</span><span class="p">;</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">356</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> \
</tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">357</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">delete</span> <span class="n">warningMB</span><span \
class="p">;</span></pre></td> <th bgcolor="#ebb1ba" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th> \
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">was there a \
particular reason why this message box was removed?</pre> </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="http://git.reviewboard.kde.org/r/102027/diff/1/?file=27777#file27777line482" \
style="color: black; font-weight: bold; text-decoration: \
underline;">savesystem/timeline.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 \
TimeLine::mergeBranch()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">476</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">warningMB</span><span class="o">-></span><span \
class="n">setIcon</span><span class="p">(</span><span \
class="n">QMessageBox</span><span class="o">::</span><span \
class="n">Warning</span><span class="p">);</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">449</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="kt">int</span> <span class="n">code</span> <span class="o">=</span> <span \
class="n">KMessageBox</span><span class="o">::</span><span \
class="n">warningYesNo</span><span class="p">(</span><span class="k">this</span><span \
class="p">,</span><span class="n">dialog</span><span class="p">);</span></pre></td> \
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes/No \
buttons are not great usuability; it is usually preferred to have them describe the \
action.
e.g. in this case the Yes button could be set to say "Remove the selected \
section." and no should probably be "Cancel"</pre> </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="http://git.reviewboard.kde.org/r/102027/diff/1/?file=27777#file27777line493" \
style="color: black; font-weight: bold; text-decoration: \
underline;">savesystem/timeline.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 \
TimeLine::mergeBranch()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">487</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">delete</span> <span class="n">warningMB</span><span \
class="p">;</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">454</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">KAction</span> <span \
class="o">*</span><span class="n">sender</span> <span class="o">=</span> <span \
class="k">dynamic_cast</span><span class="o"><</span><span \
class="n">KAction</span><span class="o">*></span><span class="p">(</span><span \
class="k">this</span><span class="o">-></span><span class="n">sender</span><span \
class="p">());</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">488</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> \
</tr>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">489</font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QAction</span> <span class="o">*</span><span class="n">sender</span> <span \
class="o">=</span> <span class="k">dynamic_cast</span><span \
class="o"><</span><span class="n">QAction</span><span class="o">*></span><span \
class="p">(</span><span class="k">this</span><span class="o">-></span><span \
class="n">sender</span><span class="p">());</span></pre></td> <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">490</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QString</span> <span class="n">branch</span> <span class="o">=</span> <span \
class="n">sender</span><span class="o">-></span><span class="n">text</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">455</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">QString</span> <span \
class="n">branch</span> <span class="o">=</span> <span class="n">sender</span><span \
class="o">-></span><span class="n">text</span><span \
class="p">();</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">while not \
your fault (the code was already there), there's a common mistake here: using \
dynamic_cast, which can return NULL, and then not checking the value before use. this \
should either be written as:
KAction *sender = static_cast<KAction *>(this->sender());
const QString branch = sender->text();
or:
KAction *sender = dynamic_cast<KAction *>(this->sender());
if (sender) {
const QString branch = sender->text();
....
}
also, in this case, using a qobject_cast rather than dynamic_cast is also usually \
prefered.</pre> </div>
<br />
<p>- Aaron J.</p>
<br />
<p>On July 21st, 2011, 3:44 p.m., Giorgos Tsiapaliwkas wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Plasma.</div>
<div>By Giorgos Tsiapaliwkas.</div>
<p style="color: grey;"><i>Updated July 21, 2011, 3:44 p.m.</i></p>
<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;">hello,
the patch migrates the timeline.cpp from the Q classes to K classes.
Also adds a KMessageBox::information in the newsavepoint(),in order to inform the \
user that he can't create a new save point without any changes being made</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;">no issues.</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>savesystem/timeline.cpp <span style="color: grey">(1d7bf03)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/102027/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic