Replace QUrl::fromUserInput by lighter heuristic

Authored by broulik on May 12 2019, 5:53 PM.



I just found that QUrl::fromLocalFile() actually calls QFileInfo::exists on the URL which is not something you want to be doing constantly and especially not for remote locations.

Test Plan
  • No longer have plasmashell creeping to a halt when copying stuff from my phone (using sshfs mounted by kdeconnect, ie a "local" path but actually remote) to my PC

This code is really just trying to guess whether the descriptions of the job have any sort of path / filename in it, so replace it by a lighter guessing logic.

Diff Detail

R120 Plasma Workspace
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.May 12 2019, 5:53 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 12 2019, 5:53 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.May 12 2019, 5:53 PM
apol added a subscriber: apol.May 12 2019, 10:46 PM

How about using QUrl::toDisplayString(QUrl::PreferLocalFile)?

broulik updated this revision to Diff 57988.May 13 2019, 10:38 AM
broulik edited the summary of this revision. (Show Details)
apol accepted this revision.May 13 2019, 1:40 PM

Oh right, it's the other way around.


This revision is now accepted and ready to land.May 13 2019, 1:40 PM
This revision was automatically updated to reflect the committed changes.