tools/assistant/lib/qhelpindexwidget.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   128         return;
   128         return;
   129     m_mutex.lock();
   129     m_mutex.lock();
   130     m_abort = true;
   130     m_abort = true;
   131     m_mutex.unlock();
   131     m_mutex.unlock();
   132     wait();
   132     wait();
       
   133     m_abort = false;
   133 }
   134 }
   134 
   135 
   135 QStringList QHelpIndexProvider::indices() const
   136 QStringList QHelpIndexProvider::indices() const
   136 {
   137 {
   137     QMutexLocker lck(&m_mutex);
   138     QMutexLocker lck(&m_mutex);
   162     m_mutex.unlock();
   163     m_mutex.unlock();
   163 
   164 
   164     foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) {
   165     foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) {
   165         m_mutex.lock();
   166         m_mutex.lock();
   166         if (m_abort) {
   167         if (m_abort) {
   167             m_abort = false;
       
   168             m_mutex.unlock();
   168             m_mutex.unlock();
   169             return;
   169             return;
   170         }
   170         }
   171         m_mutex.unlock();
   171         m_mutex.unlock();
   172         QHelpDBReader reader(dbFileName,
   172         QHelpDBReader reader(dbFileName,
   179         if (!lst.isEmpty()) {
   179         if (!lst.isEmpty()) {
   180             m_mutex.lock();
   180             m_mutex.lock();
   181             foreach (QString s, lst)
   181             foreach (QString s, lst)
   182                 indicesSet.insert(s);
   182                 indicesSet.insert(s);
   183             if (m_abort) {
   183             if (m_abort) {
   184                 m_abort = false;
       
   185                 m_mutex.unlock();
   184                 m_mutex.unlock();
   186                 return;
   185                 return;
   187             }
   186             }
   188             QHelpDBReader *orgReader = m_helpEngine->fileNameReaderMap.value(dbFileName);
   187             QHelpDBReader *orgReader = m_helpEngine->fileNameReaderMap.value(dbFileName);
   189             m_indexIds.insert(orgReader, reader.indexIds(atts));
   188             m_indexIds.insert(orgReader, reader.indexIds(atts));
   192         }
   191         }
   193     }
   192     }
   194     m_mutex.lock();
   193     m_mutex.lock();
   195     m_indices = indicesSet.values();
   194     m_indices = indicesSet.values();
   196     qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan);
   195     qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan);
   197     m_abort = false;
       
   198     m_mutex.unlock();
   196     m_mutex.unlock();
   199 }
   197 }
   200 
   198 
   201 
   199 
   202 
   200 
   389 QHelpIndexWidget::QHelpIndexWidget()
   387 QHelpIndexWidget::QHelpIndexWidget()
   390     : QListView(0)
   388     : QListView(0)
   391 {
   389 {
   392     setEditTriggers(QAbstractItemView::NoEditTriggers);
   390     setEditTriggers(QAbstractItemView::NoEditTriggers);
   393     setUniformItemSizes(true);
   391     setUniformItemSizes(true);
   394     connect(this, SIGNAL(activated(const QModelIndex&)),
   392     connect(this, SIGNAL(activated(QModelIndex)),
   395         this, SLOT(showLink(const QModelIndex&)));
   393         this, SLOT(showLink(QModelIndex)));
   396 }
   394 }
   397 
   395 
   398 void QHelpIndexWidget::showLink(const QModelIndex &index)
   396 void QHelpIndexWidget::showLink(const QModelIndex &index)
   399 {
   397 {
   400     if (!index.isValid())
   398     if (!index.isValid())