tools/assistant/lib/qhelpsearchindexwriter_default.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -55,9 +55,8 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace qt {
-    namespace fulltextsearch {
-        namespace std {
+namespace fulltextsearch {
+namespace std {
 
 Writer::Writer(const QString &path)
     : indexPath(path)
@@ -104,7 +103,7 @@
         return status;
 
     QDataStream docStream(&docFile);
-    foreach(const QStringList list, documentList) {
+    foreach(const QStringList &list, documentList) {
         docStream << list.at(0);
         docStream << list.at(1);
     }
@@ -126,9 +125,9 @@
 
 void Writer::setIndexFile(const QString &namespaceName, const QString &attributes)
 {
-    QString extention = namespaceName + QLatin1String("@") + attributes;
-    indexFile = indexPath + QLatin1String("/indexdb40.") + extention;
-    documentFile = indexPath + QLatin1String("/indexdoc40.") + extention;
+    QString extension = namespaceName + QLatin1String("@") + attributes;
+    indexFile = indexPath + QLatin1String("/indexdb40.") + extension;
+    documentFile = indexPath + QLatin1String("/indexdoc40.") + extension;
 }
 
 void Writer::insertInIndex(const QString &string, int docNum)
@@ -192,7 +191,7 @@
     this->m_collectionFile = collectionFile;
     this->m_indexFilesFolder = indexFilesFolder;
 
-    start(QThread::NormalPriority);
+    start(QThread::LowestPriority);
 }
 
 void QHelpSearchIndexWriter::run()
@@ -226,7 +225,7 @@
 
     QStringList namespaces;
     Writer writer(indexPath);
-    foreach(const QString namespaceName, registeredDocs) {
+    foreach(const QString &namespaceName, registeredDocs) {
         mutex.lock();
         if (m_cancel) {
             mutex.unlock();
@@ -242,7 +241,7 @@
         const QList<QStringList> attributeSets =
             engine.filterAttributeSets(namespaceName);
 
-        foreach (QStringList attributes, attributeSets) {
+        foreach (const QStringList &attributes, attributeSets) {
             // cleanup maybe old or unfinished files
             writer.setIndexFile(namespaceName, attributes.join(QLatin1String("@")));
             writer.removeIndex();
@@ -266,7 +265,7 @@
 
             int docNum = 0;
             const QStringList documentsList(documentsSet.toList());
-            foreach(const QString url, documentsList) {
+            foreach(const QString &url, documentsList) {
                 if (m_cancel)
                     return;
 
@@ -347,7 +346,7 @@
         const QList<QStringList> attributeSets =
             engine.filterAttributeSets(namespaceName);
 
-        foreach (QStringList attributes, attributeSets) {
+        foreach (const QStringList &attributes, attributeSets) {
             writer.setIndexFile(namespaceName, attributes.join(QLatin1String("@")));
             writer.removeIndex();
         }
@@ -379,8 +378,7 @@
     return value;
 }
 
-        }   // namespace std
-    }   // namespace fulltextsearch
-}   // namespace qt
+}   // namespace std
+}   // namespace fulltextsearch
 
 QT_END_NAMESPACE