]> git.lyx.org Git - features.git/commitdiff
isReadable can only be used after the file has been opened
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 18 May 2015 09:15:11 +0000 (11:15 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 18 May 2015 09:15:11 +0000 (11:15 +0200)
src/frontends/qt4/GuiAbout.cpp

index 817efbf30253676a5551f5d7fb1b1ed3260ae173..a9402238d885f6ff37608bc5325c8ba73cf86d45 100644 (file)
@@ -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 << "<b>" << line.mid(2) << "</b>";
-                       else if (line.startsWith("@i")) {
-                               if (line.startsWith("@iE-mail")) {
-                                       // unmask email
-                                       line.replace(QString(" () "), QString("@"));
-                                       line.replace(QString(" ! "), QString("."));
-                               }
-                               out << "<i>" << line.mid(2) << "</i>";
-                       } else
-                               out << line;
-                       out << "<br>";
-               } 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 << "<b>" << line.mid(2) << "</b>";
+                               else if (line.startsWith("@i")) {
+                                       if (line.startsWith("@iE-mail")) {
+                                               // unmask email
+                                               line.replace(QString(" () "), QString("@"));
+                                               line.replace(QString(" ! "), QString("."));
+                                       }
+                                       out << "<i>" << line.mid(2) << "</i>";
+                               } else
+                                       out << line;
+                               out << "<br>";
+                       } while (!line.isNull());
+               }
        }
        out.flush();
        return res;