Re: [Libreoffice] [PATCH] Only accelerators in Edit popup on Windows and KDE
On Tuesday 19 of April 2011, Christian Dywan wrote: > > Am 19.04.2011 13:35:54 schrieb Lubos Lunak: > > I think it makes more sense to have it as a style setting rather than > > hardcoding a bunch of if's > > I don't think it makes sense as a setting, and no platform has a setting > for this afair. By setting I don't mean a configurable setting, but a style setting, i.e. the StyleSettings vcl class. There are already settings for things like palette, widget sizes, cursor blink time, whether to show icons in menus and other platform settings, so a setting for not showing accelerators in edit popups seems to fit there. Each platform sets the settings the way it should be for the platform and the code just checks the setting and doesn't care what platforms those are (so no if's and all the settings are in one place rather than scattered over the codebase). -- Lubos Lunak l.lu...@suse.cz ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PATCH] Only accelerators in Edit popup on Windows and KDE
Am 19.04.2011 13:30:25 schrieb libreoffice@lists.freedesktop.org: > On 2011-04-15 at 12:48 +, Christian Dywan wrote: > > I'm not sure if this is the best way to address this, I looked at the > > style settings, but this isn't a setting, and I saw get_desktop_session() > but that isn't public API and I'm not > > sure how it's meant to be used. If there's a better approach, pointers > > welcome. > Nice, thank you very much for the patch! :-) The best is to use > Application::GetDesktopEnvironment(), like eg. here: > > http://opengrok.libreoffice.org/xref/components/cui/source/options/optgdlg.cxx#129 > > [without the #ifdefs etc. - here you don't care whether the plugin is > available, or not ;-)] > Can you please update it? Nice, that's exactly the API I was looking for but didn't find before. Thanks! Updated the patch. > Am 19.04.2011 13:35:54 schrieb Lubos Lunak: > I think it makes more sense to have it as a style setting rather than > hardcoding a bunch of if's I don't think it makes sense as a setting, and no platform has a setting for this afair. SetAccelKey applies to all menus if I understand correctly, but the distinction is for context menues as opposed to the menubar. ciao, Christian From 624e46b936d37e6281fb601ce00bdc4b076b4b1d Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 14 Apr 2011 19:41:41 +0200 Subject: [PATCH] Only accelerators in Edit popup on Windows and KDE Fixes: fdo#36239 --- vcl/source/control/edit.cxx | 20 +--- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 30e0296..e7353db 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2933,13 +2933,19 @@ PopupMenu* Edit::CreatePopupMenu() return new PopupMenu(); PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); +const ::rtl::OUString &rDesktopEnvironment = Application::GetDesktopEnvironment(); +if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde") || + rDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde4") || + rDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("windows") ) +{ +pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); +} return pPopup; } -- 1.7.1 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PATCH] Only accelerators in Edit popup on Windows and KDE
On Friday 15 of April 2011, Christian Dywan wrote: > I made a change to not show accelerators in Edit popups except in KDE and > Windows, which are to my knowledge the only platforms doing this. I'm not > sure if this is the best way to address this, I looked at the style > settings, but this isn't a setting, What is not there can be added. I think it makes more sense to have it as a style setting rather than hardcoding a bunch of if's (where it's easier to miss a platform, e.g. KDE in LO is "kde" for KDE3 or "kde4"). Also, is this lineedit popups only, or generic? In the latter case it should just go to SetAccelKey(). > and I saw get_desktop_session() but > that isn't public API and I'm not sure how it's meant to be used. If > there's a better approach, pointers welcome. > > Also filed as fdo#36235 with the same patch. -- Lubos Lunak l.lu...@suse.cz ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PATCH] Only accelerators in Edit popup on Windows and KDE
Hi Christian, On 2011-04-15 at 12:48 +, Christian Dywan wrote: > I'm not sure if this is the best way to address this, I looked at the > style settings, but this isn't a setting, and I saw > get_desktop_session() but that isn't public API and I'm not sure how > it's meant to be used. If there's a better approach, pointers welcome. Nice, thank you very much for the patch! :-) The best is to use Application::GetDesktopEnvironment(), like eg. here: http://opengrok.libreoffice.org/xref/components/cui/source/options/optgdlg.cxx#129 [without the #ifdefs etc. - here you don't care whether the plugin is available, or not ;-)] Can you please update it? Thank you, Kendy ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] [PATCH] Only accelerators in Edit popup on Windows and KDE
I made a change to not show accelerators in Edit popups except in KDE and Windows, which are to my knowledge the only platforms doing this. I'm not sure if this is the best way to address this, I looked at the style settings, but this isn't a setting, and I saw get_desktop_session() but that isn't public API and I'm not sure how it's meant to be used. If there's a better approach, pointers welcome. Also filed as fdo#36235 with the same patch. ciao, ChristianFrom 509dccd84864c79a659901800e145303d1182b23 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 14 Apr 2011 19:41:41 +0200 Subject: [PATCH] Only accelerators in Edit popup on Windows and KDE Fixes: fdo#36239 diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 30e0296..ee6f6ff 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2933,13 +2933,23 @@ PopupMenu* Edit::CreatePopupMenu() return new PopupMenu(); PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); -pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); +#ifdef _WIN32 +if (1) +#else +static const char *pDesktop = getenv ("OOO_FORCE_DESKTOP"); +if (! ( pDesktop && *pDesktop)) +pDesktop = getenv ("DESKTOP_SESSION"); +if ( strstr( pDesktop, "kde" ) != NULL ) +#endif +{ +pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) ); +pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) ); +} return pPopup; } -- 1.7.1 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice