mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
fix view file when path is not shown
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23572 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c57ca0a9f4
commit
ad19114709
@ -26,6 +26,7 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -38,42 +39,16 @@ namespace frontend {
|
|||||||
|
|
||||||
static QString texFileFromList(QString const & file, QString const & type)
|
static QString texFileFromList(QString const & file, QString const & type)
|
||||||
{
|
{
|
||||||
QString file_ = file;
|
|
||||||
// do we need to add the suffix?
|
|
||||||
if (getExtension(file) != type)
|
|
||||||
file_ += '.' + type;
|
|
||||||
|
|
||||||
lyxerr << "Searching for file " << fromqstr(file_) << endl;
|
|
||||||
|
|
||||||
QString lstfile = type + "Files.lst";
|
QString lstfile = type + "Files.lst";
|
||||||
if (type == "cls")
|
|
||||||
lstfile = "clsFiles.lst";
|
|
||||||
else if (type == "sty")
|
|
||||||
lstfile = "styFiles.lst";
|
|
||||||
else if (type == "bst")
|
|
||||||
lstfile = "bstFiles.lst";
|
|
||||||
else if (type == "bib")
|
|
||||||
lstfile = "bibFiles.lst";
|
|
||||||
FileName const abslstfile = libFileSearch(QString(), lstfile);
|
FileName const abslstfile = libFileSearch(QString(), lstfile);
|
||||||
if (abslstfile.empty()) {
|
if (abslstfile.empty())
|
||||||
lyxerr << "File `'" << fromqstr(lstfile) << "' not found." << endl;
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
QString cs = toqstr(abslstfile.fileContents("UTF-8"));
|
||||||
// FIXME UNICODE
|
cs.replace("\r", "");
|
||||||
string const allClasses = to_utf8(abslstfile.fileContents("UTF-8"));
|
QStringList const result = cs.split("\n").filter(file);
|
||||||
int entries = 0;
|
if (result.empty())
|
||||||
string classfile = token(allClasses, '\n', entries);
|
return QString();
|
||||||
int count = 0;
|
return result.at(0);
|
||||||
while ((!contains(classfile, fromqstr(file))
|
|
||||||
|| support::onlyFilename(classfile) != fromqstr(file))
|
|
||||||
&& ++count < 1000) {
|
|
||||||
classfile = token(allClasses, '\n', ++entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now we have filename with full path
|
|
||||||
lyxerr << "with full path: " << classfile << endl;
|
|
||||||
|
|
||||||
return toqstr(classfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user