MenuItem(Kind kind,
QString const & label,
QString const & submenu = QString(),
+ QString const & tooltip = QString(),
bool optional = false)
- : kind_(kind), label_(label), submenuname_(submenu), optional_(optional)
+ : kind_(kind), label_(label), submenuname_(submenu),
+ tooltip_(tooltip), optional_(optional)
{
LASSERT(kind == Submenu || kind == Help || kind == Info, /**/);
}
MenuItem(Kind kind,
QString const & label,
FuncRequest const & func,
+ QString const & tooltip = QString(),
bool optional = false,
FuncRequest::Origin origin = FuncRequest::MENU)
- : kind_(kind), label_(label), func_(func), optional_(optional)
+ : kind_(kind), label_(label), func_(func),
+ tooltip_(tooltip), optional_(optional)
{
func_.setOrigin(origin);
}
return index == -1 ? QString() : label_.mid(index + 1);
}
/// The complete label, with label and shortcut separated by a '|'
- QString fulllabel() const { return label_;}
+ QString fulllabel() const { return label_; }
/// The kind of entry
Kind kind() const { return kind_; }
/// the action (if relevant)
FuncRequest const & func() const { return func_; }
+ /// the tooltip
+ QString const & tooltip() const { return tooltip_; }
/// returns true if the entry should be omitted when disabled
bool optional() const { return optional_; }
/// returns the status of the lfun associated with this entry
///
QString submenuname_;
///
+ QString tooltip_;
+ ///
bool optional_;
///
FuncStatus status_;
FuncRequest::Origin origin = FuncRequest::MENU;
if (name_.startsWith("context-toc-"))
origin = FuncRequest::TOC;
- add(MenuItem(MenuItem::Command, toqstr(name), func, optional, origin));
+ add(MenuItem(MenuItem::Command, toqstr(name), func, QString(), optional, origin));
optional = false;
break;
}
lex.next(true);
docstring const mname = lex.getDocString();
add(MenuItem(MenuItem::Submenu,
- toqstr(mlabel), toqstr(mname), optional));
+ toqstr(mlabel), toqstr(mname), QString(), optional));
optional = false;
break;
}
for (; lfit != lf.end() && ii <= lyxrc.num_lastfiles; ++lfit, ++ii) {
string const file = lfit->absFileName();
+ QString const short_path = toqstr(makeDisplayPath(file, 30));
+ QString const long_path = toqstr(makeDisplayPath(file));
QString label;
if (ii < 10)
- label = QString("%1. %2|%3").arg(ii)
- .arg(toqstr(makeDisplayPath(file, 30))).arg(ii);
+ label = QString("%1. %2|%3").arg(ii).arg(short_path).arg(ii);
else
- label = QString("%1. %2").arg(ii)
- .arg(toqstr(makeDisplayPath(file, 30)));
- add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, file)));
+ label = QString("%1. %2").arg(ii).arg(short_path);
+ add(MenuItem(MenuItem::Command, label,
+ FuncRequest(LFUN_FILE_OPEN, file), long_path));
}
}
} else {
// we have a MenuItem::Command
qMenu.addAction(new Action(view, QIcon(), label(*m),
- m->func(), QString(), &qMenu));
+ m->func(), m->tooltip(), &qMenu));
}
}
}