Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
72 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/assistant/lib/fulltextsearch/qanalyzer.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
    5 **
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
     5**
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    analyzer = _CL_POINTER(other.analyzer);
     37    deleteCLuceneAnalyzer = other.deleteCLuceneAnalyzer;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qanalyzer_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qclucene-config_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2936#include <QtCore/QChar>
    3037#include <QtCore/QString>
     38
     39#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
     40#   if !defined(TCHAR)
     41#       define TCHAR wchar_t
     42#   endif
     43#else
     44#   include <windows.h>
     45#endif
    3146
    3247QT_BEGIN_HEADER
     
    88103#endif
    89104
    90 #if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
    91 #   if !defined(TCHAR)
    92 #       define TCHAR wchar_t
    93 #   endif
    94 #else
    95 #   include <windows.h>
    96 #endif
    97 
    98105namespace {
    99106    TCHAR* QStringToTChar(const QString &str)
  • trunk/tools/assistant/lib/fulltextsearch/qdocument.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    3037{
    3138    document = _CL_POINTER(other.document);
     39    deleteCLuceneDocument = other.deleteCLuceneDocument;
    3240}
    3341
  • trunk/tools/assistant/lib/fulltextsearch/qdocument_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qfield.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2431    deleteCLuceneField = true;
    2532}
    26    
     33
    2734QCLuceneFieldPrivate::QCLuceneFieldPrivate(const QCLuceneFieldPrivate &other)
    2835    : QSharedData()
    2936{
    3037    field = _CL_POINTER(other.field);
     38    deleteCLuceneField = other.deleteCLuceneField;
    3139}
    3240
     
    5159    TCHAR* fieldName = QStringToTChar(name);
    5260    TCHAR* fieldValue = QStringToTChar(value);
    53    
     61
    5462    d->field = new lucene::document::Field(fieldName, fieldValue, configs);
    5563
     
    6775    reader->d->deleteCLuceneReader = false; // clucene takes ownership
    6876    d->field = new lucene::document::Field(fieldName, reader->d->reader, configs);
    69    
     77
    7078    delete [] fieldName;
    7179}
  • trunk/tools/assistant/lib/fulltextsearch/qfield_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qfilter.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2734{
    2835    filter = _CL_POINTER(other.filter);
     36    deleteCLuceneFilter = other.deleteCLuceneFilter;
    2937}
    3038
  • trunk/tools/assistant/lib/fulltextsearch/qfilter_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qhits.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2330    deleteCLuceneHits = true;
    2431}
    25    
     32
    2633QCLuceneHitsPrivate::QCLuceneHitsPrivate(const QCLuceneHitsPrivate &other)
    2734    : QSharedData()
    2835{
    2936    hits = _CL_POINTER(other.hits);
     37    deleteCLuceneHits = other.deleteCLuceneHits;
    3038}
    3139
     
    3745
    3846
    39 QCLuceneHits::QCLuceneHits(const QCLuceneSearcher &searcher, 
     47QCLuceneHits::QCLuceneHits(const QCLuceneSearcher &searcher,
    4048                           const QCLuceneQuery &query, const QCLuceneFilter &filter)
    4149    : d(new QCLuceneHitsPrivate())
  • trunk/tools/assistant/lib/fulltextsearch/qhits_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qindexreader.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    reader = _CL_POINTER(other.reader);
     37    deleteCLuceneIndexReader = other.deleteCLuceneIndexReader;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qindexreader_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qindexwriter.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    writer = _CL_POINTER(other.writer);
     37    deleteCLuceneIndexWriter = other.deleteCLuceneIndexWriter;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qindexwriter_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qquery.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2936{
    3037    query = _CL_POINTER(other.query);
     38    deleteCLuceneQuery = other.deleteCLuceneQuery;
    3139}
    3240
  • trunk/tools/assistant/lib/fulltextsearch/qquery_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qqueryparser.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2936{
    3037    queryParser = _CL_POINTER(other.queryParser);
     38    deleteCLuceneQueryParser = other.deleteCLuceneQueryParser;
    3139}
    3240
     
    3846
    3947
    40 QCLuceneQueryParser::QCLuceneQueryParser(const QString &field, 
     48QCLuceneQueryParser::QCLuceneQueryParser(const QString &field,
    4149                                         QCLuceneAnalyzer &analyzer)
    4250    : d(new QCLuceneQueryParserPrivate())
     
    4553{
    4654    TCHAR *fieldName = QStringToTChar(field);
    47    
    48     d->queryParser = new lucene::queryParser::QueryParser(fieldName, 
     55
     56    d->queryParser = new lucene::queryParser::QueryParser(fieldName,
    4957        analyzer.d->analyzer);
    5058
     
    114122}
    115123
    116 QCLuceneQuery* QCLuceneMultiFieldQueryParser::parse(const QString &query, 
     124QCLuceneQuery* QCLuceneMultiFieldQueryParser::parse(const QString &query,
    117125                                                    const QStringList &fieldList,
    118126                                                    QCLuceneAnalyzer &analyzer)
     
    144152            qint32 flag = flags.at(i);
    145153            switch (flag) {
    146                 case QCLuceneMultiFieldQueryParser::REQUIRED_FIELD: {   
     154                case QCLuceneMultiFieldQueryParser::REQUIRED_FIELD: {
    147155                    retValue->add(q, true, true, false);
    148156                }   break;
  • trunk/tools/assistant/lib/fulltextsearch/qqueryparser_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qreader.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    1724QT_BEGIN_NAMESPACE
    1825
    19 QCLuceneReaderPrivate::QCLuceneReaderPrivate() 
     26QCLuceneReaderPrivate::QCLuceneReaderPrivate()
    2027    : QSharedData()
    21 { 
    22     reader = 0; 
     28{
     29    reader = 0;
    2330    deleteCLuceneReader = true;
    2431}
     
    2633QCLuceneReaderPrivate::QCLuceneReaderPrivate(const QCLuceneReaderPrivate &other)
    2734    : QSharedData()
    28 {
    29     reader = _CL_POINTER(other.reader);
     35{
     36    reader = _CL_POINTER(other.reader);
     37    deleteCLuceneReader = other.deleteCLuceneReader;
    3038}
    3139
    32 QCLuceneReaderPrivate::~QCLuceneReaderPrivate() 
    33 { 
     40QCLuceneReaderPrivate::~QCLuceneReaderPrivate()
     41{
    3442    if (deleteCLuceneReader)
    3543        _CLDECDELETE(reader);
    3644}
    37    
    3845
    3946QCLuceneReader::QCLuceneReader()
     
    6370}
    6471
    65 QCLuceneStringReader::QCLuceneStringReader(const QString &value, qint32 length, 
     72QCLuceneStringReader::QCLuceneStringReader(const QString &value, qint32 length,
    6673                                           bool copyData)
    6774    : QCLuceneReader()
  • trunk/tools/assistant/lib/fulltextsearch/qreader_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    4552{
    4653public:
    47     QCLuceneReaderPrivate(); 
     54    QCLuceneReaderPrivate();
    4855    QCLuceneReaderPrivate(const QCLuceneReaderPrivate &other);
    49    
     56
    5057    ~QCLuceneReaderPrivate();
    51    
     58
    5259    Reader* reader;
    5360    bool deleteCLuceneReader;
  • trunk/tools/assistant/lib/fulltextsearch/qsearchable.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
    5 **
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
     5**
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2734{
    2835    searchable = _CL_POINTER(other.searchable);
     36    deleteCLuceneSearchable = other.deleteCLuceneSearchable;
    2937}
    3038
     
    6472}
    6573
    66 QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query, 
     74QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
    6775                                      const QCLuceneFilter &filter)
    6876{
     
    7078}
    7179
    72 QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query, 
     80QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
    7381                                      const QCLuceneSort &sort)
    7482{
     
    7684}
    7785
    78 QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query, 
     86QCLuceneHits QCLuceneSearcher::search(const QCLuceneQuery &query,
    7987                                      const QCLuceneFilter &filter,
    8088                                      const QCLuceneSort &sort)
     
    8795    : QCLuceneSearcher()
    8896{
    89     lucene::search::IndexSearcher *searcher = 
     97    lucene::search::IndexSearcher *searcher =
    9098        new lucene::search::IndexSearcher(path);
    9199
     
    132140: QCLuceneSearcher()
    133141{
    134     lucene::search::Searchable** list= 
     142    lucene::search::Searchable** list=
    135143        _CL_NEWARRAY(lucene::search::Searchable*, searchables.count());
    136144
     
    162170    if (searcher == 0)
    163171        return 0;
    164    
     172
    165173    return qint32(searcher->subDoc(int32_t(index)));
    166174}
     
    173181    if (searcher == 0)
    174182        return 0;
    175    
     183
    176184    return qint32(searcher->subSearcher(int32_t(index)));
    177185}
     
    184192    if (searcher == 0)
    185193        return 0;
    186    
     194
    187195    return qint32(searcher->searcherIndex(int32_t(index)));
    188196}
  • trunk/tools/assistant/lib/fulltextsearch/qsearchable_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qsort.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    sort = _CL_POINTER(other.sort);
     37    deleteCLuceneSort = other.deleteCLuceneSort;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qsort_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qterm.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    term = _CL_POINTER(other.term);
     37    deleteCLuceneTerm = other.deleteCLuceneTerm;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qterm_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qtoken.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2835{
    2936    token = _CL_POINTER(other.token);
     37    deleteCLuceneToken = other.deleteCLuceneToken;
    3038}
    3139
  • trunk/tools/assistant/lib/fulltextsearch/qtoken_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qtokenizer.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qtokenizer_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/fulltextsearch/qtokenstream.cpp

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
     
    2734{
    2835    tokenStream = _CL_POINTER(other.tokenStream);
     36    deleteCLuceneTokenStream = other.deleteCLuceneTokenStream;
    2937}
    3038
  • trunk/tools/assistant/lib/fulltextsearch/qtokenstream_p.h

    r2 r561  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     3** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team.
     4** All rights reserved.
    55**
    6 ** This file is part of the QCLucene library and is distributable under
    7 ** the terms of the LGPL license as specified in the license.txt file.
     6** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     7** All rights reserved.
     8**
     9** This file may be used under the terms of the GNU Lesser General Public
     10** License version 2.1 as published by the Free Software Foundation and
     11** appearing in the file LICENSE.LGPL included in the packaging of this file.
     12** Please review the following information to ensure the GNU Lesser General
     13** Public License version 2.1 requirements will be met:
     14** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    815**
    916****************************************************************************/
  • trunk/tools/assistant/lib/lib.pro

    r552 r561  
    1 QT += sql xml network
     1QT += sql \
     2    xml \
     3    network
    24TEMPLATE = lib
    35TARGET = QtHelp
    4 DEFINES += QHELP_LIB QT_CLUCENE_SUPPORT
    5 CONFIG += qt warn_on
    6 
     6DEFINES += QHELP_LIB \
     7    QT_CLUCENE_SUPPORT
     8CONFIG += qt \
     9    warn_on
    710include(../../../src/qbase.pri)
    8 
    911QMAKE_TARGET_PRODUCT = Help
    10 QMAKE_TARGET_DESCRIPTION = Help application framework.
     12QMAKE_TARGET_DESCRIPTION = Help \
     13    application \
     14    framework.
    1115DEFINES -= QT_ASCII_CAST_WARNINGS
    12 
    1316qclucene = QtCLucene$${QT_LIBINFIX}
    14 if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
     17if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { 
    1518    mac:qclucene = $${qclucene}_debug
    1619    win32|os2:qclucene = $${qclucene}d
    1720}
    18 linux-lsb-g++:LIBS += --lsb-shared-libs=$$qclucene
    19 unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork QtSql QtXml
    20 LIBS += -l$$qclucene
    21 unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork QtSql QtXml
     21linux-lsb-g++:LIBS_PRIVATE += --lsb-shared-libs=$$qclucene
     22unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
     23    QtSql \
     24    QtXml
     25LIBS_PRIVATE += -l$$qclucene
    2226
    2327RESOURCES += helpsystem.qrc
    24 
    2528SOURCES += qhelpenginecore.cpp \
    26            qhelpengine.cpp \
    27            qhelpdbreader.cpp \
    28            qhelpcontentwidget.cpp \
    29            qhelpindexwidget.cpp \
    30            qhelpgenerator.cpp \
    31            qhelpdatainterface.cpp \
    32            qhelpprojectdata.cpp \
    33            qhelpcollectionhandler.cpp \
    34            qhelpsearchengine.cpp \
    35            qhelpsearchquerywidget.cpp \
    36            qhelpsearchresultwidget.cpp \
    37            qhelpsearchindex_default.cpp \
    38            qhelpsearchindexwriter_default.cpp \
    39            qhelpsearchindexreader_default.cpp
     29    qhelpengine.cpp \
     30    qhelpdbreader.cpp \
     31    qhelpcontentwidget.cpp \
     32    qhelpindexwidget.cpp \
     33    qhelpgenerator.cpp \
     34    qhelpdatainterface.cpp \
     35    qhelpprojectdata.cpp \
     36    qhelpcollectionhandler.cpp \
     37    qhelpsearchengine.cpp \
     38    qhelpsearchquerywidget.cpp \
     39    qhelpsearchresultwidget.cpp \
     40    qhelpsearchindex_default.cpp \
     41    qhelpsearchindexwriter_default.cpp \
     42    qhelpsearchindexreader_default.cpp \
     43    qhelpsearchindexreader.cpp \
     44    qhelp_global.cpp
    4045
    4146# access to clucene
    4247SOURCES += qhelpsearchindexwriter_clucene.cpp \
    43            qhelpsearchindexreader_clucene.cpp
    44 
     48    qhelpsearchindexreader_clucene.cpp
    4549HEADERS += qhelpenginecore.h \
    46            qhelpengine.h \
    47            qhelpengine_p.h \
    48            qhelp_global.h \
    49            qhelpdbreader_p.h \
    50            qhelpcontentwidget.h \
    51            qhelpindexwidget.h \
    52            qhelpgenerator_p.h \
    53            qhelpdatainterface_p.h \
    54            qhelpprojectdata_p.h \
    55            qhelpcollectionhandler_p.h \
    56            qhelpsearchengine.h \
    57            qhelpsearchquerywidget.h \
    58            qhelpsearchresultwidget.h \
    59            qhelpsearchindex_default_p.h \
    60            qhelpsearchindexwriter_default_p.h \
    61            qhelpsearchindexreader_default_p.h
     50    qhelpengine.h \
     51    qhelpengine_p.h \
     52    qhelp_global.h \
     53    qhelpdbreader_p.h \
     54    qhelpcontentwidget.h \
     55    qhelpindexwidget.h \
     56    qhelpgenerator_p.h \
     57    qhelpdatainterface_p.h \
     58    qhelpprojectdata_p.h \
     59    qhelpcollectionhandler_p.h \
     60    qhelpsearchengine.h \
     61    qhelpsearchquerywidget.h \
     62    qhelpsearchresultwidget.h \
     63    qhelpsearchindex_default_p.h \
     64    qhelpsearchindexwriter_default_p.h \
     65    qhelpsearchindexreader_default_p.h \
     66    qhelpsearchindexreader_p.h
    6267
    6368# access to clucene
    6469HEADERS += qhelpsearchindexwriter_clucene_p.h \
    65            qhelpsearchindexreader_clucene_p.h
     70    qhelpsearchindexreader_clucene_p.h
  • trunk/tools/assistant/lib/qhelp_global.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include <QtCore/QString>
    4747#include <QtCore/QObject>
    48 #include <QtCore/QRegExp>
    49 #include <QtCore/QMutexLocker>
    50 #include <QtGui/QTextDocument>
    5148
    5249QT_BEGIN_HEADER
     
    6663class QHelpGlobal {
    6764public:
    68     static QString uniquifyConnectionName(const QString &name, void *pointer)
    69     {
    70         static int counter = 0;
    71         static QMutex mutex;
     65    static QString uniquifyConnectionName(const QString &name, void *pointer);
     66    static QString documentTitle(const QString &content);
     67    static QString codecFromData(const QByteArray &data);
    7268
    73         QMutexLocker locker(&mutex);
    74         if (++counter > 1000)
    75             counter = 0;
    76        
    77         return QString::fromLatin1("%1-%2-%3")
    78             .arg(name).arg(long(pointer)).arg(counter);
    79     };
    80 
    81     static QString documentTitle(const QString &content)
    82     {
    83         QString title = QObject::tr("Untitled");
    84         if (!content.isEmpty()) {
    85             int start = content.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7;
    86             int end = content.indexOf(QLatin1String("</title>"), 0, Qt::CaseInsensitive);
    87             if ((end - start) > 0) {
    88                 title = content.mid(start, end - start);
    89                 if (Qt::mightBeRichText(title) || title.contains(QLatin1Char('&'))) {
    90                     QTextDocument doc;
    91                     doc.setHtml(title);
    92                     title = doc.toPlainText();
    93                 }
    94             }
    95         }
    96         return title;
    97     };
    98 
    99     static QString charsetFromData(const QByteArray &data)
    100     {
    101         QString content = QString::fromUtf8(data.constData(), data.size());
    102         int start =
    103             content.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive);
    104         if (start > 0) {
    105             int end;
    106             QRegExp r(QLatin1String("charset=([^\"\\s]+)"));
    107             while (start != -1) {
    108                 end = content.indexOf(QLatin1Char('>'), start) + 1;
    109                 const QString &meta = content.mid(start, end - start).toLower();
    110                 if (r.indexIn(meta) != -1)
    111                     return r.cap(1);
    112                 start = content.indexOf(QLatin1String("<meta"), end,
    113                     Qt::CaseInsensitive);
    114             }
    115         }
    116         return QLatin1String("utf-8");
    117     }
     69private:
     70    static QString codecFromHtmlData(const QByteArray &data);
     71    static QString codecFromXmlData(const QByteArray &data);
    11872};
    11973
  • trunk/tools/assistant/lib/qhelpcollectionhandler.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7777    if (m_dbOpened)
    7878        return true;
    79     emit error(tr("The collection file is not set up yet!"));
     79    emit error(tr("The collection file '%1' is not set up yet!").
     80               arg(m_collectionFile));
    8081    return false;
    8182}
     
    135136    QFileInfo fi(fileName);
    136137    if (fi.exists()) {
    137         emit error(tr("The specified collection file already exists!"));
     138        emit error(tr("The collection file '%1' already exists!").
     139                   arg(fileName));
    138140        return false;
    139141    }
     
    282284
    283285    if (filterNameId < 0) {
    284         emit error(tr("Unknown filter!"));
     286        emit error(tr("Unknown filter '%1'!").arg(filterName));
    285287        return false;
    286288    }
     
    387389    QString ns = reader.namespaceName();
    388390    if (ns.isEmpty()) {
    389         emit error(tr("Invalid documentation file!"));
     391        emit error(tr("Invalid documentation file '%1'!").arg(fileName));
    390392        return false;
    391393    }
     
    554556        namespaceId = m_query.lastInsertId().toInt();
    555557    if (namespaceId < 1) {
    556         emit error(tr("Cannot register namespace!"));
     558        emit error(tr("Cannot register namespace '%1'!").arg(nspace));
    557559        return -1;
    558560    }
     
    578580        if (!db.open()) {
    579581            QSqlDatabase::removeDatabase(QLatin1String("optimize"));
    580             emit error(tr("Cannot open database to optimize!"));
     582            emit error(tr("Cannot open database '%1' to optimize!").arg(fileName));
    581583            return;
    582584        }
  • trunk/tools/assistant/lib/qhelpcollectionhandler_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpcontentwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    519519    header()->hide();
    520520    setUniformRowHeights(true);
    521     connect(this, SIGNAL(activated(const QModelIndex&)),
    522         this, SLOT(showLink(const QModelIndex&)));
     521    connect(this, SIGNAL(activated(QModelIndex)),
     522        this, SLOT(showLink(QModelIndex)));
    523523}
    524524
  • trunk/tools/assistant/lib/qhelpcontentwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpdatainterface.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpdatainterface_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpdbreader.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    9393    db.setDatabaseName(m_dbName);
    9494    if (!db.open()) {
     95        /*: The placeholders are: %1 - The name of the database which cannot be opened
     96                                  %2 - The unique id for the connection
     97                                  %3 - The actual error string */
    9598        m_error = tr("Cannot open database '%1' '%2': %3").arg(m_dbName, m_uniqueId, db.lastError().text());
    9699        QSqlDatabase::removeDatabase(m_uniqueId);
  • trunk/tools/assistant/lib/qhelpdbreader_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpengine.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8181    connect(helpEngineCore, SIGNAL(setupFinished()),
    8282        this, SLOT(applyCurrentFilter()));
    83     connect(helpEngineCore, SIGNAL(currentFilterChanged(const QString&)),
     83    connect(helpEngineCore, SIGNAL(currentFilterChanged(QString)),
    8484        this, SLOT(applyCurrentFilter()));
    8585
  • trunk/tools/assistant/lib/qhelpengine.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpengine_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpenginecore.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6767    q = helpEngineCore;
    6868    collectionHandler = new QHelpCollectionHandler(collectionFile, helpEngineCore);
    69     connect(collectionHandler, SIGNAL(error(const QString&)),
    70         this, SLOT(errorReceived(const QString&)));
     69    connect(collectionHandler, SIGNAL(error(QString)),
     70        this, SLOT(errorReceived(QString)));
    7171    needsSetup = true;
    7272}
     
    176176    indices or contents. If you need one of those use QHelpEngine
    177177    instead.
     178
     179    When creating a custom help viewer the viewer can be
     180    configured by writing a custom collection file which could contain various
     181    keywords to be used to configure the help engine. These keywords and values
     182    and their meaning can be found in the help information for
     183    \l{assistant-custom-help-viewer.html#creating-a-custom-help-collection-file}
     184    {creating a custom help collection file} for Assistant.
    178185*/
    179186
     
    353360QString QHelpEngineCore::documentationFileName(const QString &namespaceName)
    354361{
    355     QString res;
    356     if (!d->setup())
    357         return res;
    358     const QHelpCollectionHandler::DocInfoList docList = d->collectionHandler->registeredDocumentations();
    359     foreach(const QHelpCollectionHandler::DocInfo info, docList) {
    360         if (info.namespaceName == namespaceName) {
    361             QFileInfo fi(d->collectionHandler->collectionFile());
    362             fi.setFile(fi.absolutePath() + QDir::separator() + info.fileName);
    363             res = QDir::cleanPath(fi.absoluteFilePath());
    364             break;
     362    if (d->setup()) {
     363        const QHelpCollectionHandler::DocInfoList docList =
     364            d->collectionHandler->registeredDocumentations();
     365        foreach(const QHelpCollectionHandler::DocInfo info, docList) {
     366            if (info.namespaceName == namespaceName) {
     367                if (QDir::isAbsolutePath(info.fileName))
     368                    return QDir::cleanPath(info.fileName);
     369
     370                QFileInfo fi(d->collectionHandler->collectionFile());
     371                fi.setFile(fi.absolutePath() + QDir::separator() + info.fileName);
     372                return QDir::cleanPath(fi.absoluteFilePath());
     373            }
    365374        }
    366375    }
    367     return res;
     376    return QString();
    368377}
    369378
  • trunk/tools/assistant/lib/qhelpenginecore.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpgenerator.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    468468    emit statusChanged(tr("Insert files..."));
    469469    QList<int> filterAtts;
    470     foreach (QString filterAtt, filterAttributes) {
    471         d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable WHERE Name=?"));
     470    foreach (const QString &filterAtt, filterAttributes) {
     471        d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable "
     472            "WHERE Name=?"));
    472473        d->query->bindValue(0, filterAtt);
    473474        d->query->exec();
     
    483484        return false;
    484485    ++filterSetId;
    485     foreach (int attId, filterAtts) {
    486         d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable VALUES(?, ?)"));
     486    foreach (const int &attId, filterAtts) {
     487        d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable "
     488            "VALUES(?, ?)"));
    487489        d->query->bindValue(0, filterSetId);
    488490        d->query->bindValue(1, attId);
    489491        d->query->exec();
    490492    }
    491 
    492     QString title;
    493     QString charSet;
    494     QMap<int, QSet<int> > tmpFileFilterMap;
    495     QList<FileNameTableData> fileNameDataList;
    496     QList<QByteArray> fileDataList;
    497493
    498494    int tableFileId = 1;
     
    501497        tableFileId = d->query->value(0).toInt() + 1;
    502498
     499    QString title;
     500    QString charSet;
    503501    FileNameTableData fileNameData;
     502    QList<QByteArray> fileDataList;
     503    QMap<int, QSet<int> > tmpFileFilterMap;
     504    QList<FileNameTableData> fileNameDataList;
    504505
    505506    int i = 0;
    506     foreach (QString file, files) {
    507         QFileInfo fi(rootPath + QDir::separator() + file);
     507    foreach (const QString &file, files) {
     508        const QString fileName = QDir::cleanPath(file);
     509        if (fileName.startsWith(QLatin1String("../"))) {
     510            emit warning(tr("The referenced file %1 must be inside or within a "
     511                "subdirectory of (%2). Skipping it.").arg(fileName).arg(rootPath));
     512            continue;
     513        }
     514
     515        QFile fi(rootPath + QDir::separator() + fileName);
    508516        if (!fi.exists()) {
    509517            emit warning(tr("The file %1 does not exist! Skipping it.")
    510                 .arg(fi.absoluteFilePath()));
     518                .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
    511519            continue;
    512520        }
    513521
    514         QFile f(fi.absoluteFilePath());
    515         if (!f.open(QIODevice::ReadOnly)) {
     522        if (!fi.open(QIODevice::ReadOnly)) {
    516523            emit warning(tr("Cannot open file %1! Skipping it.")
    517                 .arg(fi.absoluteFilePath()));
     524                .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
    518525            continue;
    519526        }
    520527
    521         title.clear();
    522         QByteArray data;
    523         data = f.readAll();
    524 
    525         if (fi.suffix() == QLatin1String("html") || fi.suffix() == QLatin1String("htm")) {
    526             charSet = QHelpGlobal::charsetFromData(data);
    527             QTextStream stream(&data);
    528             stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
    529             title = QHelpGlobal::documentTitle(stream.readAll());
     528        QByteArray data = fi.readAll();
     529        if (fileName.endsWith(QLatin1String(".html"))
     530            || fileName.endsWith(QLatin1String(".htm"))) {
     531                charSet = QHelpGlobal::codecFromData(data);
     532                QTextStream stream(&data);
     533                stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
     534                title = QHelpGlobal::documentTitle(stream.readAll());
    530535        } else {
    531             title = fi.fileName();
    532         }
    533 
    534         QString fName = QDir::cleanPath(file);
    535         if (fName.startsWith(QLatin1String("./")))
    536             fName = fName.mid(2);
     536            title = fileName.mid(fileName.lastIndexOf(QLatin1Char('/')) + 1);
     537        }
    537538
    538539        int fileId = -1;
    539         if (!d->fileMap.contains(fName)) {
     540        if (!d->fileMap.contains(fileName)) {
    540541            fileDataList.append(qCompress(data));
    541542
    542             fileNameData.name = fName;
     543            fileNameData.name = fileName;
    543544            fileNameData.fileId = tableFileId;
    544545            fileNameData.title = title;
    545546            fileNameDataList.append(fileNameData);
    546547
    547             d->fileMap.insert(fName, tableFileId);
     548            d->fileMap.insert(fileName, tableFileId);
    548549            d->fileFilterMap.insert(tableFileId, filterAtts.toSet());
    549550            tmpFileFilterMap.insert(tableFileId, filterAtts.toSet());
     
    551552            ++tableFileId;
    552553        } else {
    553             fileId = d->fileMap.value(fName);
    554             foreach (int filter, filterAtts) {
     554            fileId = d->fileMap.value(fileName);
     555            foreach (const int &filter, filterAtts) {
    555556                if (!d->fileFilterMap.value(fileId).contains(filter)
    556557                    && !tmpFileFilterMap.value(fileId).contains(filter)) {
     
    566567        QMap<int, QSet<int> >::const_iterator it = tmpFileFilterMap.constBegin();
    567568        while (it != tmpFileFilterMap.constEnd()) {
    568             QSet<int>::const_iterator i = it.value().constBegin();
    569             while (i != it.value().constEnd()) {
    570                 d->query->prepare(QLatin1String("INSERT INTO FileFilterTable VALUES(?, ?)"));
    571                 d->query->bindValue(0, *i);
     569            QSet<int>::const_iterator si = it.value().constBegin();
     570            while (si != it.value().constEnd()) {
     571                d->query->prepare(QLatin1String("INSERT INTO FileFilterTable "
     572                    "VALUES(?, ?)"));
     573                d->query->bindValue(0, *si);
    572574                d->query->bindValue(1, it.key());
    573575                d->query->exec();
    574                 ++i;
     576                ++si;
    575577            }
    576578            ++it;
     
    579581        QList<QByteArray>::const_iterator fileIt = fileDataList.constBegin();
    580582        while (fileIt != fileDataList.constEnd()) {
    581             d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES (Null, ?)"));
     583            d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES "
     584                "(Null, ?)"));
    582585            d->query->bindValue(0, *fileIt);
    583586            d->query->exec();
     
    587590        }
    588591
    589         QList<FileNameTableData>::const_iterator fileNameIt = fileNameDataList.constBegin();
     592        QList<FileNameTableData>::const_iterator fileNameIt =
     593                                                  fileNameDataList.constBegin();
    590594        while (fileNameIt != fileNameDataList.constEnd()) {
    591             d->query->prepare(QLatin1String("INSERT INTO FileNameTable (FolderId, Name, FileId, Title) "
    592                 " VALUES (?, ?, ?, ?)"));
     595            d->query->prepare(QLatin1String("INSERT INTO FileNameTable "
     596                "(FolderId, Name, FileId, Title) VALUES (?, ?, ?, ?)"));
    593597            d->query->bindValue(0, 1);
    594598            d->query->bindValue(1, (*fileNameIt).name);
     
    610614}
    611615
    612 bool QHelpGenerator::registerCustomFilter(const QString &filterName, const QStringList &filterAttribs,
    613                                           bool forceUpdate)
     616bool QHelpGenerator::registerCustomFilter(const QString &filterName,
     617    const QStringList &filterAttribs, bool forceUpdate)
    614618{
    615619    if (!d->query)
  • trunk/tools/assistant/lib/qhelpgenerator_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpindexwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    131131    m_mutex.unlock();
    132132    wait();
     133    m_abort = false;
    133134}
    134135
     
    165166        m_mutex.lock();
    166167        if (m_abort) {
    167             m_abort = false;
    168168            m_mutex.unlock();
    169169            return;
     
    182182                indicesSet.insert(s);
    183183            if (m_abort) {
    184                 m_abort = false;
    185184                m_mutex.unlock();
    186185                return;
     
    195194    m_indices = indicesSet.values();
    196195    qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan);
    197     m_abort = false;
    198196    m_mutex.unlock();
    199197}
     
    392390    setEditTriggers(QAbstractItemView::NoEditTriggers);
    393391    setUniformItemSizes(true);
    394     connect(this, SIGNAL(activated(const QModelIndex&)),
    395         this, SLOT(showLink(const QModelIndex&)));
     392    connect(this, SIGNAL(activated(QModelIndex)),
     393        this, SLOT(showLink(QModelIndex)));
    396394}
    397395
  • trunk/tools/assistant/lib/qhelpindexwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpprojectdata.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qhelpprojectdata_p.h"
    4343
     44#include <QtCore/QDir>
    4445#include <QtCore/QFileInfo>
    4546#include <QtCore/QStack>
    4647#include <QtCore/QMap>
     48#include <QtCore/QRegExp>
    4749#include <QtCore/QVariant>
    4850#include <QtXml/QXmlStreamReader>
     
    7476    void readFiles();
    7577    void raiseUnknownTokenError();
     78    void addMatchingFiles(const QString &pattern);
     79
     80    QMap<QString, QStringList> dirEntriesCache;
    7681};
    7782
     
    162167        if (isStartElement()) {
    163168            if (name() == QLatin1String("filterAttribute"))
    164                 filterSectionList.last().addFilterAttribute(readElementText());                         
     169                filterSectionList.last().addFilterAttribute(readElementText());
    165170            else if (name() == QLatin1String("toc"))
    166171                readTOC();
     
    245250        if (isStartElement()) {
    246251            if (name() == QLatin1String("file"))
    247                 filterSectionList.last().addFile(readElementText());
     252                addMatchingFiles(readElementText());
    248253            else
    249254                raiseUnknownTokenError();
     
    259264}
    260265
    261 
     266// Expand file pattern and add matches into list. If the pattern does not match
     267// any files, insert the pattern itself so the QHelpGenerator will emit a
     268// meaningful warning later.
     269void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern)
     270{
     271    // The pattern matching is expensive, so we skip it if no
     272    // wildcard symbols occur in the string.
     273    if (!pattern.contains('?') && !pattern.contains('*')
     274        && !pattern.contains('[') && !pattern.contains(']')) {
     275        filterSectionList.last().addFile(pattern);
     276        return;
     277    }
     278
     279    QFileInfo fileInfo(rootPath + '/' + pattern);
     280    const QDir &dir = fileInfo.dir();
     281    const QString &path = dir.canonicalPath();
     282
     283    // QDir::entryList() is expensive, so we cache the results.
     284    QMap<QString, QStringList>::ConstIterator it = dirEntriesCache.find(path);
     285    const QStringList &entries = it != dirEntriesCache.constEnd() ?
     286                                 it.value() : dir.entryList(QDir::Files);
     287    if (it == dirEntriesCache.constEnd())
     288        dirEntriesCache.insert(path, entries);
     289
     290    bool matchFound = false;
     291#ifdef Q_OS_WIN
     292    Qt::CaseSensitivity cs = Qt::CaseInsensitive;
     293#else
     294    Qt::CaseSensitivity cs = Qt::CaseSensitive;
     295#endif
     296    QRegExp regExp(fileInfo.fileName(), cs, QRegExp::Wildcard);
     297    foreach (const QString &file, entries) {
     298        if (regExp.exactMatch(file)) {
     299            matchFound = true;
     300            filterSectionList.last().
     301                addFile(QFileInfo(pattern).dir().path() + '/' + file);
     302        }
     303    }
     304    if (!matchFound)
     305        filterSectionList.last().addFile(pattern);
     306}
    262307
    263308/*!
     
    325370
    326371/*!
    327     \reimp
     372    \internal
    328373*/
    329374QString QHelpProjectData::namespaceName() const
     
    333378
    334379/*!
    335     \reimp
     380    \internal
    336381*/
    337382QString QHelpProjectData::virtualFolder() const
     
    341386
    342387/*!
    343     \reimp
     388    \internal
    344389*/
    345390QList<QHelpDataCustomFilter> QHelpProjectData::customFilters() const
     
    349394
    350395/*!
    351     \reimp
     396    \internal
    352397*/
    353398QList<QHelpDataFilterSection> QHelpProjectData::filterSections() const
     
    357402
    358403/*!
    359     \reimp
     404    \internal
    360405*/
    361406QMap<QString, QVariant> QHelpProjectData::metaData() const
     
    365410
    366411/*!
    367     \reimp
     412    \internal
    368413*/
    369414QString QHelpProjectData::rootPath() const
  • trunk/tools/assistant/lib/qhelpprojectdata_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpsearchengine.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include "qhelpsearchresultwidget.h"
    4646
     47#include "qhelpsearchindexreader_p.h"
    4748#if defined(QT_CLUCENE_SUPPORT)
    4849#   include "qhelpsearchindexreader_clucene_p.h"
     
    8586        , helpEngine(helpEngine)
    8687    {
    87         hitList.clear();
    8888        indexReader = 0;
    8989        indexWriter = 0;
     
    9292    ~QHelpSearchEnginePrivate()
    9393    {
    94         hitList.clear();
    9594        delete indexReader;
    9695        delete indexWriter;
    9796    }
    9897
    99     int hitsCount() const
     98    int hitCount() const
    10099    {
    101100        int count = 0;
    102101        if (indexReader)
    103             count = indexReader->hitsCount();
     102            count = indexReader->hitCount();
    104103
    105104        return count;
     
    108107    QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const
    109108    {
    110         QList<QHelpSearchEngine::SearchHit> returnValue;
    111         if (indexReader) {
    112             for (int i = start; i < end && i < hitsCount(); ++i)
    113                 returnValue.append(indexReader->hit(i));
    114         }
    115         return returnValue;
     109        return indexReader ?
     110                indexReader->hits(start, end) :
     111                QList<QHelpSearchEngine::SearchHit>();
    116112    }
    117113
     
    132128        }
    133129
    134         if (indexWriter) {
    135             indexWriter->cancelIndexing();
    136             indexWriter->updateIndex(helpEngine->collectionFile(),
    137                 indexFilesFolder(), reindex);
    138         }
     130        indexWriter->cancelIndexing();
     131        indexWriter->updateIndex(helpEngine->collectionFile(),
     132                                 indexFilesFolder(), reindex);
    139133    }
    140134
     
    154148
    155149        if (!indexReader) {
    156             indexReader = new QHelpSearchIndexReader();
    157 
     150#if defined(QT_CLUCENE_SUPPORT)
     151            indexReader = new QHelpSearchIndexReaderClucene();
     152#else
     153            indexReader = new QHelpSearchIndexReaderDefault();
     154#endif // QT_CLUCENE_SUPPORT
    158155            connect(indexReader, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted()));
    159156            connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int)));
    160157        }
    161158
    162         if (indexReader) {
    163             m_queryList = queryList;
    164             indexReader->cancelSearching();
    165             indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
    166         }
     159        m_queryList = queryList;
     160        indexReader->cancelSearching();
     161        indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
    167162    }
    168163
     
    190185#if defined(QT_CLUCENE_SUPPORT)
    191186        if (indexWriter && !helpEngine.isNull()) {
    192             indexWriter->optimizeIndex();           
     187            indexWriter->optimizeIndex();
    193188        }
    194189#endif
     
    201196    QHelpSearchResultWidget *resultWidget;
    202197
    203     QHelpSearchIndexReader *indexReader;
     198    qt::fulltextsearch::QHelpSearchIndexReader *indexReader;
    204199    QHelpSearchIndexWriter *indexWriter;
    205200
    206201    QPointer<QHelpEngineCore> helpEngine;
    207     QList<QHelpSearchEngine::SearchHit> hitList;
    208202
    209203    QList<QHelpSearchQuery> m_queryList;
     
    244238
    245239    \value DEFAULT  the default field provided by the search widget, several terms should be
    246                     splitted and stored in the wordlist except search terms enclosed in quotes.
     240                    split and stored in the word list except search terms enclosed in quotes.
    247241    \value FUZZY    a field only provided in use with clucene. Terms should be split in seperate
    248242                    words and passed to the search engine.
     
    331325{
    332326    d = new QHelpSearchEnginePrivate(helpEngine);
    333    
     327
    334328    connect(helpEngine, SIGNAL(setupFinished()), this, SLOT(indexDocumentation()));
    335329
     
    372366
    373367/*!
     368    \obsolete
    374369    Returns the amount of hits the search engine found.
     370    \sa hitCount()
    375371*/
    376372int QHelpSearchEngine::hitsCount() const
    377373{
    378     return d->hitsCount();
     374    return d->hitCount();
     375}
     376
     377/*!
     378    \since 4.6
     379    Returns the amount of hits the search engine found.
     380*/
     381int QHelpSearchEngine::hitCount() const
     382{
     383    return d->hitCount();
    379384}
    380385
  • trunk/tools/assistant/lib/qhelpsearchengine.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8787    QHelpSearchResultWidget* resultWidget();
    8888
    89     int hitsCount() const;
     89#ifdef QT_DEPRECATED
     90    QT_DEPRECATED int hitsCount() const;
     91#endif
     92    int hitCount() const;
    9093
    9194    typedef QPair<QString, QString> SearchHit;
  • trunk/tools/assistant/lib/qhelpsearchindex_default.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpsearchindex_default_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6060        namespace clucene {
    6161
    62 QHelpSearchIndexReader::QHelpSearchIndexReader()
    63     : QThread()
    64     , m_cancel(false)
     62QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
     63    : QHelpSearchIndexReader()
    6564{
    6665    // nothing todo
    6766}
    6867
    69 QHelpSearchIndexReader::~QHelpSearchIndexReader()
    70 {
    71     mutex.lock();
    72     this->m_cancel = true;
    73     waitCondition.wakeOne();
    74     mutex.unlock();
    75 
    76     wait();
    77 }
    78 
    79 void QHelpSearchIndexReader::cancelSearching()
    80 {
    81     mutex.lock();
    82     this->m_cancel = true;
    83     mutex.unlock();
    84 }
    85 
    86 void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder,
    87     const QList<QHelpSearchQuery> &queryList)
    88 {
    89     QMutexLocker lock(&mutex);
    90 
    91     this->hitList.clear();
    92     this->m_cancel = false;
    93     this->m_query = queryList;
    94     this->m_collectionFile = collectionFile;
    95     this->m_indexFilesFolder = indexFilesFolder;
    96 
    97     start(QThread::NormalPriority);
    98 }
    99 
    100 int QHelpSearchIndexReader::hitsCount() const
    101 {
    102     return hitList.count();
    103 }
    104 
    105 QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const
    106 {
    107     return hitList.at(index);
    108 }
    109 
    110 void QHelpSearchIndexReader::run()
     68QHelpSearchIndexReaderClucene::~QHelpSearchIndexReaderClucene()
     69{
     70}
     71
     72
     73void QHelpSearchIndexReaderClucene::run()
    11174{
    11275    mutex.lock();
     
    214177#if !defined(QT_NO_EXCEPTIONS)
    215178        } catch(...) {
     179            mutex.lock();
    216180            hitList.clear();
     181            mutex.unlock();
    217182            emit searchingFinished(0);
    218183        }
     
    221186}
    222187
    223 bool QHelpSearchIndexReader::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
     188bool QHelpSearchIndexReaderClucene::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
    224189    QCLuceneStandardAnalyzer &analyzer)
    225190{
     
    238203}
    239204
    240 bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery,
     205bool QHelpSearchIndexReaderClucene::buildQuery(QCLuceneBooleanQuery &booleanQuery,
    241206    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
    242207{
     
    338303}
    339304
    340 bool QHelpSearchIndexReader::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
     305bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
    341306    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
    342307{
     
    361326}
    362327
    363 void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine,
     328void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engine,
    364329    QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList)
    365330{
     
    417382        } while (it != hitMap.constBegin());
    418383        boostedList += hitList.mid(count, hitList.count());
    419 
     384        mutex.lock();
    420385        hitList = boostedList;
     386        mutex.unlock();
    421387    }
    422388}
  • trunk/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5454//
    5555
    56 #include "qhelpsearchengine.h"
     56#include "qhelpsearchindexreader_p.h"
    5757
    5858#include "fulltextsearch/qanalyzer_p.h"
    5959#include "fulltextsearch/qquery_p.h"
    60 
    61 #include <QtCore/QList>
    62 #include <QtCore/QMutex>
    63 #include <QtCore/QObject>
    64 #include <QtCore/QString>
    65 #include <QtCore/QThread>
    66 #include <QtCore/QWaitCondition>
    67 
    68 class QHelpEngineCore;
    6960
    7061QT_BEGIN_NAMESPACE
     
    7465        namespace clucene {
    7566
    76 class QHelpSearchIndexReader : public QThread
     67class QHelpSearchIndexReaderClucene : public QHelpSearchIndexReader
    7768{
    7869    Q_OBJECT
    7970
    8071public:
    81     QHelpSearchIndexReader();
    82     ~QHelpSearchIndexReader();
    83 
    84     void cancelSearching();
    85     void search(const QString &collectionFile,
    86         const QString &indexFilesFolder,
    87         const QList<QHelpSearchQuery> &queryList);
    88 
    89     int hitsCount() const;
    90     QHelpSearchEngine::SearchHit hit(int index) const;
    91 
    92 signals:
    93     void searchingStarted();
    94     void searchingFinished(int hits);
     72    QHelpSearchIndexReaderClucene();
     73    ~QHelpSearchIndexReaderClucene();
    9574
    9675private:
     
    10483    void boostSearchHits(const QHelpEngineCore &engine, QList<QHelpSearchEngine::SearchHit> &hitList,
    10584        const QList<QHelpSearchQuery> &queryList);
    106 
    107 private:
    108     QMutex mutex;
    109     QList<QHelpSearchEngine::SearchHit> hitList;
    110     QWaitCondition waitCondition;
    111 
    112     bool m_cancel;
    113     QString m_collectionFile;
    114     QList<QHelpSearchQuery> m_query;
    115     QString m_indexFilesFolder;
    11685};
    11786
  • trunk/tools/assistant/lib/qhelpsearchindexreader_default.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    493493
    494494
    495 QHelpSearchIndexReader::QHelpSearchIndexReader()
    496     : QThread()
    497     , m_cancel(false)
     495QHelpSearchIndexReaderDefault::QHelpSearchIndexReaderDefault()
     496    : QHelpSearchIndexReader()
    498497{
    499498    // nothing todo
    500499}
    501500
    502 QHelpSearchIndexReader::~QHelpSearchIndexReader()
    503 {
    504     mutex.lock();
    505     this->m_cancel = true;
    506     waitCondition.wakeOne();
    507     mutex.unlock();
    508 
    509     wait();
    510 }
    511 
    512 void QHelpSearchIndexReader::cancelSearching()
    513 {
    514     mutex.lock();
    515     this->m_cancel = true;
    516     mutex.unlock();
    517 }
    518 
    519 void QHelpSearchIndexReader::search(const QString &collectionFile,
    520                                     const QString &indexFilesFolder,
    521                                     const QList<QHelpSearchQuery> &queryList)
    522 {
    523     QMutexLocker lock(&mutex);
    524 
    525     this->hitList.clear();
    526     this->m_cancel = false;
    527     this->m_query = queryList;
    528     this->m_collectionFile = collectionFile;
    529     this->m_indexFilesFolder = indexFilesFolder;
    530 
    531     start(QThread::NormalPriority);
    532 }
    533 
    534 int QHelpSearchIndexReader::hitsCount() const
    535 {
    536     return hitList.count();
    537 }
    538 
    539 QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const
    540 {
    541     return hitList.at(index);
    542 }
    543 
    544 void QHelpSearchIndexReader::run()
     501QHelpSearchIndexReaderDefault::~QHelpSearchIndexReaderDefault()
     502{
     503}
     504
     505void QHelpSearchIndexReaderDefault::run()
    545506{
    546507    mutex.lock();
     
    572533    if (!engine.setupData())
    573534        return;
    574    
     535
    575536    const QStringList registeredDocs = engine.registeredDocumentations();
    576537    const QStringList indexedNamespaces = engine.customValue(key).toString().
  • trunk/tools/assistant/lib/qhelpsearchindexreader_default_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5555
    5656#include "qhelpsearchindex_default_p.h"
    57 #include "qhelpsearchengine.h"
     57#include "qhelpsearchindexreader_p.h"
    5858
    5959#include <QtCore/QHash>
    6060#include <QtCore/QPair>
    61 #include <QtCore/QList>
    62 #include <QtCore/QMutex>
    63 #include <QtCore/QString>
    64 #include <QtCore/QThread>
    65 #include <QtCore/QObject>
    66 #include <QtCore/QVector>
    67 #include <QtCore/QByteArray>
    68 #include <QtCore/QStringList>
    69 #include <QtCore/QWaitCondition>
    7061
    7162QT_BEGIN_NAMESPACE
     
    122113
    123114
    124 class QHelpSearchIndexReader : public QThread
     115class QHelpSearchIndexReaderDefault : public QHelpSearchIndexReader
    125116{
    126117    Q_OBJECT
    127118
    128119public:
    129     QHelpSearchIndexReader();
    130     ~QHelpSearchIndexReader();
    131 
    132     void cancelSearching();
    133     void search(const QString &collectionFile,
    134         const QString &indexFilesFolder,
    135         const QList<QHelpSearchQuery> &queryList);
    136 
    137     int hitsCount() const;
    138     QHelpSearchEngine::SearchHit hit(int index) const;
    139 
    140 signals:
    141     void searchingStarted();
    142     void searchingFinished(int hits);
     120    QHelpSearchIndexReaderDefault();
     121    ~QHelpSearchIndexReaderDefault();
    143122
    144123private:
     
    146125
    147126private:
    148     QMutex mutex;
    149127    Reader m_reader;
    150     QWaitCondition waitCondition;
    151     QList<QHelpSearchEngine::SearchHit> hitList;
    152 
    153     bool m_cancel;
    154     QList<QHelpSearchQuery> m_query;
    155     QString m_collectionFile;
    156     QString m_indexFilesFolder;
    157128};
    158129
  • trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    431431    {
    432432        QTextStream textStream(data);
    433         QByteArray charSet = QHelpGlobal::charsetFromData(data).toLatin1();
    434         textStream.setCodec(QTextCodec::codecForName(charSet.constData()));
     433        const QByteArray &codec = QHelpGlobal::codecFromData(data).toLatin1();
     434        textStream.setCodec(QTextCodec::codecForName(codec.constData()));
    435435
    436436        QString stream = textStream.readAll();
     
    579579    const QString &indexFilesFolder, bool reindex)
    580580{
     581    wait();
    581582    mutex.lock();
    582583    this->m_cancel = false;
     
    591592void QHelpSearchIndexWriter::optimizeIndex()
    592593{
    593     if (QCLuceneIndexReader::indexExists(m_indexFilesFolder)) {
    594         if (QCLuceneIndexReader::isLocked(m_indexFilesFolder))
    595             return;
    596 
    597         QCLuceneStandardAnalyzer analyzer;
    598         QCLuceneIndexWriter writer(m_indexFilesFolder, analyzer, false);
    599         writer.optimize();
    600         writer.close();
    601     }
     594#if !defined(QT_NO_EXCEPTIONS)
     595    try {
     596#endif
     597        if (QCLuceneIndexReader::indexExists(m_indexFilesFolder)) {
     598            if (QCLuceneIndexReader::isLocked(m_indexFilesFolder))
     599                return;
     600
     601            QCLuceneStandardAnalyzer analyzer;
     602            QCLuceneIndexWriter writer(m_indexFilesFolder, analyzer, false);
     603            writer.optimize();
     604            writer.close();
     605        }
     606#if !defined(QT_NO_EXCEPTIONS)
     607    } catch (...) {
     608        qWarning("Full Text Search, could not optimize index.");
     609        return;
     610    }
     611#endif
    602612}
    603613
     
    640650    QFileInfo fInfo(indexPath);
    641651    if (fInfo.exists() && !fInfo.isWritable()) {
    642         qWarning("Full Text Search, could not create index (missing permissions).");
     652        qWarning("Full Text Search, could not create index (missing permissions for '%s').", qPrintable(indexPath));
    643653        return;
    644654    }
     
    721731#if !defined(QT_NO_EXCEPTIONS)
    722732    } catch (...) {
    723         qWarning("Full Text Search, could not create index writer.");
     733        qWarning("Full Text Search, could not create index writer in '%s'.",
     734            qPrintable(indexPath));
    724735        return;
    725736    }
    726737#endif
    727738
    728     writer->setMergeFactor(100);
    729     writer->setMinMergeDocs(1000);
    730     writer->setMaxFieldLength(QCLuceneIndexWriter::DEFAULT_MAX_FIELD_LENGTH);
     739#if !defined(QT_NO_EXCEPTIONS)
     740    try {
     741#endif
     742        writer->setMergeFactor(100);
     743        writer->setMinMergeDocs(1000);
     744        writer->setMaxFieldLength(QCLuceneIndexWriter::DEFAULT_MAX_FIELD_LENGTH);
     745#if !defined(QT_NO_EXCEPTIONS)
     746    } catch (...) {
     747        qWarning("Full Text Search, could not set writer properties.");
     748        return;
     749    }
     750#endif
    731751
    732752    QStringList namespaces;
     
    734754        mutexLocker.relock();
    735755        if (m_cancel) {
    736             writer->close();
    737             delete writer;
     756            closeIndexWriter(writer);
    738757            emit indexingFinished();
    739758            return;
     
    778797    }
    779798
    780     writer->close();
    781     delete writer;
     799    closeIndexWriter(writer);
    782800
    783801    mutexLocker.relock();
     
    814832        QCLuceneDocument document;
    815833        DocumentHelper helper(url.toString(), engine.fileData(url));
    816         if (helper.addFieldsToDocument(&document, namespaceName, attrList))
    817             writer->addDocument(document, analyzer);
    818 
     834        if (helper.addFieldsToDocument(&document, namespaceName, attrList)) {
     835#if !defined(QT_NO_EXCEPTIONS)
     836            try {
     837#endif
     838                writer->addDocument(document, analyzer);
     839#if !defined(QT_NO_EXCEPTIONS)
     840            } catch (...) {
     841                qWarning("Full Text Search, could not properly add documents.");
     842                return false;
     843            }
     844#endif
     845        }
    819846        locker.relock();
    820847        if (m_cancel)
     
    822849        locker.unlock();
    823850    }
    824 
    825851    return true;
    826852}
     
    862888}
    863889
     890void QHelpSearchIndexWriter::closeIndexWriter(QCLuceneIndexWriter *writer)
     891{
     892#if !defined(QT_NO_EXCEPTIONS)
     893    try {
     894#endif
     895        writer->close();
     896        delete writer;
     897#if !defined(QT_NO_EXCEPTIONS)
     898    } catch (...) {
     899        qWarning("Full Text Search, could not properly close index writer.");
     900    }
     901#endif
     902}
    864903
    865904        }   // namespace clucene
  • trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    105105        const QString &namespaceName, const QStringList &attributes) const;
    106106
     107    void closeIndexWriter(QCLuceneIndexWriter *writer);
     108
    107109private:
    108110    QMutex mutex;
  • trunk/tools/assistant/lib/qhelpsearchindexwriter_default.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    185185                                         bool reindex)
    186186{
     187    wait();
    187188    QMutexLocker lock(&mutex);
    188189
     
    275276
    276277                QTextStream s(data);
    277                 QString en = QHelpGlobal::charsetFromData(data);
     278                QString en = QHelpGlobal::codecFromData(data);
    278279                s.setCodec(QTextCodec::codecForName(en.toLatin1().constData()));
    279280
  • trunk/tools/assistant/lib/qhelpsearchindexwriter_default_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpsearchquerywidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444#include <QtCore/QDebug>
    4545
     46#include <QtCore/QAbstractListModel>
    4647#include <QtCore/QObject>
    4748#include <QtCore/QStringList>
    48 
     49#include <QtCore/QtGlobal>
     50
     51#include <QtGui/QCompleter>
    4952#include <QtGui/QLabel>
    5053#include <QtGui/QLayout>
     
    6164
    6265private:
     66    struct QueryHistory {
     67        explicit QueryHistory() : curQuery(-1) {}
     68        QList<QList<QHelpSearchQuery> > queries;
     69        int curQuery;
     70    };
     71
     72    class CompleterModel : public QAbstractListModel
     73    {
     74    public:
     75        explicit CompleterModel(QObject *parent)
     76          : QAbstractListModel(parent) {}
     77
     78        int rowCount(const QModelIndex &parent = QModelIndex()) const
     79        {
     80            return parent.isValid() ? 0 : termList.size();
     81        }
     82
     83        QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
     84        {
     85            if (!index.isValid() || index.row() >= termList.count()||
     86                (role != Qt::EditRole && role != Qt::DisplayRole))
     87                return QVariant();
     88            return termList.at(index.row());
     89        }
     90
     91        void addTerm(const QString &term)
     92        {
     93            if (!termList.contains(term)) {
     94                termList.append(term);
     95                reset();
     96            }
     97        }
     98
     99    private:
     100        QStringList termList;
     101    };
     102
    63103    QHelpSearchQueryWidgetPrivate()
    64         : QObject()
     104        : QObject(), simpleSearch(true),
     105          searchCompleter(new CompleterModel(this), this)
    65106    {
    66107        searchButton = 0;
     
    137178    }
    138179
     180    void saveQuery(const QList<QHelpSearchQuery> &query, QueryHistory &queryHist)
     181    {
     182        // We only add the query to the list if it is different from the last one.
     183        bool insert = false;
     184        if (queryHist.queries.empty())
     185            insert = true;
     186        else {
     187            const QList<QHelpSearchQuery> &lastQuery = queryHist.queries.last();
     188            if (lastQuery.size() != query.size()) {
     189                insert = true;
     190            } else {
     191                for (int i = 0; i < query.size(); ++i) {
     192                    if (query.at(i).fieldName != lastQuery.at(i).fieldName
     193                        || query.at(i).wordList != lastQuery.at(i).wordList) {
     194                        insert = true;
     195                        break;
     196                    }
     197                }
     198            }
     199        }
     200        if (insert) {
     201            queryHist.queries.append(query);
     202            foreach (const QHelpSearchQuery &queryPart, query) {
     203                static_cast<CompleterModel *>(searchCompleter.model())->
     204                        addTerm(queryPart.wordList.join(" "));
     205            }
     206        }
     207    }
     208
     209    void nextOrPrevQuery(int maxOrMinIndex, int addend,
     210                         QToolButton *thisButton, QToolButton *otherButton)
     211    {
     212        QueryHistory *queryHist;
     213        QList<QLineEdit *> lineEdits;
     214        if (simpleSearch) {
     215            queryHist = &simpleQueries;
     216            lineEdits << defaultQuery;
     217        } else {
     218            queryHist = &complexQueries;
     219            lineEdits << allQuery << atLeastQuery << similarQuery
     220                    << withoutQuery << exactQuery;
     221        }
     222        foreach (QLineEdit *lineEdit, lineEdits)
     223            lineEdit->clear();
     224
     225        // Otherwise, the respective button would be disabled.
     226        Q_ASSERT(queryHist->curQuery != maxOrMinIndex);
     227
     228        queryHist->curQuery += addend;
     229        const QList<QHelpSearchQuery> &query =
     230                queryHist->queries.at(queryHist->curQuery);
     231        foreach (const QHelpSearchQuery &queryPart, query) {
     232            QLineEdit *lineEdit = 0;
     233            switch (queryPart.fieldName) {
     234            case QHelpSearchQuery::DEFAULT:
     235                lineEdit = defaultQuery;
     236                break;
     237            case QHelpSearchQuery::ALL:
     238                lineEdit = allQuery;
     239                break;
     240            case QHelpSearchQuery::ATLEAST:
     241                lineEdit = atLeastQuery;
     242                break;
     243            case QHelpSearchQuery::FUZZY:
     244                lineEdit = similarQuery;
     245                break;
     246            case QHelpSearchQuery::WITHOUT:
     247                lineEdit = withoutQuery;
     248                break;
     249            case QHelpSearchQuery::PHRASE:
     250                lineEdit = exactQuery;
     251                break;
     252            default:
     253                Q_ASSERT(0);
     254            }
     255            lineEdit->setText(queryPart.wordList.join(" "));
     256        }
     257
     258        if (queryHist->curQuery == maxOrMinIndex)
     259            thisButton->setEnabled(false);
     260        otherButton->setEnabled(true);
     261    }
     262
     263    void enableOrDisableToolButtons()
     264    {
     265        const QueryHistory &queryHist =
     266                simpleSearch ? simpleQueries : complexQueries;
     267        prevQueryButton->setEnabled(queryHist.curQuery > 0);
     268        nextQueryButton->setEnabled(queryHist.curQuery <
     269                                    queryHist.queries.size() - 1);
     270    }
     271
    139272private slots:
    140273    void showHideAdvancedSearch()
    141274    {
    142         bool hidden = advancedSearchWidget->isHidden();
    143         if (hidden) {
     275        if (simpleSearch) {
    144276            advancedSearchWidget->show();
    145277            showHideAdvancedSearchButton->setText((QLatin1String("-")));
     
    149281        }
    150282
    151         defaultQuery->setEnabled(!hidden);
     283        simpleSearch = !simpleSearch;
     284        defaultQuery->setEnabled(simpleSearch);
     285        enableOrDisableToolButtons();
     286    }
     287
     288    void searchRequested()
     289    {
     290        QList<QHelpSearchQuery> queryList;
     291#if !defined(QT_CLUCENE_SUPPORT)
     292        queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
     293                                          QStringList(defaultQuery->text())));
     294
     295#else
     296        if (defaultQuery->isEnabled()) {
     297            queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
     298                                              buildTermList(escapeString(defaultQuery->text()))));
     299        } else {
     300            const QRegExp exp(QLatin1String("\\s+"));
     301            QStringList lst = similarQuery->text().split(exp, QString::SkipEmptyParts);
     302            if (!lst.isEmpty()) {
     303                QStringList fuzzy;
     304                foreach (const QString term, lst)
     305                    fuzzy += buildTermList(escapeString(term));
     306                queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy));
     307            }
     308
     309            lst = withoutQuery->text().split(exp, QString::SkipEmptyParts);
     310            if (!lst.isEmpty()) {
     311                QStringList without;
     312                foreach (const QString term, lst)
     313                    without.append(escapeString(term));
     314                queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without));
     315            }
     316
     317            if (!exactQuery->text().isEmpty()) {
     318                QString phrase = exactQuery->text().remove(QLatin1Char('\"'));
     319                phrase = escapeString(phrase.simplified());
     320                queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase)));
     321            }
     322
     323            lst = allQuery->text().split(exp, QString::SkipEmptyParts);
     324            if (!lst.isEmpty()) {
     325                QStringList all;
     326                foreach (const QString term, lst)
     327                    all.append(escapeString(term));
     328                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all));
     329            }
     330
     331            lst = atLeastQuery->text().split(exp, QString::SkipEmptyParts);
     332            if (!lst.isEmpty()) {
     333                QStringList atLeast;
     334                foreach (const QString term, lst)
     335                    atLeast += buildTermList(escapeString(term));
     336                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast));
     337            }
     338        }
     339#endif
     340        QueryHistory &queryHist = simpleSearch ? simpleQueries : complexQueries;
     341        saveQuery(queryList, queryHist);
     342        queryHist.curQuery = queryHist.queries.size() - 1;
     343        if (queryHist.curQuery > 0)
     344            prevQueryButton->setEnabled(true);
     345        nextQueryButton->setEnabled(false);
     346    }
     347
     348    void nextQuery()
     349    {
     350        nextOrPrevQuery((simpleSearch ? simpleQueries : complexQueries).queries.size() - 1,
     351                        1, nextQueryButton, prevQueryButton);
     352    }
     353
     354    void prevQuery()
     355    {
     356        nextOrPrevQuery(0, -1, prevQueryButton, nextQueryButton);
    152357    }
    153358
     
    155360    friend class QHelpSearchQueryWidget;
    156361
     362    bool simpleSearch;
    157363    QPushButton *searchButton;
    158364    QWidget* advancedSearchWidget;
     
    164370    QLineEdit *allQuery;
    165371    QLineEdit *atLeastQuery;
     372    QToolButton *nextQueryButton;
     373    QToolButton *prevQueryButton;
     374    QueryHistory simpleQueries;
     375    QueryHistory complexQueries;
     376    QCompleter searchCompleter;
    166377};
    167378
     
    200411    QLabel *label = new QLabel(tr("Search for:"), this);
    201412    d->defaultQuery = new QLineEdit(this);
     413    d->defaultQuery->setCompleter(&d->searchCompleter);
     414    d->prevQueryButton = new QToolButton(this);
     415    d->prevQueryButton->setArrowType(Qt::LeftArrow);
     416    d->prevQueryButton->setToolTip(tr("Previous search"));
     417    d->prevQueryButton->setEnabled(false);
     418    d->nextQueryButton = new QToolButton(this);
     419    d->nextQueryButton->setArrowType(Qt::RightArrow);
     420    d->nextQueryButton->setToolTip(tr("Next search"));
     421    d->nextQueryButton->setEnabled(false);
    202422    d->searchButton = new QPushButton(tr("Search"), this);
    203423    hBoxLayout->addWidget(label);
    204424    hBoxLayout->addWidget(d->defaultQuery);
     425    hBoxLayout->addWidget(d->prevQueryButton);
     426    hBoxLayout->addWidget(d->nextQueryButton);
    205427    hBoxLayout->addWidget(d->searchButton);
    206428
    207429    vLayout->addLayout(hBoxLayout);
    208430
     431    connect(d->prevQueryButton, SIGNAL(clicked()), d, SLOT(prevQuery()));
     432    connect(d->nextQueryButton, SIGNAL(clicked()), d, SLOT(nextQuery()));
    209433    connect(d->searchButton, SIGNAL(clicked()), this, SIGNAL(search()));
    210434    connect(d->defaultQuery, SIGNAL(returnPressed()), this, SIGNAL(search()));
     
    237461    gLayout->addWidget(label, 0, 0);
    238462    d->similarQuery = new QLineEdit(this);
     463    d->similarQuery->setCompleter(&d->searchCompleter);
    239464    gLayout->addWidget(d->similarQuery, 0, 1);
    240465
     
    242467    gLayout->addWidget(label, 1, 0);
    243468    d->withoutQuery = new QLineEdit(this);
     469    d->withoutQuery->setCompleter(&d->searchCompleter);
    244470    gLayout->addWidget(d->withoutQuery, 1, 1);
    245471
     
    247473    gLayout->addWidget(label, 2, 0);
    248474    d->exactQuery = new QLineEdit(this);
     475    d->exactQuery->setCompleter(&d->searchCompleter);
    249476    gLayout->addWidget(d->exactQuery, 2, 1);
    250477
     
    252479    gLayout->addWidget(label, 3, 0);
    253480    d->allQuery = new QLineEdit(this);
     481    d->allQuery->setCompleter(&d->searchCompleter);
    254482    gLayout->addWidget(d->allQuery, 3, 1);
    255483
     
    257485    gLayout->addWidget(label, 4, 0);
    258486    d->atLeastQuery = new QLineEdit(this);
     487    d->atLeastQuery->setCompleter(&d->searchCompleter);
    259488    gLayout->addWidget(d->atLeastQuery, 4, 1);
    260489
     
    270499        d, SLOT(showHideAdvancedSearch()));
    271500#endif
     501    connect(this, SIGNAL(search()), d, SLOT(searchRequested()));
    272502}
    273503
     
    286516QList<QHelpSearchQuery> QHelpSearchQueryWidget::query() const
    287517{
    288 #if !defined(QT_CLUCENE_SUPPORT)
    289     QList<QHelpSearchQuery> queryList;
    290     queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
    291         QStringList(d->defaultQuery->text())));
    292 
    293     return queryList;
    294 #else
    295     QList<QHelpSearchQuery> queryList;
    296     if (d->defaultQuery->isEnabled()) {
    297         queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
    298             d->buildTermList(d->escapeString(d->defaultQuery->text()))));
    299     } else {
    300         const QRegExp exp(QLatin1String("\\s+"));
    301         QStringList lst = d->similarQuery->text().split(exp, QString::SkipEmptyParts);
    302         if (!lst.isEmpty()) {
    303             QStringList fuzzy;
    304             foreach (const QString term, lst)
    305                 fuzzy += d->buildTermList(d->escapeString(term));
    306             queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy));
    307         }
    308 
    309         lst = d->withoutQuery->text().split(exp, QString::SkipEmptyParts);
    310         if (!lst.isEmpty()) {
    311             QStringList without;
    312             foreach (const QString term, lst)
    313                 without.append(d->escapeString(term));
    314             queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without));
    315         }
    316 
    317         if (!d->exactQuery->text().isEmpty()) {
    318             QString phrase = d->exactQuery->text().remove(QLatin1Char('\"'));
    319             phrase = d->escapeString(phrase.simplified());
    320             queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase)));
    321         }
    322 
    323         lst = d->allQuery->text().split(exp, QString::SkipEmptyParts);
    324         if (!lst.isEmpty()) {
    325             QStringList all;
    326             foreach (const QString term, lst)
    327                 all.append(d->escapeString(term));
    328             queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all));
    329         }
    330 
    331         lst = d->atLeastQuery->text().split(exp, QString::SkipEmptyParts);
    332         if (!lst.isEmpty()) {
    333             QStringList atLeast;
    334             foreach (const QString term, lst)
    335                 atLeast += d->buildTermList(d->escapeString(term));
    336             queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast));
    337         }
    338     }
    339     return queryList;
    340 #endif
     518    const QHelpSearchQueryWidgetPrivate::QueryHistory &queryHist =
     519        d->simpleSearch ? d->simpleQueries : d->complexQueries;
     520    return queryHist.queries.isEmpty() ?
     521        QList<QHelpSearchQuery>() : queryHist.queries.last();
    341522}
    342523
  • trunk/tools/assistant/lib/qhelpsearchquerywidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/tools/assistant/lib/qhelpsearchresultwidget.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6868    {
    6969        header()->hide();
    70         connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
    71             this, SLOT(itemActivated(QTreeWidgetItem*, int)));
     70        connect(this, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
     71            this, SLOT(itemActivated(QTreeWidgetItem*,int)));
    7272    }
    7373
     
    100100        : QTextBrowser(parent)
    101101    {
    102         connect(this, SIGNAL(anchorClicked(const QUrl&)),
    103             this, SIGNAL(requestShowLink(const QUrl&)));
     102        connect(this, SIGNAL(anchorClicked(QUrl)),
     103            this, SIGNAL(requestShowLink(QUrl)));
    104104        setContextMenuPolicy(Qt::NoContextMenu);
    105105    }
     
    170170    {
    171171        if (!searchEngine.isNull()
    172             && resultLastToShow < searchEngine->hitsCount()) {
     172            && resultLastToShow < searchEngine->hitCount()) {
    173173            resultLastToShow += 20;
    174174            resultFirstToShow += 20;
     
    176176            resultTextBrowser->showResultPage(searchEngine->hits(resultFirstToShow,
    177177                resultLastToShow), isIndexing);
    178             if (resultLastToShow >= searchEngine->hitsCount())
     178            if (resultLastToShow >= searchEngine->hitCount())
    179179                updateNextButtonState(false);
    180180        }
     
    185185    {
    186186        if (!searchEngine.isNull()) {
    187             resultLastToShow = searchEngine->hitsCount();
     187            resultLastToShow = searchEngine->hitCount();
    188188            resultFirstToShow = resultLastToShow - (resultLastToShow % 20);
    189189
     
    215215        if (!searchEngine.isNull()) {
    216216            int count = resultLastToShow % 20;
    217             if (count == 0 || resultLastToShow != searchEngine->hitsCount())
     217            if (count == 0 || resultLastToShow != searchEngine->hitCount())
    218218                count = 20;
    219219
     
    299299
    300300        if (!searchEngine.isNull()) {
    301             count = searchEngine->hitsCount();
     301            count = searchEngine->hitCount();
    302302            if (count > 0) {
    303303                first = resultFirstToShow +1;
     
    386386    vLayout->addWidget(d->resultTextBrowser);
    387387
    388     connect(d->resultTextBrowser, SIGNAL(requestShowLink(const QUrl&)), this,
    389         SIGNAL(requestShowLink(const QUrl&)));
     388    connect(d->resultTextBrowser, SIGNAL(requestShowLink(QUrl)), this,
     389        SIGNAL(requestShowLink(QUrl)));
    390390
    391391    connect(d->nextResultPage, SIGNAL(clicked()), d, SLOT(showNextResultPage()));
     
    402402    d->resultTreeWidget = new QDefaultResultWidget(this);
    403403    vLayout->addWidget(d->resultTreeWidget);
    404     connect(d->resultTreeWidget, SIGNAL(requestShowLink(const QUrl&)), this,
    405         SIGNAL(requestShowLink(const QUrl&)));
     404    connect(d->resultTreeWidget, SIGNAL(requestShowLink(QUrl)), this,
     405        SIGNAL(requestShowLink(QUrl)));
    406406#endif
    407407
  • trunk/tools/assistant/lib/qhelpsearchresultwidget.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
Note: See TracChangeset for help on using the changeset viewer.