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()));
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())) {
} 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
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("&&"));
if (!binding.empty())
label += '\t' + binding;
- return label;
+ return toqstr(label);
}
#ifndef GUIPOPUPMENU_H
#define GUIPOPUPMENU_H
-#include <QMenu>
-
-#include "FuncRequest.h"
#include "MenuBackend.h"
+#include <QMenu>
+
namespace lyx {
namespace frontend {
/// 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
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_;
};