<br><br><div class="gmail_quote">2010/6/8 Sebastian Trüg <span dir="ltr"><<a href="mailto:trueg@kde.org">trueg@kde.org</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Just use KFileItem::localPath(). If that is empty then the result is not<br>
a local file.<br>
<br>
And of course KDirModel provides KFileItems. It is based on them. Just<br>
use KDirModel::itemForIndex and always make sure you properly convert<br>
indexes in case you are using filter models.<br></blockquote><div><br>Thank you Sebastian, my concern was about url() returning the query string instead of the file's url.<br>I fixed making use of mostLocalUrl(); <br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Cheers,<br>
Sebastian<br>
<div class="im"><br>
On 06/08/2010 11:04 AM, Alessandro Diaferia wrote:<br>
><br>
><br>
> 2010/6/8 Alessandro Sivieri <<a href="mailto:alessandro.sivieri@gmail.com">alessandro.sivieri@gmail.com</a><br>
</div>> <mailto:<a href="mailto:alessandro.sivieri@gmail.com">alessandro.sivieri@gmail.com</a>>><br>
<div class="im">><br>
> 2010/6/7 Alessandro Diaferia <<a href="mailto:alediaferia@gmail.com">alediaferia@gmail.com</a><br>
</div>> <mailto:<a href="mailto:alediaferia@gmail.com">alediaferia@gmail.com</a>>><br>
<div><div></div><div class="h5">><br>
> As you may have understood i'm using Nepomuk to show media files<br>
> to the user.<br>
> One thing i noticed is that when using the KDirModel (and so the<br>
> KDirLister) to list the results of a query<br>
> it seems that each QModelIndex doesn't have a valid<br>
> KDirModel::FileItemRole and therefore no important pieces of<br>
> information<br>
> like the url of the file (AFAIK KDirModel is KFileItem-centric).<br>
> I make use of such role in order to get previews of the files.<br>
><br>
><br>
> Well, both in Sembrowser and in Smartsave I am using KDirOperator,<br>
> and it works correctly for me, I mean files are shown with correct<br>
> name and icon, and they are correctly opened once passed to KRun; I<br>
> use Nepomuk::Query::toSearchUrl, to obtain the URL to set the URL to<br>
> KDirOperator.<br>
> I think I also used KDirModel directly some time ago, but then I<br>
> decided that the operator was better.<br>
> Can you show us some code?<br>
><br>
><br>
> Ok, giving some context: the mediabrowser applet we use in PMC takes<br>
> advantage of an AbstractItemView written from scratch (aka not<br>
> inheriting from QAbstractItemView).<br>
> This means that the QAbstractItemModel passed is handled internally. If<br>
> the set model makes use of KDirModel::FileItemRole additional<br>
> capabilities are enabled:<br>
> this means that not only the name and the icon is drawn but now, through<br>
> the given KFileItem, the view has access to the URL of the file and can,<br>
> for example, retrieve previews.<br>
> Unfortunately I cannot make use of KDirOperator as long as PMC has this<br>
> particular structure. My concern now is: is there a way to get the file<br>
> url for the particular nepomuk search result?<br>
> I might go for Nepomuk::Resource::property(Vocabulary::NIE::url()) i<br>
> don't know how to build the resource from the given QModelIndex.<br>
><br>
> Hints appreciated :p<br>
><br>
><br>
><br>
> --<br>
> Sivieri Alessandro<br>
</div></div>> <a href="mailto:alessandro.sivieri@gmail.com">alessandro.sivieri@gmail.com</a> <mailto:<a href="mailto:alessandro.sivieri@gmail.com">alessandro.sivieri@gmail.com</a>><br>
<div class="im">> <a href="http://www.chimera-bellerofonte.eu/" target="_blank">http://www.chimera-bellerofonte.eu/</a><br>
> <a href="http://www.poul.org/" target="_blank">http://www.poul.org/</a><br>
><br>
><br>
> Thank you.<br>
><br>
> P.S.: forgot to mention that I'm using Nepomuk::Query::toSearchUrl too,<br>
> passing it to the KDirLister->openUrl() method.<br>
><br>
> --<br>
> Alessandro Diaferia<br>
> KDE Developer<br>
> KDE e.V. member<br>
><br>
><br>
><br>
</div>> _______________________________________________<br>
> Nepomuk mailing list<br>
> <a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
> <a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
_______________________________________________<br>
Nepomuk mailing list<br>
<a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
</blockquote></div><br>Thanks again and sorry for the unuseful post.<br><br>Cheers.<br clear="all"><br>-- <br>Alessandro Diaferia<br>KDE Developer<br>KDE e.V. member<br><br>