Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Am 19.04.2011 13:30:25 schrieb libreoffice@lists.freedesktop.org:
 On 2011-04-15 at 12:48 +0000, 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 <christian.dywan@lanedo.com>
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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.