D14442: Unify window and tab title
Mark Gaiser
noreply at phabricator.kde.org
Thu Aug 9 15:51:37 BST 2018
markg added inline comments.
INLINE COMMENTS
> dolphinviewcontainer.cpp:428-446
> + if (!url().isLocalFile()) {
> + QUrl adjustedUrl = url().adjusted(QUrl::StripTrailingSlash);
> + QString caption;
> + if (!adjustedUrl.fileName().isEmpty()) {
> + caption = adjustedUrl.fileName();
> + } else if (!adjustedUrl.path().isEmpty() && adjustedUrl.path() != "/") {
> + caption = adjustedUrl.path();
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.
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/20180809/3fe2df45/attachment.htm>
More information about the kfm-devel
mailing list