<table><tr><td style="">wbauer created this revision.<br />wbauer added a reviewer: Amarok.<br />wbauer added a project: Amarok.<br />Herald removed a project: Amarok.<br />Herald added a subscriber: amarok-devel.<br />wbauer requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D24043">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><tt style="background: #ebebeb; font-size: 13px;">QUrl::QUrl()</tt> expects a full Url including the scheme (unlike <tt style="background: #ebebeb; font-size: 13px;">KUrl::KUrl()</tt> that supports local paths too).<br />
But for local files, <tt style="background: #ebebeb; font-size: 13px;">urlString</tt> contains the local path without a scheme ("file://").</p>
<p>The problem here is that <tt style="background: #ebebeb; font-size: 13px;">QUrl</tt> cannot detect that the Url is actually pointing to a local file if the scheme is missing (according to the Qt docs, a URL is a local file path if the scheme is "file"), so <tt style="background: #ebebeb; font-size: 13px;">QUrl::isLocalFile()</tt> was always <tt style="background: #ebebeb; font-size: 13px;">false</tt> and the "Open in filemanager" button never got enabled.</p>
<p>So use <tt style="background: #ebebeb; font-size: 13px;">QUrl::fromUserInput()</tt> instead to construct the <tt style="background: #ebebeb; font-size: 13px;">QUrl</tt>, which also supports local paths.</p>
<p>Also, to avoid showing the "file://" scheme in the "Location" text field now, pass <tt style="background: #ebebeb; font-size: 13px;">QUrl::PreferLocalFile</tt> to <tt style="background: #ebebeb; font-size: 13px;">QUrl::toDisplayString()</tt> as suggested in the <a href="https://api.kde.org/frameworks/kdelibs4support/html/classKUrl.html#a4f0c69c2e82bd69a9dfc9c84439b29ea" class="remarkup-link" target="_blank" rel="noreferrer">KUrl::pathOrUrl() docs</a>.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Opened the tag dialog ("Edit track details") for a file in the local collection.<br />
The button is enabled now, clicking it successfully opens the containing folder in dolphin.<br />
The "Location" text field still shows "/path/to/folder/file" (without "file://").</p>
<p>Added a remote podcast to the playlist, and opened the tag dialog.<br />
The button stays disabled, the text field still correctly shows the Url including the scheme ("https://...") in my case).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R181 Amarok</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24043">https://phabricator.kde.org/D24043</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/dialogs/TagDialog.cpp</div></div></div><br /><div><strong>To: </strong>wbauer, Amarok<br /><strong>Cc: </strong>amarok-devel<br /></div>