D14442: Unify window and tab title

David Hallas noreply at phabricator.kde.org
Fri Aug 10 12:52:52 BST 2018


hallas added inline comments.

INLINE COMMENTS

> markg wrote in dolphinviewcontainer.cpp:428-446
> I'm guessing now, please have a look at the code to see if this is possible.
> 
> You're doing QUrl foo to figure stuff out about the url. It will (probably) work in most scenario's but there is an easier and more reliable way.
> When a view is opened or changed, it - somewhere in dolphin - exists as KFileItem. That object knows everything about the item (if it's a folder, a file, a link.. etc...).
> 
> Now, i don't see the KFileItem as class member of DolphinViewContainer so i'm guessing it comes in DolphinViewContainer via signals/slots (where i do see it) but isn't stored. If you want to go for a reliable title handling i'd go for saving the KFileItem that belong to the current view as a class member and build up the title based on that.
> 
> You should not need to stat for it again as that is already done when the item is opened. You just need to keep it stored in DolphinViewContainer to use it.
> 
> It will probably simplify this getCaption function quite a bit.

Hi Mark,

yes I would really like to avoid this QUrl magic :) The problem (as I see it), is that I do not always have a KFileItem with the correct contents (but please correct me if I am wrong here, since this code is pretty new to me), for example: When Dolphin starts up, it basically navigates to a QUrl either passed on the command line, or uses the home directory, so in this case we do not have a populated KFileItem. But when the user navigates using the view, we should have a KFileItem, because the view basically displays a list of KFileItems, so no problem here. But if the user types in a new url in the locator, i.e. if I  type in remote:// this I do not have a KFileItem for this URL and hence we cannot display the user friendly string for it.  This is why i tried doing a KIO::stat on the QUrl, but had limited success. It seems like some of the "pseudo" protocols like remote:// and smb:// doesn't really support stat in all cases, for example stat of remote: doesn't give me the "Network" pretty name :/

So is there a way where I consistently can populate KFileItem, mainly the UDS_NAME or UDS_PRETTY_NAME attributes, given a QUrl?

REPOSITORY
  R318 Dolphin

REVISION DETAIL
  https://phabricator.kde.org/D14442

To: hallas, #dolphin, ngraham, elvisangelaccio
Cc: markg, kfm-devel, spoorun, navarromorales, firef, andrebarros, emmanuelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180810/ea7adcff/attachment.htm>


More information about the kfm-devel mailing list