[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Review Request 110065: fix notifcation plasmoid about some undefined data when retreive data fro
From:       "Marco Martin" <notmart () gmail ! com>
Date:       2013-04-20 10:18:40
Message-ID: 20130420101840.15092.40241 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On April 18, 2013, 8:17 a.m., Aaron J. Seigo wrote:
> > plasma/generic/applets/notifications/contents/ui/JobDelegate.qml, lines 33-39
> > <http://git.reviewboard.kde.org/r/110065/diff/2/?file=139268#file139268line33>
> > 
> > this is likely to break property binding, so if infoMessage changes (for \
> > instance) the string property won't also update. 
> > while it's more verbose in the QML, each of the properties should simply use the \
> > full form directly so that property binding can happen, e.g. 
> > label0: jobsSource.data["labelName0"] ? jobsSource.data["labelName0"];
> 
> Xuetian Weng wrote:
> well so there is a code style problem.. any advice to make this looks better \
> instead copy-paste such long expression here and there? 
> Because when loading, data[modelData] can be undefined, and data[modelData][name] \
> can be also undefined so both of them have to be checked to avoid warning in qml. 
> BTW, the update is working here... I know it looks like it will break property \
> binding, but seems qml is cleverer.

hmm, even if most of the code is in a function, in the right hand of the expression i \
think the binded property should be in the first level


- Marco


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110065/#review31233
-----------------------------------------------------------


On April 17, 2013, 4:57 p.m., Xuetian Weng wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/110065/
> -----------------------------------------------------------
> 
> (Updated April 17, 2013, 4:57 p.m.)
> 
> 
> Review request for Plasma and Marco Martin.
> 
> 
> Description
> -------
> 
> Current notifications will give quite a lot warning, since \
> jobsSource.data[modelData] might be undefined in the first place. 
> And this can also cause label1NameText to be shown as "undefinded: " for a job, \
> this can be reproduced when you do the job of copy a large folder to sftp, the \
> label1 will be undefined when doing the folder creation. 
> 
> Diffs
> -----
> 
> plasma/generic/applets/notifications/contents/ui/JobDelegate.qml cf60946 
> 
> Diff: http://git.reviewboard.kde.org/r/110065/diff/
> 
> 
> Testing
> -------
> 
> all related warning is now suppressed, and undefined will not be shown in the same \
> case. 
> 
> Thanks,
> 
> Xuetian Weng
> 
> 


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










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On April 18th, 2013, 8:17 a.m. UTC, <b>Aaron J. \
Seigo</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="http://git.reviewboard.kde.org/r/110065/diff/2/?file=139268#file139268line33" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/generic/applets/notifications/contents/ui/JobDelegate.qml</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">33</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="kd">function</span> <span class="nx">getData</span><span \
class="p">(</span><span class="nx">name</span><span class="p">,</span> <span \
class="nx">defaultValue</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  </tr>

  <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">34</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">return</span> <span class="nx">jobsSource</span><span \
class="p">.</span><span class="nx">data</span><span class="p">[</span><span \
class="nx">modelData</span><span class="p">]</span> <span \
class="o">?</span></pre></td>  </tr>

  <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">35</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="p">(</span><span class="nx">jobsSource</span><span \
class="p">.</span><span class="nx">data</span><span class="p">[</span><span \
class="nx">modelData</span><span class="p">][</span><span class="nx">name</span><span \
class="p">]</span> <span class="o">?</span></pre></td>  </tr>

  <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">36</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="nx">jobsSource</span><span class="p">.</span><span \
class="nx">data</span><span class="p">[</span><span class="nx">modelData</span><span \
class="p">][</span><span class="nx">name</span><span class="p">]</span></pre></td>  \
</tr>

  <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">37</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="o">:</span> <span class="nx">defaultValue</span><span \
class="p">)</span></pre></td>  </tr>

  <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">38</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="o">:</span> <span class="nx">defaultValue</span><span \
class="p">;</span></pre></td>  </tr>

  <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">39</font></th>  <td bgcolor="#c5ffc4" \
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;">this is likely to break \
property binding, so if infoMessage changes (for instance) the string property \
won&#39;t also update.

while it&#39;s more verbose in the QML, each of the properties should simply use the \
full form directly so that property binding can happen, e.g.

label0: jobsSource.data[&quot;labelName0&quot;] ? \
jobsSource.data[&quot;labelName0&quot;];</pre>  </blockquote>



 <p>On April 18th, 2013, 3:29 p.m. UTC, <b>Xuetian Weng</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">well so there is a code \
style problem.. any advice to make this looks better instead copy-paste such long \
expression here and there?

Because when loading, data[modelData] can be undefined, and data[modelData][name] can \
be also undefined so both of them have to be checked to avoid warning in qml.

BTW, the update is working here... I know it looks like it will break property \
binding, but seems qml is cleverer.</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;">hmm, even \
if most of the code is in a function, in the right hand of the expression i think the \
binded property should be in the first level</pre> <br />




<p>- Marco</p>


<br />
<p>On April 17th, 2013, 4:57 p.m. UTC, Xuetian Weng wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Plasma and Marco Martin.</div>
<div>By Xuetian Weng.</div>


<p style="color: grey;"><i>Updated April 17, 2013, 4:57 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;">Current notifications will give quite a lot warning, since \
jobsSource.data[modelData] might be undefined in the first place.

And this can also cause label1NameText to be shown as &quot;undefinded: &quot; for a \
job, this can be reproduced when you do the job of copy a large folder to sftp, the \
label1 will be undefined when doing the folder creation.</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;">all related warning is now suppressed, and undefined will not be shown \
in the same case.</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>plasma/generic/applets/notifications/contents/ui/JobDelegate.qml <span \
style="color: grey">(cf60946)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/110065/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