Bug 428193

Summary: Partial terms search not working for shutdown/restart/suspend options
Product: [Plasma] krunner Reporter: Mikhail Shchemelev <mikhail.schemelev>
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs
Priority: NOR    
Version: 5.20.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.21
Sentry Crash Report:

Description Mikhail Shchemelev 2020-10-24 19:10:49 UTC
SUMMARY

Searching for incomplete strings for actions such as shutdown/restart/suspend does not yield any results

STEPS TO REPRODUCE
1. Open krunner
2. Start entering "rest"
3. Alternatively enter full term "restart"

OBSERVED RESULT
Nothing is found for partial term, while "Restart computer" option is found for full term

EXPECTED RESULT
Power actions should be found for partial terms as well

SOFTWARE/OS VERSIONS
Any linux distribution
KDE versions at least 5.18, 5.19 or 5.20, but probably any as well

ADDITIONAL INFORMATION
The issue is so far observed for powerdevil krunner plugin (if i'm not wrong about which module owns those actions), however in theory it may be broader in scope and be present in other plugins as well.
Comment 1 Alexander Lohnau 2020-10-24 19:21:03 UTC
Hmm, where would you draw the line for a partial match? Note that also short trigger words like "sleep" are available.
Comment 2 Mikhail Shchemelev 2020-10-24 19:42:38 UTC
(In reply to Alexander Lohnau from comment #1)
> Hmm, where would you draw the line for a partial match? Note that also short
> trigger words like "sleep" are available.

As far as i can see, there is no such line for application search ("k" will show you konsole among all things, for example). Can it be done the same way or are there some unwanted consequences?
Comment 3 Alexander Lohnau 2020-10-24 20:35:39 UTC
>Can it be done the same way or are there some unwanted consequences?
The problem is that we would be spamming a lot of unwanted results. Currently the query has to match the term exactly, which makes it very predictable.
Especially considering that we don't want the user to accidentally click the option to shutdown their computer this makes sense.

But technically it is definitely possible.
Comment 4 Alexander Lohnau 2020-10-24 20:46:15 UTC
I will look into implementing this after fixing BUG 428194.
Comment 5 Alexander Lohnau 2020-10-31 12:15:39 UTC
May I assume that the issue mentioned in BUG 324617 should also be kept in mind when implementing this?
Comment 6 Mikhail Shchemelev 2020-10-31 15:36:44 UTC
(In reply to Alexander Lohnau from comment #5)
> May I assume that the issue mentioned in BUG 324617 should also be kept in
> mind when implementing this?

Probably?
I can't really comment from my perspective, since russian does not have diacritics... Except for е/ё ([ye]/[yo]), maybe? Those are considered separate letters (both in alphabete, and in practical terms - different keyboard keys, for example), although often considered interchangeable in written language (despite different phonemes).
Comment 7 Bug Janitor Service 2020-12-16 20:28:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/521
Comment 8 Alexander Lohnau 2020-12-27 21:56:04 UTC
Git commit 6f54d49ade5f11f1a5d8f4944e61e0ede7380267 by Alexander Lohnau.
Committed on 27/12/2020 at 21:56.
Pushed by alex into branch 'master'.

Rewrite match logic of PowerDevil runner

- Support partial matches
- Allow both translated and non-translated trigger words
- Avoid duplicating the translated strings. This can become useful in
 case we also want to add the non-translated trigger words to the
 syntaxes (once they get displayed somewhere ;))
- Get rid of QRegExp usage
Related: bug 428194
FIXED-IN: 5.21

M  +101  -83   runners/powerdevil/PowerDevilRunner.cpp
M  +16   -2    runners/powerdevil/PowerDevilRunner.h

https://invent.kde.org/plasma/plasma-workspace/commit/6f54d49ade5f11f1a5d8f4944e61e0ede7380267