isReadable can only be used after the file has been opened

This commit is contained in:
Juergen Spitzmueller 2015-05-18 11:15:11 +02:00
parent 7f1d33efc1
commit 927136c256

View File

@ -47,30 +47,36 @@ static QString credits()
QFile file(toqstr(package().system_support().absFileName()) + "/CREDITS"); QFile file(toqstr(package().system_support().absFileName()) + "/CREDITS");
QTextStream out(&res); QTextStream out(&res);
if (file.isReadable()) { if (!file.exists()) {
out << qt_("ERROR: LyX wasn't able to read CREDITS file\n"); out << qt_("ERROR: LyX wasn't able to find the CREDITS file\n");
out << qt_("Please install correctly to estimate the great\n"); out << qt_("Please install correctly to estimate the great\n");
out << qt_("amount of work other people have done for the LyX project."); out << qt_("amount of work other people have done for the LyX project.");
} else { } else {
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
QTextStream ts(&file); if (!file.isReadable()) {
ts.setCodec("UTF-8"); out << qt_("ERROR: LyX wasn't able to read the CREDITS file\n");
QString line; out << qt_("Please install correctly to estimate the great\n");
do { out << qt_("amount of work other people have done for the LyX project.");
line = ts.readLine(); } else {
if (line.startsWith("@b")) QTextStream ts(&file);
out << "<b>" << line.mid(2) << "</b>"; ts.setCodec("UTF-8");
else if (line.startsWith("@i")) { QString line;
if (line.startsWith("@iE-mail")) { do {
// unmask email line = ts.readLine();
line.replace(QString(" () "), QString("@")); if (line.startsWith("@b"))
line.replace(QString(" ! "), QString(".")); out << "<b>" << line.mid(2) << "</b>";
} else if (line.startsWith("@i")) {
out << "<i>" << line.mid(2) << "</i>"; if (line.startsWith("@iE-mail")) {
} else // unmask email
out << line; line.replace(QString(" () "), QString("@"));
out << "<br>"; line.replace(QString(" ! "), QString("."));
} while (!line.isNull()); }
out << "<i>" << line.mid(2) << "</i>";
} else
out << line;
out << "<br>";
} while (!line.isNull());
}
} }
out.flush(); out.flush();
return res; return res;