From 927136c2565462287cb4570ecd3e2779efd997e8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 18 May 2015 11:15:11 +0200 Subject: [PATCH] isReadable can only be used after the file has been opened --- src/frontends/qt4/GuiAbout.cpp | 46 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/frontends/qt4/GuiAbout.cpp b/src/frontends/qt4/GuiAbout.cpp index 817efbf302..a9402238d8 100644 --- a/src/frontends/qt4/GuiAbout.cpp +++ b/src/frontends/qt4/GuiAbout.cpp @@ -47,30 +47,36 @@ static QString credits() QFile file(toqstr(package().system_support().absFileName()) + "/CREDITS"); QTextStream out(&res); - if (file.isReadable()) { - out << qt_("ERROR: LyX wasn't able to read CREDITS file\n"); + if (!file.exists()) { + 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_("amount of work other people have done for the LyX project."); } else { file.open(QIODevice::ReadOnly); - QTextStream ts(&file); - ts.setCodec("UTF-8"); - QString line; - do { - line = ts.readLine(); - if (line.startsWith("@b")) - out << "" << line.mid(2) << ""; - else if (line.startsWith("@i")) { - if (line.startsWith("@iE-mail")) { - // unmask email - line.replace(QString(" () "), QString("@")); - line.replace(QString(" ! "), QString(".")); - } - out << "" << line.mid(2) << ""; - } else - out << line; - out << "
"; - } while (!line.isNull()); + if (!file.isReadable()) { + out << qt_("ERROR: LyX wasn't able to read the CREDITS file\n"); + out << qt_("Please install correctly to estimate the great\n"); + out << qt_("amount of work other people have done for the LyX project."); + } else { + QTextStream ts(&file); + ts.setCodec("UTF-8"); + QString line; + do { + line = ts.readLine(); + if (line.startsWith("@b")) + out << "" << line.mid(2) << ""; + else if (line.startsWith("@i")) { + if (line.startsWith("@iE-mail")) { + // unmask email + line.replace(QString(" () "), QString("@")); + line.replace(QString(" ! "), QString(".")); + } + out << "" << line.mid(2) << ""; + } else + out << line; + out << "
"; + } while (!line.isNull()); + } } out.flush(); return res; -- 2.39.2