Bug 420311 - The prepare/teardown signal is emitted for each query
Summary: The prepare/teardown signal is emitted for each query
Status: RESOLVED FIXED
Alias: None
Product: frameworks-krunner
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.69.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-19 18:43 UTC by Alexander Lohnau
Modified: 2020-05-27 07:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Lohnau 2020-04-19 18:43:28 UTC
SUMMARY
The prepare/teardown signal is emitted for each query and not for each match session.

STEPS TO REPRODUCE
1. Connect to the signal in a runner:
    connect(this, &MyRunner::prepare, [=]() {
        qWarning() << "prepare";
    });

2. Install plugin, restart krunner
3. Type some letters

OBSERVED RESULT
The warning is displayed for each letter typed.

EXPECTED RESULT
The warning gets displayed when the first letter is typed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon beta
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.1

ADDITIONAL INFORMATION

It works as expected with krunner 5.62.
Comment 1 Nate Graham 2020-04-20 20:10:32 UTC
Sounds like you could submit a patch. :)
Comment 2 Alexander Lohnau 2020-04-21 06:45:59 UTC
But I have found the issue: I installed version 5.62 from source with the same issue, but then I reverted https://phabricator.kde.org/D22758 and installed it again and it works.

I will do my best to write a patch :-).
Comment 3 Alexander Lohnau 2020-04-21 15:31:47 UTC
https://phabricator.kde.org/D29050
Comment 4 Nate Graham 2020-04-21 17:18:05 UTC
Thanks!
Comment 5 Alexander Lohnau 2020-05-27 07:48:31 UTC
Git commit 7c365354907d595d5e75458c4a3c4226ae40d3a4 by Alexander Lohnau.
Committed on 27/05/2020 at 07:48.
Pushed by alex into branch 'master'.

KRunner fix prepare/teardown signals

Summary:
Because the teardown was requested and checked the prepped variable was set to false and consequently
the prepare method gets called for the next character typed.

The exact two lines get called in the `matchSessionComplete` method.
The `matchSessionComplete` method gets called called in `RunnerResultsModel::clear` (milou repo).

Test Plan:
If you connect to the prepare/teardown slot, for example:
```
connect(this, &MyRunner::prepare, [=]() {
        qWarning() << "prepare";
});````

You see that they get triggered for each letter typed, after applying this patch they get only triggered when the match session is started/is over.

Reviewers: meven, ngraham, broulik

Reviewed By: meven

Subscribers: davidedmundson, cfeck, kde-frameworks-devel

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D29050

M  +0    -3    src/runnermanager.cpp

https://invent.kde.org/frameworks/krunner/commit/7c365354907d595d5e75458c4a3c4226ae40d3a4