Enter searchbar modes only once and make slots private
Review Request #128615 - Created Aug. 5, 2016 and submitted
After initializing KateSearchBar KateNormalInputMode calls the respective enter incremental search or power search method.
But this is already done in the constructor and should therefore be avoided.
could you try and see whether the following still works (I somewhat doubt it):
ctrl + f
ctrl + r
the expected result is the "power mode" search bar with "something" in the Find bar. I suspect that your patch breaks this transition, i.e. when the search bar is already initialized
Thank you for your reviews! I didn't know / thought about, that we also have the functionality to press CTRL + F/R to switch between modes or refocus on the searchbar. I added now an if-statement, that makes sure, the enterInc/Power fcts are only called, if we don't call the constructor before and would call them two times in row. I think it's still a little bit clearer when we only call the fcts if we really need to. Also it saves a little computing time. Added also the enum, Milian asked for.
Revision 2 (+18 -10)
please split the bool-to-enum into a separate patch, it's not directly related (sorry for confusing you there, that was a drive-by review on my side).
for the issue at hand, please improve performance by adding an early return to
KateSearchBar::enter*Modewhen the current mode is reentered.
I don't think you are already allowed to use enum class in KF5 code, but I might be mistaken.
if this is costly, then to fix it, you should put a check into the search bar itself to not do anything when we re-enter the current mode. that way, nothing would change here on the consumer side
ideally, you'd simply move the enum into the search bar and then propagate it here