}
-Action * GuiToolbar::addItem(ToolbarItem const & item)
+Action * GuiToolbar::addItem(ToolbarItem const & item, bool menu)
{
QString text = toqstr(item.label);
+ QString tooltip = text;
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(*item.func);
- if (!bindings.empty())
- text += " [" + toqstr(bindings.begin()->print(KeySequence::ForGui)) + "]";
+ if (!bindings.empty()) {
+ QString binding = toqstr(bindings.begin()->print(KeySequence::ForGui));
+ if (menu)
+ text += '\t' + binding;
+ else
+ tooltip += " [" + binding + "]";
+ }
Action * act = new Action(item.func, getIcon(*item.func, false), text,
- text, this);
+ tooltip, this);
if (item.type == ToolbarItem::BIDICOMMAND)
act->setRtlIcon(getIcon(*item.func, false, true));
ToolbarInfo::item_iterator const end = tbinfo->items.end();
for (; it != end; ++it)
if (!getStatus(*it->func).unknown())
- m->add(bar_->addItem(*it));
+ m->add(bar_->addItem(*it, true));
setMenu(m);
}
}
-bool GuiToolbar::isVisibiltyOn() const
+bool GuiToolbar::isVisibilityOn() const
{
return visibility_ & Toolbars::ON;
}
void GuiToolbar::toggle()
{
if (visibility_ & Toolbars::ALLOWAUTO) {
- if (!(visibility_ & Toolbars::AUTO) && !isVisibiltyOn()) {
+ if (!(visibility_ & Toolbars::AUTO) && !isVisibilityOn()) {
setState("auto");
} else {
- if (isVisibiltyOn())
+ if (isVisibilityOn())
setState("off");
else
setState("on");