Fix share menu not showing the first time it is used
ClosedPublic

Authored by faridb on Jun 2 2018, 7:54 PM.

Details

Summary

When the share menu is clicked for the first time (kipi plugins are not loaded
yet) the share menu doesn't work because updateMenu() clears the menu before any
plugin is available, thus the menu is empty and nothing is shown.

updateMenu() should be called when init() is triggered by loadingFinished() and not
when it's triggered by aboutToShow().

Test Plan
  • Start an new instance of Gwenview
  • Click on 'Share'
  • The share menu should show the first time without having to click 'Share' a second

time

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
faridb requested review of this revision.Jun 2 2018, 7:54 PM
faridb created this revision.
rkflx accepted this revision.Jun 2 2018, 7:56 PM

👍

I'll land it first thing in the morning!

This revision is now accepted and ready to land.Jun 2 2018, 7:56 PM
rkflx added a comment.Jun 2 2018, 10:19 PM

I'll land this on the stable branch, i.e. Applications/18.04, as it is a nice bugfix for an annoying problem.

This means it will be released on Thursday already with 18.04.2: https://community.kde.org/Schedules/Applications/18.04_Release_Schedule


@faridb I noticed a small problem though, perhaps you can find a way to solve it later: Loading... is not shown anymore (I'd consider the bugfix more important than showing the entry, though, so I'll land it in any case).

I could not find a way to test if Loading... was showing correctly because the plugins were loading almost instantaneously.

rkflx added a comment.Jun 2 2018, 11:10 PM

I could not find a way to test if Loading... was showing correctly because the plugins were loading almost instantaneously.

A couple of ideas: cpulimit gwenview -l 1, run under Valgrind, add sleep() in the source code of kipi-plugins

Thanks for the suggestions! I will try that.

This revision was automatically updated to reflect the committed changes.
faridb added a comment.EditedJun 3 2018, 12:11 PM

I looked into the problem of Loading... not showing and I found out that it's because of my bugfix. My change caused d->updateMenu() to be called only when the loading is finished, thus not showing Loading....

I have found two possible solutions which solve both problems which are:

  • At the start of updateMenu() call menu->hide(), then call menu->show() at the end. However, this causes the menu to flicker because it's shown and hidden quickly. It causes the menu to be shown when it shouldn't.
  • Call d->updateMenu() twice when the loading is finished (i.e. both inside and outside if (d->mKIPIInterface->isLoadingFinished()) or twice outside).

The second solution seems to work fine but I couldn't find the real cause of the problem. What do you think?

I have created a Diff for the second solution at D13312.

faridb reopened this revision.Jun 3 2018, 2:10 PM
This revision is now accepted and ready to land.Jun 3 2018, 2:10 PM
faridb closed this revision.Jun 3 2018, 7:26 PM
rkflx added a comment.Jun 3 2018, 10:15 PM

I'll reply in the other Diff, as updating the code of an already landed Diff is always a bit confusing later on…