From 56dec68703b71f6875d6860f3fefa49e0b69dacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 6 Mar 2008 19:51:15 +0000 Subject: [PATCH] more of that... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23517 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiPopupMenu.cpp | 22 ++++++++++------------ src/frontends/qt4/GuiPopupMenu.h | 11 +++++------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/frontends/qt4/GuiPopupMenu.cpp b/src/frontends/qt4/GuiPopupMenu.cpp index b4ff3ae517..cdbcf34bfa 100644 --- a/src/frontends/qt4/GuiPopupMenu.cpp +++ b/src/frontends/qt4/GuiPopupMenu.cpp @@ -31,9 +31,9 @@ GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi, bool topLevelMenu) : QMenu(owner), owner_(owner) { - name_ = mi.submenuname(); + name_ = toqstr(mi.submenuname()); - setTitle(toqstr(getLabel(mi))); + setTitle(label(mi)); if (topLevelMenu) connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView())); @@ -43,18 +43,18 @@ GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi, void GuiPopupMenu::updateView() { LYXERR(Debug::GUI, "GuiPopupMenu::updateView()" - << "\tTriggered menu: " << to_utf8(name_)); + << "\tTriggered menu: " << fromqstr(name_)); clear(); - if (name_.empty()) + if (name_.isEmpty()) return; // Here, We make sure that theLyXFunc points to the correct LyXView. theLyXFunc().setLyXView(owner_); MenuBackend const & menubackend = guiApp->menuBackend(); - Menu const & fromLyxMenu = menubackend.getMenu(name_); + Menu const & fromLyxMenu = menubackend.getMenu(qstring_to_ucs4(name_)); menubackend.expand(fromLyxMenu, topLevelMenu_, owner_->buffer()); if (!menubackend.hasMenu(topLevelMenu_.name())) { @@ -87,8 +87,8 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu) } else if (m->kind() == MenuItem::Submenu) { LYXERR(Debug::GUI, "** creating New Sub-Menu " - << to_utf8(getLabel(*m))); - QMenu * subMenu = qMenu->addMenu(toqstr(getLabel(*m))); + << fromqstr(label(*m))); + QMenu * subMenu = qMenu->addMenu(label(*m)); populate(subMenu, m->submenu()); } else { // we have a MenuItem::Command @@ -96,17 +96,15 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu) LYXERR(Debug::GUI, "creating Menu Item " << to_utf8(m->label())); - docstring const label = getLabel(*m); - Action * action = new Action(*(owner_), - QIcon(), toqstr(label), m->func(), QString()); + QIcon(), label(*m), m->func(), QString()); qMenu->addAction(action); } } } -docstring const GuiPopupMenu::getLabel(MenuItem const & mi) +QString GuiPopupMenu::label(MenuItem const & mi) const { docstring label = support::subst(mi.label(), from_ascii("&"), from_ascii("&&")); @@ -122,7 +120,7 @@ docstring const GuiPopupMenu::getLabel(MenuItem const & mi) if (!binding.empty()) label += '\t' + binding; - return label; + return toqstr(label); } diff --git a/src/frontends/qt4/GuiPopupMenu.h b/src/frontends/qt4/GuiPopupMenu.h index 646fbdabac..cf50f3b71c 100644 --- a/src/frontends/qt4/GuiPopupMenu.h +++ b/src/frontends/qt4/GuiPopupMenu.h @@ -12,11 +12,10 @@ #ifndef GUIPOPUPMENU_H #define GUIPOPUPMENU_H -#include - -#include "FuncRequest.h" #include "MenuBackend.h" +#include + namespace lyx { namespace frontend { @@ -33,7 +32,7 @@ public: /// populates the menu or one of its submenu /// This is used as a recursive function - void populate(QMenu* qMenu, Menu * menu); + void populate(QMenu * qMenu, Menu * menu); public Q_SLOTS: /// populate the toplevel menu and all children @@ -41,12 +40,12 @@ public Q_SLOTS: private: /// Get a Menu item label from the menu backend - docstring const getLabel(MenuItem const & mi); + QString label(MenuItem const & mi) const; /// our owning view GuiView * owner_; /// the name of this menu - docstring name_; + QString name_; /// Top Level Menu Menu topLevelMenu_; };