* support/filetools.C (makeDisplayPath): if the file is in the lyx

support directory, return as a relative path (enclosed in brackets)

	* frontends/qt4/GuiView.C (updateTabs): use makeDisplayPath instead
	of onlyFileName. 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17384 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-02-28 21:48:04 +00:00
parent 136403d64b
commit a7c2c8e3d5
2 changed files with 8 additions and 4 deletions

View File

@ -64,9 +64,8 @@ using std::vector;
namespace lyx {
using support::FileName;
using support::onlyFilename;
using support::subst;
using support::libFileSearch;
using support::makeDisplayPath;
namespace frontend {
@ -512,7 +511,7 @@ void GuiView::updateTab()
// rebuild tabbar and function map from scratch
if (names.size() > 1) {
for(size_t i = 0; i < names.size(); i++) {
tabbar.addTab(toqstr(onlyFilename(names[i])));
tabbar.addTab(toqstr(makeDisplayPath(names[i], 30)));
// set current tab
if (names[i] == cur_title)
tabbar.setCurrentIndex(i);

View File

@ -999,9 +999,14 @@ FileName const unzipFile(FileName const & zipped_file, string const & unzipped_f
docstring const makeDisplayPath(string const & path, unsigned int threshold)
{
string str = path;
string const home = package().home_dir();
// If file is from LyXDir, display it as if it were relative.
string const system = package().system_support();
if (prefixIs(str, system))
return from_utf8("[" + str.erase(0, system.length()) + "]");
// replace /home/blah with ~/
string const home = package().home_dir();
if (!home.empty() && prefixIs(str, home))
str = subst(str, home, "~");