D8920: Fixes url navigation with relative links on KUrlNavigator

Emirald Mateli noreply at phabricator.kde.org
Mon Nov 20 18:06:27 UTC 2017


emateli created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.

REVISION SUMMARY
  This patch aims to address an issue with KUrlNavigator using relative paths. Upon attempting to navigate using relative paths, due to the way `QUrl::fromUserInput` works, a relative symbol such as 'Documents' will be converted to `http://Documents` or `.config` will be converted to an empty QUrl. This patch uses the `AssumeLocalFile` flag along with the home directory as the relative link (which is where the suggestions are taken from), alongside that it adds two test cases to account for this behaviour. The suggestions would perhaps be more intuitive if they were from the current directory but I assume that's an issue to be discussed in another patch.
  
  All tests currently pass, but someone with more knowledge of this should check if this patch potentially breaks something with `KUriFilter::filterUri`.

TEST PLAN
  Open an application where KUrlNavigator is used. Eg.: Dolphin, Gwenview
  
  - Select the KUrlNavigator and clear the text
  - Type something with dot or a character that would otherwise show suggestions
  - Highlight one of the suggestions and activate it via enter
  
  Expected: The selected directory should be browsed
  Actual: Dolphin will show invalid protocol error for dotfiles or otherwise launch browser. Gwenview fails silently.

REPOSITORY
  R241 KIO

BRANCH
  relative-files

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

AFFECTED FILES
  autotests/kurlnavigatortest.cpp
  src/filewidgets/kurlnavigator.cpp
  src/widgets/kurifilter.cpp

To: emateli
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171120/6f0edd2e/attachment.html>


More information about the Kde-frameworks-devel mailing list