Review Request 122981: add KGlobalAccel::loadShortcutFromGlobalSettings

Albert Astals Cid aacid at kde.org
Fri Apr 3 12:25:00 UTC 2015



> On mar. 22, 2015, 3:56 p.m., Albert Astals Cid wrote:
> > src/kglobalaccel.h, line 260
> > <https://git.reviewboard.kde.org/r/122981/diff/2/?file=356138#file356138line260>
> >
> >     typo in following
> 
> Gregor Mi wrote:
>     About why it is needed: see KGlobalShortcutTest::testLoadShortcutFromGlobalSettings: shortcut() does not behave as expected when the new method loadShortcutFromGlobalSettings() is not called
>     
>     I don't know if always calling loadShortcutFromGlobalSettings() before shortcut() would break existing code. E.g. in kwin/effects/desktopgrid/desktopgrid_config.cpp shortcut() is used without prior call of loadShortcutFromGlobalSettings().
>     
>     On the other hand, a call to loadShortcutFromGlobalSettings() might be harmless but I don't have a good overview of the KGlobalAccel usage patterns.
> 
> Albert Astals Cid wrote:
>     Honestly i have no idea on how this kglobalaccel thing works, but it seems to me you're just adding a way to workaround a bug instead of fixing it.
> 
> Gregor Mi wrote:
>     Me neither :-)
>     
>     I was hoping that someone with more experience with kglobalaccel can say more about the proposed solution.
>     
>     Like you Thomas suggested to put the loading method into shortcut() (which is essentially a one-liner: d->updateGlobalShortcut(action, KGlobalAccelPrivate::ActiveShortcut, KGlobalAccel::Autoloading);).
> 
> Martin Gräßlin wrote:
>     well we could try it: add the one-line change and try whether the unit tests pass and then try whether the case in DesktopGridConfig works.
>     
>     Unfortunately I'm also not that into KGloalAccel code yet to be 100 % whether it's a valid change :-(
> 
> Gregor Mi wrote:
>     I tried to call loadShortcutFromGlobalSettings() from within shortcut() and found that this violates const constraints:
>     
>     shortcut() is const
>     d->updateGlobalShortcut is not const
>     
>     So this is not possible.
>     
>     How to proceed now?

make mutable the members that updateGlobalShortcut modifies


- Albert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122981/#review77912
-----------------------------------------------------------


On abr. 2, 2015, 2:56 p.m., Gregor Mi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122981/
> -----------------------------------------------------------
> 
> (Updated abr. 2, 2015, 2:56 p.m.)
> 
> 
> Review request for KDE Frameworks, Martin Gräßlin and Thomas Lübking.
> 
> 
> Repository: kglobalaccel
> 
> 
> Description
> -------
> 
> In some cases you need to call loadShortcutFromGlobalSettings() in order not to get a an empty list when calling shortcut() (which is const).
> 
> See discussion in https://git.reviewboard.kde.org/r/122249/ ("libksysguard: add Kill Window to End Process button and show correct keyboard shortcut").
> 
> 
> Diffs
> -----
> 
>   autotests/kglobalshortcuttest.h 2a7b40d34875e16345a659fb9764e4f536ad79c6 
>   autotests/kglobalshortcuttest.cpp 169bf92ffbff985cd4381e771c2fcecaff77156b 
>   src/kglobalaccel.h 3fe20ca8e4ec6ceb0bb9e54235aef7f1aeeb8c16 
>   src/kglobalaccel.cpp 1b6b3f5cb6d42401d684e6a491d12a6e57248fd1 
> 
> Diff: https://git.reviewboard.kde.org/r/122981/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Gregor Mi
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150403/141d0923/attachment.html>


More information about the Kde-frameworks-devel mailing list