<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="https://git.reviewboard.kde.org/r/114761/">https://git.reviewboard.kde.org/r/114761/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On January 1st, 2014, 8:10 a.m. UTC, <b>Dennis Nienhüser</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/114761/diff/1/?file=228507#file228507line324" style="color: black; font-weight: bold; text-decoration: underline;">src/lib/marble/GeoDataTreeModel.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; ">QVariant GeoDataTreeModel::data( const QModelIndex &index, int role ) 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">323</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">return</span> <span class="n">folder</span><span class="o">-></span><span class="n">style</span><span class="p">()</span><span class="o">-></span><span class="n">listStyle</span><span class="p">().</span><span class="n">first</span><span class="p">().</span><span class="n">icon</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;">Shouldn't this iterate over all styles and select the one which has a suitable state?
</pre>
</blockquote>
<p>On January 1st, 2014, 10:48 a.m. UTC, <b>Levente Kurusa</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;">Yes, it should, but we can't find out the requested item's state yet...</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;">We don't know the item state in the model, but we know that it is a folder and not a network link. Therefore we can limit the choice of suitable templates to "open" and "closed" and ignore the fetching ones (network link only). In code:
@@ -310,11 +311,20 @@ QVariant GeoDataTreeModel::data( const QModelIndex &index, int role ) const
else if ( role == Qt::DecorationRole
&& index.column() == 0 ) {
if ( object->nodeType() == GeoDataTypes::GeoDataPlacemarkType
- || object->nodeType() == GeoDataTypes::GeoDataFolderType
|| object->nodeType() == GeoDataTypes::GeoDataDocumentType
|| object->nodeType() == GeoDataTypes::GeoDataTourType ) {
GeoDataFeature *feature = static_cast<GeoDataFeature*>( object );
return QVariant(feature->style()->iconStyle().icon());
+ } else if ( object->nodeType() == GeoDataTypes::GeoDataFolderType ) {
+ GeoDataFolder *folder = static_cast<GeoDataFolder*>( object );
+ // @TODO: Subclass QTreeView, and overwrite icon rendering and pass a specific @role,
+ // so as to be able to determine the state of the folder.
+ foreach( GeoDataItemIcon* icon, folder->style()->listStyle().itemIconList() ) {
+ if ( icon->state() == GeoDataItemIcon::Open ) {
+ return icon->icon();
+ }
+ }
+ return folder->style()->iconStyle().icon();
}
} else if ( role == Qt::ToolTipRole
&& index.column() == 0 ) {</pre>
<br />
<p>- Dennis</p>
<br />
<p>On December 31st, 2013, 3:35 p.m. UTC, Levente Kurusa wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://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 Marble, Dennis Nienhüser and Torsten Rahn.</div>
<div>By Levente Kurusa.</div>
<p style="color: grey;"><i>Updated Dec. 31, 2013, 3:35 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
marble
</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;">GCI task: http://www.google-melange.com/gci/task/view/google/gci2013/6070288135487488</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>src/lib/marble/GeoDataTreeModel.cpp <span style="color: grey">(9f9cc0a)</span></li>
<li>src/lib/marble/geodata/data/GeoDataItemIcon.cpp <span style="color: grey">(d731a11)</span></li>
<li>src/lib/marble/geodata/data/GeoDataStyle.cpp <span style="color: grey">(8771787)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/114761/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>