From cdb78de5253dc8921cac903d94899e98181e9d2c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 7 Jan 2008 10:53:04 +0000 Subject: [PATCH] * MenuBackend.cpp (binding): remove forgui argument * frontends/qt4/GuiPopupMenu.cpp (addBinding): remove (merge into getLabel and remove mac-specific code). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22412 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/MenuBackend.cpp | 2 +- src/MenuBackend.h | 7 ++----- src/frontends/qt4/GuiPopupMenu.cpp | 23 +++++++---------------- src/frontends/qt4/GuiPopupMenu.h | 2 -- 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index af26c856ee..5426b218b4 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -116,7 +116,7 @@ docstring const MenuItem::shortcut() const } -docstring const MenuItem::binding(bool forgui) const +docstring const MenuItem::binding() const { if (kind_ != Command) return docstring(); diff --git a/src/MenuBackend.h b/src/MenuBackend.h index eed0875fa4..33e9d57b45 100644 --- a/src/MenuBackend.h +++ b/src/MenuBackend.h @@ -117,11 +117,8 @@ public: FuncStatus & status() { return status_; } /// returns the status of the lfun associated with this entry void status(FuncStatus const & status) { status_ = status; } - /** - * returns the binding associated to this action. - * Use the native UI format when \c forgui is true. - */ - docstring const binding(bool forgui) const; + ///returns the binding associated to this action. + docstring const binding() const; /// the description of the submenu (if relevant) docstring const & submenuname() const { return submenuname_; } /// set the description of the submenu diff --git a/src/frontends/qt4/GuiPopupMenu.cpp b/src/frontends/qt4/GuiPopupMenu.cpp index 1fd1688898..5c4da6d699 100644 --- a/src/frontends/qt4/GuiPopupMenu.cpp +++ b/src/frontends/qt4/GuiPopupMenu.cpp @@ -96,8 +96,7 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu) LYXERR(Debug::GUI, "creating Menu Item " << to_utf8(m->label())); - docstring label = getLabel(*m); - addBinding(label, *m); + docstring const label = getLabel(*m); Action * action = new Action(*(owner_), QIcon(), toqstr(label), m->func(), QString()); @@ -109,29 +108,21 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu) docstring const GuiPopupMenu::getLabel(MenuItem const & mi) { - docstring const shortcut = mi.shortcut(); - docstring label = support::subst(mi.label(), - from_ascii("&"), from_ascii("&&")); + docstring label = support::subst(mi.label(), + from_ascii("&"), from_ascii("&&")); + docstring const shortcut = mi.shortcut(); if (!shortcut.empty()) { size_t pos = label.find(shortcut); if (pos != docstring::npos) label.insert(pos, 1, char_type('&')); } - return label; -} - - -void GuiPopupMenu::addBinding(docstring & label, MenuItem const & mi) -{ -#ifdef Q_WS_MACX - docstring const binding = mi.binding(false); -#else - docstring const binding = mi.binding(true); -#endif + docstring const binding = mi.binding(); if (!binding.empty()) label += '\t' + binding; + + return label; } diff --git a/src/frontends/qt4/GuiPopupMenu.h b/src/frontends/qt4/GuiPopupMenu.h index 1106ccd354..646fbdabac 100644 --- a/src/frontends/qt4/GuiPopupMenu.h +++ b/src/frontends/qt4/GuiPopupMenu.h @@ -42,8 +42,6 @@ public Q_SLOTS: private: /// Get a Menu item label from the menu backend docstring const getLabel(MenuItem const & mi); - /// add binding keys a the menu item label. - void addBinding(docstring & label, MenuItem const & mi); /// our owning view GuiView * owner_;