]> git.lyx.org Git - features.git/commitdiff
more of that...
authorAndré Pönitz <poenitz@gmx.net>
Thu, 6 Mar 2008 19:51:15 +0000 (19:51 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 6 Mar 2008 19:51:15 +0000 (19:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23517 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiPopupMenu.cpp
src/frontends/qt4/GuiPopupMenu.h

index b4ff3ae51775454d4a59cce282135cf5fa8331db..cdbcf34bfa1d868c699f7ec55eab8d70918bd242 100644 (file)
@@ -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);
 }
 
 
index 646fbdabac28cbbbd2d671592b406586c4759cff..cf50f3b71c798777b842977e9f99747b17a97167 100644 (file)
 #ifndef GUIPOPUPMENU_H
 #define GUIPOPUPMENU_H
 
-#include <QMenu>
-
-#include "FuncRequest.h"
 #include "MenuBackend.h"
 
+#include <QMenu>
+
 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_;
 };