[PluginLoader] Replace one usage of QRegExp with QString::startsWith()
AbandonedPublic

Authored by ahmadsamir on Apr 19 2020, 12:45 PM.

Details

Reviewers
apol
broulik
Group Reviewers
Plasma
Summary

AFAICS, from grep'ing for "DropUrlPatterns" in /usr/share/{kservices5,plasma/plasmoids/}
"urlPatterns" is either run:/ or trash:/, hence startsWith() should suffice.

Test Plan

make && ctest

Diff Detail

Repository
R242 Plasma Framework (Library)
Branch
l-QRE (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25460
Build 25478: arc lint + arc unit
ahmadsamir created this revision.Apr 19 2020, 12:45 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 19 2020, 12:45 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
ahmadsamir requested review of this revision.Apr 19 2020, 12:45 PM
apol added a comment.Apr 19 2020, 3:19 PM

I wonder, while this will work with all our uses of DropUrlPatterns, this would have been able to work with something like scheme:/*potato* which after this patch won't work.

In fact, it's called Patterns, not DropUrlWhenStartsWith. I'd appreciate feedback from someone else. Code-wise, looks better for sure.

I had trouble finding what urlPatterns would look like, and only found trash:/ and run:/, also couldn't find any documentation about X-Plasma-DropUrlPatterns.

Porting regex, especially with the pesky QRegExp::Wildcard, seeing what the pattern should look like always helps (and then adding a comment in the code with examples, that helps future changes, some docs say that the best regex-handling-code is one that has comments with examples of what the regex is supposed to match).

ahmadsamir abandoned this revision.Apr 20 2020, 5:30 PM

Talking with kbroulik on irc confirms your POV, the format of those patterns aren't documented anywhere so changing the matching now would change the behaviour...

I'll abandon this, (I suggest that X-Plasma-DropUrlPatterns should be documented somewhere so that there's a defined format on which to base the contract of not breaking API :/).