tools/qdoc3/config.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    41 
    41 
    42 /*
    42 /*
    43   config.cpp
    43   config.cpp
    44 */
    44 */
    45 
    45 
    46 #include <QtCore>
    46 #include <QDir>
       
    47 #include <QVariant>
       
    48 #include <QFile>
       
    49 #include <QTemporaryFile>
       
    50 #include <QTextStream>
    47 
    51 
    48 #include "archiveextractor.h"
    52 #include "archiveextractor.h"
    49 #include "config.h"
    53 #include "config.h"
    50 #include "uncompressor.h"
    54 #include "uncompressor.h"
    51 #include <stdlib.h>
    55 #include <stdlib.h>
   522                          const QStringList& fileExtensions,
   526                          const QStringList& fileExtensions,
   523                          QString& userFriendlyFilePath)
   527                          QString& userFriendlyFilePath)
   524 {
   528 {
   525     QStringList::ConstIterator e = fileExtensions.begin();
   529     QStringList::ConstIterator e = fileExtensions.begin();
   526     while (e != fileExtensions.end()) {
   530     while (e != fileExtensions.end()) {
   527 	QString filePath = findFile(location, files, dirs, fileBase + "." + *e,
   531 	QString filePath = findFile(location,
   528 				     userFriendlyFilePath);
   532                                     files,
       
   533                                     dirs,
       
   534                                     fileBase + "." + *e,
       
   535                                     userFriendlyFilePath);
   529 	if (!filePath.isEmpty())
   536 	if (!filePath.isEmpty())
   530 	    return filePath;
   537 	    return filePath;
   531 	++e;
   538 	++e;
   532     }
   539     }
   533     return findFile(location, files, dirs, fileBase, userFriendlyFilePath);
   540     return findFile(location, files, dirs, fileBase, userFriendlyFilePath);
   669         fin.setFileName(fileName + ".qdoc");
   676         fin.setFileName(fileName + ".qdoc");
   670         if (!fin.open(QFile::ReadOnly | QFile::Text))
   677         if (!fin.open(QFile::ReadOnly | QFile::Text))
   671             location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
   678             location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
   672     }
   679     }
   673 
   680 
   674     QString text = fin.readAll();
   681     QTextStream stream(&fin);
       
   682     stream.setCodec("UTF-8");
       
   683     QString text = stream.readAll();
   675     text += QLatin1String("\n\n");
   684     text += QLatin1String("\n\n");
   676     text += QChar('\0');
   685     text += QChar('\0');
   677     fin.close();
   686     fin.close();
   678 
   687 
   679     location.push(fileName);
   688     location.push(fileName);