<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/100838/">http://git.reviewboard.kde.org/r/100838/</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 11th, 2011, 12:46 a.m., <b>David Edmundson</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/100838/diff/2/?file=11002#file11002line34" style="color: black; font-weight: bold; text-decoration: underline;">accountbutton.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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; "></pre></td>

  </tr>
 </tbody>




 
 



 <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">34</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">static</span> <span class="n">Tp</span><span class="o">::</span><span class="n">ConnectionPresenceType</span> <span class="n">accountPresenceTypes</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="n">Tp</span><span class="o">::</span><span class="n">ConnectionPresenceTypeAvailable</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;">This whole class is very weird.

Never write &#39;magic numbers&#39; i.e 3 or 7 just unexplained throughout the code.
Storing a C array of every possible enum value seems a wrong approach.

I would store the presence status() - the string (which you can use as an ID) as the data() field of the QAction.

onlineAction-&gt;setData(Presence::Available().status());

(you might even be able to just store the Tp::Presence object in there if it&#39;s a Q_METATYPE (try it and see). )

Then you can use this to create a proper presence from.

Also your presence lists have no profile support - this can be a future thing so I&#39;ll explain that later.</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;">Alright, I fixed this by setting the Tp::Presence as the data() of actions. This works surprisingly well. I&#39;ll update the diff soon.</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 11th, 2011, 12:46 a.m., <b>David Edmundson</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/100838/diff/2/?file=11002#file11002line58" style="color: black; font-weight: bold; text-decoration: underline;">accountbutton.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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; "></pre></td>

  </tr>
 </tbody>




 
 



 <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">58</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">if</span><span class="p">(</span><span class="n">iconPath</span><span class="p">.</span><span class="n">isEmpty</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;">This is done for you:

from the docs:
----
Tp::Account::iconName();
As a last resort, &quot;im-&quot; + protocolName() will be returned.
</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;">Fixed.</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 11th, 2011, 12:46 a.m., <b>David Edmundson</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/100838/diff/2/?file=11004#file11004line51" style="color: black; font-weight: bold; text-decoration: underline;">accountfiltermodel.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">bool AccountFilterModel::filterAcceptsRow(int source_row, const QModelIndex &amp;source_parent) const</pre></td>

  </tr>
 </tbody>




 
 



 <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">51</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span><span class="p">(</span><span class="n">m_filterByName</span> <span class="o">&amp;&amp;</span><span class="ew"> </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;">It seems a bit wrong to reimplement text filtering in something that inherits from QSortFilterProxyModel. For someone using this class there are two methods to set a text filter. One that works, one that doesn&#39;t. 

Your reasoning not to made sense
(default behaviour is recursive so will not show any contacts if the account name doesn&#39;t match the string)

but maybe we can get round that by calling
QSortFilterProxyMode::filterAcceptsRow(source_row, source_parent) here, where we know it&#39;s a contact. </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;">From my understanding of the docs, you can either use the regexp. filtering _or_ to reimplement the filterAcceptsRow by yourself. Since we&#39;re already using it for filtering the offline contacts, there&#39;s no point in setting the regexp for filtering (which IMHO calls filterAcceptsRow anyway). So it is all implemented in filterAcceptsRow.</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 11th, 2011, 12:46 a.m., <b>David Edmundson</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/100838/diff/2/?file=11020#file11020line79" style="color: black; font-weight: bold; text-decoration: underline;">contactdelegate.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void ContactDelegate::paint(QPainter * painter, const QStyleOptionViewItem &amp; option, const QModelIndex &amp; index) const</pre></td>

  </tr>
 </tbody>




 
 



 <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">79</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">statusIconRect</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="n">QPoint</span><span class="p">(</span><span class="n">optV4</span><span class="p">.</span><span class="n">rect</span><span class="p">.</span><span class="n">right</span><span class="p">()</span> <span class="o">-</span> <span class="mi">24</span><span class="p">,</span> <span class="n">optV4</span><span class="p">.</span><span class="n">rect</span><span class="p">.</span><span class="n">top</span><span class="p">()</span> <span class="o">+</span> <span class="mi">8</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;">hardcoded values here. At the end of this there should be very few fixed numbers.</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;">Yes, the delegate needs some work regarding the hardcoded values. Both positions and font metrics. Anyone up to it?</pre>
<br />




<p>- Martin</p>


<br />
<p>On March 11th, 2011, 12:27 a.m., Martin Klapetek wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.orgrb/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 Telepathy.</div>
<div>By Martin Klapetek.</div>


<p style="color: grey;"><i>Updated March 11, 2011, 12:27 a.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;">This is the work that begun in my clone repo and has matured enough now to be merged back to &#39;upstream&#39;, where the work should continue now.</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;">We did a lot of thourough testing on #kde-telepathy, also some people emailed their reports which all has been fixed.</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">(2c62ea10556cdba38d1bca0fe63603df97414336)</span></li>

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

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

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

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

 <li>accounts-model-item.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>accounts-model-item.cpp <span style="color: grey">(PRE-CREATION)</span></li>

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

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

 <li>avatars/astronaut.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/chess.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/coffee.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/dice.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/fish.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/lightning.jpg <span style="color: grey">(PRE-CREATION)</span></li>

 <li>avatars/soccerball.png <span style="color: grey">(PRE-CREATION)</span></li>

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

 <li>contact-model-item.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>contact-model-item.cpp <span style="color: grey">(PRE-CREATION)</span></li>

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

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

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

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

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

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

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

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

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

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

 <li>main-widget.h <span style="color: grey">(aed6f7c8336321bc8a6ffb3b9af6b1d493f85790)</span></li>

 <li>main-widget.cpp <span style="color: grey">(6146b62eec17b54be63b594200613931673ac5fe)</span></li>

 <li>main-widget.ui <span style="color: grey">(5b0d5aaaf3a4e2f49eb030b98b15fcae3a86170c)</span></li>

 <li>main.cpp <span style="color: grey">(bba0e4175e8853afe603f26ea4707f4974192d0f)</span></li>

 <li>ontologies/CMakeLists.txt <span style="color: grey">(3e0bbe8c634908f689dcd360409aeddcc6fc0d23)</span></li>

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

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

</ul>

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




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








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