Author: vfr
Date: Mon Jan 3 19:44:52 2011
New Revision: 37083
URL: http://www.lyx.org/trac/changeset/37083
Log:
Fix part 2 of bug #7182: LyX truncates file names to about 25 chars.
Now, when hovering the lastfiles menu, the full file names are shown in the
statusbar.
Modified:
lyx-devel/trunk/src/frontends/qt4/Menus.cpp
Modified: lyx-devel/trunk/src/frontends/qt4/Menus.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/Menus.cpp Mon Jan 3 18:21:37 2011
(r37082)
+++ lyx-devel/trunk/src/frontends/qt4/Menus.cpp Mon Jan 3 19:44:52 2011
(r37083)
@@ -177,8 +177,10 @@
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, /**/);
}
@@ -186,9 +188,11 @@
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);
}
@@ -210,11 +214,13 @@
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
@@ -267,6 +273,8 @@
///
QString submenuname_;
///
+ QString tooltip_;
+ ///
bool optional_;
///
FuncStatus status_;
@@ -498,7 +506,7 @@
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;
}
@@ -612,7 +620,7 @@
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;
}
@@ -884,14 +892,15 @@
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));
}
}
@@ -1540,7 +1549,7 @@
} else {
// we have a MenuItem::Command
qMenu.addAction(new Action(view, QIcon(), label(*m),
- m->func(), QString(), &qMenu));
+ m->func(), m->tooltip(), &qMenu));
}
}
}