tools/assistant/lib/qhelpsearchindexwriter_default.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
child 18 2f34d5167611
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   182 
   182 
   183 void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile,
   183 void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile,
   184                                          const QString &indexFilesFolder,
   184                                          const QString &indexFilesFolder,
   185                                          bool reindex)
   185                                          bool reindex)
   186 {
   186 {
       
   187     wait();
   187     QMutexLocker lock(&mutex);
   188     QMutexLocker lock(&mutex);
   188 
   189 
   189     this->m_cancel = false;
   190     this->m_cancel = false;
   190     this->m_reindex = reindex;
   191     this->m_reindex = reindex;
   191     this->m_collectionFile = collectionFile;
   192     this->m_collectionFile = collectionFile;
   272                 QByteArray data(engine.fileData(url));
   273                 QByteArray data(engine.fileData(url));
   273                 if (data.isEmpty())
   274                 if (data.isEmpty())
   274                     continue;
   275                     continue;
   275 
   276 
   276                 QTextStream s(data);
   277                 QTextStream s(data);
   277                 QString en = QHelpGlobal::charsetFromData(data);
   278                 QString en = QHelpGlobal::codecFromData(data);
   278                 s.setCodec(QTextCodec::codecForName(en.toLatin1().constData()));
   279                 s.setCodec(QTextCodec::codecForName(en.toLatin1().constData()));
   279 
   280 
   280                 QString text = s.readAll();
   281                 QString text = s.readAll();
   281                 if (text.isNull())
   282                 if (text.isNull())
   282                     continue;
   283                     continue;