Index: trunk/tools/activeqt/dumpcpp/main.cpp
===================================================================
--- trunk/tools/activeqt/dumpcpp/main.cpp	(revision 769)
+++ trunk/tools/activeqt/dumpcpp/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/dumpdoc/main.cpp
===================================================================
--- trunk/tools/activeqt/dumpdoc/main.cpp	(revision 769)
+++ trunk/tools/activeqt/dumpdoc/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/ambientproperties.cpp
===================================================================
--- trunk/tools/activeqt/testcon/ambientproperties.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/ambientproperties.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/ambientproperties.h
===================================================================
--- trunk/tools/activeqt/testcon/ambientproperties.h	(revision 769)
+++ trunk/tools/activeqt/testcon/ambientproperties.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/ambientproperties.ui
===================================================================
--- trunk/tools/activeqt/testcon/ambientproperties.ui	(revision 769)
+++ trunk/tools/activeqt/testcon/ambientproperties.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/changeproperties.cpp
===================================================================
--- trunk/tools/activeqt/testcon/changeproperties.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/changeproperties.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -112,8 +112,8 @@
 	    } else {
 		QMessageBox::warning(this, tr("Can't parse input"), 
-		                            QString(tr("Failed to create a color from %1\n"
+		                           tr("Failed to create a color from %1\n"
 					                "The string has to be a valid color name (e.g. 'red')\n"
 							"or a RGB triple of format '#rrggbb'."
-							).arg(editValue->text())));
+							).arg(editValue->text()));
 	    }
 	}
@@ -126,8 +126,8 @@
 	    } else {
 		QMessageBox::warning(this, tr("Can't parse input"), 
-		                            (tr("Failed to create a font from %1\n"
+		                           tr("Failed to create a font from %1\n"
 					        "The string has to have a format family,<point size> or\n"
 						"family,pointsize,stylehint,weight,italic,underline,strikeout,fixedpitch,rawmode."
-							).arg(editValue->text())));
+							).arg(editValue->text()));
 	    }
 	}
Index: trunk/tools/activeqt/testcon/changeproperties.h
===================================================================
--- trunk/tools/activeqt/testcon/changeproperties.h	(revision 769)
+++ trunk/tools/activeqt/testcon/changeproperties.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/changeproperties.ui
===================================================================
--- trunk/tools/activeqt/testcon/changeproperties.ui	(revision 769)
+++ trunk/tools/activeqt/testcon/changeproperties.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/controlinfo.cpp
===================================================================
--- trunk/tools/activeqt/testcon/controlinfo.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/controlinfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/controlinfo.h
===================================================================
--- trunk/tools/activeqt/testcon/controlinfo.h	(revision 769)
+++ trunk/tools/activeqt/testcon/controlinfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/controlinfo.ui
===================================================================
--- trunk/tools/activeqt/testcon/controlinfo.ui	(revision 769)
+++ trunk/tools/activeqt/testcon/controlinfo.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/docuwindow.cpp
===================================================================
--- trunk/tools/activeqt/testcon/docuwindow.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/docuwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/docuwindow.h
===================================================================
--- trunk/tools/activeqt/testcon/docuwindow.h	(revision 769)
+++ trunk/tools/activeqt/testcon/docuwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/invokemethod.cpp
===================================================================
--- trunk/tools/activeqt/testcon/invokemethod.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/invokemethod.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/invokemethod.h
===================================================================
--- trunk/tools/activeqt/testcon/invokemethod.h	(revision 769)
+++ trunk/tools/activeqt/testcon/invokemethod.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/invokemethod.ui
===================================================================
--- trunk/tools/activeqt/testcon/invokemethod.ui	(revision 769)
+++ trunk/tools/activeqt/testcon/invokemethod.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/main.cpp
===================================================================
--- trunk/tools/activeqt/testcon/main.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/mainwindow.cpp
===================================================================
--- trunk/tools/activeqt/testcon/mainwindow.cpp	(revision 769)
+++ trunk/tools/activeqt/testcon/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/mainwindow.h
===================================================================
--- trunk/tools/activeqt/testcon/mainwindow.h	(revision 769)
+++ trunk/tools/activeqt/testcon/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/mainwindow.ui
===================================================================
--- trunk/tools/activeqt/testcon/mainwindow.ui	(revision 769)
+++ trunk/tools/activeqt/testcon/mainwindow.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/scripts/perlscript.pl
===================================================================
--- trunk/tools/activeqt/testcon/scripts/perlscript.pl	(revision 769)
+++ trunk/tools/activeqt/testcon/scripts/perlscript.pl	(revision 846)
@@ -1,5 +1,5 @@
 #############################################################################
 ##
-## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ## All rights reserved.
 ## Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/scripts/pythonscript.py
===================================================================
--- trunk/tools/activeqt/testcon/scripts/pythonscript.py	(revision 769)
+++ trunk/tools/activeqt/testcon/scripts/pythonscript.py	(revision 846)
@@ -2,5 +2,5 @@
 #############################################################################
 ##
-## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ## All rights reserved.
 ## Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/activeqt/testcon/testcon.pro
===================================================================
--- trunk/tools/activeqt/testcon/testcon.pro	(revision 769)
+++ trunk/tools/activeqt/testcon/testcon.pro	(revision 846)
@@ -17,5 +17,5 @@
     QMAKE_POST_LINK = -midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl
 } else {
-    !win32-g++:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR)
+    !win32-g++*:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR)
 
 }
Index: trunk/tools/activeqt/testcon/testcon.rc
===================================================================
--- trunk/tools/activeqt/testcon/testcon.rc	(revision 769)
+++ trunk/tools/activeqt/testcon/testcon.rc	(revision 846)
@@ -24,5 +24,5 @@
 				VALUE "FileVersion", "1,0,0,1\0"
 				VALUE "InternalName", "testcon\0"
-				VALUE "LegalCopyright", "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).0"
+				VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).0"
 				VALUE "LegalTrademarks", "\0"
 				VALUE "OriginalFilename", "testcon.exe\0"
Index: trunk/tools/assistant/assistant.pro
===================================================================
--- trunk/tools/assistant/assistant.pro	(revision 769)
+++ trunk/tools/assistant/assistant.pro	(revision 846)
@@ -4,5 +4,3 @@
 SUBDIRS += lib/fulltextsearch \
            lib \
-           tools \
-           compat \
-           compat/lib \
+           tools
Index: trunk/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	(revision 846)
@@ -32,5 +32,5 @@
     CONFIG -= exceptions_off
     CONFIG += exceptions
-    !win32|win32-g++ {
+    !win32|win32-g++* {
         QMAKE_CFLAGS -= -fno-exceptions
         QMAKE_CXXFLAGS -= -fno-exceptions
@@ -49,4 +49,4 @@
 # the following define could be set globally in case we need it elsewhere
 solaris* {
-    DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\.//')
+    DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\\.//')
 }
Index: trunk/tools/assistant/lib/fulltextsearch/qanalyzer.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qanalyzer.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qanalyzer.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qanalyzer_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qanalyzer_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qanalyzer_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qclucene-config_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qclucene-config_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qclucene-config_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
@@ -315,12 +315,10 @@
 #endif
 
-// Do not use the tchar.h that ships with mingw, this causes the qt build to
-// fail (211547, 211401, etc...), reuse the replacement as with any other compiler
-// #if defined(__MINGW32__)
-//     /* Define to 1 if you have the <tchar.h> header file. */
-// #   ifndef _CL_HAVE_TCHAR_H
-// #   define _CL_HAVE_TCHAR_H  1
-// #   endif
-// #endif
+#if defined(__MINGW32__)
+     /* Define to 1 if you have the <tchar.h> header file. */
+ #   ifndef _CL_HAVE_TCHAR_H
+ #   define _CL_HAVE_TCHAR_H  1
+ #   endif
+#endif
 
 #if defined(__MINGW32__) || defined(__SUNPRO_CC) || defined(__SUNPRO_C)
Index: trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
@@ -37,5 +37,5 @@
 #include <QtCore/QString>
 
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) && !defined(__MINGW32__) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
 #   if !defined(TCHAR)
 #       if defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) && !defined(_ASCII)
Index: trunk/tools/assistant/lib/fulltextsearch/qdocument.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qdocument.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qdocument.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qdocument_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qdocument_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qdocument_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qfield.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qfield.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qfield.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qfield_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qfield_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qfield_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qfilter.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qfilter.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qfilter.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qfilter_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qfilter_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qfilter_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qhits.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qhits.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qhits.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qhits_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qhits_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qhits_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qindexreader.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qindexreader.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qindexreader.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qindexreader_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qindexreader_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qindexreader_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qindexwriter.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
@@ -89,5 +89,5 @@
 
     d->writer->addIndexes(readerArray);
-    delete readerArray; 
+    delete [] readerArray;
 }
 
Index: trunk/tools/assistant/lib/fulltextsearch/qindexwriter_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qindexwriter_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qindexwriter_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qquery.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qquery.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qquery.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qquery_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qquery_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qquery_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qqueryparser.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qqueryparser.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qqueryparser.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qqueryparser_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qqueryparser_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qqueryparser_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qreader.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qreader.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qreader.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qreader_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qreader_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qreader_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qsearchable.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qsearchable.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qsearchable.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qsearchable_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qsearchable_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qsearchable_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qsort.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qsort.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qsort.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
@@ -85,5 +85,5 @@
     for (int i = 0; i < fieldNames.count(); ++i)
         delete [] nameArray[i];
-    delete nameArray;
+    delete [] nameArray;
 }
 
Index: trunk/tools/assistant/lib/fulltextsearch/qsort_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qsort_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qsort_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
@@ -65,7 +65,7 @@
 {
 public:
-	QCLuceneSort();
-	QCLuceneSort(const QStringList &fieldNames);
-    QCLuceneSort(const QString &field, bool reverse = false);
+    QCLuceneSort();
+    explicit QCLuceneSort(const QStringList &fieldNames);
+    explicit QCLuceneSort(const QString &field, bool reverse = false);
 
     virtual ~QCLuceneSort();
@@ -73,5 +73,5 @@
     QString toString() const;
     void setSort(const QStringList &fieldNames);
-	void setSort(const QString &field, bool reverse = false);
+    void setSort(const QString &field, bool reverse = false);
 
 protected:
Index: trunk/tools/assistant/lib/fulltextsearch/qterm.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qterm.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qterm.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qterm_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qterm_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qterm_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtoken.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtoken.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtoken.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtoken_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtoken_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtoken_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtokenizer.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtokenizer.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtokenizer.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtokenizer_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtokenizer_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtokenizer_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtokenstream.cpp
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtokenstream.cpp	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtokenstream.cpp	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/fulltextsearch/qtokenstream_p.h
===================================================================
--- trunk/tools/assistant/lib/fulltextsearch/qtokenstream_p.h	(revision 769)
+++ trunk/tools/assistant/lib/fulltextsearch/qtokenstream_p.h	(revision 846)
@@ -4,5 +4,5 @@
 ** All rights reserved.
 **
-** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Portion Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 **
Index: trunk/tools/assistant/lib/lib.pro
===================================================================
--- trunk/tools/assistant/lib/lib.pro	(revision 769)
+++ trunk/tools/assistant/lib/lib.pro	(revision 846)
@@ -24,5 +24,4 @@
     QtXml
 LIBS_PRIVATE += -l$$qclucene
-
 RESOURCES += helpsystem.qrc
 SOURCES += qhelpenginecore.cpp \
@@ -42,4 +41,5 @@
     qhelpsearchindexreader_default.cpp \
     qhelpsearchindexreader.cpp \
+    qclucenefieldnames.cpp \
     qhelp_global.cpp
 
@@ -64,5 +64,6 @@
     qhelpsearchindexwriter_default_p.h \
     qhelpsearchindexreader_default_p.h \
-    qhelpsearchindexreader_p.h
+    qhelpsearchindexreader_p.h \
+    qclucenefieldnames_p.h
 
 # access to clucene
Index: trunk/tools/assistant/lib/qclucenefieldnames.cpp
===================================================================
--- trunk/tools/assistant/lib/qclucenefieldnames.cpp	(revision 846)
+++ trunk/tools/assistant/lib/qclucenefieldnames.cpp	(revision 846)
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qclucenefieldnames_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace fulltextsearch {
+namespace clucene {
+const QString AttributeField(QLatin1String("attribute"));
+const QString ContentField(QLatin1String("content"));
+const QString NamespaceField(QLatin1String("namespace"));
+const QString PathField(QLatin1String("path"));
+const QString TitleField(QLatin1String("title"));
+const QString TitleTokenizedField(QLatin1String("titleTokenized"));
+} // namespace clucene
+} // namespace fulltextsearch
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/lib/qclucenefieldnames_p.h
===================================================================
--- trunk/tools/assistant/lib/qclucenefieldnames_p.h	(revision 846)
+++ trunk/tools/assistant/lib/qclucenefieldnames_p.h	(revision 846)
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCLUCENEFIELDNAMES_P_H
+#define QCLUCENEFIELDNAMES_P_H
+
+#include <QtCore/QtGlobal>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+namespace fulltextsearch {
+namespace clucene {
+    extern const QString AttributeField;
+    extern const QString ContentField;
+    extern const QString NamespaceField;
+    extern const QString PathField;
+    extern const QString TitleField;
+    extern const QString TitleTokenizedField;
+} // namespace clucene
+} // namespace fulltextsearch
+
+QT_END_NAMESPACE
+
+#endif // QCLUCENEFIELDNAMES_P_H
Index: trunk/tools/assistant/lib/qhelp_global.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelp_global.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelp_global.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,4 +40,5 @@
 ****************************************************************************/
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QRegExp>
 #include <QtCore/QMutexLocker>
@@ -56,10 +57,10 @@
 
     return QString::fromLatin1("%1-%2-%3").
-        arg(name).arg(long(pointer)).arg(counter);
+        arg(name).arg(quintptr(pointer)).arg(counter);
 }
 
 QString QHelpGlobal::documentTitle(const QString &content)
 {
-    QString title = QObject::tr("Untitled");
+    QString title = QCoreApplication::translate("QHelp", "Untitled");
     if (!content.isEmpty()) {
         int start = content.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7;
@@ -87,15 +88,16 @@
 QString QHelpGlobal::codecFromHtmlData(const QByteArray &data)
 {
-    QString content = QString::fromUtf8(data.constData(), data.size());
-    int start = content.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive);
+    QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size()));
+    int start = head.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive);
     if (start > 0) {
-        int end;
         QRegExp r(QLatin1String("charset=([^\"\\s]+)"));
         while (start != -1) {
-            end = content.indexOf(QLatin1Char('>'), start) + 1;
-            const QString &meta = content.mid(start, end - start).toLower();
+            const int end = head.indexOf(QLatin1Char('>'), start) + 1;
+            if (end <= start)
+                break;
+            const QString &meta = head.mid(start, end - start).toLower();
             if (r.indexIn(meta) != -1)
                 return r.cap(1);
-            start = content.indexOf(QLatin1String("<meta"), end,
+            start = head.indexOf(QLatin1String("<meta"), end,
                                     Qt::CaseInsensitive);
         }
@@ -106,7 +108,7 @@
 QString QHelpGlobal::codecFromXmlData(const QByteArray &data)
 {
-    QString content = QString::fromUtf8(data.constData(), data.size());
+    QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size()));
     const QRegExp encodingExp(QLatin1String("^\\s*<\\?xml version="
         "\"\\d\\.\\d\" encoding=\"([^\"]+)\"\\?>.*"));
-    return encodingExp.exactMatch(content) ? encodingExp.cap(1) : QString();
+    return encodingExp.exactMatch(head) ? encodingExp.cap(1) : QString();
 }
Index: trunk/tools/assistant/lib/qhelp_global.h
===================================================================
--- trunk/tools/assistant/lib/qhelp_global.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelp_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpcollectionhandler.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpcollectionhandler.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpcollectionhandler.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -115,4 +115,7 @@
     }
 
+    m_query.exec(QLatin1String("PRAGMA synchronous=OFF"));
+    m_query.exec(QLatin1String("PRAGMA cache_size=3000"));
+
     m_query.exec(QLatin1String("SELECT COUNT(*) FROM sqlite_master WHERE TYPE=\'table\'"
                                "AND Name=\'NamespaceTable\'"));
@@ -163,4 +166,7 @@
         return false;
     }
+
+    copyQuery->exec(QLatin1String("PRAGMA synchronous=OFF"));
+    copyQuery->exec(QLatin1String("PRAGMA cache_size=3000"));
 
     if (!createTables(copyQuery)) {
@@ -309,8 +315,6 @@
     m_query.bindValue(0, filterName);
     m_query.exec();
-    while (m_query.next()) {
+    if (m_query.next())
         nameId = m_query.value(0).toInt();
-        break;
-    }
 
     m_query.exec(QLatin1String("SELECT Id, Name FROM FilterAttributeTable"));
@@ -585,4 +589,6 @@
 
         QSqlQuery query(db);
+        db.exec(QLatin1String("PRAGMA synchronous=OFF"));
+        db.exec(QLatin1String("PRAGMA cache_size=3000"));
         db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS NameIndex ON IndexTable(Name)"));
         db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS FileNameIndex ON FileNameTable(Name)"));
Index: trunk/tools/assistant/lib/qhelpcollectionhandler_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpcollectionhandler_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpcollectionhandler_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -77,5 +77,6 @@
     typedef QList<DocInfo> DocInfoList;
 
-    QHelpCollectionHandler(const QString &collectionFile, QObject *parent = 0);
+    explicit QHelpCollectionHandler(const QString &collectionFile,
+        QObject *parent = 0);
     ~QHelpCollectionHandler();
 
Index: trunk/tools/assistant/lib/qhelpcontentwidget.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpcontentwidget.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpcontentwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -371,5 +371,6 @@
         d->rootItem = 0;
     }
-    reset();
+    if (!onShutDown)
+        reset();
 }
 
Index: trunk/tools/assistant/lib/qhelpcontentwidget.h
===================================================================
--- trunk/tools/assistant/lib/qhelpcontentwidget.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpcontentwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpdatainterface.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpdatainterface.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpdatainterface.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpdatainterface_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpdatainterface_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpdatainterface_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpdbreader.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpdbreader.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpdbreader.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -206,5 +206,5 @@
         "AND c.Name=? AND c.NamespaceId=d.Id AND d.Name=?"));
     m_query->bindValue(0, filePath);
-    m_query->bindValue(1, QLatin1String("./") + filePath);
+    m_query->bindValue(1, QString(QLatin1String("./") + filePath));
     m_query->bindValue(2, virtualFolder);
     m_query->bindValue(3, m_namespace);
Index: trunk/tools/assistant/lib/qhelpdbreader_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpdbreader_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpdbreader_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpengine.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpengine.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpengine.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -76,12 +76,13 @@
     QHelpEngineCorePrivate::init(collectionFile, helpEngineCore);
 
-    contentModel = new QHelpContentModel(this);
-    indexModel = new QHelpIndexModel(this);
-
-    connect(helpEngineCore, SIGNAL(setupFinished()),
-        this, SLOT(applyCurrentFilter()));
-    connect(helpEngineCore, SIGNAL(currentFilterChanged(QString)),
-        this, SLOT(applyCurrentFilter()));
-
+    if (!contentModel)
+        contentModel = new QHelpContentModel(this);
+    if (!indexModel)
+        indexModel = new QHelpIndexModel(this);
+
+    connect(helpEngineCore, SIGNAL(setupFinished()), this,
+        SLOT(applyCurrentFilter()));
+    connect(helpEngineCore, SIGNAL(currentFilterChanged(QString)), this,
+        SLOT(applyCurrentFilter()));
 }
 
Index: trunk/tools/assistant/lib/qhelpengine.h
===================================================================
--- trunk/tools/assistant/lib/qhelpengine.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpengine.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -63,5 +63,5 @@
 
 public:
-    QHelpEngine(const QString &collectionFile, QObject *parent = 0);
+    explicit QHelpEngine(const QString &collectionFile, QObject *parent = 0);
     ~QHelpEngine();
 
Index: trunk/tools/assistant/lib/qhelpengine_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpengine_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpengine_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpenginecore.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpenginecore.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpenginecore.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -120,5 +120,5 @@
             QHelpGlobal::uniquifyConnectionName(info.fileName, this), this);
         if (!reader->init()) {
-            emit q->warning(tr("Cannot open documentation file %1: %2!")
+            emit q->warning(QHelpEngineCore::tr("Cannot open documentation file %1: %2!")
                 .arg(absFileName, reader->errorMessage()));
             continue;
@@ -407,6 +407,7 @@
 /*!
     Adds the new custom filter \a filterName. The filter attributes
-    are specified by \a attributes. The function returns false if
-    the filter can not be added, e.g. when the filter already exists.
+    are specified by \a attributes. If the filter already exists,
+    its attribute set is replaced. The function returns true if
+    the operation succeeded, otherwise it returns false.
 
     \sa customFilters(), removeCustomFilter()
@@ -706,5 +707,5 @@
 
 /*!
-    Returns a description of the last error that occured.
+    Returns a description of the last error that occurred.
 */
 QString QHelpEngineCore::error() const
Index: trunk/tools/assistant/lib/qhelpenginecore.h
===================================================================
--- trunk/tools/assistant/lib/qhelpenginecore.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpenginecore.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -66,5 +66,5 @@
     
 public:
-    QHelpEngineCore(const QString &collectionFile, QObject *parent = 0);
+    explicit QHelpEngineCore(const QString &collectionFile, QObject *parent = 0);
     virtual ~QHelpEngineCore();
 
Index: trunk/tools/assistant/lib/qhelpgenerator.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpgenerator.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -48,4 +48,5 @@
 #include <QtCore/QDir>
 #include <QtCore/QDebug>
+#include <QtCore/QSet>
 #include <QtCore/QVariant>
 #include <QtCore/QDateTime>
@@ -190,4 +191,7 @@
         return false;
     }
+
+    d->query->exec(QLatin1String("PRAGMA synchronous=OFF"));
+    d->query->exec(QLatin1String("PRAGMA cache_size=3000"));
 
     addProgress(1.0);
@@ -538,5 +542,6 @@
 
         int fileId = -1;
-        if (!d->fileMap.contains(fileName)) {
+        QMap<QString, int>::Iterator fileMapIt = d->fileMap.find(fileName);
+        if (fileMapIt == d->fileMap.end()) {
             fileDataList.append(qCompress(data));
 
@@ -552,10 +557,12 @@
             ++tableFileId;
         } else {
-            fileId = d->fileMap.value(fileName);
+            fileId = fileMapIt.value();
+            QSet<int> &fileFilterSet = d->fileFilterMap[fileId];
+            QSet<int> &tmpFileFilterSet = tmpFileFilterMap[fileId];
             foreach (const int &filter, filterAtts) {
-                if (!d->fileFilterMap.value(fileId).contains(filter)
-                    && !tmpFileFilterMap.value(fileId).contains(filter)) {
-                        d->fileFilterMap[fileId].insert(filter);
-                        tmpFileFilterMap[fileId].insert(filter);
+                if (!fileFilterSet.contains(filter)
+                    && !tmpFileFilterSet.contains(filter)) {
+                    fileFilterSet.insert(filter);
+                    tmpFileFilterSet.insert(filter);
                 }
             }
@@ -563,5 +570,5 @@
     }
 
-    if (tmpFileFilterMap.count()) {
+    if (!tmpFileFilterMap.isEmpty()) {
         d->query->exec(QLatin1String("BEGIN"));
         QMap<int, QSet<int> >::const_iterator it = tmpFileFilterMap.constBegin();
@@ -626,6 +633,5 @@
         attributeMap.insert(d->query->value(1).toString(),
             d->query->value(0).toInt());
-        if (idsToInsert.contains(d->query->value(1).toString()))
-            idsToInsert.removeAll(d->query->value(1).toString());
+        idsToInsert.removeAll(d->query->value(1).toString());
     }
 
@@ -675,5 +681,5 @@
 }
 
-bool QHelpGenerator::insertKeywords(const QList<QHelpDataIndexItem> keywords,
+bool QHelpGenerator::insertKeywords(const QList<QHelpDataIndexItem> &keywords,
                                     const QStringList &filterAttributes)
 {
@@ -705,5 +711,16 @@
     int i = 0;
     d->query->exec(QLatin1String("BEGIN"));
+    QSet<QString> indices;
     foreach (const QHelpDataIndexItem &itm, keywords) {
+         // Identical ids make no sense and just confuse the Assistant user,
+         // so we ignore all repetitions.
+        if (indices.contains(itm.identifier))
+            continue;
+
+        // Still empty ids should be ignored, as otherwise we will include only
+        // the first keyword with an empty id.
+        if (!itm.identifier.isEmpty())
+            indices.insert(itm.identifier);
+
         pos = itm.reference.indexOf(QLatin1Char('#'));
         fileName = itm.reference.left(pos);
@@ -717,6 +734,7 @@
             fName = fName.mid(2);
 
-        if (d->fileMap.contains(fName))
-            fileId = d->fileMap.value(fName);
+        QMap<QString, int>::ConstIterator it = d->fileMap.find(fName);
+        if (it != d->fileMap.end())
+            fileId = it.value();
         else
             fileId = 1;
@@ -750,5 +768,5 @@
 
     d->query->exec(QLatin1String("SELECT COUNT(Id) FROM IndexTable"));
-    if (d->query->next() && d->query->value(0).toInt() >= keywords.count())
+    if (d->query->next() && d->query->value(0).toInt() >= indices.count())
         return true;
     return false;
@@ -825,3 +843,67 @@
 }
 
+bool QHelpGenerator::checkLinks(const QHelpDataInterface &helpData)
+{
+    /*
+     * Step 1: Gather the canoncal file paths of all files in the project.
+     *         We use a set, because there will be a lot of look-ups.
+     */
+    QSet<QString> files;
+    foreach (const QHelpDataFilterSection &filterSection, helpData.filterSections()) {
+        foreach (const QString &file, filterSection.files()) {
+            QFileInfo fileInfo(helpData.rootPath() + QDir::separator() + file);
+            const QString &canonicalFileName = fileInfo.canonicalFilePath();
+            if (!fileInfo.exists())
+                emit warning(tr("File '%1' does not exist.").arg(file));
+            else
+                files.insert(canonicalFileName);
+        }
+    }
+
+    /*
+     * Step 2: Check the hypertext and image references of all HTML files.
+     *         Note that we don't parse the files, but simply grep for the
+     *         respective HTML elements. Therefore. contents that are e.g.
+     *         commented out can cause false warning.
+     */
+    bool allLinksOk = true;
+    foreach (const QString &fileName, files) {
+        if (!fileName.endsWith(QLatin1String("html"))
+            && !fileName.endsWith(QLatin1String("htm")))
+            continue;
+        QFile htmlFile(fileName);
+        if (!htmlFile.open(QIODevice::ReadOnly)) {
+            emit warning(tr("File '%1' cannot be opened.").arg(fileName));
+            continue;
+        }
+        const QRegExp linkPattern(QLatin1String("<(?:a href|img src)=\"?([^#\">]+)[#\">]"));
+        QTextStream stream(&htmlFile);
+        const QString codec = QHelpGlobal::codecFromData(htmlFile.read(1000));
+        stream.setCodec(QTextCodec::codecForName(codec.toLatin1().constData()));
+        const QString &content = stream.readAll();
+        QStringList invalidLinks;
+        for (int pos = linkPattern.indexIn(content); pos != -1;
+             pos = linkPattern.indexIn(content, pos + 1)) {
+            const QString& linkedFileName = linkPattern.cap(1);
+            if (linkedFileName.contains(QLatin1String("://")))
+                continue;
+            const QString curDir = QFileInfo(fileName).dir().path();
+            const QString &canonicalLinkedFileName =
+                QFileInfo(curDir + QDir::separator() + linkedFileName).canonicalFilePath();
+            if (!files.contains(canonicalLinkedFileName)
+                && !invalidLinks.contains(canonicalLinkedFileName)) {
+                emit warning(tr("File '%1' contains an invalid link to file '%2'").
+                         arg(fileName).arg(linkedFileName));
+                allLinksOk = false;
+                invalidLinks.append(canonicalLinkedFileName);
+            }
+        }
+    }
+
+    if (!allLinksOk)
+        d->error = tr("Invalid links in HTML files.");
+    return allLinksOk;
+}
+
 QT_END_NAMESPACE
+
Index: trunk/tools/assistant/lib/qhelpgenerator_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpgenerator_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpgenerator_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -75,4 +75,5 @@
     bool generate(QHelpDataInterface *helpData,
         const QString &outputFileName);
+    bool checkLinks(const QHelpDataInterface &helpData);
     QString error() const;
 
@@ -97,5 +98,5 @@
     bool registerVirtualFolder(const QString &folderName, const QString &ns);
     bool insertFilterAttributes(const QStringList &attributes);
-    bool insertKeywords(const QList<QHelpDataIndexItem> keywords,
+    bool insertKeywords(const QList<QHelpDataIndexItem> &keywords,
         const QStringList &filterAttributes);
     bool insertFiles(const QStringList &files, const QString &rootPath,
Index: trunk/tools/assistant/lib/qhelpindexwidget.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpindexwidget.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpindexwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -245,5 +245,6 @@
     d->indexProvider->stopCollecting();
     d->indices.clear();
-    filter(QString());
+    if (!onShutDown)
+        filter(QString());
 }
 
Index: trunk/tools/assistant/lib/qhelpindexwidget.h
===================================================================
--- trunk/tools/assistant/lib/qhelpindexwidget.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpindexwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpprojectdata.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpprojectdata.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpprojectdata.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -42,4 +42,5 @@
 #include "qhelpprojectdata_p.h"
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QDir>
 #include <QtCore/QFileInfo>
@@ -47,4 +48,5 @@
 #include <QtCore/QMap>
 #include <QtCore/QRegExp>
+#include <QtCore/QUrl>
 #include <QtCore/QVariant>
 #include <QtXml/QXmlStreamReader>
@@ -77,4 +79,5 @@
     void raiseUnknownTokenError();
     void addMatchingFiles(const QString &pattern);
+    bool hasValidSyntax(const QString &nameSpace, const QString &vFolder) const;
 
     QMap<QString, QStringList> dirEntriesCache;
@@ -83,5 +86,5 @@
 void QHelpProjectDataPrivate::raiseUnknownTokenError()
 {
-    raiseError(QObject::tr("Unknown token."));
+    raiseError(QCoreApplication::translate("QHelpProject", "Unknown token."));
 }
 
@@ -96,10 +99,12 @@
                 readProject();
             else
-                raiseError(QObject::tr("Unknown token. Expected \"QtHelpProject\"!"));
+                raiseError(QCoreApplication::translate("QHelpProject",
+                               "Unknown token. Expected \"QtHelpProject\"!"));
         }
     }
 
     if (hasError()) {
-        raiseError(QObject::tr("Error in line %1: %2").arg(lineNumber())
+        raiseError(QCoreApplication::translate("QHelpProject",
+                       "Error in line %1: %2").arg(lineNumber())
             .arg(errorString()));
     }
@@ -113,10 +118,12 @@
             if (name() == QLatin1String("virtualFolder")) {
                 virtualFolder = readElementText();
-                if (virtualFolder.contains(QLatin1String("/")))
-                    raiseError(QObject::tr("A virtual folder must not contain a \'/\' character!"));
+                if (!hasValidSyntax(QLatin1String("test"), virtualFolder))
+                    raiseError(QCoreApplication::translate("QHelpProject",
+                                   "Virtual folder has invalid syntax."));
             } else if (name() == QLatin1String("namespace")) {
                 namespaceName = readElementText();
-                if (namespaceName.contains(QLatin1String("/")))
-                    raiseError(QObject::tr("A namespace must not contain a \'/\' character!"));
+                if (!hasValidSyntax(namespaceName, QLatin1String("test")))
+                    raiseError(QCoreApplication::translate("QHelpProject",
+                                   "Namespace has invalid syntax."));
             } else if (name() == QLatin1String("customFilter")) {
                 readCustomFilter();
@@ -126,7 +133,9 @@
                 QString n = attributes().value(QLatin1String("name")).toString();
                 if (!metaData.contains(n))
-                    metaData[n] = attributes().value(QLatin1String("value")).toString();
+                    metaData[n]
+                        = attributes().value(QLatin1String("value")).toString();
                 else
-                    metaData.insert(n, attributes().value(QLatin1String("value")).toString());
+                    metaData.insert(n, attributes().
+                                    value(QLatin1String("value")).toString());
             } else {
                 raiseUnknownTokenError();
@@ -134,7 +143,9 @@
         } else if (isEndElement() && name() == QLatin1String("QtHelpProject")) {
             if (namespaceName.isEmpty())
-                raiseError(QObject::tr("Missing namespace in QtHelpProject."));
+                raiseError(QCoreApplication::translate("QHelpProject",
+                              "Missing namespace in QtHelpProject."));
             else if (virtualFolder.isEmpty())
-                raiseError(QObject::tr("Missing virtual folder in QtHelpProject"));
+                raiseError(QCoreApplication::translate("QHelpProject",
+                               "Missing virtual folder in QtHelpProject"));
             break;
         }
@@ -224,10 +235,12 @@
                     || (attributes().value(QLatin1String("name")).toString().isEmpty()
                     && attributes().value(QLatin1String("id")).toString().isEmpty()))
-                    raiseError(QObject::tr("Missing attribute in keyword at line %1.")
-                        .arg(lineNumber()));
-                filterSectionList.last().addIndex(
-                    QHelpDataIndexItem(attributes().value(QLatin1String("name")).toString(),
-                        attributes().value(QLatin1String("id")).toString(),
-                        attributes().value(QLatin1String("ref")).toString()));
+                    raiseError(QCoreApplication::translate("QHelpProject",
+                                   "Missing attribute in keyword at line %1.")
+                               .arg(lineNumber()));
+                filterSectionList.last()
+                    .addIndex(QHelpDataIndexItem(attributes().
+                                  value(QLatin1String("name")).toString(),
+                              attributes().value(QLatin1String("id")).toString(),
+                              attributes().value(QLatin1String("ref")).toString()));
             } else {
                 raiseUnknownTokenError();
@@ -306,4 +319,22 @@
 }
 
+bool QHelpProjectDataPrivate::hasValidSyntax(const QString &nameSpace,
+                                             const QString &vFolder) const
+{
+    const QLatin1Char slash('/');
+    if (nameSpace.contains(slash) || vFolder.contains(slash))
+        return false;
+    QUrl url;
+    const QLatin1String scheme("qthelp");
+    url.setScheme(scheme);
+    const QString canonicalNamespace = nameSpace.toLower();
+    url.setHost(canonicalNamespace);
+    url.setPath(vFolder);
+
+    const QString expectedUrl(scheme + QLatin1String("://")
+        + canonicalNamespace + slash + vFolder);
+    return url.isValid() && url.toString() == expectedUrl;
+}
+
 /*!
     \internal
@@ -347,6 +378,6 @@
     QFile file(fileName);
     if (!file.open(QIODevice::ReadOnly)) {
-        d->errorMsg = QObject::tr("The input file %1 could not be opened!")
-            .arg(fileName);
+        d->errorMsg = QCoreApplication::translate("QHelpProject",
+                          "The input file %1 could not be opened!").arg(fileName);
         return false;
     }
Index: trunk/tools/assistant/lib/qhelpprojectdata_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpprojectdata_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpprojectdata_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchengine.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchengine.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchengine.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -264,5 +264,5 @@
 
     After starting the indexing process the signal indexingStarted() is emitted and
-    on the end of the indexing process the indexingFinished() is emited. To stop
+    on the end of the indexing process the indexingFinished() is emitted. To stop
     the indexing one can call cancelIndexing().
 
@@ -270,9 +270,9 @@
     thru its index for a given term. To do this one may use the possibility of creating the
     QHelpSearchQuery list by self or reuse the QHelpSearchQueryWidget which has the inbuild
-    functionality to set up a proper search querys list that get's passed to the search engines
+    functionality to set up a proper search queries list that get's passed to the search engines
     search() function.
 
     After the list of querys has been passed to the search engine, the signal searchingStarted()
-    is emited and after the search has finished the searchingFinished() signal is emited. The
+    is emitted and after the search has finished the searchingFinished() signal is emitted. The
     search process can be stopped by calling cancelSearching().
 
@@ -319,5 +319,5 @@
     The QHelpEngine's setupFinished() signal is automatically connected to the
     QHelpSearchEngine's indexing function, so that new documentation will be indexed
-    after the signal is emited.
+    after the signal is emitted.
 */
 QHelpSearchEngine::QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent)
@@ -435,5 +435,5 @@
 
 /*!
-    Starts the search process using the given list of querys \a queryList
+    Starts the search process using the given list of queries \a queryList
     build by the search field name and the values to search for.
 */
Index: trunk/tools/assistant/lib/qhelpsearchengine.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchengine.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchengine.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -81,5 +81,6 @@
 
 public:
-    QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent = 0);
+    explicit QHelpSearchEngine(QHelpEngineCore *helpEngine,
+        QObject *parent = 0);
     ~QHelpSearchEngine();
 
Index: trunk/tools/assistant/lib/qhelpsearchindex_default.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindex_default.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindex_default.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindex_default_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindex_default_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindex_default_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexreader.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,8 +40,10 @@
 ****************************************************************************/
 
+#include "fulltextsearch/qindexreader_p.h"
+#include "fulltextsearch/qqueryparser_p.h"
+#include "fulltextsearch/qsearchable_p.h"
+#include "qclucenefieldnames_p.h"
 #include "qhelpenginecore.h"
-#include "fulltextsearch/qsearchable_p.h"
-#include "fulltextsearch/qqueryparser_p.h"
-#include "fulltextsearch/qindexreader_p.h"
+
 #include "qhelpsearchindexreader_clucene_p.h"
 
@@ -50,4 +52,5 @@
 #include <QtCore/QString>
 #include <QtCore/QFileInfo>
+#include <QtCore/QSharedPointer>
 #include <QtCore/QStringList>
 #include <QtCore/QTextStream>
@@ -108,40 +111,62 @@
         try {
 #endif
-            QCLuceneBooleanQuery booleanQuery;
+            QCLuceneBooleanQuery booleanQueryTitle;
+            QCLuceneBooleanQuery booleanQueryContent;
             QCLuceneStandardAnalyzer analyzer;
-            if (!buildQuery(booleanQuery, queryList, analyzer)) {
+            const QStringList& attribList =
+                engine.filterAttributes(engine.currentFilter());
+            bool titleQueryIsValid = buildQuery(queryList, TitleTokenizedField,
+                                       attribList, booleanQueryTitle, analyzer);
+            bool contentQueryIsValid = buildQuery(queryList, ContentField,
+                                     attribList, booleanQueryContent, analyzer);
+            if (!titleQueryIsValid && !contentQueryIsValid) {
                 emit searchingFinished(0);
                 return;
             }
 
-            const QStringList attribList = engine.filterAttributes(engine.currentFilter());
-            if (!attribList.isEmpty()) {
-                QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+")
-                    + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), analyzer);
-
-                if (!query) {
+            QCLuceneIndexSearcher indexSearcher(indexPath);
+
+            // QCLuceneHits object must be allocated on the heap, because
+            // there is no default constructor.
+            QSharedPointer<QCLuceneHits> titleHits;
+            QSharedPointer<QCLuceneHits> contentHits;
+            if (titleQueryIsValid) {
+                titleHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits(
+                    indexSearcher.search(booleanQueryTitle)));
+            }
+            if (contentQueryIsValid) {
+                contentHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits(
+                    indexSearcher.search(booleanQueryContent)));
+            }
+            bool boost = true;
+            if ((titleHits.isNull() || titleHits->length() == 0)
+                && (contentHits.isNull() || contentHits->length() == 0)) {
+                booleanQueryTitle = QCLuceneBooleanQuery();
+                booleanQueryContent = QCLuceneBooleanQuery();
+                titleQueryIsValid =
+                    buildTryHarderQuery(queryList, TitleTokenizedField,
+                                        attribList, booleanQueryTitle, analyzer);
+                contentQueryIsValid =
+                    buildTryHarderQuery(queryList, ContentField, attribList,
+                                        booleanQueryContent, analyzer);
+                if (!titleQueryIsValid && !contentQueryIsValid) {
                     emit searchingFinished(0);
                     return;
                 }
-                booleanQuery.add(query, true, true, false);
-            }
-
-            QCLuceneIndexSearcher indexSearcher(indexPath);
-            QCLuceneHits hits = indexSearcher.search(booleanQuery);
-
-            bool boost = true;
-            QCLuceneBooleanQuery tryHarderQuery;
-            if (hits.length() == 0) {
-                if (buildTryHarderQuery(tryHarderQuery, queryList, analyzer)) {
-                    if (!attribList.isEmpty()) {
-                        QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+")
-                            + attribList.join(QLatin1String(" +")), QLatin1String("attribute"),
-                            analyzer);
-                        tryHarderQuery.add(query, true, true, false);
-                    }
-                    hits = indexSearcher.search(tryHarderQuery);
-                    boost = (hits.length() == 0);
+                if (titleQueryIsValid) {
+                    titleHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits(
+                        indexSearcher.search(booleanQueryTitle)));
                 }
-            }
+                if (contentQueryIsValid) {
+                    contentHits = QSharedPointer<QCLuceneHits>(new QCLuceneHits(
+                        indexSearcher.search(booleanQueryContent)));
+                }
+                boost = false;
+            }
+            QList<QSharedPointer<QCLuceneHits> > cluceneHitsList;
+            if (!titleHits.isNull())
+                cluceneHitsList.append(titleHits);
+            if (!contentHits.isNull())
+                cluceneHitsList.append(contentHits);
 
             QSet<QString> pathSet;
@@ -149,21 +174,23 @@
             const QStringList namespaceList = engine.registeredDocumentations();
 
-            for (qint32 i = 0; i < hits.length(); i++) {
-                document = hits.document(i);
-                const QString path = document.get(QLatin1String("path"));
-                if (!pathSet.contains(path) && namespaceList.contains(
-                    document.get(QLatin1String("namespace")), Qt::CaseInsensitive)) {
-                    pathSet.insert(path);
-                    hitList.append(qMakePair(path, document.get(QLatin1String("title"))));
+            foreach (const QSharedPointer<QCLuceneHits> &hits, cluceneHitsList) {
+                for (qint32 i = 0; i < hits->length(); i++) {
+                    document = hits->document(i);
+                    const QString path = document.get(PathField);
+                    if (!pathSet.contains(path) && namespaceList.contains(
+                            document.get(NamespaceField), Qt::CaseInsensitive)) {
+                        pathSet.insert(path);
+                        hitList.append(qMakePair(path, document.get(TitleField)));
+                    }
+                    document.clear();
+
+                    mutex.lock();
+                    if (m_cancel) {
+                        mutex.unlock();
+                        emit searchingFinished(0);
+                        return;
+                    }
+                    mutex.unlock();
                 }
-                document.clear();
-
-                mutex.lock();
-                if (m_cancel) {
-                    mutex.unlock();
-                    emit searchingFinished(0);
-                    return;
-                }
-                mutex.unlock();
             }
 
@@ -185,142 +212,203 @@
 }
 
-bool QHelpSearchIndexReaderClucene::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
-    QCLuceneStandardAnalyzer &analyzer)
-{
-    const QLatin1String c("content");
-    const QLatin1String t("titleTokenized");
-
-    QCLuceneQuery *query = QCLuceneQueryParser::parse(term, c, analyzer);
-    QCLuceneQuery *query2 = QCLuceneQueryParser::parse(term, t, analyzer);
-    if (query && query2) {
-        booleanQuery.add(query, true, false, false);
-        booleanQuery.add(query2, true, false, false);
+bool QHelpSearchIndexReaderClucene::buildQuery(
+    const QList<QHelpSearchQuery> &queries, const QString &fieldName,
+    const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery,
+    QCLuceneAnalyzer &analyzer)
+{
+    bool queryIsValid = false;
+    foreach (const QHelpSearchQuery &query, queries) {
+        if (fieldName != ContentField && isNegativeQuery(query)) {
+            queryIsValid = false;
+            break;
+        }
+        switch (query.fieldName) {
+            case QHelpSearchQuery::FUZZY:
+                if (addFuzzyQuery(query, fieldName, booleanQuery, analyzer))
+                    queryIsValid = true;
+                break;
+            case QHelpSearchQuery::WITHOUT:
+                if (fieldName != ContentField)
+                    return false;
+                if (addWithoutQuery(query, fieldName, booleanQuery))
+                    queryIsValid = true;
+                break;
+            case QHelpSearchQuery::PHRASE:
+               if (addPhraseQuery(query, fieldName, booleanQuery))
+                   queryIsValid = true;
+               break;
+            case QHelpSearchQuery::ALL:
+               if (addAllQuery(query, fieldName, booleanQuery))
+                   queryIsValid = true;
+               break;
+            case QHelpSearchQuery::DEFAULT:
+               if (addDefaultQuery(query, fieldName, true, booleanQuery, analyzer))
+                   queryIsValid = true;
+               break;
+            case QHelpSearchQuery::ATLEAST:
+               if (addAtLeastQuery(query, fieldName, booleanQuery, analyzer))
+                   queryIsValid = true;
+               break;
+            default:
+               Q_ASSERT(!"Invalid field name");
+        }
+    }
+
+    if (queryIsValid && !filterAttributes.isEmpty()) {
+        queryIsValid =
+            addAttributesQuery(filterAttributes, booleanQuery, analyzer);
+    }
+
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(
+    const QList<QHelpSearchQuery> &queries, const QString &fieldName,
+    const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery,
+    QCLuceneAnalyzer &analyzer)
+{
+    if (queries.isEmpty())
+        return false;
+    const QHelpSearchQuery &query = queries.front();
+    if (query.fieldName != QHelpSearchQuery::DEFAULT)
+        return false;
+    if (isNegativeQuery(query))
+        return false;
+    if (!addDefaultQuery(query, fieldName, false, booleanQuery, analyzer))
+        return false;
+    if (filterAttributes.isEmpty())
         return true;
-    }
-
-    return false;
-}
-
-bool QHelpSearchIndexReaderClucene::buildQuery(QCLuceneBooleanQuery &booleanQuery,
-    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
-{
-    foreach (const QHelpSearchQuery query, queryList) {
-        switch (query.fieldName) {
-            case QHelpSearchQuery::FUZZY: {
-                const QLatin1String fuzzy("~");
-                foreach (const QString &term, query.wordList) {
-                    if (term.isEmpty()
-                        || !defaultQuery(term.toLower() + fuzzy, booleanQuery, analyzer)) {
-                        return false;
-                    }
-                }
-            }   break;
-
-            case QHelpSearchQuery::WITHOUT: {
-                QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords();
-                foreach (const QString &term, query.wordList) {
-                    if (stopWords.contains(term, Qt::CaseInsensitive))
-                        continue;
-
-                    QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm(
-                        QLatin1String("content"), term.toLower()));
-                    QCLuceneQuery *query2 = new QCLuceneTermQuery(QCLuceneTerm(
-                        QLatin1String("titleTokenized"), term.toLower()));
-
-                    if (query && query2) {
-                        booleanQuery.add(query, true, false, true);
-                        booleanQuery.add(query2, true, false, true);
-                    } else {
-                        return false;
-                    }
-                }
-            }   break;
-
-            case QHelpSearchQuery::PHRASE: {
-                const QString &term = query.wordList.at(0).toLower();
-                if (term.contains(QLatin1Char(' '))) {
-                    QStringList termList = term.split(QLatin1String(" "));
-                    QCLucenePhraseQuery *q = new QCLucenePhraseQuery();
-                    QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords();
-                    foreach (const QString &term, termList) {
-                        if (!stopWords.contains(term, Qt::CaseInsensitive))
-                            q->addTerm(QCLuceneTerm(QLatin1String("content"), term.toLower()));
-                    }
-                    booleanQuery.add(q, true, true, false);
-                } else {
-                    QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm(
-                        QLatin1String("content"), term.toLower()));
-                    QCLuceneQuery *query2 = new QCLuceneTermQuery(QCLuceneTerm(
-                        QLatin1String("titleTokenized"), term.toLower()));
-
-                    if (query && query2) {
-                        booleanQuery.add(query, true, true, false);
-                        booleanQuery.add(query2, true, false, false);
-                    } else {
-                        return false;
-                    }
-                }
-            }   break;
-
-            case QHelpSearchQuery::ALL: {
-                QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords();
-                foreach (const QString &term, query.wordList) {
-                    if (stopWords.contains(term, Qt::CaseInsensitive))
-                        continue;
-
-                    QCLuceneQuery *query = new QCLuceneTermQuery(QCLuceneTerm(
-                        QLatin1String("content"), term.toLower()));
-
-                    if (query) {
-                        booleanQuery.add(query, true, true, false);
-                    } else {
-                        return false;
-                    }
-                }
-            }   break;
-
-            case QHelpSearchQuery::DEFAULT: {
-                foreach (const QString &term, query.wordList) {
-                    QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(),
-                        QLatin1String("content"), analyzer);
-
-                    if (query)
-                        booleanQuery.add(query, true, true, false);
-                }
-            }   break;
-
-            case QHelpSearchQuery::ATLEAST: {
-                foreach (const QString &term, query.wordList) {
-                    if (term.isEmpty() || !defaultQuery(term.toLower(), booleanQuery, analyzer))
-                        return false;
-                }
-            }
-        }
-    }
-
+    return addAttributesQuery(filterAttributes, booleanQuery, analyzer);
+}
+
+bool QHelpSearchIndexReaderClucene::isNegativeQuery(const QHelpSearchQuery &query) const
+{
+    const QString &search = query.wordList.join(" ");
+    return search.contains('!') || search.contains('-')
+            || search.contains(QLatin1String(" NOT "));
+}
+
+bool QHelpSearchIndexReaderClucene::addFuzzyQuery(const QHelpSearchQuery &query,
+    const QString &fieldName, QCLuceneBooleanQuery &booleanQuery,
+    QCLuceneAnalyzer &analyzer)
+{
+    bool queryIsValid = false;
+    const QLatin1String fuzzy("~");
+    foreach (const QString &term, query.wordList) {
+        if (!term.isEmpty()) {
+            QCLuceneQuery *lQuery =
+                    QCLuceneQueryParser::parse(term + fuzzy, fieldName, analyzer);
+            if (lQuery != 0) {
+                booleanQuery.add(lQuery, true, false, false);
+                queryIsValid = true;
+            }
+        }
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addWithoutQuery(const QHelpSearchQuery &query,
+    const QString &fieldName, QCLuceneBooleanQuery &booleanQuery)
+{
+    bool queryIsValid = false;
+    const QStringList &stopWords = QCLuceneStopAnalyzer().englishStopWords();
+    foreach (const QString &term, query.wordList) {
+        if (stopWords.contains(term, Qt::CaseInsensitive))
+            continue;
+        QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm(
+                fieldName, term.toLower()));
+        booleanQuery.add(lQuery, true, false, true);
+        queryIsValid = true;
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addPhraseQuery(const QHelpSearchQuery &query,
+    const QString &fieldName, QCLuceneBooleanQuery &booleanQuery)
+{
+    bool queryIsValid = false;
+    const QString &term = query.wordList.at(0).toLower();
+    if (term.contains(QLatin1Char(' '))) {
+        const QStringList termList = term.split(QLatin1String(" "));
+        QCLucenePhraseQuery *q = new QCLucenePhraseQuery();
+        const QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords();
+        foreach (const QString &term, termList) {
+            if (!stopWords.contains(term, Qt::CaseInsensitive))
+                q->addTerm(QCLuceneTerm(fieldName, term.toLower()));
+        }
+        if (!q->getTerms().isEmpty()) {
+            booleanQuery.add(q, true, true, false);
+            queryIsValid = true;
+        }
+    } else {
+        QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm(
+                fieldName, term.toLower()));
+        booleanQuery.add(lQuery, true, true, false);
+        queryIsValid = true;
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addAllQuery(const QHelpSearchQuery &query,
+    const QString &fieldName, QCLuceneBooleanQuery &booleanQuery)
+{
+    bool queryIsValid = false;
+    const QStringList &stopWords = QCLuceneStopAnalyzer().englishStopWords();
+    foreach (const QString &term, query.wordList) {
+        if (stopWords.contains(term, Qt::CaseInsensitive))
+            continue;
+        QCLuceneQuery *lQuery = new QCLuceneTermQuery(QCLuceneTerm(
+                fieldName, term.toLower()));
+        booleanQuery.add(lQuery, true, true, false);
+        queryIsValid = true;
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addDefaultQuery(const QHelpSearchQuery &query,
+    const QString &fieldName, bool allTermsRequired,
+    QCLuceneBooleanQuery &booleanQuery,
+    QCLuceneAnalyzer &analyzer)
+{
+    bool queryIsValid = false;
+    foreach (const QString &term, query.wordList) {
+        QCLuceneQuery *lQuery =
+            QCLuceneQueryParser::parse(term.toLower(), fieldName, analyzer);
+        if (lQuery) {
+            booleanQuery.add(lQuery, true, allTermsRequired, false);
+            queryIsValid = true;
+        }
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addAtLeastQuery(
+    const QHelpSearchQuery &query, const QString &fieldName,
+    QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer)
+{
+    bool queryIsValid = false;
+    foreach (const QString &term, query.wordList) {
+        if (!term.isEmpty()) {
+            QCLuceneQuery *lQuery =
+                QCLuceneQueryParser::parse(term, fieldName, analyzer);
+            if (lQuery) {
+                booleanQuery.add(lQuery, true, false, false);
+                queryIsValid = true;
+            }
+        }
+    }
+    return queryIsValid;
+}
+
+bool QHelpSearchIndexReaderClucene::addAttributesQuery(
+    const QStringList &filterAttributes, QCLuceneBooleanQuery &booleanQuery,
+    QCLuceneAnalyzer &analyzer)
+{
+    QCLuceneQuery* lQuery = QCLuceneQueryParser::parse(QLatin1String("+")
+        + filterAttributes.join(QLatin1String(" +")), AttributeField, analyzer);
+    if (!lQuery)
+        return false;
+    booleanQuery.add(lQuery, true, true, false);
     return true;
-}
-
-bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
-    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
-{
-    bool retVal = false;
-    foreach (const QHelpSearchQuery query, queryList) {
-        switch (query.fieldName) {
-            default:    break;
-            case QHelpSearchQuery::DEFAULT: {
-                foreach (const QString &term, query.wordList) {
-                    QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(),
-                        QLatin1String("content"), analyzer);
-
-                    if (query) {
-                        retVal = true;
-                        booleanQuery.add(query, true, false, false);
-                    }
-                }
-            }   break;
-        }
-    }
-    return retVal;
 }
 
@@ -328,5 +416,5 @@
     QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList)
 {
-    foreach (const QHelpSearchQuery query, queryList) {
+    foreach (const QHelpSearchQuery &query, queryList) {
         if (query.fieldName != QHelpSearchQuery::DEFAULT)
             continue;
@@ -336,5 +424,5 @@
         QCLuceneStandardAnalyzer analyzer;
         QCLuceneQuery *parsedQuery = QCLuceneQueryParser::parse(
-            joinedQuery, QLatin1String("content"), analyzer);
+            joinedQuery, ContentField, analyzer);
 
         if (parsedQuery) {
@@ -343,6 +431,7 @@
         }
 
-        int length = QString(QLatin1String("content:")).length();
-        int index = joinedQuery.indexOf(QLatin1String("content:"));
+        const QString contentString(ContentField + QLatin1String(":"));
+        int length = contentString.length();
+        int index = joinedQuery.indexOf(contentString);
 
         QString term;
@@ -350,5 +439,5 @@
         QStringList searchTerms;
         while (index != -1) {
-            nextIndex = joinedQuery.indexOf(QLatin1String("content:"), index + 1);
+            nextIndex = joinedQuery.indexOf(contentString, index + 1);
             term = joinedQuery.mid(index + length, nextIndex - (length + index)).simplified();
             if (term.startsWith(QLatin1String("\""))
Index: trunk/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,8 +54,11 @@
 //
 
-#include "qhelpsearchindexreader_p.h"
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
 
 #include "fulltextsearch/qanalyzer_p.h"
 #include "fulltextsearch/qquery_p.h"
+#include "qhelpsearchindexreader_p.h"
 
 QT_BEGIN_NAMESPACE
@@ -74,12 +77,32 @@
 private:
     void run();
-    bool defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
-        QCLuceneStandardAnalyzer &analyzer);
-    bool buildQuery(QCLuceneBooleanQuery &booleanQuery, const QList<QHelpSearchQuery> &queryList,
-        QCLuceneStandardAnalyzer &analyzer);
-    bool buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
-        const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer);
     void boostSearchHits(const QHelpEngineCore &engine, QList<QHelpSearchEngine::SearchHit> &hitList,
         const QList<QHelpSearchQuery> &queryList);
+    bool buildQuery(const QList<QHelpSearchQuery> &queries,
+                    const QString &fieldName,
+                    const QStringList &filterAttributes,
+                    QCLuceneBooleanQuery &booleanQuery,
+                    QCLuceneAnalyzer &analyzer);
+    bool buildTryHarderQuery(const QList<QHelpSearchQuery> &queries,
+                             const QString &fieldName,
+                             const QStringList &filterAttributes,
+                             QCLuceneBooleanQuery &booleanQuery,
+                             QCLuceneAnalyzer &analyzer);
+    bool addFuzzyQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                       QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer);
+    bool addWithoutQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                         QCLuceneBooleanQuery &booleanQuery);
+    bool addPhraseQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                        QCLuceneBooleanQuery &booleanQuery);
+    bool addAllQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                     QCLuceneBooleanQuery &booleanQuery);
+    bool addDefaultQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                         bool allTermsRequired, QCLuceneBooleanQuery &booleanQuery,
+                         QCLuceneAnalyzer &analyzer);
+    bool addAtLeastQuery(const QHelpSearchQuery &query, const QString &fieldName,
+                         QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer);
+    bool addAttributesQuery(const QStringList &filterAttributes,
+               QCLuceneBooleanQuery &booleanQuery, QCLuceneAnalyzer &analyzer);
+    bool isNegativeQuery(const QHelpSearchQuery &query) const;
 };
 
Index: trunk/tools/assistant/lib/qhelpsearchindexreader_default.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader_default.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader_default.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexreader_default_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader_default_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader_default_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -61,7 +61,4 @@
 
 QT_BEGIN_NAMESPACE
-
-struct Entry;
-struct PosEntry;
 
 namespace fulltextsearch {
Index: trunk/tools/assistant/lib/qhelpsearchindexreader_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexreader_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexreader_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,4 +40,5 @@
 ****************************************************************************/
 
+#include "qclucenefieldnames_p.h"
 #include "qhelpenginecore.h"
 #include "qhelp_global.h"
@@ -407,15 +408,15 @@
 
             if(!parsedData.isEmpty()) {
-                document->add(new QCLuceneField(QLatin1String("content"),
+                document->add(new QCLuceneField(ContentField,
                     parsedData,QCLuceneField::INDEX_TOKENIZED));
-                document->add(new QCLuceneField(QLatin1String("path"), fileName,
+                document->add(new QCLuceneField(PathField, fileName,
                     QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED));
-                document->add(new QCLuceneField(QLatin1String("title"), parsedTitle,
+                document->add(new QCLuceneField(TitleField, parsedTitle,
                     QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED));
-                document->add(new QCLuceneField(QLatin1String("titleTokenized"), parsedTitle,
+                document->add(new QCLuceneField(TitleTokenizedField, parsedTitle,
                     QCLuceneField::STORE_YES | QCLuceneField::INDEX_TOKENIZED));
-                document->add(new QCLuceneField(QLatin1String("namespace"), namespaceName,
+                document->add(new QCLuceneField(NamespaceField, namespaceName,
                     QCLuceneField::STORE_YES | QCLuceneField::INDEX_UNTOKENIZED));
-                document->add(new QCLuceneField(QLatin1String("attribute"), attributes,
+                document->add(new QCLuceneField(AttributeField, attributes,
                     QCLuceneField::STORE_YES | QCLuceneField::INDEX_TOKENIZED));
                 return true;
@@ -716,7 +717,5 @@
                     if (indexMap.contains(namespaceName)) {
                         // make sure we really have content indexed for namespace
-                        // NOTE: Extra variable just for GCC 3.3.5
-                        QLatin1String key("namespace");
-                        QCLuceneTermQuery query(QCLuceneTerm(key, namespaceName));
+                        QCLuceneTermQuery query(QCLuceneTerm(NamespaceField, namespaceName));
                         QCLuceneIndexSearcher indexSearcher(indexPath);
                         QCLuceneHits hits = indexSearcher.search(query);
@@ -852,6 +851,5 @@
 
     QCLuceneIndexReader reader = QCLuceneIndexReader::open(indexPath);
-    reader.deleteDocuments(QCLuceneTerm(QLatin1String("namespace"),
-        namespaceName));
+    reader.deleteDocuments(QCLuceneTerm(NamespaceField, namespaceName));
 
     reader.close();
Index: trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexwriter_default.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexwriter_default.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchindexwriter_default_p.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchindexwriter_default_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchquerywidget.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchquerywidget.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchquerywidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -42,6 +42,4 @@
 #include "qhelpsearchquerywidget.h"
 
-#include <QtCore/QDebug>
-
 #include <QtCore/QAbstractListModel>
 #include <QtCore/QObject>
@@ -102,6 +100,7 @@
 
     QHelpSearchQueryWidgetPrivate()
-        : QObject(), simpleSearch(true),
-          searchCompleter(new CompleterModel(this), this)
+        : QObject()
+        , simpleSearch(true)
+        , searchCompleter(new CompleterModel(this), this)
     {
         searchButton = 0;
@@ -135,31 +134,4 @@
         atLeastLabel->setText(QHelpSearchQueryWidget::tr("with <B>at least one</B> of the words:"));
 #endif
-    }
-
-    QString escapeString(const QString &text)
-    {
-        QString retValue = text;
-        const QString escape(QLatin1String("\\"));
-        QStringList escapableCharsList;
-        escapableCharsList << QLatin1String("\\") << QLatin1String("+")
-            << QLatin1String("-") << QLatin1String("!") << QLatin1String("(")
-            << QLatin1String(")") << QLatin1String(":") << QLatin1String("^")
-            << QLatin1String("[") << QLatin1String("]") << QLatin1String("{")
-            << QLatin1String("}") << QLatin1String("~");
-
-        // make sure we won't end up with an empty string
-        foreach (const QString &escapeChar, escapableCharsList) {
-            if (retValue.contains(escapeChar))
-                retValue.replace(escapeChar, QLatin1String(""));
-        }
-        if (retValue.trimmed().isEmpty())
-            return retValue;
-
-        retValue = text; // now really escape the string...
-        foreach (const QString &escapeChar, escapableCharsList) {
-            if (retValue.contains(escapeChar))
-                retValue.replace(escapeChar, escape + escapeChar);
-        }
-        return retValue;
     }
 
@@ -223,6 +195,6 @@
     }
 
-    void nextOrPrevQuery(int maxOrMinIndex, int addend,
-                         QToolButton *thisButton, QToolButton *otherButton)
+    void nextOrPrevQuery(int maxOrMinIndex, int addend, QToolButton *thisButton,
+        QToolButton *otherButton)
     {
         QueryHistory *queryHist;
@@ -234,5 +206,5 @@
             queryHist = &complexQueries;
             lineEdits << allQuery << atLeastQuery << similarQuery
-                    << withoutQuery << exactQuery;
+                << withoutQuery << exactQuery;
         }
         foreach (QLineEdit *lineEdit, lineEdits)
@@ -279,9 +251,9 @@
     void enableOrDisableToolButtons()
     {
-        const QueryHistory &queryHist =
-                simpleSearch ? simpleQueries : complexQueries;
+        const QueryHistory &queryHist = simpleSearch ? simpleQueries
+            : complexQueries;
         prevQueryButton->setEnabled(queryHist.curQuery > 0);
-        nextQueryButton->setEnabled(queryHist.curQuery <
-                                    queryHist.queries.size() - 1);
+        nextQueryButton->setEnabled(queryHist.curQuery
+            < queryHist.queries.size() - 1);
     }
 
@@ -307,18 +279,20 @@
 #if !defined(QT_CLUCENE_SUPPORT)
         queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
-                                          QStringList(defaultQuery->text())));
+            QStringList(defaultQuery->text())));
 
 #else
         if (defaultQuery->isEnabled()) {
             queryList.append(QHelpSearchQuery(QHelpSearchQuery::DEFAULT,
-                                              buildTermList(escapeString(defaultQuery->text()))));
+                buildTermList(defaultQuery->text())));
         } else {
             const QRegExp exp(QLatin1String("\\s+"));
-            QStringList lst = similarQuery->text().split(exp, QString::SkipEmptyParts);
+            QStringList lst = similarQuery->text().split(exp,
+                QString::SkipEmptyParts);
             if (!lst.isEmpty()) {
                 QStringList fuzzy;
                 foreach (const QString &term, lst)
-                    fuzzy += buildTermList(escapeString(term));
-                queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy));
+                    fuzzy += buildTermList(term);
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY,
+                    fuzzy));
             }
 
@@ -327,12 +301,14 @@
                 QStringList without;
                 foreach (const QString &term, lst)
-                    without.append(escapeString(term));
-                queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without));
+                    without.append(term);
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT,
+                    without));
             }
 
             if (!exactQuery->text().isEmpty()) {
                 QString phrase = exactQuery->text().remove(QLatin1Char('\"'));
-                phrase = escapeString(phrase.simplified());
-                queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE, QStringList(phrase)));
+                phrase = phrase.simplified();
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::PHRASE,
+                    QStringList(phrase)));
             }
 
@@ -341,5 +317,5 @@
                 QStringList all;
                 foreach (const QString &term, lst)
-                    all.append(escapeString(term));
+                    all.append(term);
                 queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all));
             }
@@ -349,6 +325,7 @@
                 QStringList atLeast;
                 foreach (const QString &term, lst)
-                    atLeast += buildTermList(escapeString(term));
-                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast));
+                    atLeast += buildTermList(term);
+                queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST,
+                    atLeast));
             }
         }
@@ -364,6 +341,7 @@
     void nextQuery()
     {
-        nextOrPrevQuery((simpleSearch ? simpleQueries : complexQueries).queries.size() - 1,
-                        1, nextQueryButton, prevQueryButton);
+        nextOrPrevQuery((simpleSearch ? simpleQueries
+            : complexQueries).queries.size() - 1, 1, nextQueryButton,
+                prevQueryButton);
     }
 
@@ -416,6 +394,7 @@
 
     This signal is emitted when a the user has the search button invoked.
-    After reciving the signal you can ask the QHelpSearchQueryWidget for the build list
-    of QHelpSearchQuery's that you may pass to the QHelpSearchEngine's search() function.
+    After reciving the signal you can ask the QHelpSearchQueryWidget for the
+    build list of QHelpSearchQuery's that you may pass to the QHelpSearchEngine's
+    search() function.
 */
 
@@ -545,5 +524,6 @@
 }
 
-/*! \reimp
+/*!
+    \reimp
 */
 void QHelpSearchQueryWidget::focusInEvent(QFocusEvent *focusEvent)
Index: trunk/tools/assistant/lib/qhelpsearchquerywidget.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchquerywidget.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchquerywidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/lib/qhelpsearchresultwidget.cpp
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchresultwidget.cpp	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchresultwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -305,5 +305,5 @@
             }
         }
-        hitsLabel->setText(tr("%1 - %2 of %3 Hits").arg(first).arg(last).arg(count));
+        hitsLabel->setText(QHelpSearchResultWidget::tr("%1 - %2 of %n Hits", 0, count).arg(first).arg(last));
     }
 
Index: trunk/tools/assistant/lib/qhelpsearchresultwidget.h
===================================================================
--- trunk/tools/assistant/lib/qhelpsearchresultwidget.h	(revision 769)
+++ trunk/tools/assistant/lib/qhelpsearchresultwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/assistant/aboutdialog.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/aboutdialog.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/aboutdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,4 +39,6 @@
 **
 ****************************************************************************/
+#include "helpviewer.h"
+#include "tracer.h"
 
 #include <QtCore/QBuffer>
@@ -57,4 +59,5 @@
     : QTextBrowser(parent)
 {
+    TRACE_OBJ
     setFrameStyle(QFrame::NoFrame);
     QPalette p;
@@ -65,7 +68,8 @@
 void AboutLabel::setText(const QString &text, const QByteArray &resources)
 {
+    TRACE_OBJ
     QDataStream in(resources);
     in >> m_resourceMap;
-    
+
     QTextBrowser::setText(text);
 }
@@ -73,4 +77,5 @@
 QSize AboutLabel::minimumSizeHint() const
 {
+    TRACE_OBJ
     QTextDocument *doc = document();
     doc->adjustSize();
@@ -80,4 +85,5 @@
 QVariant AboutLabel::loadResource(int type, const QUrl &name)
 {
+    TRACE_OBJ
     if (type == 2 || type == 3) {
         if (m_resourceMap.contains(name.toString())) {
@@ -90,11 +96,10 @@
 void AboutLabel::setSource(const QUrl &url)
 {
-    if (url.isValid() 
-        && (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("ftp") 
-            || url.scheme() == QLatin1String("mailto") || url.path().endsWith(QLatin1String("pdf")))) {
+    TRACE_OBJ
+    if (url.isValid() && (!AbstractHelpViewer::isLocalUrl(url)
+    || !AbstractHelpViewer::canOpenPage(url.path()))) {
         if (!QDesktopServices::openUrl(url)) {
             QMessageBox::warning(this, tr("Warning"),
-                         tr("Unable to launch external application.\n"),
-                         tr("OK"));
+                tr("Unable to launch external application.\n"), tr("OK"));
         }
     }
@@ -102,24 +107,27 @@
 
 AboutDialog::AboutDialog(QWidget *parent)
-    : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint|Qt::WindowTitleHint|Qt::WindowSystemMenuHint)
+    : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint |
+        Qt::WindowTitleHint|Qt::WindowSystemMenuHint)
 {
+    TRACE_OBJ
     m_pixmapLabel = 0;
     m_aboutLabel = new AboutLabel();
-    
+
     m_closeButton = new QPushButton();
     m_closeButton->setText(tr("&Close"));
-    connect(m_closeButton, SIGNAL(clicked()),
-        this, SLOT(close()));
+    connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close()));
 
     m_layout = new QGridLayout(this);
     m_layout->addWidget(m_aboutLabel, 1, 0, 1, -1);
-    m_layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1, 1, 1);
+    m_layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum,
+        QSizePolicy::Fixed), 2, 1, 1, 1);
     m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 0, 1, 1);
     m_layout->addWidget(m_closeButton, 3, 1, 1, 1);
-    m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1);    
+    m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1);
 }
 
 void AboutDialog::setText(const QString &text, const QByteArray &resources)
 {
+    TRACE_OBJ
     m_aboutLabel->setText(text, resources);
     updateSize();
@@ -128,4 +136,5 @@
 void AboutDialog::setPixmap(const QPixmap &pixmap)
 {
+    TRACE_OBJ
     if (!m_pixmapLabel) {
         m_pixmapLabel = new QLabel();
@@ -138,4 +147,5 @@
 QString AboutDialog::documentTitle() const
 {
+    TRACE_OBJ
     return m_aboutLabel->documentTitle();
 }
@@ -143,5 +153,7 @@
 void AboutDialog::updateSize()
 {
-    QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
+    TRACE_OBJ
+    QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos())
+        .size();
     int limit = qMin(screenSize.width()/2, 500);
 
@@ -155,5 +167,5 @@
     if (width > limit)
         width = limit;
-    
+
     QFontMetrics fm(qApp->font("QWorkspaceTitleBar"));
     int windowTitleWidth = qMin(fm.width(windowTitle()) + 50, limit);
@@ -163,6 +175,6 @@
     layout()->activate();
     int height = (layout()->hasHeightForWidth())
-                     ? layout()->totalHeightForWidth(width)
-                     : layout()->totalMinimumSize().height();
+        ? layout()->totalHeightForWidth(width)
+        : layout()->totalMinimumSize().height();
     setFixedSize(width, height);
     QCoreApplication::removePostedEvents(this, QEvent::LayoutRequest);
Index: trunk/tools/assistant/tools/assistant/aboutdialog.h
===================================================================
--- trunk/tools/assistant/tools/assistant/aboutdialog.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/aboutdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/assistant/assistant.pro
===================================================================
--- trunk/tools/assistant/tools/assistant/assistant.pro	(revision 769)
+++ trunk/tools/assistant/tools/assistant/assistant.pro	(revision 846)
@@ -1,70 +1,93 @@
-include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri)
-
+include(../../../shared/fontpanel/fontpanel.pri)
 TEMPLATE = app
 LANGUAGE = C++
 TARGET = assistant
+contains(QT_CONFIG, webkit):QT += webkit
+CONFIG += qt \
+    warn_on \
+    help
+QT += network
+PROJECTNAME = Assistant
+DESTDIR = ../../../../bin
+target.path = $$[QT_INSTALL_BINS]
+INSTALLS += target
+DEPENDPATH += ../shared
 
+# ## Work around a qmake issue when statically linking to
+# ## not-yet-installed plugins
+QMAKE_LIBDIR += $$QT_BUILD_TREE/plugins/sqldrivers
+HEADERS += aboutdialog.h \
+    bookmarkdialog.h \
+    bookmarkfiltermodel.h \
+    bookmarkitem.h \
+    bookmarkmanager.h \
+    bookmarkmanagerwidget.h \
+    bookmarkmodel.h \
+    centralwidget.h \
+    cmdlineparser.h \
+    contentwindow.h \
+    findwidget.h \
+    filternamedialog.h \
+    helpenginewrapper.h \
+    helpviewer.h \
+    indexwindow.h \
+    installdialog.h \
+    mainwindow.h \
+    preferencesdialog.h \
+    qtdocinstaller.h \
+    remotecontrol.h \
+    searchwidget.h \
+    topicchooser.h \
+    tracer.h \
+    xbelsupport.h \
+    ../shared/collectionconfiguration.h
 contains(QT_CONFIG, webkit) {
-    QT += webkit
+    HEADERS += helpviewer_qwv.h
+} else {
+   HEADERS += helpviewer_qtb.h
+ }
+win32|os2:HEADERS += remotecontrol_win.h
+
+SOURCES += aboutdialog.cpp \
+    bookmarkdialog.cpp \
+    bookmarkfiltermodel.cpp \
+    bookmarkitem.cpp \
+    bookmarkmanager.cpp \
+    bookmarkmanagerwidget.cpp \
+    bookmarkmodel.cpp \
+    centralwidget.cpp \
+    cmdlineparser.cpp \
+    contentwindow.cpp \
+    findwidget.cpp \
+    filternamedialog.cpp \
+    helpenginewrapper.cpp \
+    helpviewer.cpp \
+    indexwindow.cpp \
+    installdialog.cpp \
+    main.cpp \
+    mainwindow.cpp \
+    preferencesdialog.cpp \
+    qtdocinstaller.cpp \
+    remotecontrol.cpp \
+    searchwidget.cpp \
+    topicchooser.cpp \
+    xbelsupport.cpp \
+    ../shared/collectionconfiguration.cpp
+ contains(QT_CONFIG, webkit) {
+    SOURCES += helpviewer_qwv.cpp
+} else {
+    SOURCES += helpviewer_qtb.cpp
 }
 
-CONFIG += qt warn_on help
+FORMS += bookmarkdialog.ui \
+    bookmarkmanagerwidget.ui \
+    bookmarkwidget.ui \
+    filternamedialog.ui \
+    installdialog.ui \
+    preferencesdialog.ui \
+    topicchooser.ui
 
-QT += network
-
-PROJECTNAME = Assistant
-DESTDIR = ../../../../bin
-
-target.path=$$[QT_INSTALL_BINS]
-INSTALLS += target
-
-### Work around a qmake issue when statically linking to
-### not-yet-installed plugins
-LIBS += -L$$QT_BUILD_TREE/plugins/sqldrivers
-
-HEADERS += helpviewer.h \
-           mainwindow.h \
-           indexwindow.h \
-           topicchooser.h \
-           contentwindow.h \
-           searchwidget.h \
-           preferencesdialog.h \
-           filternamedialog.h \
-           centralwidget.h \
-           installdialog.h \
-           bookmarkmanager.h \
-           remotecontrol.h \
-           cmdlineparser.h \
-           aboutdialog.h \
-           qtdocinstaller.h
-
-win32|os2 {
-    HEADERS += remotecontrol_win.h
-}
-
-SOURCES += helpviewer.cpp \
-           main.cpp \
-           mainwindow.cpp \
-           indexwindow.cpp \
-           topicchooser.cpp \
-           contentwindow.cpp \
-           searchwidget.cpp \
-           preferencesdialog.cpp \
-           filternamedialog.cpp \
-           centralwidget.cpp \
-           installdialog.cpp \
-           bookmarkmanager.cpp \
-           remotecontrol.cpp \
-           cmdlineparser.cpp \
-           aboutdialog.cpp \
-           qtdocinstaller.cpp
-
-FORMS += topicchooser.ui \
-         preferencesdialog.ui \
-         filternamedialog.ui \
-         installdialog.ui \
-         bookmarkdialog.ui
-
-RESOURCES += assistant.qrc assistant_images.qrc
+RESOURCES += assistant.qrc \
+    assistant_images.qrc
 
 win32 {
Index: trunk/tools/assistant/tools/assistant/assistant.rc
===================================================================
--- trunk/tools/assistant/tools/assistant/assistant.rc	(revision 769)
+++ trunk/tools/assistant/tools/assistant/assistant.rc	(revision 846)
@@ -19,5 +19,5 @@
             VALUE "FileDescription", "Qt Assistant"
             VALUE "FileVersion", "1.0.0.0"
-            VALUE "LegalCopyright", "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+            VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
             VALUE "InternalName", "assistant.exe"
             VALUE "OriginalFilename", "assistant.exe"
Index: trunk/tools/assistant/tools/assistant/assistant_images.qrc
===================================================================
--- trunk/tools/assistant/tools/assistant/assistant_images.qrc	(revision 769)
+++ trunk/tools/assistant/tools/assistant/assistant_images.qrc	(revision 846)
@@ -5,4 +5,5 @@
         <file>images/assistant.png</file>
         <file>images/wrap.png</file>
+        <file>images/bookmark.png</file>
 #mac
         <file>images/mac/addtab.png</file>
Index: trunk/tools/assistant/tools/assistant/bookmarkdialog.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkdialog.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkdialog.cpp	(revision 846)
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bookmarkdialog.h"
+#include "bookmarkfiltermodel.h"
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
+
+#include <QtGui/QKeyEvent>
+#include <QtGui/QMenu>
+
+QT_BEGIN_NAMESPACE
+
+BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title,
+        const QString &url, QWidget *parent)
+    : QDialog(parent)
+    , m_url(url)
+    , m_title(title)
+    , bookmarkModel(sourceModel)
+{
+    TRACE_OBJ
+    ui.setupUi(this);
+
+    ui.bookmarkEdit->setText(m_title);
+    ui.newFolderButton->setVisible(false);
+    ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+
+    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accepted()));
+    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(rejected()));
+    connect(ui.newFolderButton, SIGNAL(clicked()), this, SLOT(addFolder()));
+    connect(ui.toolButton, SIGNAL(clicked()), this, SLOT(toolButtonClicked()));
+    connect(ui.bookmarkEdit, SIGNAL(textChanged(QString)), this,
+        SLOT(textChanged(QString)));
+
+    bookmarkProxyModel = new BookmarkFilterModel(this);
+    bookmarkProxyModel->setSourceModel(bookmarkModel);
+    ui.bookmarkFolders->setModel(bookmarkProxyModel);
+    connect(ui.bookmarkFolders, SIGNAL(currentIndexChanged(int)), this,
+        SLOT(currentIndexChanged(int)));
+
+    bookmarkTreeModel = new BookmarkTreeModel(this);
+    bookmarkTreeModel->setSourceModel(bookmarkModel);
+    ui.treeView->setModel(bookmarkTreeModel);
+
+    ui.treeView->expandAll();
+    ui.treeView->setVisible(false);
+    ui.treeView->installEventFilter(this);
+    ui.treeView->viewport()->installEventFilter(this);
+    ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
+
+    connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this,
+        SLOT(customContextMenuRequested(QPoint)));
+    connect(ui.treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,
+        QModelIndex)), this, SLOT(currentIndexChanged(QModelIndex)));
+
+    ui.bookmarkFolders->setCurrentIndex(0);
+    ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2)));
+
+    const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    if (helpEngine.usesAppFont())
+        setFont(helpEngine.appFont());
+}
+
+BookmarkDialog::~BookmarkDialog()
+{
+    TRACE_OBJ
+}
+
+bool BookmarkDialog::isRootItem(const QModelIndex &index) const
+{
+    return !bookmarkTreeModel->parent(index).isValid();
+}
+
+bool BookmarkDialog::eventFilter(QObject *object, QEvent *event)
+{
+    TRACE_OBJ
+    if (object != ui.treeView && object != ui.treeView->viewport())
+        return QWidget::eventFilter(object, event);
+
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *ke = static_cast<QKeyEvent*>(event);
+        switch (ke->key()) {
+            case Qt::Key_F2: {
+                const QModelIndex &index = ui.treeView->currentIndex();
+                if (!isRootItem(index)) {
+                    bookmarkModel->setItemsEditable(true);
+                    ui.treeView->edit(index);
+                    bookmarkModel->setItemsEditable(false);
+                }
+            }   break;
+            default: break;
+        }
+    }
+
+    return QObject::eventFilter(object, event);
+}
+
+void BookmarkDialog::currentIndexChanged(int row)
+{
+    TRACE_OBJ
+    QModelIndex next = bookmarkProxyModel->index(row, 0, QModelIndex());
+    if (next.isValid()) {
+        next = bookmarkProxyModel->mapToSource(next);
+        ui.treeView->setCurrentIndex(bookmarkTreeModel->mapFromSource(next));
+    }
+}
+
+void BookmarkDialog::currentIndexChanged(const QModelIndex &index)
+{
+    TRACE_OBJ
+    const QModelIndex current = bookmarkTreeModel->mapToSource(index);
+    if (current.isValid()) {
+        const int row = bookmarkProxyModel->mapFromSource(current).row();
+        ui.bookmarkFolders->setCurrentIndex(row);
+    }
+}
+
+void BookmarkDialog::accepted()
+{
+    TRACE_OBJ
+    QModelIndex index = ui.treeView->currentIndex();
+    if (index.isValid()) {
+        index = bookmarkModel->addItem(bookmarkTreeModel->mapToSource(index));
+        bookmarkModel->setData(index, DataVector() << m_title << m_url << false);
+    } else
+        rejected();
+
+    accept();
+}
+
+void BookmarkDialog::rejected()
+{
+    TRACE_OBJ
+    foreach (const QPersistentModelIndex &index, cache)
+        bookmarkModel->removeItem(index);
+    reject();
+}
+
+void BookmarkDialog::addFolder()
+{
+    TRACE_OBJ
+    QModelIndex index = ui.treeView->currentIndex();
+    if (index.isValid()) {
+        index = bookmarkModel->addItem(bookmarkTreeModel->mapToSource(index),
+            true);
+        cache.append(index);
+
+        index = bookmarkTreeModel->mapFromSource(index);
+        if (index.isValid()) {
+            bookmarkModel->setItemsEditable(true);
+            ui.treeView->edit(index);
+            ui.treeView->expand(index);
+            ui.treeView->setCurrentIndex(index);
+            bookmarkModel->setItemsEditable(false);
+        }
+    }
+}
+
+void BookmarkDialog::toolButtonClicked()
+{
+    TRACE_OBJ
+    const bool visible = !ui.treeView->isVisible();
+    ui.treeView->setVisible(visible);
+    ui.newFolderButton->setVisible(visible);
+
+    if (visible) {
+        resize(QSize(width(), 400));
+        ui.toolButton->setText(QLatin1String("-"));
+    } else {
+        resize(width(), minimumHeight());
+        ui.toolButton->setText(QLatin1String("+"));
+    }
+}
+
+void BookmarkDialog::textChanged(const QString& text)
+{
+    m_title = text;
+}
+
+void BookmarkDialog::customContextMenuRequested(const QPoint &point)
+{
+    TRACE_OBJ
+    const QModelIndex &index = ui.treeView->currentIndex();
+    if (isRootItem(index))
+        return; // check if we go to rename the "Bookmarks Menu", bail
+
+    QMenu menu(QLatin1String(""), this);
+    QAction *renameItem = menu.addAction(tr("Rename Folder"));
+
+    QAction *picked = menu.exec(ui.treeView->mapToGlobal(point));
+    if (picked == renameItem) {
+        bookmarkModel->setItemsEditable(true);
+        ui.treeView->edit(index);
+        bookmarkModel->setItemsEditable(false);
+    }
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/bookmarkdialog.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkdialog.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkdialog.h	(revision 846)
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BOOKMARKDIALOG_H
+#define BOOKMARKDIALOG_H
+
+#include "ui_bookmarkdialog.h"
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkModel;
+class BookmarkFilterModel;
+class BookmarkTreeModel;
+
+class BookmarkDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    BookmarkDialog(BookmarkModel *bookmarkModel, const QString &title,
+        const QString &url, QWidget *parent = 0);
+    ~BookmarkDialog();
+
+private:
+    bool isRootItem(const QModelIndex &index) const;
+    bool eventFilter(QObject *object, QEvent *event);
+
+private slots:
+    void currentIndexChanged(int index);
+    void currentIndexChanged(const QModelIndex &index);
+
+    void accepted();
+    void rejected();
+
+    void addFolder();
+    void toolButtonClicked();
+    void textChanged(const QString& text);
+    void customContextMenuRequested(const QPoint &point);
+
+private:
+    QString m_url;
+    QString m_title;
+    Ui::BookmarkDialog ui;
+    QList<QPersistentModelIndex> cache;
+
+    BookmarkModel *bookmarkModel;
+    BookmarkTreeModel *bookmarkTreeModel;
+    BookmarkFilterModel *bookmarkProxyModel;
+};
+
+QT_END_NAMESPACE
+
+#endif  // BOOKMARKDIALOG_H
Index: trunk/tools/assistant/tools/assistant/bookmarkdialog.ui
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkdialog.ui	(revision 769)
+++ trunk/tools/assistant/tools/assistant/bookmarkdialog.ui	(revision 846)
@@ -1,30 +1,31 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>BookmarkDialog</class>
- <widget class="QDialog" name="BookmarkDialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="BookmarkDialog">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>450</width>
-    <height>135</height>
+    <height>133</height>
    </rect>
   </property>
-  <property name="sizePolicy" >
-   <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Add Bookmark</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout_3" >
+  <layout class="QVBoxLayout" name="verticalLayout_3">
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout" >
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <layout class="QVBoxLayout" name="verticalLayout_2" >
+      <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
-        <widget class="QLabel" name="label" >
-         <property name="text" >
+        <widget class="QLabel" name="label">
+         <property name="text">
           <string>Bookmark:</string>
          </property>
@@ -32,6 +33,6 @@
        </item>
        <item>
-        <widget class="QLabel" name="label_2" >
-         <property name="text" >
+        <widget class="QLabel" name="label_2">
+         <property name="text">
           <string>Add in Folder:</string>
          </property>
@@ -41,10 +42,10 @@
      </item>
      <item>
-      <layout class="QVBoxLayout" name="verticalLayout" >
+      <layout class="QVBoxLayout" name="verticalLayout">
        <item>
-        <widget class="QLineEdit" name="bookmarkEdit" />
+        <widget class="QLineEdit" name="bookmarkEdit"/>
        </item>
        <item>
-        <widget class="QComboBox" name="bookmarkFolders" />
+        <widget class="QComboBox" name="bookmarkFolders"/>
        </item>
       </layout>
@@ -53,8 +54,8 @@
    </item>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_3" >
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
      <item>
-      <widget class="QToolButton" name="toolButton" >
-       <property name="minimumSize" >
+      <widget class="QToolButton" name="toolButton">
+       <property name="minimumSize">
         <size>
          <width>25</width>
@@ -62,5 +63,5 @@
         </size>
        </property>
-       <property name="text" >
+       <property name="text">
         <string>+</string>
        </property>
@@ -68,6 +69,6 @@
      </item>
      <item>
-      <widget class="Line" name="line" >
-       <property name="orientation" >
+      <widget class="Line" name="line">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -77,18 +78,27 @@
    </item>
    <item>
-    <widget class="QTreeView" name="treeView" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="Ignored" hsizetype="Expanding" >
+    <widget class="QTreeView" name="treeView">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
+     <property name="uniformRowHeights">
+      <bool>true</bool>
+     </property>
+     <property name="allColumnsShowFocus">
+      <bool>true</bool>
+     </property>
+     <property name="headerHidden">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout_4" >
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
      <item>
-      <widget class="QPushButton" name="newFolderButton" >
-       <property name="text" >
+      <widget class="QPushButton" name="newFolderButton">
+       <property name="text">
         <string>New Folder</string>
        </property>
@@ -96,9 +106,9 @@
      </item>
      <item>
-      <widget class="QDialogButtonBox" name="buttonBox" >
-       <property name="orientation" >
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="standardButtons" >
+       <property name="standardButtons">
         <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
        </property>
@@ -117,9 +127,9 @@
    <slot>accept()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>248</x>
      <y>254</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>157</x>
      <y>274</y>
@@ -133,9 +143,9 @@
    <slot>reject()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>316</x>
      <y>260</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>286</x>
      <y>274</y>
Index: trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp	(revision 846)
@@ -0,0 +1,322 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bookmarkfiltermodel.h"
+
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
+
+BookmarkFilterModel::BookmarkFilterModel(QObject *parent)
+    : QAbstractProxyModel(parent)
+    , hideBookmarks(true)
+    , sourceModel(0)
+{
+}
+
+void
+BookmarkFilterModel::setSourceModel(QAbstractItemModel *_sourceModel)
+{
+    beginResetModel();
+
+    QAbstractProxyModel::setSourceModel(sourceModel);
+    sourceModel = qobject_cast<BookmarkModel*> (_sourceModel);
+
+    connect(sourceModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+        SLOT(changed(QModelIndex, QModelIndex)));
+
+    connect(sourceModel, SIGNAL(rowsInserted(QModelIndex, int, int)),
+        this, SLOT(rowsInserted(QModelIndex, int, int)));
+
+    connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)),
+        this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int)));
+    connect(sourceModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+        SLOT(rowsRemoved(QModelIndex, int, int)));
+
+    connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this,
+        SLOT(layoutAboutToBeChanged()));
+    connect(sourceModel, SIGNAL(layoutChanged()), this,
+        SLOT(layoutChanged()));
+
+    connect(sourceModel, SIGNAL(modelAboutToBeReset()), this,
+        SLOT(modelAboutToBeReset()));
+    connect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset()));
+
+    if (sourceModel)
+        setupCache(sourceModel->index(0, 0, QModelIndex()));
+
+    endResetModel();
+}
+
+int
+BookmarkFilterModel::rowCount(const QModelIndex &index) const
+{
+    Q_UNUSED(index)
+    return cache.count();
+}
+
+int
+BookmarkFilterModel::columnCount(const QModelIndex &index) const
+{
+    Q_UNUSED(index)
+    if (sourceModel)
+        return sourceModel->columnCount();
+    return 0;
+}
+
+QModelIndex
+BookmarkFilterModel::mapToSource(const QModelIndex &proxyIndex) const
+{
+    const int row = proxyIndex.row();
+    if (proxyIndex.isValid() && row >= 0 && row < cache.count())
+        return cache[row];
+    return QModelIndex();
+}
+
+QModelIndex
+BookmarkFilterModel::mapFromSource(const QModelIndex &sourceIndex) const
+{
+    return index(cache.indexOf(sourceIndex), 0, QModelIndex());
+}
+
+QModelIndex
+BookmarkFilterModel::parent(const QModelIndex &child) const
+{
+    Q_UNUSED(child)
+    return QModelIndex();
+}
+
+QModelIndex
+BookmarkFilterModel::index(int row, int column, const QModelIndex &index) const
+{
+    Q_UNUSED(index)
+    if (row < 0 || column < 0 || cache.count() <= row
+        || !sourceModel || sourceModel->columnCount() <= column) {
+        return QModelIndex();
+    }
+    return createIndex(row, 0);
+}
+
+Qt::DropActions
+BookmarkFilterModel::supportedDropActions () const
+{
+    if (sourceModel)
+        return sourceModel->supportedDropActions();
+    return Qt::IgnoreAction;
+}
+
+Qt::ItemFlags
+BookmarkFilterModel::flags(const QModelIndex &index) const
+{
+    if (sourceModel)
+        return sourceModel->flags(index);
+    return Qt::NoItemFlags;
+}
+
+QVariant
+BookmarkFilterModel::data(const QModelIndex &index, int role) const
+{
+    if (sourceModel)
+        return sourceModel->data(mapToSource(index), role);
+    return QVariant();
+}
+
+bool
+BookmarkFilterModel::setData(const QModelIndex &index, const QVariant &value,
+    int role)
+{
+    if (sourceModel)
+        return sourceModel->setData(mapToSource(index), value, role);
+    return false;
+}
+
+void
+BookmarkFilterModel::filterBookmarks()
+{
+    if (sourceModel) {
+        beginResetModel();
+        hideBookmarks = true;
+        setupCache(sourceModel->index(0, 0, QModelIndex()));
+        endResetModel();
+    }
+}
+
+void
+BookmarkFilterModel::filterBookmarkFolders()
+{
+    if (sourceModel) {
+        beginResetModel();
+        hideBookmarks = false;
+        setupCache(sourceModel->index(0, 0, QModelIndex()));
+        endResetModel();
+    }
+}
+
+void
+BookmarkFilterModel::changed(const QModelIndex &topLeft,
+    const QModelIndex &bottomRight)
+{
+    emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight));
+}
+
+void
+BookmarkFilterModel::rowsInserted(const QModelIndex &parent, int start, int end)
+{
+    if (!sourceModel)
+        return;
+
+    QModelIndex cachePrevious = parent;
+    if (BookmarkItem *parentItem = sourceModel->itemFromIndex(parent)) {
+        BookmarkItem *newItem = parentItem->child(start);
+
+        // iterate over tree hirarchie to find the previous folder
+        for (int i = 0; i < parentItem->childCount(); ++i) {
+            if (BookmarkItem *child = parentItem->child(i)) {
+                const QModelIndex &tmp = sourceModel->indexFromItem(child);
+                if (tmp.data(UserRoleFolder).toBool() && child != newItem)
+                    cachePrevious = tmp;
+            }
+        }
+
+        const QModelIndex &newIndex = sourceModel->indexFromItem(newItem);
+        const bool isFolder = newIndex.data(UserRoleFolder).toBool();
+        if ((isFolder && hideBookmarks) || (!isFolder && !hideBookmarks)) {
+            beginInsertRows(mapFromSource(parent), start, end);
+            cache.insert(cache.indexOf(cachePrevious) + 1, newIndex);
+            endInsertRows();
+        }
+    }
+}
+
+void
+BookmarkFilterModel::rowsAboutToBeRemoved(const QModelIndex &parent, int start,
+    int end)
+{
+    if (!sourceModel)
+        return;
+
+    if (BookmarkItem *parentItem = sourceModel->itemFromIndex(parent)) {
+        if (BookmarkItem *child = parentItem->child(start)) {
+            indexToRemove = sourceModel->indexFromItem(child);
+            if (cache.contains(indexToRemove))
+                beginRemoveRows(mapFromSource(parent), start, end);
+        }
+    }
+}
+
+void
+BookmarkFilterModel::rowsRemoved(const QModelIndex &/*parent*/, int, int)
+{
+    if (cache.contains(indexToRemove)) {
+        cache.removeAll(indexToRemove);
+        endRemoveRows();
+    }
+}
+
+void
+BookmarkFilterModel::layoutAboutToBeChanged()
+{
+    // TODO: ???
+}
+
+void
+BookmarkFilterModel::layoutChanged()
+{
+    // TODO: ???
+}
+
+void
+BookmarkFilterModel::modelAboutToBeReset()
+{
+    beginResetModel();
+}
+
+void
+BookmarkFilterModel::modelReset()
+{
+    if (sourceModel)
+        setupCache(sourceModel->index(0, 0, QModelIndex()));
+    endResetModel();
+}
+
+void
+BookmarkFilterModel::setupCache(const QModelIndex &parent)
+{
+    cache.clear();
+    collectItems(parent);
+}
+
+void
+BookmarkFilterModel::collectItems(const QModelIndex &parent)
+{
+    if (parent.isValid()) {
+        bool isFolder = sourceModel->data(parent, UserRoleFolder).toBool();
+        if ((isFolder && hideBookmarks) || (!isFolder && !hideBookmarks))
+            cache.append(parent);
+
+        if (sourceModel->hasChildren(parent)) {
+            for (int i = 0; i < sourceModel->rowCount(parent); ++i)
+                collectItems(sourceModel->index(i, 0, parent));
+        }
+    }
+}
+
+// -- BookmarkTreeModel
+
+BookmarkTreeModel::BookmarkTreeModel(QObject *parent)
+    : QSortFilterProxyModel(parent)
+{
+}
+
+int
+BookmarkTreeModel::columnCount(const QModelIndex &parent) const
+{
+    return qMin(1, QSortFilterProxyModel::columnCount(parent));
+}
+
+bool
+BookmarkTreeModel::filterAcceptsRow(int row, const QModelIndex &parent) const
+{
+    Q_UNUSED(row)
+    BookmarkModel *model = qobject_cast<BookmarkModel*> (sourceModel());
+    if (model->rowCount(parent) > 0
+        && model->data(model->index(row, 0, parent), UserRoleFolder).toBool())
+        return true;
+    return false;
+}
Index: trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkfiltermodel.h	(revision 846)
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BOOKMARKFILTERMODEL_H
+#define BOOKMARKFILTERMODEL_H
+
+#include <QtCore/QPersistentModelIndex>
+
+#include <QtGui/QAbstractProxyModel>
+#include <QtGui/QSortFilterProxyModel>
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkItem;
+class BookmarkModel;
+
+typedef QList<QPersistentModelIndex> PersistentModelIndexCache;
+
+class BookmarkFilterModel : public QAbstractProxyModel
+{
+    Q_OBJECT
+public:
+    explicit BookmarkFilterModel(QObject *parent = 0);
+
+    void setSourceModel(QAbstractItemModel *sourceModel);
+
+    int rowCount(const QModelIndex &index) const;
+    int columnCount(const QModelIndex &index) const;
+
+    QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
+    QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
+
+    QModelIndex parent(const QModelIndex &child) const;
+    QModelIndex index(int row, int column, const QModelIndex &parent) const;
+
+    Qt::DropActions supportedDropActions () const;
+    Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    QVariant data(const QModelIndex &index, int role) const;
+    bool setData(const QModelIndex &index, const QVariant &value, int role);
+
+    void filterBookmarks();
+    void filterBookmarkFolders();
+
+private slots:
+    void changed(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+    void rowsInserted(const QModelIndex &parent, int start, int end);
+    void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+    void rowsRemoved(const QModelIndex &parent, int start, int end);
+    void layoutAboutToBeChanged();
+    void layoutChanged();
+    void modelAboutToBeReset();
+    void modelReset();
+
+private:
+    void setupCache(const QModelIndex &parent);
+    void collectItems(const QModelIndex &parent);
+
+private:
+    bool hideBookmarks;
+    BookmarkModel *sourceModel;
+    PersistentModelIndexCache cache;
+    QPersistentModelIndex indexToRemove;
+};
+
+// -- BookmarkTreeModel
+
+class BookmarkTreeModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+public:
+    BookmarkTreeModel(QObject *parent = 0);
+    int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+protected:
+    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // BOOKMARKFILTERMODEL_H
Index: trunk/tools/assistant/tools/assistant/bookmarkitem.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkitem.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkitem.cpp	(revision 846)
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bookmarkitem.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BookmarkItem::BookmarkItem(const DataVector &data, BookmarkItem *parent)
+    : m_data(data)
+    , m_parent(parent)
+{
+}
+
+BookmarkItem::~BookmarkItem()
+{
+    qDeleteAll(m_children);
+}
+
+BookmarkItem*
+BookmarkItem::parent() const
+{
+    return m_parent;
+}
+
+void
+BookmarkItem::setParent(BookmarkItem *parent)
+{
+    m_parent = parent;
+}
+
+void
+BookmarkItem::addChild(BookmarkItem *child)
+{
+    child->setParent(this);
+    m_children.append(child);
+}
+
+BookmarkItem*
+BookmarkItem::child(int number) const
+{
+    if (number >= 0 && number < m_children.count())
+        return m_children[number];
+    return 0;
+}
+
+int BookmarkItem::childCount() const
+{
+    return m_children.count();
+}
+
+int BookmarkItem::childNumber() const
+{
+     if (m_parent)
+         return m_parent->m_children.indexOf(const_cast<BookmarkItem*>(this));
+     return 0;
+}
+
+QVariant
+BookmarkItem::data(int column) const
+{
+    if (column == 0)
+        return m_data[0];
+
+    if (column == 1 || column == UserRoleUrl)
+        return m_data[1];
+
+    if (column == UserRoleFolder)
+        return m_data[1].toString() == QLatin1String("Folder");
+
+    if (column == UserRoleExpanded)
+        return m_data[2];
+
+    return QVariant();
+}
+
+void
+BookmarkItem::setData(const DataVector &data)
+{
+    m_data = data;
+}
+
+bool
+BookmarkItem::setData(int column, const QVariant &newValue)
+{
+    int index = -1;
+    if (column == 0 || column == 1)
+        index = column;
+
+    if (column == UserRoleUrl || column == UserRoleFolder)
+        index = 1;
+
+    if (column == UserRoleExpanded)
+        index = 2;
+
+    if (index < 0)
+        return false;
+
+    m_data[index] = newValue;
+    return true;
+}
+
+bool
+BookmarkItem::insertChildren(bool isFolder, int position, int count)
+{
+    if (position < 0 || position > m_children.size())
+        return false;
+
+    for (int row = 0; row < count; ++row) {
+        m_children.insert(position, new BookmarkItem(DataVector()
+            << (isFolder
+                ? QCoreApplication::translate("BookmarkItem", "New Folder")
+                : QCoreApplication::translate("BookmarkItem", "Untitled"))
+            << (isFolder ? "Folder" : "about:blank") << false, this));
+    }
+
+    return true;
+}
+
+bool
+BookmarkItem::removeChildren(int position, int count)
+{
+    if (position < 0 || position > m_children.size())
+        return false;
+
+    for (int row = 0; row < count; ++row)
+        delete m_children.takeAt(position);
+
+    return true;
+}
+
+void
+BookmarkItem::dumpTree(int indent) const
+{
+    const QString tree(indent, ' ');
+    qDebug() << tree + (data(UserRoleFolder).toBool() ? "Folder" : "Bookmark")
+        << "Label:" << data(0).toString() << "parent:" << m_parent << "this:"
+        << this;
+
+    foreach (BookmarkItem *item, m_children)
+        item->dumpTree(indent + 4);
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/bookmarkitem.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkitem.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkitem.h	(revision 846)
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BOOKMARKITEM_H
+#define BOOKMARKITEM_H
+
+#include <QtCore/QVariant>
+#include <QtCore/QVector>
+
+QT_BEGIN_NAMESPACE
+
+enum {
+    UserRoleUrl = Qt::UserRole + 50,
+    UserRoleFolder = Qt::UserRole + 100,
+    UserRoleExpanded = Qt::UserRole + 150
+};
+
+typedef QVector<QVariant> DataVector;
+
+class BookmarkItem
+{
+public:
+    explicit BookmarkItem(const DataVector &data, BookmarkItem *parent = 0);
+    ~BookmarkItem();
+
+    BookmarkItem *parent() const;
+    void setParent(BookmarkItem *parent);
+
+    void addChild(BookmarkItem *child);
+    BookmarkItem *child(int number) const;
+
+    int childCount() const;
+    int childNumber() const;
+
+    QVariant data(int column) const;
+    void setData(const DataVector &data);
+    bool setData(int column, const QVariant &value);
+
+    bool insertChildren(bool isFolder, int position, int count);
+    bool removeChildren(int position, int count);
+
+    void dumpTree(int indent) const;
+
+private:
+    DataVector m_data;
+
+    BookmarkItem *m_parent;
+    QList<BookmarkItem*> m_children;
+};
+
+QT_END_NAMESPACE
+
+#endif // BOOKMARKITEM_H
Index: trunk/tools/assistant/tools/assistant/bookmarkmanager.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmanager.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/bookmarkmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,875 +39,450 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "bookmarkmanager.h"
+#include "bookmarkmanagerwidget.h"
+#include "bookmarkdialog.h"
+#include "bookmarkfiltermodel.h"
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
 #include "centralwidget.h"
+#include "helpenginewrapper.h"
 
 #include <QtGui/QMenu>
-#include <QtGui/QIcon>
-#include <QtGui/QStyle>
-#include <QtGui/QLabel>
-#include <QtGui/QLayout>
-#include <QtCore/QEvent>
-#include <QtGui/QComboBox>
 #include <QtGui/QKeyEvent>
-#include <QtGui/QLineEdit>
 #include <QtGui/QMessageBox>
-#include <QtGui/QHeaderView>
-#include <QtGui/QToolButton>
-#include <QtGui/QPushButton>
-#include <QtGui/QApplication>
-#include <QtHelp/QHelpEngineCore>
-#include <QtGui/QDialogButtonBox>
 #include <QtGui/QSortFilterProxyModel>
 
 QT_BEGIN_NAMESPACE
 
-BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
-        const QString &url, QWidget *parent)
-    : QDialog(parent)
-    , m_url(url)
-    , m_title(title)
-    , bookmarkManager(manager)
-{
-    ui.setupUi(this);
-
-    installEventFilter(this);
-    ui.treeView->installEventFilter(this);
-    ui.treeView->viewport()->installEventFilter(this);
-
-    ui.bookmarkEdit->setText(title);
-    ui.newFolderButton->setVisible(false);
-    ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
-    ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
-
-    proxyModel = new QSortFilterProxyModel(this);
-    proxyModel->setFilterKeyColumn(0);
-    proxyModel->setDynamicSortFilter(true);
-    proxyModel->setFilterRole(Qt::UserRole + 10);
-    proxyModel->setSourceModel(bookmarkManager->treeBookmarkModel());
-    proxyModel->setFilterRegExp(QRegExp(QLatin1String("Folder"),
-        Qt::CaseSensitive, QRegExp::FixedString));
-    ui.treeView->setModel(proxyModel);
-
-    ui.treeView->expandAll();
-    ui.treeView->setVisible(false);
-    ui.treeView->header()->setVisible(false);
-    ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
-
-    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(addAccepted()));
-    connect(ui.newFolderButton, SIGNAL(clicked()), this, SLOT(addNewFolder()));
-    connect(ui.toolButton, SIGNAL(clicked()), this, SLOT(toolButtonClicked()));
-    connect(ui.bookmarkEdit, SIGNAL(textChanged(QString)), this,
+// -- BookmarkManager::BookmarkWidget
+
+void BookmarkManager::BookmarkWidget::focusInEvent(QFocusEvent *event)
+{
+    TRACE_OBJ
+    if (event->reason() != Qt::MouseFocusReason) {
+        ui.lineEdit->selectAll();
+        ui.lineEdit->setFocus();
+
+        // force the focus in event on bookmark manager
+        emit focusInEvent();
+    }
+}
+
+// -- BookmarkManager::BookmarkTreeView
+
+BookmarkManager::BookmarkTreeView::BookmarkTreeView(QWidget *parent)
+    : QTreeView(parent)
+{
+    TRACE_OBJ
+    setAcceptDrops(true);
+    setDragEnabled(true);
+    setAutoExpandDelay(1000);
+    setUniformRowHeights(true);
+    setDropIndicatorShown(true);
+    setExpandsOnDoubleClick(true);
+
+    connect(this, SIGNAL(expanded(QModelIndex)), this,
+        SLOT(setExpandedData(QModelIndex)));
+    connect(this, SIGNAL(collapsed(QModelIndex)), this,
+        SLOT(setExpandedData(QModelIndex)));
+
+}
+
+void BookmarkManager::BookmarkTreeView::subclassKeyPressEvent(QKeyEvent *event)
+{
+    TRACE_OBJ
+    QTreeView::keyPressEvent(event);
+}
+
+void BookmarkManager::BookmarkTreeView::setExpandedData(const QModelIndex &index)
+{
+    TRACE_OBJ
+    if (BookmarkModel *treeModel = qobject_cast<BookmarkModel*> (model()))
+        treeModel->setData(index, isExpanded(index), UserRoleExpanded);
+}
+
+// -- BookmarkManager
+
+QMutex BookmarkManager::mutex;
+BookmarkManager* BookmarkManager::bookmarkManager = 0;
+
+// -- public
+
+BookmarkManager* BookmarkManager::instance()
+{
+    TRACE_OBJ
+    if (!bookmarkManager) {
+        QMutexLocker _(&mutex);
+        if (!bookmarkManager)
+            bookmarkManager = new BookmarkManager();
+    }
+    return bookmarkManager;
+}
+
+void BookmarkManager::destroy()
+{
+    TRACE_OBJ
+    delete bookmarkManager;
+    bookmarkManager = 0;
+}
+
+QWidget* BookmarkManager::bookmarkDockWidget() const
+{
+    TRACE_OBJ
+    if (bookmarkWidget)
+        return bookmarkWidget;
+    return 0;
+}
+
+void BookmarkManager::takeBookmarksMenu(QMenu* menu)
+{
+    TRACE_OBJ
+    bookmarkMenu = menu;
+    refeshBookmarkMenu();
+}
+
+// -- public slots
+
+void BookmarkManager::addBookmark(const QString &title, const QString &url)
+{
+    TRACE_OBJ
+    showBookmarkDialog(title.isEmpty() ? tr("Untitled") : title,
+        url.isEmpty() ? QLatin1String("about:blank") : url);
+}
+
+// -- private
+
+BookmarkManager::BookmarkManager()
+    : typeAndSearch(false)
+    , bookmarkMenu(0)
+    , bookmarkModel(new BookmarkModel)
+    , bookmarkWidget(new BookmarkWidget)
+    , bookmarkTreeView(new BookmarkTreeView)
+    , bookmarkManagerWidget(0)
+{
+    TRACE_OBJ
+    bookmarkWidget->installEventFilter(this);
+    connect(bookmarkWidget->ui.add, SIGNAL(clicked()), this,
+        SLOT(addBookmark()));
+    connect(bookmarkWidget->ui.remove, SIGNAL(clicked()), this,
+        SLOT(removeBookmark()));
+    connect(bookmarkWidget->ui.lineEdit, SIGNAL(textChanged(QString)), this,
         SLOT(textChanged(QString)));
-
-    connect(bookmarkManager->treeBookmarkModel(),
-        SIGNAL(itemChanged(QStandardItem*)),
-        this, SLOT(itemChanged(QStandardItem*)));
-
-    connect(ui.bookmarkFolders, SIGNAL(currentIndexChanged(QString)), this,
-        SLOT(selectBookmarkFolder(QString)));
-
-    connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this,
+    connect(bookmarkWidget, SIGNAL(focusInEvent()), this, SLOT(focusInEvent()));
+
+    bookmarkTreeView->setModel(bookmarkModel);
+    bookmarkTreeView->installEventFilter(this);
+    bookmarkTreeView->viewport()->installEventFilter(this);
+    bookmarkTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
+    bookmarkWidget->ui.stackedWidget->addWidget(bookmarkTreeView);
+
+    connect(bookmarkTreeView, SIGNAL(activated(QModelIndex)), this,
+        SLOT(setSourceFromIndex(QModelIndex)));
+    connect(bookmarkTreeView, SIGNAL(customContextMenuRequested(QPoint)), this,
         SLOT(customContextMenuRequested(QPoint)));
 
-    connect(ui.treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,
-        QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
-}
-
-BookmarkDialog::~BookmarkDialog()
-{
-}
-
-void BookmarkDialog::addAccepted()
-{
-    QItemSelectionModel *model = ui.treeView->selectionModel();
-    const QModelIndexList &list = model->selection().indexes();
-
-    QModelIndex index;
-    if (!list.isEmpty())
-        index = proxyModel->mapToSource(list.at(0));
-
-    bookmarkManager->addNewBookmark(index, ui.bookmarkEdit->text(), m_url);
-    accept();
-}
-
-void BookmarkDialog::addNewFolder()
-{
-    QItemSelectionModel *model = ui.treeView->selectionModel();
-    const QModelIndexList &list = model->selection().indexes();
-
-    QModelIndex index;
-    if (!list.isEmpty())
-        index = list.at(0);
-
-    QModelIndex newFolder =
-        bookmarkManager->addNewFolder(proxyModel->mapToSource(index));
-    if (newFolder.isValid()) {
-        ui.treeView->expand(index);
-        const QModelIndex &index = proxyModel->mapFromSource(newFolder);
-        model->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
-
-        ui.bookmarkFolders->clear();
-        ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
-
-        const QString &name = index.data().toString();
-        ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
-    }
-    ui.treeView->setFocus();
-}
-
-void BookmarkDialog::toolButtonClicked()
-{
-    bool visible = !ui.treeView->isVisible();
-    ui.treeView->setVisible(visible);
-    ui.newFolderButton->setVisible(visible);
-
-    if (visible) {
-        resize(QSize(width(), 400));
-        ui.toolButton->setText(QLatin1String("-"));
-    } else {
-        resize(width(), minimumHeight());
-        ui.toolButton->setText(QLatin1String("+"));
-    }
-}
-
-void BookmarkDialog::itemChanged(QStandardItem *item)
-{
-    if (renameItem != item) {
-        renameItem = item;
-        oldText = item->text();
-        return;
-    }
-
-    if (item->text() != oldText) {
-        ui.bookmarkFolders->clear();
-        ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
-
-        QString name = tr("Bookmarks");
-        const QModelIndex &index = ui.treeView->currentIndex();
-        if (index.isValid())
-            name = index.data().toString();
-        ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
-    }
-}
-
-void BookmarkDialog::textChanged(const QString &string)
-{
-    ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!string.isEmpty());
-}
-
-void BookmarkDialog::selectBookmarkFolder(const QString &folderName)
-{
-    if (folderName.isEmpty())
-        return;
-
-    if (folderName == tr("Bookmarks")) {
-        ui.treeView->clearSelection();
-        return;
-    }
-
-    QStandardItemModel *model = bookmarkManager->treeBookmarkModel();
-    QList<QStandardItem*> list = model->findItems(folderName,
-        Qt::MatchCaseSensitive | Qt::MatchRecursive, 0);
-    if (!list.isEmpty()) {
-        const QModelIndex &index = model->indexFromItem(list.at(0));
-        QItemSelectionModel *model = ui.treeView->selectionModel();
-        if (model) {
-            model->setCurrentIndex(proxyModel->mapFromSource(index),
-                QItemSelectionModel::ClearAndSelect);
-        }
-    }
-}
-
-void BookmarkDialog::customContextMenuRequested(const QPoint &point)
-{
-    QModelIndex index = ui.treeView->indexAt(point);
-    if (!index.isValid())
-        return;
-
-    QMenu menu(QLatin1String(""), this);
-
-    QAction *removeItem = menu.addAction(tr("Delete Folder"));
-    QAction *renameItem = menu.addAction(tr("Rename Folder"));
-
-    QAction *picked = menu.exec(ui.treeView->mapToGlobal(point));
-    if (!picked)
-        return;
-
-    const QModelIndex &proxyIndex = proxyModel->mapToSource(index);
-    if (picked == removeItem) {
-        bookmarkManager->removeBookmarkItem(ui.treeView, proxyIndex);
-        ui.bookmarkFolders->clear();
-        ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
-
-        QString name = tr("Bookmarks");
-        index = ui.treeView->currentIndex();
-        if (index.isValid())
-            name = index.data().toString();
-        ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
-    }
-    else if (picked == renameItem) {
-        BookmarkModel *model = bookmarkManager->treeBookmarkModel();
-        if (QStandardItem *item = model->itemFromIndex(proxyIndex)) {
-            item->setEditable(true);
-            ui.treeView->edit(index);
-            item->setEditable(false);
-        }
-    }
-}
-
-void BookmarkDialog::currentChanged(const QModelIndex &current)
-{
-    QString text = tr("Bookmarks");
-    if (current.isValid())
-        text = current.data().toString();
-    ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(text));
-}
-
-bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
-{
-    if (object != ui.treeView && object != ui.treeView->viewport())
-        return QWidget::eventFilter(object, e);
-
-    if (e->type() == QEvent::KeyPress) {
-        QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+    connect(&HelpEngineWrapper::instance(), SIGNAL(setupFinished()), this,
+        SLOT(setupFinished()));
+    connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+        SLOT(refeshBookmarkMenu()));
+    connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+        SLOT(refeshBookmarkMenu()));
+    connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+        SLOT(refeshBookmarkMenu()));
+}
+
+BookmarkManager::~BookmarkManager()
+{
+    TRACE_OBJ
+    delete bookmarkManagerWidget;
+    HelpEngineWrapper::instance().setBookmarks(bookmarkModel->bookmarks());
+    delete bookmarkModel;
+}
+
+void BookmarkManager::removeItem(const QModelIndex &index)
+{
+    TRACE_OBJ
+    QModelIndex current = index;
+    if (typeAndSearch) { // need to map because of proxy
+        current = typeAndSearchModel->mapToSource(current);
+        current = bookmarkFilterModel->mapToSource(current);
+    } else if (!bookmarkModel->parent(index).isValid()) {
+        return;  // check if we should delete the "Bookmarks Menu", bail
+    }
+
+    if (bookmarkModel->hasChildren(current)) {
+        int value = QMessageBox::question(bookmarkTreeView, tr("Remove"),
+            tr("You are going to delete a Folder, this will also<br>"
+            "remove it's content. Are you sure to continue?"),
+            QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
+        if (value == QMessageBox::Cancel)
+            return;
+    }
+    bookmarkModel->removeItem(current);
+}
+
+bool BookmarkManager::eventFilter(QObject *object, QEvent *event)
+{
+    if (object != bookmarkTreeView && object != bookmarkTreeView->viewport()
+        && object != bookmarkWidget)
+            return QObject::eventFilter(object, event);
+
+    TRACE_OBJ
+    const bool isWidget = object == bookmarkWidget;
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *ke = static_cast<QKeyEvent*>(event);
         switch (ke->key()) {
             case Qt::Key_F2: {
-                const QModelIndex &index = ui.treeView->currentIndex();
-                const QModelIndex &source = proxyModel->mapToSource(index);
-                QStandardItem *item =
-                    bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
-                if (item) {
-                    item->setEditable(true);
-                    ui.treeView->edit(index);
-                    item->setEditable(false);
-                }
+                renameBookmark(bookmarkTreeView->currentIndex());
             }   break;
 
             case Qt::Key_Delete: {
-                const QModelIndex &index = ui.treeView->currentIndex();
-                bookmarkManager->removeBookmarkItem(ui.treeView,
-                    proxyModel->mapToSource(index));
-                ui.bookmarkFolders->clear();
-                ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
-
-                QString name = tr("Bookmarks");
-                if (index.isValid())
-                    name = index.data().toString();
-                ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
-            }   break;
-
-            default:
-                break;
+                removeItem(bookmarkTreeView->currentIndex());
+                return true;
+            }   break;
+
+            case Qt::Key_Up: {    // needs event filter on widget
+            case Qt::Key_Down:
+                if (isWidget)
+                    bookmarkTreeView->subclassKeyPressEvent(ke);
+            }   break;
+
+            case Qt::Key_Escape: {
+                emit escapePressed();
+            }   break;
+
+            default: break;
         }
     }
 
-    return QObject::eventFilter(object, e);
-}
-
-
-// #pragma mark -- BookmarkWidget
-
-
-BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent,
-        bool showButtons)
-    : QWidget(parent)
-    , addButton(0)
-    , removeButton(0)
-    , bookmarkManager(manager)
-{
-    setup(showButtons);
-
-    installEventFilter(this);
-    treeView->installEventFilter(this);
-    treeView->viewport()->installEventFilter(this);
-}
-
-BookmarkWidget::~BookmarkWidget()
-{
-}
-
-void BookmarkWidget::removeClicked()
-{
-    const QModelIndex &index = treeView->currentIndex();
-    if (searchField->text().isEmpty()) {
-        bookmarkManager->removeBookmarkItem(treeView,
-            filterBookmarkModel->mapToSource(index));
-    }
-}
-
-void BookmarkWidget::filterChanged()
-{
-    bool searchBookmarks = searchField->text().isEmpty();
-    if (!searchBookmarks) {
-        regExp.setPattern(searchField->text());
-        filterBookmarkModel->setSourceModel(bookmarkManager->listBookmarkModel());
+    if (event->type() == QEvent::MouseButtonRelease && !isWidget) {
+        QMouseEvent *me = static_cast<QMouseEvent*>(event);
+        switch (me->button()) {
+            case Qt::LeftButton: {
+                if (me->modifiers() & Qt::ControlModifier)
+                    setSourceFromIndex(bookmarkTreeView->currentIndex(), true);
+            }   break;
+
+            case Qt::MidButton: {
+                setSourceFromIndex(bookmarkTreeView->currentIndex(), true);
+            }   break;
+
+            default: break;
+        }
+    }
+
+    return QObject::eventFilter(object, event);
+}
+
+void BookmarkManager::buildBookmarksMenu(const QModelIndex &index, QMenu* menu)
+{
+    TRACE_OBJ
+    if (!index.isValid())
+        return;
+
+    const QString &text = index.data().toString();
+    const QIcon &icon = qVariantValue<QIcon>(index.data(Qt::DecorationRole));
+    if (index.data(UserRoleFolder).toBool()) {
+        if (QMenu* subMenu = menu->addMenu(icon, text)) {
+            for (int i = 0; i < bookmarkModel->rowCount(index); ++i)
+                buildBookmarksMenu(bookmarkModel->index(i, 0, index), subMenu);
+        }
     } else {
-        regExp.setPattern(QLatin1String(""));
-        filterBookmarkModel->setSourceModel(bookmarkManager->treeBookmarkModel());
-    }
-
-    if (addButton)
-        addButton->setEnabled(searchBookmarks);
-
-    if (removeButton)
-        removeButton->setEnabled(searchBookmarks);
-
-    filterBookmarkModel->setFilterRegExp(regExp);
-
-    const QModelIndex &index = treeView->indexAt(QPoint(1, 1));
-    if (index.isValid())
-        treeView->setCurrentIndex(index);
-
-    if (searchBookmarks)
-        expandItems();
-}
-
-void BookmarkWidget::expand(const QModelIndex &index)
-{
-    const QModelIndex &source = filterBookmarkModel->mapToSource(index);
-    QStandardItem *item =
-        bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
-    if (item)
-        item->setData(treeView->isExpanded(index), Qt::UserRole + 11);
-}
-
-void BookmarkWidget::activated(const QModelIndex &index)
-{
+        QAction *action = menu->addAction(icon, text);
+        action->setData(index.data(UserRoleUrl).toString());
+    }
+}
+
+void BookmarkManager::showBookmarkDialog(const QString &name, const QString &url)
+{
+    TRACE_OBJ
+    BookmarkDialog dialog(bookmarkModel, name, url, bookmarkTreeView);
+    dialog.exec();
+}
+
+// -- private slots
+
+void BookmarkManager::setupFinished()
+{
+    TRACE_OBJ
+    bookmarkModel->setBookmarks(HelpEngineWrapper::instance().bookmarks());
+    bookmarkModel->expandFoldersIfNeeeded(bookmarkTreeView);
+
+    refeshBookmarkMenu();
+
+    bookmarkTreeView->hideColumn(1);
+    bookmarkTreeView->header()->setVisible(false);
+    bookmarkTreeView->header()->setStretchLastSection(true);
+
+    bookmarkFilterModel = new BookmarkFilterModel(this);
+    bookmarkFilterModel->setSourceModel(bookmarkModel);
+    bookmarkFilterModel->filterBookmarkFolders();
+
+    typeAndSearchModel = new QSortFilterProxyModel(this);
+    typeAndSearchModel->setDynamicSortFilter(true);
+    typeAndSearchModel->setSourceModel(bookmarkFilterModel);
+}
+
+void BookmarkManager::addBookmark()
+{
+    TRACE_OBJ
+    if (CentralWidget *widget = CentralWidget::instance())
+        addBookmark(widget->currentTitle(), widget->currentSource().toString());
+}
+
+void BookmarkManager::removeBookmark()
+{
+    TRACE_OBJ
+    removeItem(bookmarkTreeView->currentIndex());
+}
+
+void BookmarkManager::manageBookmarks()
+{
+    TRACE_OBJ
+    if (bookmarkManagerWidget == 0) {
+        bookmarkManagerWidget = new BookmarkManagerWidget(bookmarkModel);
+        connect(bookmarkManagerWidget, SIGNAL(setSource(QUrl)), this,
+            SIGNAL(setSource(QUrl)));
+        connect(bookmarkManagerWidget, SIGNAL(setSourceInNewTab(QUrl))
+            , this, SIGNAL(setSourceInNewTab(QUrl)));
+        connect(bookmarkManagerWidget, SIGNAL(managerWidgetAboutToClose())
+            , this, SLOT(managerWidgetAboutToClose()));
+    }
+    bookmarkManagerWidget->show();
+    bookmarkManagerWidget->raise();
+}
+
+void BookmarkManager::refeshBookmarkMenu()
+{
+    TRACE_OBJ
+    if (!bookmarkMenu)
+        return;
+
+    bookmarkMenu->clear();
+
+    bookmarkMenu->addAction(tr("Manage Bookmarks..."), this,
+        SLOT(manageBookmarks()));
+    bookmarkMenu->addAction(QIcon::fromTheme("bookmark-new"),
+                            tr("Add Bookmark..."), this, SLOT(addBookmark()),
+                            QKeySequence(tr("Ctrl+D")));
+    bookmarkMenu->addSeparator();
+
+    const QModelIndex &root = bookmarkModel->index(0, 0, QModelIndex());
+    for (int i = 0; i < bookmarkModel->rowCount(root); ++i)
+        buildBookmarksMenu(bookmarkModel->index(i, 0, root), bookmarkMenu);
+
+    connect(bookmarkMenu, SIGNAL(triggered(QAction*)), this,
+        SLOT(setSourceFromAction(QAction*)));
+}
+
+void BookmarkManager::renameBookmark(const QModelIndex &index)
+{
+    // check if we should rename the "Bookmarks Menu", bail
+    if (!typeAndSearch && !bookmarkModel->parent(index).isValid())
+        return;
+
+    bookmarkModel->setItemsEditable(true);
+    bookmarkTreeView->edit(index);
+    bookmarkModel->setItemsEditable(false);
+}
+
+void BookmarkManager::setSourceFromAction(QAction *action)
+{
+    TRACE_OBJ
+    const QVariant &data = action->data();
+
+    if (data.canConvert<QUrl>())
+        emit setSource(data.toUrl());
+}
+
+void BookmarkManager::setSourceFromIndex(const QModelIndex &index, bool newTab)
+{
+    TRACE_OBJ
+    QAbstractItemModel *base = bookmarkModel;
+    if (typeAndSearch)
+        base = typeAndSearchModel;
+
+    if (base->data(index, UserRoleFolder).toBool())
+        return;
+
+    const QVariant &data = base->data(index, UserRoleUrl);
+    if (data.canConvert<QUrl>()) {
+        if (newTab)
+            emit setSourceInNewTab(data.toUrl());
+        else
+            emit setSource(data.toUrl());
+    }
+}
+
+void BookmarkManager::customContextMenuRequested(const QPoint &point)
+{
+    TRACE_OBJ
+    QModelIndex index = bookmarkTreeView->indexAt(point);
     if (!index.isValid())
         return;
 
-    QString data = index.data(Qt::UserRole + 10).toString();
-    if (data != QLatin1String("Folder"))
-        emit requestShowLink(data);
-}
-
-void BookmarkWidget::customContextMenuRequested(const QPoint &point)
-{
-    QModelIndex index = treeView->indexAt(point);
-    if (!index.isValid())
-        return;
-
+    // check if we should open the menu on "Bookmarks Menu", bail
+    if (!typeAndSearch && !bookmarkModel->parent(index).isValid())
+        return;
+
+    QAction *remove = 0;
+    QAction *rename = 0;
     QAction *showItem = 0;
-    QAction *removeItem = 0;
-    QAction *renameItem = 0;
-    QAction *showItemNewTab = 0;
-
-    QMenu menu(QLatin1String(""), this);
-    QString data = index.data(Qt::UserRole + 10).toString();
-    if (data == QLatin1String("Folder")) {
-        removeItem = menu.addAction(tr("Delete Folder"));
-        renameItem = menu.addAction(tr("Rename Folder"));
+    QAction *showItemInNewTab = 0;
+
+    QMenu menu(QLatin1String(""));
+    if (!typeAndSearch && bookmarkModel->data(index, UserRoleFolder).toBool()) {
+        remove = menu.addAction(tr("Delete Folder"));
+        rename = menu.addAction(tr("Rename Folder"));
     } else {
         showItem = menu.addAction(tr("Show Bookmark"));
-        showItemNewTab = menu.addAction(tr("Show Bookmark in New Tab"));
-        if (searchField->text().isEmpty()) {
-            menu.addSeparator();
-            removeItem = menu.addAction(tr("Delete Bookmark"));
-            renameItem = menu.addAction(tr("Rename Bookmark"));
+        showItemInNewTab = menu.addAction(tr("Show Bookmark in New Tab"));
+        menu.addSeparator();
+        remove = menu.addAction(tr("Delete Bookmark"));
+        rename = menu.addAction(tr("Rename Bookmark"));
+    }
+
+    QAction *pickedAction = menu.exec(bookmarkTreeView->mapToGlobal(point));
+    if (pickedAction == rename)
+        renameBookmark(index);
+    else if (pickedAction == remove)
+        removeItem(index);
+    else if (pickedAction == showItem || pickedAction == showItemInNewTab)
+        setSourceFromIndex(index, pickedAction == showItemInNewTab);
+}
+
+void BookmarkManager::focusInEvent()
+{
+    TRACE_OBJ
+    const QModelIndex &index = bookmarkTreeView->indexAt(QPoint(2, 2));
+    if (index.isValid())
+        bookmarkTreeView->setCurrentIndex(index);
+}
+
+void BookmarkManager::managerWidgetAboutToClose()
+{
+    delete bookmarkManagerWidget;
+    bookmarkManagerWidget = 0;
+}
+
+void BookmarkManager::textChanged(const QString &text)
+{
+    TRACE_OBJ
+    if (!bookmarkWidget->ui.lineEdit->text().isEmpty()) {
+        if (!typeAndSearch) {
+            typeAndSearch = true;
+            bookmarkTreeView->setItemsExpandable(false);
+            bookmarkTreeView->setRootIsDecorated(false);
+            bookmarkTreeView->setModel(typeAndSearchModel);
         }
-    }
-
-    QAction *pickedAction = menu.exec(treeView->mapToGlobal(point));
-    if (!pickedAction)
-        return;
-
-    if (pickedAction == showItem) {
-        emit requestShowLink(data);
-    }
-    else if (pickedAction == showItemNewTab) {
-        CentralWidget::instance()->setSourceInNewTab(data);
-    }
-    else if (pickedAction == removeItem) {
-        bookmarkManager->removeBookmarkItem(treeView,
-            filterBookmarkModel->mapToSource(index));
-    }
-    else if (pickedAction == renameItem) {
-        const QModelIndex &source = filterBookmarkModel->mapToSource(index);
-        QStandardItem *item =
-            bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
-        if (item) {
-            item->setEditable(true);
-            treeView->edit(index);
-            item->setEditable(false);
-        }
-    }
-}
-
-void BookmarkWidget::setup(bool showButtons)
-{
-    regExp.setPatternSyntax(QRegExp::FixedString);
-    regExp.setCaseSensitivity(Qt::CaseInsensitive);
-
-    QLayout *vlayout = new QVBoxLayout(this);
-    vlayout->setMargin(4);
-
-    QLabel *label = new QLabel(tr("Filter:"), this);
-    vlayout->addWidget(label);
-
-    searchField = new QLineEdit(this);
-    vlayout->addWidget(searchField);
-    connect(searchField, SIGNAL(textChanged(QString)), this,
-        SLOT(filterChanged()));
-
-    treeView = new TreeView(this);
-    vlayout->addWidget(treeView);
-
-#ifdef Q_OS_MAC
-#   define SYSTEM "mac"
-#else
-#   define SYSTEM "win"
-#endif
-
-    if (showButtons) {
-        QLayout *hlayout = new QHBoxLayout();
-        vlayout->addItem(hlayout);
-
-        hlayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding));
-
-        addButton = new QToolButton(this);
-        addButton->setText(tr("Add"));
-        addButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
-            SYSTEM "/addtab.png")));
-        addButton->setAutoRaise(true);
-        addButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
-        hlayout->addWidget(addButton);
-        connect(addButton, SIGNAL(clicked()), this, SIGNAL(addBookmark()));
-
-        removeButton = new QToolButton(this);
-        removeButton->setText(tr("Remove"));
-        removeButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
-            SYSTEM "/closetab.png")));
-        removeButton->setAutoRaise(true);
-        removeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
-        hlayout->addWidget(removeButton);
-        connect(removeButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
-    }
-
-    filterBookmarkModel = new QSortFilterProxyModel(this);
-    treeView->setModel(filterBookmarkModel);
-
-    treeView->setDragEnabled(true);
-    treeView->setAcceptDrops(true);
-    treeView->setAutoExpandDelay(1000);
-    treeView->setDropIndicatorShown(true);
-    treeView->header()->setVisible(false);
-    treeView->setContextMenuPolicy(Qt::CustomContextMenu);
-
-    connect(treeView, SIGNAL(expanded(QModelIndex)), this,
-        SLOT(expand(QModelIndex)));
-    connect(treeView, SIGNAL(collapsed(QModelIndex)), this,
-        SLOT(expand(QModelIndex)));
-    connect(treeView, SIGNAL(activated(QModelIndex)), this,
-        SLOT(activated(QModelIndex)));
-    connect(treeView, SIGNAL(customContextMenuRequested(QPoint)),
-        this, SLOT(customContextMenuRequested(QPoint)));
-
-    filterBookmarkModel->setFilterKeyColumn(0);
-    filterBookmarkModel->setDynamicSortFilter(true);
-    filterBookmarkModel->setSourceModel(bookmarkManager->treeBookmarkModel());
-
-    expandItems();
-}
-
-void BookmarkWidget::expandItems()
-{
-    QStandardItemModel *model = bookmarkManager->treeBookmarkModel();
-    QList<QStandardItem*>list = model->findItems(QLatin1String("*"),
-        Qt::MatchWildcard | Qt::MatchRecursive, 0);
-    foreach (const QStandardItem *item, list) {
-        const QModelIndex &index = model->indexFromItem(item);
-        treeView->setExpanded(filterBookmarkModel->mapFromSource(index),
-            item->data(Qt::UserRole + 11).toBool());
-    }
-}
-
-void BookmarkWidget::focusInEvent(QFocusEvent *e)
-{
-    if (e->reason() != Qt::MouseFocusReason) {
-        searchField->selectAll();
-        searchField->setFocus();
-
-        QModelIndex index = treeView->indexAt(QPoint(1, 1));
-        if (index.isValid())
-            treeView->setCurrentIndex(index);
-
-    }
-}
-
-bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
-{
-    if (object != this && object != treeView
-        && object != treeView->viewport()) {
-            return QWidget::eventFilter(object, e);
-    }
-
-    if (e->type() == QEvent::KeyPress) {
-        QKeyEvent *ke = static_cast<QKeyEvent*>(e);
-        const bool tree = object == treeView || object == treeView->viewport();
-        switch (ke->key()) {
-            case Qt::Key_F2: {
-                const QModelIndex &index = treeView->currentIndex();
-                const QModelIndex &src = filterBookmarkModel->mapToSource(index);
-                if (tree && searchField->text().isEmpty()) {
-                    if (QStandardItem *item = bookmarkManager->treeBookmarkModel()
-                        ->itemFromIndex(src)) {
-                        item->setEditable(true);
-                        treeView->edit(index);
-                        item->setEditable(false);
-                    }
-                }
-            }   break;
-
-            case Qt::Key_Enter: {
-            case Qt::Key_Return:
-                if (tree) {
-                    const QString &data = treeView->selectionModel()->currentIndex()
-                        .data(Qt::UserRole + 10).toString();
-                    if (!data.isEmpty() && data != QLatin1String("Folder"))
-                        emit requestShowLink(data);
-                }
-            }   break;
-
-            case Qt::Key_Delete: {
-                const QModelIndex &index = treeView->currentIndex();
-                const QModelIndex &src = filterBookmarkModel->mapToSource(index);
-                if (tree && searchField->text().isEmpty())
-                    bookmarkManager->removeBookmarkItem(treeView, src);
-            }   break;
-
-            case Qt::Key_Up: {
-            case Qt::Key_Down:
-                if (!tree)
-                    treeView->subclassKeyPressEvent(ke);
-            }   break;
-
-            case Qt::Key_Escape: {
-                emit escapePressed();
-            }   break;
-
-            default: break;
-        }
-    }
-
-    if (e->type() == QEvent::MouseButtonRelease) {
-        QMouseEvent *me = static_cast<QMouseEvent*>(e);
-        bool controlPressed = me->modifiers() & Qt::ControlModifier;
-        if(((me->button() == Qt::LeftButton) && controlPressed)
-            || (me->button() == Qt::MidButton)) {
-                const QModelIndex &index = treeView->currentIndex();
-                const QString &data = index.data(Qt::UserRole + 10).toString();
-                if (!data.isEmpty() && data != QLatin1String("Folder"))
-                    CentralWidget::instance()->setSourceInNewTab(data);
-        }
-    }
-
-    return QWidget::eventFilter(object, e);
-}
-
-
-// #pragma mark -- BookmarkModel
-
-
-BookmarkModel::BookmarkModel(int rows, int columns, QObject *parent)
-    : QStandardItemModel(rows, columns, parent)
-{
-}
-
-BookmarkModel::~BookmarkModel()
-{
-}
-
-Qt::DropActions BookmarkModel::supportedDropActions() const
-{
-    return Qt::MoveAction;
-}
-
-Qt::ItemFlags BookmarkModel::flags(const QModelIndex &index) const
-{
-    Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index);
-    if ((!index.isValid()) // can only happen for the invisible root item
-        || index.data(Qt::UserRole + 10).toString() == QLatin1String("Folder"))
-        return (Qt::ItemIsDropEnabled | defaultFlags) &~ Qt::ItemIsDragEnabled;
-
-    return (Qt::ItemIsDragEnabled | defaultFlags) &~ Qt::ItemIsDropEnabled;
-}
-
-
-// #pragma mark -- BookmarkManager
-
-
-BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine)
-    : treeModel(new BookmarkModel(0, 1, this))
-    , listModel(new BookmarkModel(0, 1, this))
-    , renameItem(0)
-    , helpEngine(_helpEngine)
-{
-    folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
-
-    connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this,
-        SLOT(itemChanged(QStandardItem*)));
-    connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this,
-        SIGNAL(bookmarksChanged()));
-    connect(treeModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
-        this, SIGNAL(bookmarksChanged()));
-}
-
-BookmarkManager::~BookmarkManager()
-{
-    treeModel->clear();
-    listModel->clear();
-}
-
-BookmarkModel* BookmarkManager::treeBookmarkModel()
-{
-    return treeModel;
-}
-
-BookmarkModel* BookmarkManager::listBookmarkModel()
-{
-    return listModel;
-}
-
-void BookmarkManager::saveBookmarks()
-{
-    QByteArray bookmarks;
-    QDataStream stream(&bookmarks, QIODevice::WriteOnly);
-
-    readBookmarksRecursive(treeModel->invisibleRootItem(), stream, 0);
-    helpEngine->setCustomValue(QLatin1String("Bookmarks"), bookmarks);
-}
-
-QStringList BookmarkManager::bookmarkFolders() const
-{
-    QStringList folders(tr("Bookmarks"));
-
-    QList<QStandardItem*>list = treeModel->findItems(QLatin1String("*"),
-        Qt::MatchWildcard | Qt::MatchRecursive, 0);
-
-    QString data;
-    foreach (const QStandardItem *item, list) {
-        data = item->data(Qt::UserRole + 10).toString();
-        if (data == QLatin1String("Folder"))
-            folders << item->data(Qt::DisplayRole).toString();
-    }
-    return folders;
-}
-
-QModelIndex BookmarkManager::addNewFolder(const QModelIndex &index)
-{
-    QStandardItem *item = new QStandardItem(uniqueFolderName());
-    item->setEditable(false);
-    item->setData(false, Qt::UserRole + 11);
-    item->setData(QLatin1String("Folder"), Qt::UserRole + 10);
-    item->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon));
-
-    if (index.isValid()) {
-        treeModel->itemFromIndex(index)->appendRow(item);
+        typeAndSearchModel->setFilterRegExp(QRegExp(text));
     } else {
-        treeModel->appendRow(item);
-    }
-    return treeModel->indexFromItem(item);
-}
-
-void BookmarkManager::removeBookmarkItem(QTreeView *treeView,
-    const QModelIndex &index)
-{
-    QStandardItem *item = treeModel->itemFromIndex(index);
-    if (item) {
-        QString data = index.data(Qt::UserRole + 10).toString();
-        if (data == QLatin1String("Folder") && item->rowCount() > 0) {
-            int value = QMessageBox::question(treeView, tr("Remove"),
-                tr("You are going to delete a Folder, this will also<br>"
-                "remove it's content. Are you sure to continue?"),
-                QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
-
-            if (value == QMessageBox::Cancel)
-                return;
-        }
-
-        if (data != QLatin1String("Folder")) {
-            QList<QStandardItem*>itemList = listModel->findItems(item->text());
-            foreach (const QStandardItem *i, itemList) {
-                if (i->data(Qt::UserRole + 10) == data) {
-                    listModel->removeRow(i->row());
-                    break;
-                }
-            }
-        } else {
-            removeBookmarkFolderItems(item);
-        }
-        treeModel->removeRow(item->row(), index.parent());
-    }
-}
-
-void BookmarkManager::showBookmarkDialog(QWidget *parent, const QString &name,
-    const QString &url)
-{
-    BookmarkDialog dialog(this, name, url, parent);
-    dialog.exec();
-}
-
-void BookmarkManager::addNewBookmark(const QModelIndex &index,
-    const QString &name, const QString &url)
-{
-    QStandardItem *item = new QStandardItem(name);
-    item->setEditable(false);
-    item->setData(false, Qt::UserRole + 11);
-    item->setData(url, Qt::UserRole + 10);
-
-    if (index.isValid())
-        treeModel->itemFromIndex(index)->appendRow(item);
-    else
-        treeModel->appendRow(item);
-    listModel->appendRow(item->clone());
-    emit bookmarksChanged();
-}
-
-void BookmarkManager::fillBookmarkMenu(QMenu *menu)
-{
-    if (!menu || !treeModel)
-        return;
-
-    map.clear();
-    fillBookmarkMenu(menu, treeModel->invisibleRootItem());
-}
-
-void BookmarkManager::fillBookmarkMenu(QMenu *menu, QStandardItem *root)
-{
-    for (int i = 0; i < root->rowCount(); ++i) {
-        QStandardItem *item = root->child(i);
-        if (item && item->data(Qt::UserRole + 10)
-            .toString() == QLatin1String("Folder")) {
-                QMenu* newMenu = menu->addMenu(folderIcon, item->text());
-                if (item->rowCount() > 0)
-                    fillBookmarkMenu(newMenu, item);
-        } else {
-            map.insert(menu->addAction(item->text()), item->index());
-        }
-    }
-}
-
-QUrl BookmarkManager::urlForAction(QAction* action) const
-{
-    if (map.contains(action)) {
-        const QModelIndex &index = map.value(action);
-        if (QStandardItem* item = treeModel->itemFromIndex(index))
-            return QUrl(item->data(Qt::UserRole + 10).toString());
-    }
-    return QUrl();
-}
-
-void BookmarkManager::itemChanged(QStandardItem *item)
-{
-    if (renameItem != item) {
-        renameItem = item;
-        oldText = item->text();
-        return;
-    }
-
-    if (item->text() != oldText) {
-        if (item->data(Qt::UserRole + 10).toString() != QLatin1String("Folder")) {
-            QList<QStandardItem*>itemList = listModel->findItems(oldText);
-            if (itemList.count() > 0)
-                itemList.at(0)->setText(item->text());
-        }
-    }
-}
-
-void BookmarkManager::setupBookmarkModels()
-{
-    treeModel->clear();
-    listModel->clear();
-
-    qint32 depth;
-    bool expanded;
-    QString name, type;
-    QList<int> lastDepths;
-    QList<QStandardItem*> parents;
-
-    QByteArray ba =
-        helpEngine->customValue(QLatin1String("Bookmarks")).toByteArray();
-    QDataStream stream(ba);
-    while (!stream.atEnd()) {
-        stream >> depth >> name >> type >> expanded;
-
-        QStandardItem *item = new QStandardItem(name);
-        item->setEditable(false);
-        item->setData(type, Qt::UserRole + 10);
-        item->setData(expanded, Qt::UserRole + 11);
-        if (depth == 0) {
-            parents.clear(); lastDepths.clear();
-            treeModel->appendRow(item);
-            parents << item; lastDepths << depth;
-        } else {
-            if (depth <= lastDepths.last()) {
-                while (depth <= lastDepths.last() && parents.count() > 0) {
-                    parents.pop_back(); lastDepths.pop_back();
-                }
-            }
-            parents.last()->appendRow(item);
-            if (type == QLatin1String("Folder")) {
-                parents << item; lastDepths << depth;
-            }
-        }
-
-        if (type == QLatin1String("Folder"))
-            item->setIcon(folderIcon);
-        else
-            listModel->appendRow(item->clone());
-    }
-}
-
-QString BookmarkManager::uniqueFolderName() const
-{
-    QString folderName = tr("New Folder");
-    QList<QStandardItem*> list = treeModel->findItems(folderName,
-        Qt::MatchContains | Qt::MatchRecursive, 0);
-    if (!list.isEmpty()) {
-        QStringList names;
-        foreach (const QStandardItem *item, list)
-            names << item->text();
-
-        for (int i = 1; i <= names.count(); ++i) {
-            folderName = (tr("New Folder") + QLatin1String(" %1")).arg(i);
-            if (!names.contains(folderName))
-                break;
-        }
-    }
-    return folderName;
-}
-
-void BookmarkManager::removeBookmarkFolderItems(QStandardItem *item)
-{
-    for (int j = 0; j < item->rowCount(); ++j) {
-        QStandardItem *child = item->child(j);
-        if (child->rowCount() > 0)
-            removeBookmarkFolderItems(child);
-
-        QString data = child->data(Qt::UserRole + 10).toString();
-        QList<QStandardItem*>itemList = listModel->findItems(child->text());
-        foreach (const QStandardItem *i, itemList) {
-            if (i->data(Qt::UserRole + 10) == data) {
-                listModel->removeRow(i->row());
-                break;
-            }
-        }
-    }
-}
-
-void BookmarkManager::readBookmarksRecursive(const QStandardItem *item,
-    QDataStream &stream, const qint32 depth) const
-{
-    for (int j = 0; j < item->rowCount(); ++j) {
-        const QStandardItem *child = item->child(j);
-        stream << depth;
-        stream << child->data(Qt::DisplayRole).toString();
-        stream << child->data(Qt::UserRole + 10).toString();
-        stream << child->data(Qt::UserRole + 11).toBool();
-
-        if (child->rowCount() > 0)
-            readBookmarksRecursive(child, stream, (depth +1));
+        typeAndSearch = false;
+        bookmarkTreeView->setModel(bookmarkModel);
+        bookmarkTreeView->setItemsExpandable(true);
+        bookmarkTreeView->setRootIsDecorated(true);
+        bookmarkModel->expandFoldersIfNeeeded(bookmarkTreeView);
     }
 }
Index: trunk/tools/assistant/tools/assistant/bookmarkmanager.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmanager.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/bookmarkmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,177 +39,117 @@
 **
 ****************************************************************************/
-
 #ifndef BOOKMARKMANAGER_H
 #define BOOKMARKMANAGER_H
 
-#include "ui_bookmarkdialog.h"
+#include <QtCore/QMutex>
+#include <QtGui/QTreeView>
 
-#include <QtCore/QUrl>
-#include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtCore/QByteArray>
-#include <QtCore/QDataStream>
-
-#include <QtGui/QIcon>
-#include <QtGui/QDialog>
-#include <QtGui/QWidget>
-#include <QtGui/QTreeView>
-#include <QtGui/QStandardItemModel>
+#include "ui_bookmarkwidget.h"
 
 QT_BEGIN_NAMESPACE
 
-class QEvent;
-class QLineEdit;
-class QTreeView;
-class QToolButton;
-class QStandardItem;
-class QHelpEngineCore;
-class QAbstractItemModel;
+class BookmarkManagerWidget;
+class BookmarkModel;
+class BookmarkFilterModel;
+class QKeyEvent;
 class QSortFilterProxyModel;
-
-class BookmarkManager;
-
-class BookmarkDialog : public QDialog
-{
-    Q_OBJECT
-
-public:
-    BookmarkDialog(BookmarkManager *manager, const QString &title,
-        const QString &url, QWidget *parent = 0);
-    ~BookmarkDialog();
-
-private slots:
-    void addAccepted();
-    void addNewFolder();
-    void toolButtonClicked();
-    void itemChanged(QStandardItem *item);
-    void textChanged(const QString& string);
-    void selectBookmarkFolder(const QString &folderName);
-    void customContextMenuRequested(const QPoint &point);
-    void currentChanged(const QModelIndex& current);
-
-private:
-    bool eventFilter(QObject *object, QEvent *e);
-
-private:
-    QString m_url;
-    QString m_title;
-
-    QString oldText;
-    QStandardItem *renameItem;
-
-    Ui::BookmarkDialog ui;
-    BookmarkManager *bookmarkManager;
-    QSortFilterProxyModel *proxyModel;
-};
-
-class TreeView : public QTreeView {
-    Q_OBJECT
-public:
-    TreeView(QWidget* parent = 0) : QTreeView(parent) {}
-    void subclassKeyPressEvent(QKeyEvent* event)
-    {
-        QTreeView::keyPressEvent(event);
-    }
-};
-
-class BookmarkWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    BookmarkWidget(BookmarkManager *manager, QWidget *parent = 0,
-        bool showButtons = true);
-    ~BookmarkWidget();
-
-signals:
-    void addBookmark();
-    void requestShowLink(const QUrl &url);
-    void escapePressed();
-
-private slots:
-    void removeClicked();
-    void filterChanged();
-    void expand(const QModelIndex& index);
-    void activated(const QModelIndex &index);
-    void customContextMenuRequested(const QPoint &point);
-
-private:
-    void setup(bool showButtons);
-    void expandItems();
-    void focusInEvent(QFocusEvent *e);
-    bool eventFilter(QObject *object, QEvent *event);
-
-private:
-    QRegExp regExp;
-    TreeView *treeView;
-    QLineEdit *searchField;
-    QToolButton *addButton;
-    QToolButton *removeButton;
-    BookmarkManager *bookmarkManager;
-    QSortFilterProxyModel* filterBookmarkModel;
-};
-
-class BookmarkModel : public QStandardItemModel
-{
-    Q_OBJECT
-
-public:
-    BookmarkModel(int rows, int columns, QObject *parent = 0);
-    ~BookmarkModel();
-
-    Qt::DropActions supportedDropActions() const;
-    Qt::ItemFlags flags(const QModelIndex &index) const;
-};
 
 class BookmarkManager : public QObject
 {
     Q_OBJECT
+    class BookmarkWidget;
+    class BookmarkTreeView;
+    class BookmarkListView;
+    Q_DISABLE_COPY(BookmarkManager);
 
 public:
-    BookmarkManager(QHelpEngineCore* helpEngine);
+    static BookmarkManager* instance();
+    static void destroy();
+
+    QWidget* bookmarkDockWidget() const;
+    void takeBookmarksMenu(QMenu* menu);
+
+public slots:
+    void addBookmark(const QString &title, const QString &url);
+
+signals:
+    void escapePressed();
+    void setSource(const QUrl &url);
+    void setSourceInNewTab(const QUrl &url);
+
+private:
+    BookmarkManager();
     ~BookmarkManager();
 
-    BookmarkModel* treeBookmarkModel();
-    BookmarkModel* listBookmarkModel();
+    void removeItem(const QModelIndex &index);
+    bool eventFilter(QObject *object, QEvent *event);
+    void buildBookmarksMenu(const QModelIndex &index, QMenu *menu);
+    void showBookmarkDialog(const QString &name, const QString &url);
 
-    void saveBookmarks();
-    QStringList bookmarkFolders() const;
-    QModelIndex addNewFolder(const QModelIndex& index);
-    void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index);
-    void showBookmarkDialog(QWidget* parent, const QString &name,
-        const QString &url);
-    void addNewBookmark(const QModelIndex& index, const QString &name,
-        const QString &url);
-    void setupBookmarkModels();
+private slots:
+    void setupFinished();
 
-    void fillBookmarkMenu(QMenu *menu);
-    QUrl urlForAction(QAction* action) const;
+    void addBookmark();
+    void removeBookmark();
+    void manageBookmarks();
+    void refeshBookmarkMenu();
+    void renameBookmark(const QModelIndex &index);
+
+    void setSourceFromAction(QAction *action);
+    void setSourceFromIndex(const QModelIndex &index, bool newTab = false);
+
+    void focusInEvent();
+    void managerWidgetAboutToClose();
+    void textChanged(const QString &text);
+    void customContextMenuRequested(const QPoint &point);
+
+private:
+    bool typeAndSearch;
+
+    static QMutex mutex;
+    static BookmarkManager *bookmarkManager;
+
+    QMenu *bookmarkMenu;
+
+    BookmarkModel *bookmarkModel;
+    BookmarkFilterModel *bookmarkFilterModel;
+    QSortFilterProxyModel *typeAndSearchModel;
+
+    BookmarkWidget *bookmarkWidget;
+    BookmarkTreeView *bookmarkTreeView;
+    BookmarkManagerWidget *bookmarkManagerWidget;
+};
+
+class BookmarkManager::BookmarkWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    BookmarkWidget(QWidget *parent = 0)
+        : QWidget(parent) { ui.setupUi(this); }
+    virtual ~BookmarkWidget() {}
+
+    Ui::BookmarkWidget ui;
 
 signals:
-    void bookmarksChanged();
+    void focusInEvent();
+
+private:
+    void focusInEvent(QFocusEvent *event);
+};
+
+class BookmarkManager::BookmarkTreeView : public QTreeView
+{
+    Q_OBJECT
+public:
+    BookmarkTreeView(QWidget *parent = 0);
+    ~BookmarkTreeView() {}
+
+    void subclassKeyPressEvent(QKeyEvent *event);
 
 private slots:
-    void itemChanged(QStandardItem *item);
-
-private:
-    QString uniqueFolderName() const;
-    void removeBookmarkFolderItems(QStandardItem *item);
-    void readBookmarksRecursive(const QStandardItem *item, QDataStream &stream,
-        const qint32 depth) const;
-    void fillBookmarkMenu(QMenu *menu, QStandardItem *root);
-
-private:
-    QString oldText;
-    QIcon folderIcon;
-
-    BookmarkModel *treeModel;
-    BookmarkModel *listModel;
-    QStandardItem *renameItem;
-    QHelpEngineCore *helpEngine;
-    QMap<QAction*, QModelIndex> map;
+    void setExpandedData(const QModelIndex &index);
 };
 
 QT_END_NAMESPACE
 
-#endif
+#endif  // BOOKMARKMANAGER_H
Index: trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp	(revision 846)
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bookmarkmanagerwidget.h"
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
+#include "tracer.h"
+#include "xbelsupport.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QUrl>
+
+#include <QtGui/QCloseEvent>
+#include <QtGui/QFileDialog>
+#include <QtGui/QKeySequence>
+#include <QtGui/QMessageBox>
+#include <QtGui/QShortcut>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+    #define TR(x) QCoreApplication::translate("BookmarkManager", x)
+}
+
+BookmarkManagerWidget::BookmarkManagerWidget(BookmarkModel *sourceModel,
+        QWidget *parent)
+    : QWidget(parent)
+    , bookmarkModel(sourceModel)
+{
+    TRACE_OBJ
+    ui.setupUi(this);
+
+    ui.treeView->setModel(bookmarkModel);
+
+    ui.treeView->expandAll();
+    ui.treeView->installEventFilter(this);
+    ui.treeView->viewport()->installEventFilter(this);
+    ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
+
+    connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this,
+        SLOT(customContextMenuRequested(QPoint)));
+
+    connect(ui.remove, SIGNAL(clicked()), this, SLOT(removeItem()));
+    connect(ui.lineEdit, SIGNAL(textChanged(QString)), this,
+        SLOT(textChanged(QString)));
+    new QShortcut(QKeySequence::Find, ui.lineEdit, SLOT(setFocus()));
+
+    importExportMenu.addAction(tr("Import..."), this, SLOT(importBookmarks()));
+    importExportMenu.addAction(tr("Export..."), this, SLOT(exportBookmarks()));
+    ui.importExport->setMenu(&importExportMenu);
+
+    new QShortcut(QKeySequence::FindNext, this, SLOT(findNext()));
+    new QShortcut(QKeySequence::FindPrevious, this, SLOT(findPrevious()));
+
+    connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+        SLOT(refeshBookmarkCache()));
+    connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+        SLOT(refeshBookmarkCache()));
+    connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+        SLOT(refeshBookmarkCache()));
+
+    ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2)));
+}
+
+BookmarkManagerWidget::~BookmarkManagerWidget()
+{
+    TRACE_OBJ
+}
+
+void BookmarkManagerWidget::closeEvent(QCloseEvent *event)
+{
+    TRACE_OBJ
+    event->accept();
+    emit managerWidgetAboutToClose();
+}
+
+void BookmarkManagerWidget::renameItem(const QModelIndex &index)
+{
+    TRACE_OBJ
+    // check if we should rename the "Bookmarks Menu", bail
+    if (!bookmarkModel->parent(index).isValid())
+        return;
+
+    bookmarkModel->setItemsEditable(true);
+    ui.treeView->edit(index);
+    bookmarkModel->setItemsEditable(false);
+}
+
+static int nextIndex(int current, int count, bool forward)
+{
+    TRACE_OBJ
+    if (current >= 0)
+        return (forward ? (current + 1) : ((current - 1) + count)) % count;
+    return 0;
+}
+
+void BookmarkManagerWidget::selectNextIndex(bool direction) const
+{
+    QModelIndex current = ui.treeView->currentIndex();
+    if (current.isValid() && !cache.isEmpty()) {
+        current = cache.at(nextIndex(cache.indexOf(current), cache.count(),
+            direction));
+    }
+    ui.treeView->setCurrentIndex(current);
+}
+
+bool BookmarkManagerWidget::eventFilter(QObject *object, QEvent *event)
+{
+    TRACE_OBJ
+    if (object != ui.treeView && object != ui.treeView->viewport())
+        return QWidget::eventFilter(object, event);
+
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *ke = static_cast<QKeyEvent*>(event);
+        switch (ke->key()) {
+            case Qt::Key_F2: {
+                renameItem(ui.treeView->currentIndex());
+            }   break;
+
+            case Qt::Key_Delete: {
+                removeItem(ui.treeView->currentIndex());
+            }   break;
+
+            default: break;
+        }
+    }
+
+    if (event->type() == QEvent::MouseButtonRelease) {
+        QMouseEvent *me = static_cast<QMouseEvent*>(event);
+        switch (me->button()) {
+            case Qt::LeftButton: {
+                if (me->modifiers() & Qt::ControlModifier)
+                    setSourceFromIndex(ui.treeView->currentIndex(), true);
+            }   break;
+
+            case Qt::MidButton: {
+                setSourceFromIndex(ui.treeView->currentIndex(), true);
+            }   break;
+
+            default: break;
+        }
+    }
+    return QObject::eventFilter(object, event);
+}
+
+void BookmarkManagerWidget::findNext()
+{
+    TRACE_OBJ
+    selectNextIndex(true);
+}
+
+void BookmarkManagerWidget::findPrevious()
+{
+    TRACE_OBJ
+    selectNextIndex(false);
+}
+
+void BookmarkManagerWidget::importBookmarks()
+{
+    TRACE_OBJ
+    const QString &fileName = QFileDialog::getOpenFileName(0, TR("Open File"),
+        QDir::currentPath(), TR("Files (*.xbel)"));
+
+    if (fileName.isEmpty())
+        return;
+
+    QFile file(fileName);
+    if (file.open(QIODevice::ReadOnly)) {
+        XbelReader reader(bookmarkModel);
+        reader.readFromFile(&file);
+    }
+}
+
+void BookmarkManagerWidget::exportBookmarks()
+{
+    TRACE_OBJ
+    QString fileName = QFileDialog::getSaveFileName(0, TR("Save File"),
+        QLatin1String("untitled.xbel"), TR("Files (*.xbel)"));
+
+    const QLatin1String suffix(".xbel");
+    if (!fileName.endsWith(suffix))
+        fileName.append(suffix);
+
+    QFile file(fileName);
+    if (file.open(QIODevice::WriteOnly)) {
+        XbelWriter writer(bookmarkModel);
+        writer.writeToFile(&file);
+    } else {
+        QMessageBox::information(this, TR("Qt Assistant"),
+            TR("Unable to save bookmarks."), TR("OK"));
+    }
+}
+
+void BookmarkManagerWidget::refeshBookmarkCache()
+{
+    TRACE_OBJ
+    cache.clear();
+
+    const QString &text = ui.lineEdit->text();
+    if (!text.isEmpty())
+        cache = bookmarkModel->indexListFor(text);
+}
+
+void BookmarkManagerWidget::textChanged(const QString &/*text*/)
+{
+    TRACE_OBJ
+    refeshBookmarkCache();
+    if (!cache.isEmpty())
+        ui.treeView->setCurrentIndex(cache.at(0));
+}
+
+void BookmarkManagerWidget::removeItem(const QModelIndex &index)
+{
+    TRACE_OBJ
+    QModelIndex current = index.isValid() ? index : ui.treeView->currentIndex();
+    if (!bookmarkModel->parent(current).isValid())
+        return;  // check if we should delete the "Bookmarks Menu", bail
+
+    if (bookmarkModel->hasChildren(current)) {
+        int value = QMessageBox::question(this, TR("Remove"), TR("You are going"
+            "to delete a Folder, this will also<br> remove it's content. Are "
+            "you sure to continue?"),
+            QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
+        if (value == QMessageBox::Cancel)
+            return;
+    }
+    bookmarkModel->removeItem(current);
+}
+
+void BookmarkManagerWidget::customContextMenuRequested(const QPoint &point)
+{
+    TRACE_OBJ
+    const QModelIndex &index = ui.treeView->indexAt(point);
+    if (!index.isValid())
+        return;
+
+    // check if we should open the menu on "Bookmarks Menu", bail
+    if (!bookmarkModel->parent(index).isValid())
+        return;
+
+    QAction *remove = 0;
+    QAction *rename = 0;
+    QAction *showItem = 0;
+    QAction *showItemInNewTab = 0;
+
+    QMenu menu(QLatin1String(""));
+    if (bookmarkModel->data(index, UserRoleFolder).toBool()) {
+        remove = menu.addAction(TR("Delete Folder"));
+        rename = menu.addAction(TR("Rename Folder"));
+    } else {
+        showItem = menu.addAction(TR("Show Bookmark"));
+        showItemInNewTab = menu.addAction(TR("Show Bookmark in New Tab"));
+        menu.addSeparator();
+        remove = menu.addAction(TR("Delete Bookmark"));
+        rename = menu.addAction(TR("Rename Bookmark"));
+    }
+
+    QAction *pickedAction = menu.exec(ui.treeView->mapToGlobal(point));
+    if (pickedAction == rename)
+        renameItem(index);
+    else if (pickedAction == remove)
+        removeItem(index);
+    else if (pickedAction == showItem || pickedAction == showItemInNewTab)
+        setSourceFromIndex(index, pickedAction == showItemInNewTab);
+}
+
+void
+BookmarkManagerWidget::setSourceFromIndex(const QModelIndex &index, bool newTab)
+{
+    TRACE_OBJ
+    if (bookmarkModel->data(index, UserRoleFolder).toBool())
+        return;
+
+    const QVariant &data = bookmarkModel->data(index, UserRoleUrl);
+    if (data.canConvert<QUrl>()) {
+        if (newTab)
+            emit setSourceInNewTab(data.toUrl());
+        else
+            emit setSource(data.toUrl());
+    }
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.h	(revision 846)
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BOOKMARKMANAGERWIDGET_H
+#define BOOKMARKMANAGERWIDGET_H
+
+#include "ui_bookmarkmanagerwidget.h"
+
+#include <QtCore/QPersistentModelIndex>
+
+#include <QtGui/QMenu>
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkModel;
+class QCloseEvent;
+class QString;
+
+class BookmarkManagerWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit BookmarkManagerWidget(BookmarkModel *bookmarkModel,
+        QWidget *parent = 0);
+    ~BookmarkManagerWidget();
+
+protected:
+    void closeEvent(QCloseEvent *event);
+
+signals:
+    void setSource(const QUrl &url);
+    void setSourceInNewTab(const QUrl &url);
+
+    void managerWidgetAboutToClose();
+
+private:
+    void renameItem(const QModelIndex &index);
+    void selectNextIndex(bool direction) const;
+    bool eventFilter(QObject *object, QEvent *event);
+
+private slots:
+    void findNext();
+    void findPrevious();
+
+    void importBookmarks();
+    void exportBookmarks();
+
+    void refeshBookmarkCache();
+    void textChanged(const QString &text);
+
+    void removeItem(const QModelIndex &index = QModelIndex());
+
+    void customContextMenuRequested(const QPoint &point);
+    void setSourceFromIndex(const QModelIndex &index, bool newTab = false);
+
+private:
+    QMenu importExportMenu;
+    Ui::BookmarkManagerWidget ui;
+    QList<QPersistentModelIndex> cache;
+
+    BookmarkModel *bookmarkModel;
+};
+
+QT_END_NAMESPACE
+
+#endif  // BOOKMARKMANAGERWIDGET_H
Index: trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui	(revision 846)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BookmarkManagerWidget</class>
+ <widget class="QWidget" name="BookmarkManagerWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>517</width>
+    <height>348</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Manage Bookmarks</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Search:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit"/>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTreeView" name="treeView">
+     <property name="acceptDrops">
+      <bool>true</bool>
+     </property>
+     <property name="showDropIndicator" stdset="0">
+      <bool>true</bool>
+     </property>
+     <property name="dragEnabled">
+      <bool>true</bool>
+     </property>
+     <property name="autoExpandDelay">
+      <number>1000</number>
+     </property>
+     <property name="uniformRowHeights">
+      <bool>true</bool>
+     </property>
+     <property name="allColumnsShowFocus">
+      <bool>true</bool>
+     </property>
+     <attribute name="headerDefaultSectionSize">
+      <number>225</number>
+     </attribute>
+     <attribute name="headerMinimumSectionSize">
+      <number>50</number>
+     </attribute>
+     <attribute name="headerDefaultSectionSize">
+      <number>225</number>
+     </attribute>
+     <attribute name="headerMinimumSectionSize">
+      <number>50</number>
+     </attribute>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QPushButton" name="remove">
+       <property name="text">
+        <string>Remove</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="importExport">
+       <property name="text">
+        <string>Import and Backup</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButton_5">
+       <property name="text">
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButton_5</sender>
+   <signal>clicked()</signal>
+   <receiver>BookmarkManagerWidget</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>445</x>
+     <y>328</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>340</x>
+     <y>313</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/tools/assistant/tools/assistant/bookmarkmodel.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmodel.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkmodel.cpp	(revision 846)
@@ -0,0 +1,452 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bookmarkmodel.h"
+#include "bookmarkitem.h"
+
+#include <QtCore/QMimeData>
+#include <QtCore/QStack>
+
+#include <QtGui/QApplication>
+#include <QtGui/QStyle>
+#include <QtGui/QTreeView>
+
+const QLatin1String MIMETYPE("application/bookmarks.assistant");
+
+BookmarkModel::BookmarkModel()
+    : QAbstractItemModel()
+    , m_folder(false)
+    , m_editable(false)
+    , rootItem(0)
+{
+}
+
+BookmarkModel::~BookmarkModel()
+{
+    delete rootItem;
+}
+
+QByteArray
+BookmarkModel::bookmarks() const
+{
+    QByteArray ba;
+    QDataStream stream(&ba, QIODevice::WriteOnly);
+
+    const QModelIndex &root = index(0,0, QModelIndex());
+    for (int i = 0; i < rowCount(root); ++i)
+        collectItems(index(i, 0, root), 0, &stream);
+
+    return ba;
+}
+
+void
+BookmarkModel::setBookmarks(const QByteArray &bookmarks)
+{
+    beginResetModel();
+
+    delete rootItem;
+    folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
+    bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png"));
+
+    rootItem = new BookmarkItem(DataVector() << tr("Name") << tr("Address")
+        << true);
+    BookmarkItem* item = new BookmarkItem(DataVector() << tr("Bookmarks Menu")
+        << QLatin1String("Folder") << true);
+    rootItem->addChild(item);
+
+    QStack<BookmarkItem*> parents;
+    parents.push(item);
+
+    qint32 depth;
+    bool expanded;
+    QString name, url;
+    QDataStream stream(bookmarks);
+    while (!stream.atEnd()) {
+        stream >> depth >> name >> url >> expanded;
+
+        while ((parents.count() - 1) != depth)
+            parents.pop();
+
+        item = new BookmarkItem(DataVector() << name << url << expanded);
+        if (url == QLatin1String("Folder")) {
+            parents.top()->addChild(item);
+            parents.push(item);
+        } else {
+            parents.top()->addChild(item);
+        }
+    }
+
+    cache.clear();
+    const QModelIndex &root = index(0,0, QModelIndex());
+
+    setupCache(root);
+    cache.insert(static_cast<BookmarkItem*> (root.internalPointer()), root);
+
+    endResetModel();
+}
+
+void
+BookmarkModel::setItemsEditable(bool editable)
+{
+    m_editable = editable;
+}
+
+void
+BookmarkModel::expandFoldersIfNeeeded(QTreeView *treeView)
+{
+    foreach (const QModelIndex &index, cache)
+        treeView->setExpanded(index, index.data(UserRoleExpanded).toBool());
+}
+
+QModelIndex
+BookmarkModel::addItem(const QModelIndex &parent, bool isFolder)
+{
+    m_folder = isFolder;
+    QModelIndex next;
+    if (insertRow(rowCount(parent), parent))
+        next = index(rowCount(parent) - 1, 0, parent);
+    m_folder = false;
+
+    return next;
+}
+
+bool
+BookmarkModel::removeItem(const QModelIndex &index)
+{
+    if (!index.isValid())
+        return false;
+
+    QModelIndexList indexes;
+    if (rowCount(index) > 0)
+        indexes = collectItems(index);
+    indexes.append(index);
+
+    foreach (const QModelIndex &itemToRemove, indexes) {
+        if (!removeRow(itemToRemove.row(), itemToRemove.parent()))
+            return false;
+        cache.remove(itemFromIndex(itemToRemove));
+    }
+    return true;
+}
+
+int
+BookmarkModel::rowCount(const QModelIndex &index) const
+{
+    if (BookmarkItem *item = itemFromIndex(index))
+        return item->childCount();
+    return 0;
+}
+
+int
+BookmarkModel::columnCount(const QModelIndex &/*index*/) const
+{
+    return 2;
+}
+
+QModelIndex
+BookmarkModel::parent(const QModelIndex &index) const
+{
+     if (!index.isValid())
+         return QModelIndex();
+
+     if (BookmarkItem *childItem = itemFromIndex(index)) {
+         if (BookmarkItem *parent = childItem->parent()) {
+             if (parent != rootItem)
+                 return createIndex(parent->childNumber(), 0, parent);
+         }
+     }
+     return QModelIndex();
+}
+
+QModelIndex
+BookmarkModel::index(int row, int column, const QModelIndex &index) const
+{
+    if (index.isValid() && (index.column() != 0 && index.column() != 1))
+         return QModelIndex();
+
+    if (BookmarkItem *parent = itemFromIndex(index)) {
+        if (BookmarkItem *childItem = parent->child(row))
+            return createIndex(row, column, childItem);
+    }
+    return QModelIndex();
+}
+
+Qt::DropActions
+BookmarkModel::supportedDropActions () const
+{
+    return /* Qt::CopyAction | */Qt::MoveAction;
+}
+
+Qt::ItemFlags
+BookmarkModel::flags(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return Qt::NoItemFlags;
+
+    Qt::ItemFlags defaultFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+
+    if (m_editable)
+        defaultFlags |= Qt::ItemIsEditable;
+
+    if (itemFromIndex(index) && index.data(UserRoleFolder).toBool()) {
+        if (index.column() > 0)
+            return defaultFlags &~ Qt::ItemIsEditable;
+        return defaultFlags | Qt::ItemIsDropEnabled;
+    }
+
+    return defaultFlags | Qt::ItemIsDragEnabled;
+}
+
+QVariant
+BookmarkModel::data(const QModelIndex &index, int role) const
+{
+    if (index.isValid()) {
+        if (BookmarkItem *item = itemFromIndex(index)) {
+            switch (role) {
+                case Qt::EditRole: {
+                case Qt::DisplayRole:
+                    if (index.data(UserRoleFolder).toBool() && index.column() == 1)
+                        return QLatin1String("");
+                    return item->data(index.column());
+                }   break;
+
+                case Qt::DecorationRole: {
+                    if (index.column() == 0)
+                        return index.data(UserRoleFolder).toBool()
+                            ? folderIcon : bookmarkIcon;
+                }   break;
+
+                default:;
+                    return item->data(role);
+            }
+        }
+    }
+    return QVariant();
+}
+
+void BookmarkModel::setData(const QModelIndex &index, const DataVector &data)
+{
+    if (BookmarkItem *item = itemFromIndex(index)) {
+        item->setData(data);
+        emit dataChanged(index, index);
+    }
+}
+
+bool
+BookmarkModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+    bool result = false;
+    if (role != Qt::EditRole && role != UserRoleExpanded)
+        return result;
+
+    if (BookmarkItem *item = itemFromIndex(index)) {
+        if (role == Qt::EditRole) {
+            const bool isFolder = index.data(UserRoleFolder).toBool();
+            if (!isFolder || (isFolder && index.column() == 0))
+                result = item->setData(index.column(), value);
+        } else if (role == UserRoleExpanded) {
+            result = item->setData(UserRoleExpanded, value);
+        }
+    }
+
+    if (result)
+        emit dataChanged(index, index);
+    return result;
+}
+
+QVariant
+BookmarkModel::headerData(int section, Qt::Orientation orientation,
+    int role) const
+{
+     if (rootItem && orientation == Qt::Horizontal && role == Qt::DisplayRole)
+         return rootItem->data(section);
+     return QVariant();
+}
+
+QModelIndex
+BookmarkModel::indexFromItem(BookmarkItem *item) const
+{
+    return cache.value(item, QModelIndex());
+}
+
+BookmarkItem*
+BookmarkModel::itemFromIndex(const QModelIndex &index) const
+{
+    if (index.isValid())
+         return static_cast<BookmarkItem*>(index.internalPointer());
+     return rootItem;
+}
+
+QList<QPersistentModelIndex>
+BookmarkModel::indexListFor(const QString &label) const
+{
+    QList<QPersistentModelIndex> hits;
+    const QModelIndexList &list = collectItems(QModelIndex());
+    foreach(const QModelIndex &index, list) {
+        if (index.data().toString().contains(label, Qt::CaseInsensitive))
+            hits.prepend(index);    // list is reverse sorted
+    }
+    return hits;
+}
+
+bool
+BookmarkModel::insertRows(int position, int rows, const QModelIndex &parent)
+{
+    if (!parent.data(UserRoleFolder).toBool())
+        return false;
+
+    bool success = false;
+    if (BookmarkItem *parentItem = itemFromIndex(parent)) {
+        beginInsertRows(parent, position, position + rows - 1);
+        success = parentItem->insertChildren(m_folder, position, rows);
+        if (success) {
+            const QModelIndex &current = index(position, 0, parent);
+            cache.insert(itemFromIndex(current), current);
+        }
+        endInsertRows();
+    }
+    return success;
+}
+
+bool
+BookmarkModel::removeRows(int position, int rows, const QModelIndex &index)
+{
+    bool success = false;
+    if (BookmarkItem *parent = itemFromIndex(index)) {
+        beginRemoveRows(index, position, position + rows - 1);
+        success = parent->removeChildren(position, rows);
+        endRemoveRows();
+    }
+    return success;
+}
+
+QStringList
+BookmarkModel::mimeTypes() const
+{
+    return QStringList() << MIMETYPE;
+}
+
+QMimeData*
+BookmarkModel::mimeData(const QModelIndexList &indexes) const
+{
+    if (indexes.isEmpty())
+        return 0;
+
+    QByteArray data;
+    QDataStream stream(&data, QIODevice::WriteOnly);
+
+    foreach (const QModelIndex &index, indexes) {
+        if (index.column() == 0)
+            collectItems(index, 0, &stream);
+    }
+
+    QMimeData *mimeData = new QMimeData();
+    mimeData->setData(MIMETYPE, data);
+    return mimeData;
+}
+
+bool
+BookmarkModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
+    int row, int column, const QModelIndex &parent)
+{
+    if (action == Qt::IgnoreAction)
+        return true;
+
+    if (!data->hasFormat(MIMETYPE) || column > 0)
+        return false;
+
+    QByteArray ba = data->data(MIMETYPE);
+    QDataStream stream(&ba, QIODevice::ReadOnly);
+    while (stream.atEnd())
+        return false;
+
+    qint32 depth;
+    bool expanded;
+    QString name, url;
+    while (!stream.atEnd()) {
+        stream >> depth >> name >> url >> expanded;
+        if (insertRow(qMax(0, row), parent)) {
+            const QModelIndex &current = index(qMax(0, row), 0, parent);
+            if (current.isValid()) {
+                BookmarkItem* item = itemFromIndex(current);
+                item->setData(DataVector() << name << url << expanded);
+            }
+        }
+    }
+    return true;
+}
+
+void
+BookmarkModel::setupCache(const QModelIndex &parent)
+{
+    const QModelIndexList &list = collectItems(parent);
+    foreach (const QModelIndex &index, list)
+        cache.insert(itemFromIndex(index), index);
+}
+
+QModelIndexList
+BookmarkModel::collectItems(const QModelIndex &parent) const
+{
+    QModelIndexList list;
+    for (int i = rowCount(parent) - 1; i >= 0 ; --i) {
+        const QModelIndex &next = index(i, 0, parent);
+        if (data(next, UserRoleFolder).toBool())
+            list += collectItems(next);
+        list.append(next);
+    }
+    return list;
+}
+
+void
+BookmarkModel::collectItems(const QModelIndex &parent, qint32 depth,
+    QDataStream *stream) const
+{
+    if (parent.isValid()) {
+        *stream << depth;
+        *stream << parent.data().toString();
+        *stream << parent.data(UserRoleUrl).toString();
+        *stream << parent.data(UserRoleExpanded).toBool();
+
+        for (int i = 0; i < rowCount(parent); ++i) {
+            if (parent.data(UserRoleFolder).toBool())
+                collectItems(index(i, 0 , parent), depth + 1, stream);
+        }
+    }
+}
Index: trunk/tools/assistant/tools/assistant/bookmarkmodel.h
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkmodel.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkmodel.h	(revision 846)
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BOOKMARKMODEL_H
+#define BOOKMARKMODEL_H
+
+#include <QtCore/QAbstractItemModel>
+
+#include <QtGui/QIcon>
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkItem;
+class QMimeData;
+class QTreeView;
+
+typedef QMap<BookmarkItem*, QPersistentModelIndex> ItemModelIndexCache;
+
+class BookmarkModel : public QAbstractItemModel
+{
+     Q_OBJECT
+public:
+    BookmarkModel();
+    ~BookmarkModel();
+
+    QByteArray bookmarks() const;
+    void setBookmarks(const QByteArray &bookmarks);
+
+    void setItemsEditable(bool editable);
+    void expandFoldersIfNeeeded(QTreeView *treeView);
+
+    QModelIndex addItem(const QModelIndex &parent, bool isFolder = false);
+    bool removeItem(const QModelIndex &index);
+
+    int rowCount(const QModelIndex &index = QModelIndex()) const;
+    int columnCount(const QModelIndex &index = QModelIndex()) const;
+
+    QModelIndex parent(const QModelIndex &index) const;
+    QModelIndex index(int row, int column, const QModelIndex &index) const;
+
+    Qt::DropActions supportedDropActions () const;
+    Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    QVariant data(const QModelIndex &index, int role) const;
+    void setData(const QModelIndex &index, const QVector<QVariant> &data);
+    bool setData(const QModelIndex &index, const QVariant &value, int role);
+    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+    QModelIndex indexFromItem(BookmarkItem *item) const;
+    BookmarkItem *itemFromIndex(const QModelIndex &index) const;
+    QList<QPersistentModelIndex> indexListFor(const QString &label) const;
+
+    bool insertRows(int position, int rows, const QModelIndex &parent);
+    bool removeRows(int position, int rows, const QModelIndex &parent);
+
+    QStringList mimeTypes() const;
+    QMimeData* mimeData(const QModelIndexList &indexes) const;
+    bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row,
+        int column, const QModelIndex &parent);
+
+private:
+    void setupCache(const QModelIndex &parent);
+    QModelIndexList collectItems(const QModelIndex &parent) const;
+    void collectItems(const QModelIndex &parent, qint32 depth,
+        QDataStream *stream) const;
+
+private:
+    int columns;
+    bool m_folder;
+    bool m_editable;
+    QIcon folderIcon;
+    QIcon bookmarkIcon;
+    QTreeView *treeView;
+    BookmarkItem *rootItem;
+    ItemModelIndexCache cache;
+};
+
+QT_END_NAMESPACE
+
+#endif  // BOOKMARKMODEL_H
Index: trunk/tools/assistant/tools/assistant/bookmarkwidget.ui
===================================================================
--- trunk/tools/assistant/tools/assistant/bookmarkwidget.ui	(revision 846)
+++ trunk/tools/assistant/tools/assistant/bookmarkwidget.ui	(revision 846)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BookmarkWidget</class>
+ <widget class="QWidget" name="BookmarkWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>235</width>
+    <height>606</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Bookmarks</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="margin">
+    <number>4</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Filter:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QLineEdit" name="lineEdit"/>
+   </item>
+   <item>
+    <widget class="QStackedWidget" name="stackedWidget"/>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="add">
+       <property name="text">
+        <string>Add</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="remove">
+       <property name="text">
+        <string>Remove</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: trunk/tools/assistant/tools/assistant/centralwidget.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/centralwidget.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/centralwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,34 +39,34 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "centralwidget.h"
-#include "helpviewer.h"
+#include "findwidget.h"
+#include "helpenginewrapper.h"
 #include "searchwidget.h"
 #include "mainwindow.h"
-#include "preferencesdialog.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QEvent>
+#include "../shared/collectionconfiguration.h"
+
+#if defined(QT_NO_WEBKIT)
+#include "helpviewer_qtb.h"
+#else
+#include "helpviewer_qwv.h"
+#endif // QT_NO_WEBKIT
+
 #include <QtCore/QTimer>
 
+#include <QtGui/QApplication>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QLayout>
 #include <QtGui/QMenu>
-#include <QtGui/QLabel>
-#include <QtGui/QLayout>
 #include <QtGui/QPrinter>
-#include <QtGui/QLineEdit>
-#include <QtGui/QCheckBox>
 #include <QtGui/QTabBar>
 #include <QtGui/QTabWidget>
+#include <QtGui/QTextBrowser>
 #include <QtGui/QToolButton>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QSpacerItem>
-#include <QtGui/QTextCursor>
+#include <QtGui/QPageSetupDialog>
 #include <QtGui/QPrintDialog>
-#include <QtGui/QApplication>
-#include <QtGui/QTextDocumentFragment>
 #include <QtGui/QPrintPreviewDialog>
-#include <QtGui/QPageSetupDialog>
-
-#include <QtHelp/QHelpEngine>
+
 #include <QtHelp/QHelpSearchEngine>
 
@@ -77,4 +77,5 @@
         const QPoint &point)
     {
+        TRACE_OBJ
         QTabBar *tabBar = qFindChild<QTabBar*>(widget);
         for (int i = 0; i < tabBar->count(); ++i) {
@@ -87,135 +88,16 @@
 }
 
-FindWidget::FindWidget(QWidget *parent)
-    : QWidget(parent)
-    , appPalette(qApp->palette())
-{
-    QHBoxLayout *hboxLayout = new QHBoxLayout(this);
-    QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
-
-#ifndef Q_OS_MAC
-    hboxLayout->setMargin(0);
-    hboxLayout->setSpacing(6);
-    resourcePath.append(QLatin1String("win"));
-#else
-    resourcePath.append(QLatin1String("mac"));
-#endif
-
-    toolClose = setupToolButton(QLatin1String(""),
-        resourcePath + QLatin1String("/closetab.png"));
-    hboxLayout->addWidget(toolClose);
-
-    editFind = new QLineEdit(this);
-    hboxLayout->addWidget(editFind);
-    editFind->setMinimumSize(QSize(150, 0));
-    connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));
-
-    toolPrevious = setupToolButton(tr("Previous"),
-        resourcePath + QLatin1String("/previous.png"));
-    hboxLayout->addWidget(toolPrevious);
-
-    toolNext = setupToolButton(tr("Next"),
-        resourcePath + QLatin1String("/next.png"));
-    hboxLayout->addWidget(toolNext);
-
-    checkCase = new QCheckBox(tr("Case Sensitive"), this);
-    hboxLayout->addWidget(checkCase);
-
-    checkWholeWords = new QCheckBox(tr("Whole words"), this);
-    hboxLayout->addWidget(checkWholeWords);
-#if !defined(QT_NO_WEBKIT)
-    checkWholeWords->hide();
-#endif
-
-    labelWrapped = new QLabel(this);
-    labelWrapped->setScaledContents(true);
-    labelWrapped->setTextFormat(Qt::RichText);
-    labelWrapped->setMinimumSize(QSize(0, 20));
-    labelWrapped->setMaximumSize(QSize(105, 20));
-    labelWrapped->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
-    labelWrapped->setText(tr("<img src=\":/trolltech/assistant/images/wrap.png\""
-        ">&nbsp;Search wrapped"));
-    hboxLayout->addWidget(labelWrapped);
-
-    QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding,
-        QSizePolicy::Minimum);
-    hboxLayout->addItem(spacerItem);
-    setMinimumWidth(minimumSizeHint().width());
-    labelWrapped->hide();
-
-    updateButtons();
-}
-
-FindWidget::~FindWidget()
-{
-}
-
-void FindWidget::hideEvent(QHideEvent* event)
-{
-#if !defined(QT_NO_WEBKIT)
-    // TODO: remove this once webkit supports setting the palette
-    if (!event->spontaneous())
-        qApp->setPalette(appPalette);
-#else
-    Q_UNUSED(event);
-#endif
-}
-
-void FindWidget::showEvent(QShowEvent* event)
-{
-#if !defined(QT_NO_WEBKIT)
-    // TODO: remove this once webkit supports setting the palette
-    if (!event->spontaneous()) {
-        QPalette p = appPalette;
-        p.setColor(QPalette::Inactive, QPalette::Highlight,
-            p.color(QPalette::Active, QPalette::Highlight));
-        p.setColor(QPalette::Inactive, QPalette::HighlightedText,
-            p.color(QPalette::Active, QPalette::HighlightedText));
-        qApp->setPalette(p);
-    }
-#else
-    Q_UNUSED(event);
-#endif
-}
-
-void FindWidget::updateButtons()
-{
-    if (editFind->text().isEmpty()) {
-        toolPrevious->setEnabled(false);
-        toolNext->setEnabled(false);
-    } else {
-        toolPrevious->setEnabled(true);
-        toolNext->setEnabled(true);
-    }
-}
-
-QToolButton* FindWidget::setupToolButton(const QString &text, const QString &icon)
-{
-    QToolButton *toolButton = new QToolButton(this);
-
-    toolButton->setText(text);
-    toolButton->setAutoRaise(true);
-    toolButton->setIcon(QIcon(icon));
-    toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
-
-    return toolButton;
-}
-
-
-// --
-
-
-CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
+// -- CentralWidget
+
+CentralWidget::CentralWidget(MainWindow *parent)
     : QWidget(parent)
     , lastTabPage(0)
-    , collectionFile(engine->collectionFile())
-    , findBar(0)
     , tabWidget(0)
     , findWidget(0)
-    , helpEngine(engine)
     , printer(0)
     , usesDefaultCollection(parent->usesDefaultCollection())
     , m_searchWidget(0)
 {
+    TRACE_OBJ
     globalActionList.clear();
     staticCentralWidget = this;
@@ -254,18 +136,13 @@
     vboxLayout->addWidget(tabWidget);
 
-    findBar = new QWidget(this);
-    findWidget = new FindWidget(findBar);
-    findBar->setMinimumHeight(findWidget->minimumSizeHint().height());
-    findWidget->move(0, 0);
-    vboxLayout->addWidget(findBar);
-    findBar->hide();
-    findWidget->editFind->installEventFilter(this);
-
-    connect(findWidget->toolClose, SIGNAL(clicked()), findBar, SLOT(hide()));
-    connect(findWidget->toolNext, SIGNAL(clicked()), this, SLOT(findNext()));
-    connect(findWidget->editFind, SIGNAL(returnPressed()), this, SLOT(findNext()));
-    connect(findWidget->editFind, SIGNAL(textChanged(QString)), this,
-        SLOT(findCurrentText(QString)));
-    connect(findWidget->toolPrevious, SIGNAL(clicked()), this, SLOT(findPrevious()));
+    findWidget = new FindWidget(this);
+    vboxLayout->addWidget(findWidget);
+    findWidget->hide();
+
+    connect(findWidget, SIGNAL(findNext()), this, SLOT(findNext()));
+    connect(findWidget, SIGNAL(findPrevious()), this, SLOT(findPrevious()));
+    connect(findWidget, SIGNAL(find(QString, bool)), this,
+        SLOT(find(QString, bool)));
+    connect(findWidget, SIGNAL(escapePressed()), this, SLOT(activateTab()));
 
     QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
@@ -289,15 +166,11 @@
 CentralWidget::~CentralWidget()
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     delete printer;
 #endif
 
-    QHelpEngineCore engine(collectionFile, 0);
-    if (!engine.setupData())
-        return;
-
-    QString zoomCount;
-    QString currentPages;
-    QLatin1Char separator('|');
+    QStringList zoomFactors;
+    QStringList currentPages;
     bool searchAttached = m_searchWidget->isAttached();
 
@@ -306,21 +179,19 @@
         HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
         if (viewer && viewer->source().isValid()) {
-            currentPages += viewer->source().toString() + separator;
-            zoomCount += QString::number(viewer->zoom()) + separator;
+            currentPages << viewer->source().toString();
+            zoomFactors << QString::number(viewer->scale());
         }
     }
 
-    engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage);
-    engine.setCustomValue(QLatin1String("LastShownPages"), currentPages);
-    engine.setCustomValue(QLatin1String("SearchWasAttached"), searchAttached);
-#if !defined(QT_NO_WEBKIT)
-    engine.setCustomValue(QLatin1String("LastPagesZoomWebView"), zoomCount);
-#else
-    engine.setCustomValue(QLatin1String("LastPagesZoomTextBrowser"), zoomCount);
-#endif
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    helpEngine.setLastTabPage(tabWidget->currentIndex());
+    helpEngine.setLastShownPages(currentPages);
+    helpEngine.setSearchWasAttached(searchAttached);
+    helpEngine.setLastZoomFactors(zoomFactors);
 }
 
 CentralWidget *CentralWidget::instance()
 {
+    TRACE_OBJ
     return staticCentralWidget;
 }
@@ -328,4 +199,5 @@
 void CentralWidget::newTab()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
 #if !defined(QT_NO_WEBKIT)
@@ -339,7 +211,8 @@
 void CentralWidget::zoomIn()
 {
-    HelpViewer *viewer = currentHelpViewer();
-    if (viewer)
-        viewer->zoomIn();
+    TRACE_OBJ
+    HelpViewer *viewer = currentHelpViewer();
+    if (viewer)
+        viewer->scaleUp();
 
     if (tabWidget->currentWidget() == m_searchWidget)
@@ -349,7 +222,8 @@
 void CentralWidget::zoomOut()
 {
-    HelpViewer *viewer = currentHelpViewer();
-    if (viewer)
-        viewer->zoomOut();
+    TRACE_OBJ
+    HelpViewer *viewer = currentHelpViewer();
+    if (viewer)
+        viewer->scaleDown();
 
     if (tabWidget->currentWidget() == m_searchWidget)
@@ -357,11 +231,7 @@
 }
 
-void CentralWidget::findNext()
-{
-    find(findWidget->editFind->text(), true);
-}
-
 void CentralWidget::nextPage()
 {
+    TRACE_OBJ
     int index = tabWidget->currentIndex() + 1;
     if (index >= tabWidget->count())
@@ -372,7 +242,7 @@
 void CentralWidget::resetZoom()
 {
-    HelpViewer *viewer = currentHelpViewer();
-    if (viewer)
-        viewer->resetZoom();
+    TRACE_OBJ
+    if (HelpViewer *viewer = currentHelpViewer())
+        viewer->resetScale();
 
     if (tabWidget->currentWidget() == m_searchWidget)
@@ -382,4 +252,5 @@
 void CentralWidget::previousPage()
 {
+    TRACE_OBJ
     int index = tabWidget->currentIndex() -1;
     if (index < 0)
@@ -388,11 +259,7 @@
 }
 
-void CentralWidget::findPrevious()
-{
-    find(findWidget->editFind->text(), false);
-}
-
 void CentralWidget::closeTab()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (!viewer|| tabWidget->count() == 1)
@@ -405,4 +272,5 @@
 void CentralWidget::setSource(const QUrl &url)
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     HelpViewer *lastViewer =
@@ -410,5 +278,5 @@
 
     if (!viewer && !lastViewer) {
-        viewer = new HelpViewer(helpEngine, this);
+        viewer = new HelpViewer(this);
         viewer->installEventFilter(this);
         lastTabPage = tabWidget->addTab(viewer, QString());
@@ -428,16 +296,12 @@
 void CentralWidget::setupWidget()
 {
-    int option = helpEngine->customValue(QLatin1String("StartOption"),
-        ShowLastPages).toInt();
-
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    int option = helpEngine.startOption();
     if (option != ShowLastPages) {
         QString homePage;
-        if (option == ShowHomePage) {
-            homePage = helpEngine->customValue(QLatin1String("defaultHomepage"),
-                QLatin1String("help")).toString();
-            homePage = helpEngine->customValue(QLatin1String("homepage"),
-                homePage).toString();
-        }
-        if (option == ShowBlankPage)
+        if (option == ShowHomePage)
+            homePage = helpEngine.homePage();
+        else if (option == ShowBlankPage)
             homePage = QLatin1String("about:blank");
         setSource(homePage);
@@ -449,9 +313,7 @@
 void CentralWidget::setLastShownPages()
 {
-    const QLatin1String key("LastShownPages");
-    QString value = helpEngine->customValue(key, QString()).toString();
-    const QStringList lastShownPageList = value.split(QLatin1Char('|'),
-        QString::SkipEmptyParts);
-
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    const QStringList &lastShownPageList = helpEngine.lastShownPages();
     const int pageCount = lastShownPageList.count();
     if (pageCount == 0) {
@@ -462,40 +324,31 @@
         return;
     }
-
-#if !defined(QT_NO_WEBKIT)
-    const QLatin1String zoom("LastPagesZoomWebView");
-#else
-    const QLatin1String zoom("LastPagesZoomTextBrowser");
-#endif
-
-    value = helpEngine->customValue(zoom, QString()).toString();
-    QVector<QString> zoomVector = value.split(QLatin1Char('|'),
-        QString::SkipEmptyParts).toVector();
-
-    const int zoomCount = zoomVector.count();
-    zoomVector.insert(zoomCount, pageCount - zoomCount, QLatin1String("0.0"));
-
-    QVector<QString>::const_iterator zIt = zoomVector.constBegin();
-    QStringList::const_iterator it = lastShownPageList.constBegin();
-    for (; it != lastShownPageList.constEnd(); ++it, ++zIt)
-        setSourceInNewTab((*it), (*zIt).toFloat());
-
-    const QLatin1String lastTab("LastTabPage");
-    int tab = helpEngine->customValue(lastTab, 1).toInt();
-
-    const QLatin1String searchKey("SearchWasAttached");
+    QStringList zoomFactors = helpEngine.lastZoomFactors();
+    while (zoomFactors.count() < pageCount)
+        zoomFactors.append(CollectionConfiguration::DefaultZoomFactor);
+
     const bool searchIsAttached = m_searchWidget->isAttached();
-    const bool searchWasAttached = helpEngine->customValue(searchKey).toBool();
-
-    if (searchWasAttached && !searchIsAttached)
-        tabWidget->setCurrentIndex(--tab);
+    const bool searchWasAttached = helpEngine.searchWasAttached();
+    int tabToShow = helpEngine.lastTabPage();
+    if (searchWasAttached && !searchIsAttached && tabToShow != 0)
+        --tabToShow;
     else if (!searchWasAttached && searchIsAttached)
-        tabWidget->setCurrentIndex(++tab);
-    else
-        tabWidget->setCurrentIndex(tab);
+        ++tabToShow;
+
+    for (int curTab = 0; curTab < pageCount; ++curTab) {
+        const QString &curFile = lastShownPageList.at(curTab);
+        if (helpEngine.findFile(curFile).isValid()
+            || curFile == QLatin1String("about:blank")) {
+            setSourceInNewTab(curFile, zoomFactors.at(curTab).toFloat());
+        } else if (curTab + searchIsAttached <= tabToShow)
+            --tabToShow;
+    }
+
+    tabWidget->setCurrentIndex(tabToShow);
 }
 
 bool CentralWidget::hasSelection() const
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     return viewer ? viewer->hasSelection() : false;
@@ -504,4 +357,5 @@
 QUrl CentralWidget::currentSource() const
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -513,4 +367,5 @@
 QString CentralWidget::currentTitle() const
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -522,4 +377,5 @@
 void CentralWidget::copySelection()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -529,11 +385,11 @@
 void CentralWidget::showTextSearch()
 {
-    findBar->show();
-    findWidget->editFind->selectAll();
-    findWidget->editFind->setFocus(Qt::ShortcutFocusReason);
+    TRACE_OBJ
+    findWidget->show();
 }
 
 void CentralWidget::initPrinter()
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     if (!printer)
@@ -544,4 +400,5 @@
 void CentralWidget::print()
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     HelpViewer *viewer = currentHelpViewer();
@@ -551,16 +408,15 @@
     initPrinter();
 
-    QPrintDialog *dlg = new QPrintDialog(printer, this);
+    QPrintDialog dlg(printer, this);
 #if defined(QT_NO_WEBKIT)
     if (viewer->textCursor().hasSelection())
-        dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
-#endif
-    dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange);
-    dlg->addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
-    dlg->setWindowTitle(tr("Print Document"));
-    if (dlg->exec() == QDialog::Accepted) {
+        dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection);
+#endif
+    dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
+    dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
+    dlg.setWindowTitle(tr("Print Document"));
+    if (dlg.exec() == QDialog::Accepted) {
         viewer->print(printer);
     }
-    delete dlg;
 #endif
 }
@@ -568,4 +424,5 @@
 void CentralWidget::printPreview()
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     initPrinter();
@@ -579,4 +436,5 @@
 void CentralWidget::printPreview(QPrinter *p)
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     HelpViewer *viewer = currentHelpViewer();
@@ -588,4 +446,5 @@
 void CentralWidget::pageSetup()
 {
+    TRACE_OBJ
 #ifndef QT_NO_PRINTER
     initPrinter();
@@ -597,4 +456,5 @@
 bool CentralWidget::isHomeAvailable() const
 {
+    TRACE_OBJ
     return currentHelpViewer() ? true : false;
 }
@@ -602,4 +462,5 @@
 void CentralWidget::home()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -609,4 +470,5 @@
 bool CentralWidget::isForwardAvailable() const
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -618,4 +480,5 @@
 void CentralWidget::forward()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -625,4 +488,5 @@
 bool CentralWidget::isBackwardAvailable() const
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -634,4 +498,5 @@
 void CentralWidget::backward()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -642,4 +507,5 @@
 QList<QAction*> CentralWidget::globalActions() const
 {
+    TRACE_OBJ
     return globalActionList;
 }
@@ -647,4 +513,5 @@
 void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
 {
+    TRACE_OBJ
     globalActionList = actions;
 }
@@ -652,13 +519,11 @@
 void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
 {
-    HelpViewer *viewer;
-
-#if defined(QT_NO_WEBKIT)
-    viewer = currentHelpViewer();
-    if (viewer && viewer->launchedWithExternalApp(url))
-        return;
-#endif
-
-    viewer = new HelpViewer(helpEngine, this);
+    TRACE_OBJ
+    if (HelpViewer *viewer = currentHelpViewer()) {
+        if (viewer->launchWithExternalApp(url))
+            return;
+    }
+
+    HelpViewer *viewer = new HelpViewer(this, zoom);
     viewer->installEventFilter(this);
     viewer->setSource(url);
@@ -666,17 +531,4 @@
     tabWidget->setCurrentIndex(tabWidget->addTab(viewer,
         quoteTabTitle(viewer->documentTitle())));
-
-    QFont font;
-    getBrowserFontFor(viewer, &font);
-
-#if defined(QT_NO_WEBKIT)
-    font.setPointSize((int)(font.pointSize() + zoom));
-    setBrowserFontFor(viewer, font);
-    viewer->setZoom((int)zoom);
-#else
-    setBrowserFontFor(viewer, font);
-    viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
-#endif
-
     connectSignals();
 }
@@ -684,5 +536,6 @@
 HelpViewer *CentralWidget::newEmptyTab()
 {
-    HelpViewer *viewer = new HelpViewer(helpEngine, this);
+    TRACE_OBJ
+    HelpViewer *viewer = new HelpViewer(this);
     viewer->installEventFilter(this);
     viewer->setFocus(Qt::OtherFocusReason);
@@ -696,11 +549,7 @@
 }
 
-void CentralWidget::findCurrentText(const QString &text)
-{
-    find(text, true);
-}
-
 void CentralWidget::connectSignals()
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer) {
@@ -717,9 +566,17 @@
         connect(viewer, SIGNAL(sourceChanged(QUrl)), this,
             SLOT(setTabTitle(QUrl)));
-    }
-}
-
-HelpViewer *CentralWidget::currentHelpViewer() const
-{
+        connect(viewer, SIGNAL(printRequested()), this, SLOT(print()));
+    }
+}
+
+HelpViewer* CentralWidget::viewerAt(int index) const
+{
+    TRACE_OBJ
+    return qobject_cast<HelpViewer*>(tabWidget->widget(index));
+}
+
+HelpViewer* CentralWidget::currentHelpViewer() const
+{
+    TRACE_OBJ
     return qobject_cast<HelpViewer*>(tabWidget->currentWidget());
 }
@@ -727,4 +584,5 @@
 void CentralWidget::activateTab(bool onlyHelpViewer)
 {
+    TRACE_OBJ
     if (currentHelpViewer()) {
         currentHelpViewer()->setFocus();
@@ -740,4 +598,5 @@
 void CentralWidget::setTabTitle(const QUrl &url)
 {
+    TRACE_OBJ
     Q_UNUSED(url)
 #if !defined(QT_NO_WEBKIT)
@@ -761,4 +620,5 @@
 void CentralWidget::currentPageChanged(int index)
 {
+    TRACE_OBJ
     const HelpViewer *viewer = currentHelpViewer();
     if (viewer)
@@ -776,4 +636,5 @@
 void CentralWidget::showTabBarContextMenu(const QPoint &point)
 {
+    TRACE_OBJ
     HelpViewer *viewer = helpViewerFromTabPosition(tabWidget, point);
     if (!viewer)
@@ -823,9 +684,10 @@
 
     if (pickedAction == newBookmark)
-        emit addNewBookmark(viewer->documentTitle(), viewer->source().toString());
+        emit addBookmark(viewer->documentTitle(), viewer->source().toString());
 }
 
 bool CentralWidget::eventFilter(QObject *object, QEvent *e)
 {
+    TRACE_OBJ
     if (e->type() == QEvent::KeyPress) {
         QKeyEvent *ke = static_cast<QKeyEvent*>(e);
@@ -833,12 +695,4 @@
             default: {
                 return QWidget::eventFilter(object, e);
-            }   break;
-
-            case Qt::Key_Escape: {
-                if (findWidget->editFind == object) {
-                    findBar->hide();
-                    if (HelpViewer *viewer = currentHelpViewer())
-                        viewer->setFocus();
-                }
             }   break;
 
@@ -883,25 +737,33 @@
 void CentralWidget::keyPressEvent(QKeyEvent *e)
 {
+    TRACE_OBJ
     const QString &text = e->text();
     if (text.startsWith(QLatin1Char('/'))) {
-        if (!findBar->isVisible()) {
-            findBar->show();
-            findWidget->editFind->clear();
+        if (!findWidget->isVisible()) {
+            findWidget->showAndClear();
         } else {
-            findWidget->editFind->selectAll();
+            findWidget->show();
         }
-        findWidget->editFind->setFocus();
-        return;
-    }
-    QWidget::keyPressEvent(e);
+    } else {
+        QWidget::keyPressEvent(e);
+    }
+}
+
+void CentralWidget::findNext()
+{
+    TRACE_OBJ
+    find(findWidget->text(), true);
+}
+
+void CentralWidget::findPrevious()
+{
+    TRACE_OBJ
+    find(findWidget->text(), false);
 }
 
 void CentralWidget::find(const QString &ttf, bool forward)
 {
-    QPalette p = findWidget->editFind->palette();
-    p.setColor(QPalette::Active, QPalette::Base, Qt::white);
-
+    TRACE_OBJ
     bool found = false;
-
 #if defined(QT_NO_WEBKIT)
     found = findInTextBrowser(ttf, forward);
@@ -910,14 +772,15 @@
 #endif
 
-    if (!found && !ttf.isEmpty())
-        p.setColor(QPalette::Active, QPalette::Base, QColor(255, 102, 102));
+    if (!found && ttf.isEmpty())
+        found = true;   // the line edit is empty, no need to mark it red...
 
     if (!findWidget->isVisible())
         findWidget->show();
-    findWidget->editFind->setPalette(p);
+    findWidget->setPalette(found);
 }
 
 bool CentralWidget::findInWebPage(const QString &ttf, bool forward)
 {
+    TRACE_OBJ
 #if !defined(QT_NO_WEBKIT)
     if (HelpViewer *viewer = currentHelpViewer()) {
@@ -928,9 +791,9 @@
                 options |= QWebPage::FindBackward;
 
-            if (findWidget->checkCase->isChecked())
+            if (findWidget->caseSensitive())
                 options |= QWebPage::FindCaseSensitively;
 
             found = viewer->findText(ttf, options);
-            findWidget->labelWrapped->hide();
+            findWidget->setTextWrappedVisible(false);
 
             if (!found) {
@@ -938,9 +801,11 @@
                 found = viewer->findText(ttf, options);
                 if (found)
-                    findWidget->labelWrapped->show();
+                    findWidget->setTextWrappedVisible(true);
             }
         }
         // force highlighting of all other matches, also when empty (clear)
         options = QWebPage::HighlightAllOccurrences;
+        if (findWidget->caseSensitive())
+            options |= QWebPage::FindCaseSensitively;
         viewer->findText(QLatin1String(""), options);
         viewer->findText(ttf, options);
@@ -950,4 +815,7 @@
     // this needs to stay, case for active search results page
     return findInTextBrowser(ttf, forward);
+#else
+    Q_UNUSED(ttf);
+    Q_UNUSED(forward);
 #endif
     return false;
@@ -956,4 +824,5 @@
 bool CentralWidget::findInTextBrowser(const QString &ttf, bool forward)
 {
+    TRACE_OBJ
     QTextBrowser *browser = qobject_cast<QTextBrowser*>(currentHelpViewer());
     if (tabWidget->currentWidget() == m_searchWidget)
@@ -979,11 +848,8 @@
         options |= QTextDocument::FindBackward;
 
-    if (findWidget->checkCase->isChecked())
+    if (findWidget->caseSensitive())
         options |= QTextDocument::FindCaseSensitively;
 
-    if (findWidget->checkWholeWords->isChecked())
-        options |= QTextDocument::FindWholeWords;
-
-    findWidget->labelWrapped->hide();
+    findWidget->setTextWrappedVisible(false);
 
     bool found = true;
@@ -998,5 +864,5 @@
             newCursor = cursor;
         } else {
-            findWidget->labelWrapped->show();
+            findWidget->setTextWrappedVisible(true);
         }
     }
@@ -1007,19 +873,29 @@
 void CentralWidget::updateBrowserFont()
 {
-    QFont font;
-    bool searchAttached = searchWidgetAttached();
+    TRACE_OBJ
+    const bool searchAttached = searchWidgetAttached();
     if (searchAttached) {
-        getBrowserFontFor(m_searchWidget, &font);
-        setBrowserFontFor(m_searchWidget, font);
-    }
-
-    int i = searchAttached ? 1 : 0;
-    getBrowserFontFor(tabWidget->widget(i), &font);
-    for ( ; i < tabWidget->count(); ++i)
-        setBrowserFontFor(tabWidget->widget(i), font);
+        HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+        m_searchWidget->setFont(helpEngine.usesBrowserFont()
+            ? helpEngine.browserFont() : qApp->font());
+    }
+
+    const int count = tabWidget->count();
+    if (HelpViewer* viewer = viewerAt(count - 1)) {
+        const QFont &font = viewer->viewerFont();
+        for (int i = searchAttached ? 1 : 0; i < count; ++i)
+            viewerAt(i)->setViewerFont(font);
+    }
+}
+
+bool CentralWidget::searchWidgetAttached() const
+{
+    TRACE_OBJ
+    return m_searchWidget && m_searchWidget->isAttached();
 }
 
 void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine)
 {
+    TRACE_OBJ
     if (m_searchWidget)
         return;
@@ -1031,13 +907,14 @@
         SLOT(setSourceFromSearchInNewTab(QUrl)));
 
-    QFont font;
-    getBrowserFontFor(m_searchWidget, &font);
-    setBrowserFontFor(m_searchWidget, font);
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    m_searchWidget->setFont(!helpEngine.usesBrowserFont() ? qApp->font()
+        : helpEngine.browserFont());
 }
 
 void CentralWidget::activateSearchWidget(bool updateLastTabPage)
 {
+    TRACE_OBJ
     if (!m_searchWidget)
-        createSearchWidget(helpEngine->searchEngine());
+        createSearchWidget(HelpEngineWrapper::instance().searchEngine());
 
     if (!m_searchWidget->isAttached()) {
@@ -1055,4 +932,5 @@
 void CentralWidget::removeSearchWidget()
 {
+    TRACE_OBJ
     if (searchWidgetAttached()) {
         tabWidget->removeTab(0);
@@ -1063,4 +941,5 @@
 int CentralWidget::availableHelpViewer() const
 {
+    TRACE_OBJ
     int count = tabWidget->count();
     if (searchWidgetAttached())
@@ -1071,4 +950,5 @@
 bool CentralWidget::enableTabCloseAction() const
 {
+    TRACE_OBJ
     int minTabCount = 1;
     if (searchWidgetAttached())
@@ -1080,4 +960,5 @@
 QString CentralWidget::quoteTabTitle(const QString &title) const
 {
+    TRACE_OBJ
     QString s = title;
     return s.replace(QLatin1Char('&'), QLatin1String("&&"));
@@ -1087,4 +968,5 @@
 CentralWidget::setSourceFromSearch(const QUrl &url)
 {
+    TRACE_OBJ
     setSource(url);
 #if defined(QT_NO_WEBKIT)
@@ -1099,4 +981,5 @@
 CentralWidget::setSourceFromSearchInNewTab(const QUrl &url)
 {
+    TRACE_OBJ
     setSourceInNewTab(url);
 #if defined(QT_NO_WEBKIT)
@@ -1111,9 +994,11 @@
 CentralWidget::highlightSearchTerms()
 {
+    TRACE_OBJ
     HelpViewer *viewer = currentHelpViewer();
     if (!viewer)
         return;
 
-    QHelpSearchEngine *searchEngine = helpEngine->searchEngine();
+    QHelpSearchEngine *searchEngine =
+        HelpEngineWrapper::instance().searchEngine();
     QList<QHelpSearchQuery> queryList = searchEngine->query();
 
@@ -1127,5 +1012,5 @@
             case QHelpSearchQuery::ATLEAST:
                 foreach (QString term, query.wordList)
-                    terms.append(term.remove(QLatin1String("\"")));
+                    terms.append(term.remove(QLatin1Char('"')));
             }
         }
@@ -1175,6 +1060,31 @@
 }
 
+
+void CentralWidget::closeOrReloadTabs(const QList<int> &indices, bool tryReload)
+{
+    TRACE_OBJ
+    QList<int> sortedIndices = indices;
+    qSort(sortedIndices);
+    for (int i = sortedIndices.count(); --i >= 0;) {
+        const int tab = sortedIndices.at(i);
+        bool close = true;
+        if (tryReload) {
+            HelpViewer *viewer =
+                    qobject_cast<HelpViewer*>(tabWidget->widget(tab));
+            if (HelpEngineWrapper::instance().findFile(viewer->source()).isValid()) {
+                viewer->reload();
+                close = false;
+            }
+        }
+        if (close)
+            closeTabAt(tab);
+    }
+    if (availableHelpViewer() == 0)
+        setSource(QUrl(QLatin1String("about:blank")));
+}
+
 void CentralWidget::closeTabAt(int index)
 {
+    TRACE_OBJ
     HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(index));
     tabWidget->removeTab(index);
@@ -1184,6 +1094,7 @@
 QMap<int, QString> CentralWidget::currentSourceFileList() const
 {
+    TRACE_OBJ
     QMap<int, QString> sourceList;
-    for (int i = 1; i < tabWidget->count(); ++i) {
+    for (int i = 0; i < tabWidget->count(); ++i) {
         HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
         if (viewer && viewer->source().isValid())
@@ -1193,39 +1104,3 @@
 }
 
-void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font)
-{
-    const QLatin1String key("useBrowserFont");
-    if (!helpEngine->customValue(key, false).toBool()) {
-        *font = qApp->font();   // case for QTextBrowser and SearchWidget
-#if !defined(QT_NO_WEBKIT)
-        QWebView *view = qobject_cast<QWebView*> (viewer);
-        if (view) {
-            QWebSettings *settings = QWebSettings::globalSettings();
-            *font = QFont(settings->fontFamily(QWebSettings::StandardFont),
-                settings->fontSize(QWebSettings::DefaultFontSize));
-        }
-#endif
-    } else {
-        *font = qVariantValue<QFont>(helpEngine->customValue(
-            QLatin1String("browserFont")));
-    }
-}
-
-void CentralWidget::setBrowserFontFor(QWidget *widget, const QFont &font)
-{
-#if !defined(QT_NO_WEBKIT)
-    QWebView *view = qobject_cast<QWebView*> (widget);
-    if (view) {
-        QWebSettings *settings = view->settings();
-        settings->setFontFamily(QWebSettings::StandardFont, font.family());
-        settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
-    } else if (widget && widget->font() != font) {
-        widget->setFont(font);
-    }
-#else
-    if (widget && widget->font() != font)
-        widget->setFont(font);
-#endif
-}
-
 QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/centralwidget.h
===================================================================
--- trunk/tools/assistant/tools/assistant/centralwidget.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/centralwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,69 +39,18 @@
 **
 ****************************************************************************/
-
 #ifndef CENTRALWIDGET_H
 #define CENTRALWIDGET_H
 
 #include <QtCore/QUrl>
-#include <QtCore/QPoint>
-#include <QtCore/QObject>
-
 #include <QtGui/QWidget>
-
-#include "searchwidget.h"
 
 QT_BEGIN_NAMESPACE
 
-class QEvent;
-class QLabel;
-class QAction;
-class QCheckBox;
-class QLineEdit;
-class QTextBrowser;
-class QToolButton;
-
+class FindWidget;
 class HelpViewer;
+class MainWindow;
+class QHelpSearchEngine;
 class QTabWidget;
-class QHelpEngine;
-class CentralWidget;
-class PrintHelper;
-class MainWindow;
-
-class QHelpSearchEngine;
-
-class FindWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    FindWidget(QWidget *parent = 0);
-    ~FindWidget();
-
-signals:
-    void findNext();
-    void findPrevious();
-
-protected:
-    void hideEvent(QHideEvent* event);
-    void showEvent(QShowEvent * event);
-
-private slots:
-    void updateButtons();
-
-private:
-    QToolButton* setupToolButton(const QString &text, const QString &icon);
-
-private:
-    QLineEdit *editFind;
-    QCheckBox *checkCase;
-    QLabel *labelWrapped;
-    QToolButton *toolNext;
-    QToolButton *toolClose;
-    QToolButton *toolPrevious;
-    QCheckBox *checkWholeWords;
-
-    QPalette appPalette;
-    friend class CentralWidget;
-};
+class SearchWidget;
 
 class CentralWidget : public QWidget
@@ -110,5 +59,5 @@
 
 public:
-    CentralWidget(QHelpEngine *engine, MainWindow *parent);
+    CentralWidget(MainWindow *parent);
     ~CentralWidget();
 
@@ -122,10 +71,9 @@
     QList<QAction*> globalActions() const;
     void setGlobalActions(const QList<QAction*> &actions);
+
+    HelpViewer *viewerAt(int index) const;
     HelpViewer *currentHelpViewer() const;
-    void activateTab(bool onlyHelpViewer = false);
 
-    bool searchWidgetAttached() const {
-        return m_searchWidget && m_searchWidget->isAttached();
-    }
+    bool searchWidgetAttached() const;
     void createSearchWidget(QHelpSearchEngine *searchEngine);
     void activateSearchWidget(bool updateLastTabPage = false);
@@ -135,4 +83,5 @@
     bool enableTabCloseAction() const;
 
+    void closeOrReloadTabs(const QList<int> &indices, bool tryReload);
     void closeTabAt(int index);
     QMap<int, QString> currentSourceFileList() const;
@@ -143,9 +92,7 @@
     void zoomIn();
     void zoomOut();
-    void findNext();
     void nextPage();
     void resetZoom();
     void previousPage();
-    void findPrevious();
     void copySelection();
     void showTextSearch();
@@ -156,9 +103,14 @@
     void setSource(const QUrl &url);
     void setSourceInNewTab(const QUrl &url, qreal zoom = 0.0);
-    void findCurrentText(const QString &text);
     HelpViewer *newEmptyTab();
     void home();
     void forward();
     void backward();
+
+    void activateTab(bool onlyHelpViewer = false);
+
+    void findNext();
+    void findPrevious();
+    void find(const QString &text, bool forward);
 
 signals:
@@ -169,5 +121,5 @@
     void forwardAvailable(bool available);
     void backwardAvailable(bool available);
-    void addNewBookmark(const QString &title, const QString &url);
+    void addBookmark(const QString &title, const QString &url);
 
 protected:
@@ -188,5 +140,4 @@
     void connectSignals();
     bool eventFilter(QObject *object, QEvent *e);
-    void find(const QString &ttf, bool forward);
     bool findInWebPage(const QString &ttf, bool forward);
     bool findInTextBrowser(const QString &ttf, bool forward);
@@ -195,16 +146,10 @@
     void setLastShownPages();
 
-    void getBrowserFontFor(QWidget* viewer, QFont *font);
-    void setBrowserFontFor(QWidget *widget, const QFont &font);
-
 private:
     int lastTabPage;
-    QString collectionFile;
     QList<QAction*> globalActionList;
 
-    QWidget *findBar;
     QTabWidget *tabWidget;
     FindWidget *findWidget;
-    QHelpEngine *helpEngine;
     QPrinter *printer;
     bool usesDefaultCollection;
Index: trunk/tools/assistant/tools/assistant/cmdlineparser.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/cmdlineparser.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/cmdlineparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,6 +39,8 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include <QtCore/QFileInfo>
+#include <QtCore/QStringBuilder>
 #include <QtGui/QMessageBox>
 
@@ -47,19 +49,5 @@
 QT_BEGIN_NAMESPACE
 
-#define CHECK_NEXT_ARG \
-    ++i < arguments.count() && !arguments.at(i).startsWith(QLatin1String("-"))
-
-CmdLineParser::CmdLineParser()
-    : m_enableRemoteControl(false),
-    m_contents(Untouched),
-    m_index(Untouched),
-    m_bookmarks(Untouched),
-    m_search(Untouched),
-    m_register(None),
-    m_removeSearchIndex(false),
-    m_copy(false),
-    m_quiet(false)
-{
-    m_helpMessage = QLatin1String(
+static const char helpMessage[] = QT_TRANSLATE_NOOP("CmdLineParser",
         "Usage: assistant [Options]\n\n"
         "-collectionFile file       Uses the specified collection\n"
@@ -86,157 +74,73 @@
         "-setCurrentFilter filter   Set the filter as the active filter.\n"
         "-remove-search-index       Removes the full text search index.\n"
+        "-rebuild-search-index      Re-builds the full text search index (potentially slow).\n"
         "-quiet                     Does not display any error or\n"
         "                           status message.\n"
         "-help                      Displays this help.\n"
         );
-}
-
-CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments)
-{
-    QString error;
+
+
+CmdLineParser::CmdLineParser(const QStringList &arguments)
+    : m_pos(0),
+    m_enableRemoteControl(false),
+    m_contents(Untouched),
+    m_index(Untouched),
+    m_bookmarks(Untouched),
+    m_search(Untouched),
+    m_register(None),
+    m_removeSearchIndex(false),
+    m_rebuildSearchIndex(false),
+    m_quiet(false)
+{
+    TRACE_OBJ
+    for (int i = 1; i < arguments.count(); ++i) {
+        const QString &arg = arguments.at(i);
+        if (arg.toLower() == "-quiet")
+            m_quiet = true;
+        else
+            m_arguments.append(arg);
+    }
+}
+
+CmdLineParser::Result CmdLineParser::parse()
+{
+    TRACE_OBJ
     bool showHelp = false;
 
-    for (int j=1; j<arguments.count(); ++j) {
-        if (arguments.at(j).toLower() == QLatin1String("-quiet")) {
-            m_quiet = true;
-            break;
-        }
-    }
-
-    for (int i=1; i<arguments.count(); ++i) {
-        QString arg = arguments.at(i).toLower();
-        if (arg == QLatin1String("-collectionfile")) {
-            if (CHECK_NEXT_ARG) {
-                m_collectionFile = getFileName(arguments.at(i));
-                if (m_collectionFile.isEmpty()) {
-                    error = QObject::tr("The specified collection file does not exist!");
-                    break;
-                }
-            } else {
-                error = QObject::tr("Missing collection file!");
-                break;
-            }
-        } else if (arg == QLatin1String("-showurl")) {
-            if (CHECK_NEXT_ARG) {
-                QUrl url(arguments.at(i));
-                if (url.isValid()) {
-                    m_url = url;
-                } else {
-                    error = QObject::tr("Invalid URL!");
-                    break;
-                }
-            } else {
-                error = QObject::tr("Missing URL!");
-                break;
-            }
-        } else if (arg == QLatin1String("-enableremotecontrol")) {
+    while (m_error.isEmpty() && hasMoreArgs()) {
+        const QString &arg = nextArg().toLower();
+        if (arg == QLatin1String("-collectionfile"))
+            handleCollectionFileOption();
+        else if (arg == QLatin1String("-showurl"))
+            handleShowUrlOption();
+        else if (arg == QLatin1String("-enableremotecontrol"))
             m_enableRemoteControl = true;
-        } else if (arg == QLatin1String("-show")) {
-            if (CHECK_NEXT_ARG) {
-                arg = arguments.at(i).toLower();
-                if (arg == QLatin1String("contents")) {
-                    m_contents = Show;
-                } else if (arg == QLatin1String("index")) {
-                    m_index = Show;
-                } else if (arg == QLatin1String("bookmarks")) {
-                    m_bookmarks = Show;
-                } else if (arg == QLatin1String("search")) {
-                    m_search = Show;
-                } else {
-                    error = QObject::tr("Unknown widget: %1").arg(arg);
-                    break;
-                }
-            } else {
-                error = QObject::tr("Missing widget!");
-                break;
-            }
-        } else if (arg == QLatin1String("-hide")) {
-            if (CHECK_NEXT_ARG) {
-                arg = arguments.at(i).toLower();
-                if (arg == QLatin1String("contents")) {
-                    m_contents = Hide;
-                } else if (arg == QLatin1String("index")) {
-                    m_index = Hide;
-                } else if (arg == QLatin1String("bookmarks")) {
-                    m_bookmarks = Hide;
-                } else if (arg == QLatin1String("search")) {
-                    m_search = Hide;
-                } else {
-                    error = QObject::tr("Unknown widget: %1").arg(arg);
-                    break;
-                }
-            } else {
-                error = QObject::tr("Missing widget!");
-                break;
-            }
-        } else if (arg == QLatin1String("-activate")) {
-            if (CHECK_NEXT_ARG) {
-                arg = arguments.at(i).toLower();
-                if (arg == QLatin1String("contents")) {
-                    m_contents = Activate;
-                } else if (arg == QLatin1String("index")) {
-                    m_index = Activate;
-                } else if (arg == QLatin1String("bookmarks")) {
-                    m_bookmarks = Activate;
-                } else if (arg == QLatin1String("search")) {
-                    m_search = Activate;
-                } else {
-                    error = QObject::tr("Unknown widget: %1").arg(arg);
-                    break;
-                }
-            } else {
-                error = QObject::tr("Missing widget!");
-                break;
-            }
-        } else if (arg == QLatin1String("-register")) {
-            if (CHECK_NEXT_ARG) {
-                m_helpFile = getFileName(arguments.at(i));
-                if (m_helpFile.isEmpty()) {
-                    error = QObject::tr("The specified Qt help file does not exist!");
-                    break;
-                }
-                m_register = Register;
-            } else {
-                error = QObject::tr("Missing help file!");
-                break;
-            }
-        } else if (arg == QLatin1String("-unregister")) {
-            if (CHECK_NEXT_ARG) {
-                m_helpFile = getFileName(arguments.at(i));
-                if (m_helpFile.isEmpty()) {
-                    error = QObject::tr("The specified Qt help file does not exist!");
-                    break;
-                }
-                m_register = Unregister;
-            } else {
-                error = QObject::tr("Missing help file!");
-                break;
-            }
-        } else if (arg == QLatin1String("-setcurrentfilter")) {
-            if (CHECK_NEXT_ARG) {
-                m_currentFilter = arguments.at(i);
-            } else {
-                error = QObject::tr("Missing filter argument!");
-                break;
-            }
-        } else if (arg == QLatin1String("-remove-search-index")) {
+        else if (arg == QLatin1String("-show"))
+            handleShowOption();
+        else if (arg == QLatin1String("-hide"))
+            handleHideOption();
+        else if (arg == QLatin1String("-activate"))
+            handleActivateOption();
+        else if (arg == QLatin1String("-register"))
+            handleRegisterOption();
+        else if (arg == QLatin1String("-unregister"))
+            handleUnregisterOption();
+        else if (arg == QLatin1String("-setcurrentfilter"))
+            handleSetCurrentFilterOption();
+        else if (arg == QLatin1String("-remove-search-index"))
             m_removeSearchIndex = true;
-        } else if (arg == QLatin1String("-quiet")) {
-            continue;
-        } else if (arg == QLatin1String("-help")) {
+        else if (arg == QLatin1String("-rebuild-search-index"))
+            m_rebuildSearchIndex = true;
+        else if (arg == QLatin1String("-help"))
             showHelp = true;
-        } else if (arg == QLatin1String("-copy")) {
-            m_copy = true;
-        } else {
-            error = QObject::tr("Unknown option: %1").arg(arg);
-            break;
-        }
-    }
-
-    if (!error.isEmpty()) {
-        showMessage(error + QLatin1String("\n\n\n") + m_helpMessage, true);
+        else
+            m_error = tr("Unknown option: %1").arg(arg);
+    }
+
+    if (!m_error.isEmpty()) {
+        showMessage(m_error + QLatin1String("\n\n\n") + tr(helpMessage), true);
         return Error;
     } else if (showHelp) {
-        showMessage(m_helpMessage, false);
+        showMessage(tr(helpMessage), false);
         return Help;
     }
@@ -244,6 +148,123 @@
 }
 
+bool CmdLineParser::hasMoreArgs() const
+{
+    TRACE_OBJ
+    return m_pos < m_arguments.count();
+}
+
+const QString &CmdLineParser::nextArg()
+{
+    TRACE_OBJ
+    Q_ASSERT(hasMoreArgs());
+    return m_arguments.at(m_pos++);
+}
+
+void CmdLineParser::handleCollectionFileOption()
+{
+    TRACE_OBJ
+    if (hasMoreArgs()) {
+        const QString &fileName = nextArg();
+        m_collectionFile = getFileName(fileName);
+        if (m_collectionFile.isEmpty())
+            m_error = tr("The collection file '%1' does not exist.").
+                          arg(fileName);
+    } else {
+        m_error = tr("Missing collection file.");
+    }
+}
+
+void CmdLineParser::handleShowUrlOption()
+{
+    TRACE_OBJ
+    if (hasMoreArgs()) {
+        const QString &urlString = nextArg();
+        QUrl url(urlString);
+        if (url.isValid()) {
+            m_url = url;
+        } else
+            m_error = tr("Invalid URL '%1'.").arg(urlString);
+    } else {
+        m_error = tr("Missing URL.");
+    }
+}
+
+void CmdLineParser::handleShowOption()
+{
+    TRACE_OBJ
+    handleShowOrHideOrActivateOption(Show);
+}
+
+void CmdLineParser::handleHideOption()
+{
+    TRACE_OBJ
+    handleShowOrHideOrActivateOption(Hide);
+}
+
+void CmdLineParser::handleActivateOption()
+{
+    TRACE_OBJ
+    handleShowOrHideOrActivateOption(Activate);
+}
+
+void CmdLineParser::handleShowOrHideOrActivateOption(ShowState state)
+{
+    TRACE_OBJ
+    if (hasMoreArgs()) {
+        const QString &widget = nextArg().toLower();
+        if (widget == QLatin1String("contents"))
+            m_contents = state;
+        else if (widget == QLatin1String("index"))
+            m_index = state;
+        else if (widget == QLatin1String("bookmarks"))
+            m_bookmarks = state;
+        else if (widget == QLatin1String("search"))
+            m_search = state;
+        else
+            m_error = tr("Unknown widget: %1").arg(widget);
+    } else {
+        m_error = tr("Missing widget.");
+    }
+}
+
+void CmdLineParser::handleRegisterOption()
+{
+    TRACE_OBJ
+    handleRegisterOrUnregisterOption(Register);
+}
+
+void CmdLineParser::handleUnregisterOption()
+{
+    TRACE_OBJ
+    handleRegisterOrUnregisterOption(Unregister);
+}
+
+void CmdLineParser::handleRegisterOrUnregisterOption(RegisterState state)
+{
+    TRACE_OBJ
+    if (hasMoreArgs()) {
+        const QString &fileName = nextArg();
+        m_helpFile = getFileName(fileName);
+        if (m_helpFile.isEmpty())
+            m_error = tr("The Qt help file '%1' does not exist.").arg(fileName);
+        else
+            m_register = state;
+    } else {
+        m_error = tr("Missing help file.");
+    }
+}
+
+void CmdLineParser::handleSetCurrentFilterOption()
+{
+    TRACE_OBJ
+    if (hasMoreArgs())
+        m_currentFilter = nextArg();
+    else
+        m_error = tr("Missing filter argument.");
+}
+
 QString CmdLineParser::getFileName(const QString &fileName)
 {
+    TRACE_OBJ
     QFileInfo fi(fileName);
     if (!fi.exists())
@@ -254,12 +275,13 @@
 void CmdLineParser::showMessage(const QString &msg, bool error)
 {
+    TRACE_OBJ
     if (m_quiet)
         return;
 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
-    QString s = QLatin1String("<pre>") + msg + QLatin1String("</pre>");
+    QString message = QLatin1String("<pre>") % msg % QLatin1String("</pre>");
     if (error)
-        QMessageBox::critical(0, QObject::tr("Qt Assistant"), s);
+        QMessageBox::critical(0, tr("Error"), message);
     else
-        QMessageBox::information(0, QObject::tr("Qt Assistant"), s);
+        QMessageBox::information(0, tr("Notice"), message);
 #else
     fprintf(error ? stderr : stdout, "%s\n", qPrintable(msg));
@@ -269,4 +291,5 @@
 void CmdLineParser::setCollectionFile(const QString &file)
 {
+    TRACE_OBJ
     m_collectionFile = file;
 }
@@ -274,9 +297,18 @@
 QString CmdLineParser::collectionFile() const
 {
+    TRACE_OBJ
     return m_collectionFile;
 }
 
+bool CmdLineParser::collectionFileGiven() const
+{
+    TRACE_OBJ
+    return m_arguments.contains(QLatin1String("-collectionfile"),
+        Qt::CaseInsensitive);
+}
+
 QUrl CmdLineParser::url() const
 {
+    TRACE_OBJ
     return m_url;
 }
@@ -284,4 +316,5 @@
 bool CmdLineParser::enableRemoteControl() const
 {
+    TRACE_OBJ
     return m_enableRemoteControl;
 }
@@ -289,4 +322,5 @@
 CmdLineParser::ShowState CmdLineParser::contents() const
 {
+    TRACE_OBJ
     return m_contents;
 }
@@ -294,4 +328,5 @@
 CmdLineParser::ShowState CmdLineParser::index() const
 {
+    TRACE_OBJ
     return m_index;
 }
@@ -299,4 +334,5 @@
 CmdLineParser::ShowState CmdLineParser::bookmarks() const
 {
+    TRACE_OBJ
     return m_bookmarks;
 }
@@ -304,4 +340,5 @@
 CmdLineParser::ShowState CmdLineParser::search() const
 {
+    TRACE_OBJ
     return m_search;
 }
@@ -309,4 +346,5 @@
 QString CmdLineParser::currentFilter() const
 {
+    TRACE_OBJ
     return m_currentFilter;
 }
@@ -314,9 +352,17 @@
 bool CmdLineParser::removeSearchIndex() const
 {
+    TRACE_OBJ
     return m_removeSearchIndex;
 }
 
+bool CmdLineParser::rebuildSearchIndex() const
+{
+    TRACE_OBJ
+    return m_rebuildSearchIndex;
+}
+
 CmdLineParser::RegisterState CmdLineParser::registerRequest() const
 {
+    TRACE_OBJ
     return m_register;
 }
@@ -324,4 +370,5 @@
 QString CmdLineParser::helpFile() const
 {
+    TRACE_OBJ
     return m_helpFile;
 }
Index: trunk/tools/assistant/tools/assistant/cmdlineparser.h
===================================================================
--- trunk/tools/assistant/tools/assistant/cmdlineparser.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/cmdlineparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,4 +43,5 @@
 #define CMDLINEPARSER_H
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QStringList>
 #include <QtCore/QUrl>
@@ -50,4 +51,5 @@
 class CmdLineParser
 {
+    Q_DECLARE_TR_FUNCTIONS(CmdLineParser)
 public:
     enum Result {Ok, Help, Error};
@@ -55,9 +57,10 @@
     enum RegisterState {None, Register, Unregister};
 
-    CmdLineParser();
-    Result parse(const QStringList &arguments);
+    CmdLineParser(const QStringList &arguments);
+    Result parse();
 
     void setCollectionFile(const QString &file);
     QString collectionFile() const;
+    bool collectionFileGiven() const;
     QString cloneFile() const;
     QUrl url() const;
@@ -69,8 +72,7 @@
     QString currentFilter() const;
     bool removeSearchIndex() const;
+    bool rebuildSearchIndex() const;
     RegisterState registerRequest() const;
     QString helpFile() const;
-
-    bool copy() const { return m_copy; }
 
     void showMessage(const QString &msg, bool error);
@@ -78,6 +80,19 @@
 private:
     QString getFileName(const QString &fileName);
+    bool hasMoreArgs() const;
+    const QString &nextArg();
+    void handleCollectionFileOption();
+    void handleShowUrlOption();
+    void handleShowOption();
+    void handleHideOption();
+    void handleActivateOption();
+    void handleShowOrHideOrActivateOption(ShowState state);
+    void handleRegisterOption();
+    void handleUnregisterOption();
+    void handleRegisterOrUnregisterOption(RegisterState state);
+    void handleSetCurrentFilterOption();
 
-    QString m_helpMessage;
+    QStringList m_arguments;
+    int m_pos;
     QString m_collectionFile;
     QString m_cloneFile;
@@ -93,6 +108,7 @@
     QString m_currentFilter;
     bool m_removeSearchIndex;
-    bool m_copy;
+    bool m_rebuildSearchIndex;
     bool m_quiet;
+    QString m_error;
 };
 
Index: trunk/tools/assistant/tools/assistant/contentwindow.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/contentwindow.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/contentwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,7 +39,10 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "contentwindow.h"
 #include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "helpviewer.h"
 
 #include <QtGui/QLayout>
@@ -47,15 +50,13 @@
 #include <QtGui/QMenu>
 
-#include <QtHelp/QHelpEngine>
 #include <QtHelp/QHelpContentWidget>
 
 QT_BEGIN_NAMESPACE
 
-ContentWindow::ContentWindow(QHelpEngine *helpEngine)
-    : m_helpEngine(helpEngine)
-    , m_contentWidget(0)
+ContentWindow::ContentWindow()
+    : m_contentWidget(HelpEngineWrapper::instance().contentWidget())
     , m_expandDepth(-2)
 {
-    m_contentWidget = m_helpEngine->contentWidget();
+    TRACE_OBJ
     m_contentWidget->viewport()->installEventFilter(this);
     m_contentWidget->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -77,8 +78,10 @@
 ContentWindow::~ContentWindow()
 {
+    TRACE_OBJ
 }
 
 bool ContentWindow::syncToContent(const QUrl& url)
 {
+    TRACE_OBJ
     QModelIndex idx = m_contentWidget->indexOf(url);
     if (!idx.isValid())
@@ -90,4 +93,6 @@
 void ContentWindow::expandTOC()
 {
+    TRACE_OBJ
+    Q_ASSERT(m_expandDepth >= -2);
     if (m_expandDepth > -2) {
         expandToDepth(m_expandDepth);
@@ -98,13 +103,18 @@
 void ContentWindow::expandToDepth(int depth)
 {
+    TRACE_OBJ
+    Q_ASSERT(depth >= -2);
     m_expandDepth = depth;
     if (depth == -1)
         m_contentWidget->expandAll();
+    else if (depth == 0)
+        m_contentWidget->collapseAll();
     else
-        m_contentWidget->expandToDepth(depth);
+        m_contentWidget->expandToDepth(depth - 1);
 }
 
 void ContentWindow::focusInEvent(QFocusEvent *e)
 {
+    TRACE_OBJ
     if (e->reason() != Qt::MouseFocusReason)
         m_contentWidget->setFocus();
@@ -113,4 +123,5 @@
 void ContentWindow::keyPressEvent(QKeyEvent *e)
 {
+    TRACE_OBJ
     if (e->key() == Qt::Key_Escape)
         emit escapePressed();
@@ -119,12 +130,15 @@
 bool ContentWindow::eventFilter(QObject *o, QEvent *e)
 {
+    TRACE_OBJ
     if (m_contentWidget && o == m_contentWidget->viewport()
         && e->type() == QEvent::MouseButtonRelease) {
         QMouseEvent *me = static_cast<QMouseEvent*>(e);
-        QModelIndex index = m_contentWidget->indexAt(me->pos());
+        const QModelIndex &index = m_contentWidget->indexAt(me->pos());
+        if (!index.isValid())
+            return QWidget::eventFilter(o, e);
+
+        const Qt::MouseButtons button = me->button();
         QItemSelectionModel *sm = m_contentWidget->selectionModel();
-
-        Qt::MouseButtons button = me->button();
-        if (index.isValid() && (sm && sm->isSelected(index))) {
+        if (sm->isSelected(index)) {
             if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier))
                 || (button == Qt::MidButton)) {
@@ -133,5 +147,5 @@
                 if (contentModel) {
                     QHelpContentItem *itm = contentModel->contentItemAt(index);
-                    if (itm && !isPdfFile(itm))
+                    if (itm && AbstractHelpViewer::canOpenPage(itm->url().path()))
                         CentralWidget::instance()->setSourceInNewTab(itm->url());
                 }
@@ -147,4 +161,5 @@
 void ContentWindow::showContextMenu(const QPoint &pos)
 {
+    TRACE_OBJ
     if (!m_contentWidget->indexAt(pos).isValid())
         return;
@@ -158,5 +173,5 @@
     QAction *curTab = menu.addAction(tr("Open Link"));
     QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
-    if (isPdfFile(itm))
+    if (!AbstractHelpViewer::canOpenPage(itm->url().path()))
         newTab->setEnabled(false);
     
@@ -172,19 +187,16 @@
 void ContentWindow::itemClicked(const QModelIndex &index)
 {
+    TRACE_OBJ
     QHelpContentModel *contentModel =
         qobject_cast<QHelpContentModel*>(m_contentWidget->model());
 
     if (contentModel) {
-        QHelpContentItem *itm = contentModel->contentItemAt(index);
-        if (itm)
-            emit linkActivated(itm->url());
+        if (QHelpContentItem *itm = contentModel->contentItemAt(index)) {
+            const QUrl &url = itm->url();
+            if (url != CentralWidget::instance()->currentSource())
+                emit linkActivated(url);
+        }
     }
 }
 
-bool ContentWindow::isPdfFile(QHelpContentItem *item) const
-{
-    const QString &path = item->url().path();
-    return path.endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive);
-}
-
 QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/contentwindow.h
===================================================================
--- trunk/tools/assistant/tools/assistant/contentwindow.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/contentwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -58,5 +58,5 @@
 
 public:
-    ContentWindow(QHelpEngine *helpEngine);
+    ContentWindow();
     ~ContentWindow();
 
@@ -79,6 +79,5 @@
     bool isPdfFile(QHelpContentItem *item) const;
 
-    QHelpEngine *m_helpEngine;
-    QHelpContentWidget *m_contentWidget;
+    QHelpContentWidget * const m_contentWidget;
     int m_expandDepth;
 };
Index: trunk/tools/assistant/tools/assistant/doc/assistant.qdoc
===================================================================
--- trunk/tools/assistant/tools/assistant/doc/assistant.qdoc	(revision 769)
+++ trunk/tools/assistant/tools/assistant/doc/assistant.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/assistant/tools/assistant/doc/assistant.qdocconf
===================================================================
--- trunk/tools/assistant/tools/assistant/doc/assistant.qdocconf	(revision 769)
+++ trunk/tools/assistant/tools/assistant/doc/assistant.qdocconf	(revision 846)
@@ -13,4 +13,4 @@
               "<td width=\"30%\" align=\"left\">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
               "<td width=\"40%\" align=\"center\">Trademarks</td>\n" \
-              "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.6.3</div></td>\n" \
+              "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.7.2</div></td>\n" \
               "</tr></table></div></address>"
Index: trunk/tools/assistant/tools/assistant/filternamedialog.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/filternamedialog.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/filternamedialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,4 +39,5 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include <QtGui/QPushButton>
@@ -49,4 +50,5 @@
     : QDialog(parent)
 {
+    TRACE_OBJ
     m_ui.setupUi(this);
     connect(m_ui.buttonBox->button(QDialogButtonBox::Ok),
@@ -62,4 +64,5 @@
 QString FilterNameDialog::filterName() const
 {
+    TRACE_OBJ
     return m_ui.lineEdit->text();
 }
@@ -67,4 +70,5 @@
 void FilterNameDialog::updateOkButton()
 {
+    TRACE_OBJ
     m_ui.buttonBox->button(QDialogButtonBox::Ok)
         ->setDisabled(m_ui.lineEdit->text().isEmpty());
Index: trunk/tools/assistant/tools/assistant/filternamedialog.h
===================================================================
--- trunk/tools/assistant/tools/assistant/filternamedialog.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/filternamedialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/assistant/findwidget.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/findwidget.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/findwidget.cpp	(revision 846)
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "tracer.h"
+#include "findwidget.h"
+
+#include <QtGui/QApplication>
+#include <QtGui/QCheckBox>
+#include <QtGui/QHideEvent>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QLabel>
+#include <QtGui/QLayout>
+#include <QtGui/QLineEdit>
+#include <QtGui/QToolButton>
+
+QT_BEGIN_NAMESPACE
+
+FindWidget::FindWidget(QWidget *parent)
+    : QWidget(parent)
+    , appPalette(qApp->palette())
+{
+    TRACE_OBJ
+    installEventFilter(this);
+    QHBoxLayout *hboxLayout = new QHBoxLayout(this);
+    QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
+
+#ifndef Q_OS_MAC
+    hboxLayout->setMargin(0);
+    hboxLayout->setSpacing(6);
+    resourcePath.append(QLatin1String("win"));
+#else
+    resourcePath.append(QLatin1String("mac"));
+#endif
+
+    toolClose = setupToolButton(QLatin1String(""),
+        resourcePath + QLatin1String("/closetab.png"));
+    hboxLayout->addWidget(toolClose);
+    connect(toolClose, SIGNAL(clicked()), SLOT(hide()));
+
+    editFind = new QLineEdit(this);
+    hboxLayout->addWidget(editFind);
+    editFind->setMinimumSize(QSize(150, 0));
+    connect(editFind, SIGNAL(textChanged(QString)), this,
+        SLOT(textChanged(QString)));
+    connect(editFind, SIGNAL(returnPressed()), this, SIGNAL(findNext()));
+    connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));
+
+    toolPrevious = setupToolButton(tr("Previous"),
+        resourcePath + QLatin1String("/previous.png"));
+    connect(toolPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious()));
+
+    hboxLayout->addWidget(toolPrevious);
+
+    toolNext = setupToolButton(tr("Next"),
+        resourcePath + QLatin1String("/next.png"));
+    hboxLayout->addWidget(toolNext);
+    connect(toolNext, SIGNAL(clicked()), this, SIGNAL(findNext()));
+
+    checkCase = new QCheckBox(tr("Case Sensitive"), this);
+    hboxLayout->addWidget(checkCase);
+
+    labelWrapped = new QLabel(this);
+    labelWrapped->setScaledContents(true);
+    labelWrapped->setTextFormat(Qt::RichText);
+    labelWrapped->setMinimumSize(QSize(0, 20));
+    labelWrapped->setMaximumSize(QSize(105, 20));
+    labelWrapped->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
+    labelWrapped->setText(tr("<img src=\":/trolltech/assistant/images/wrap.png\""
+        ">&nbsp;Search wrapped"));
+    hboxLayout->addWidget(labelWrapped);
+
+    QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding,
+        QSizePolicy::Minimum);
+    hboxLayout->addItem(spacerItem);
+    setMinimumWidth(minimumSizeHint().width());
+    labelWrapped->hide();
+
+    updateButtons();
+}
+
+FindWidget::~FindWidget()
+{
+    TRACE_OBJ
+}
+
+void FindWidget::show()
+{
+    TRACE_OBJ
+    QWidget::show();
+    editFind->selectAll();
+    editFind->setFocus(Qt::ShortcutFocusReason);
+}
+
+void FindWidget::showAndClear()
+{
+    TRACE_OBJ
+    show();
+    editFind->clear();
+}
+
+QString FindWidget::text() const
+{
+    TRACE_OBJ
+    return editFind->text();
+}
+
+bool FindWidget::caseSensitive() const
+{
+    TRACE_OBJ
+    return checkCase->isChecked();
+}
+
+void FindWidget::setPalette(bool found)
+{
+    TRACE_OBJ
+    QPalette palette = editFind->palette();
+    palette.setColor(QPalette::Active, QPalette::Base, found ? Qt::white
+        : QColor(255, 102, 102));
+    editFind->setPalette(palette);
+}
+
+void FindWidget::setTextWrappedVisible(bool visible)
+{
+    TRACE_OBJ
+    labelWrapped->setVisible(visible);
+}
+
+void FindWidget::hideEvent(QHideEvent* event)
+{
+    TRACE_OBJ
+#if !defined(QT_NO_WEBKIT)
+    // TODO: remove this once webkit supports setting the palette
+    if (!event->spontaneous())
+        qApp->setPalette(appPalette);
+#else
+    Q_UNUSED(event);
+#endif
+}
+
+void FindWidget::showEvent(QShowEvent* event)
+{
+    TRACE_OBJ
+#if !defined(QT_NO_WEBKIT)
+    // TODO: remove this once webkit supports setting the palette
+    if (!event->spontaneous()) {
+        QPalette p = appPalette;
+        p.setColor(QPalette::Inactive, QPalette::Highlight,
+            p.color(QPalette::Active, QPalette::Highlight));
+        p.setColor(QPalette::Inactive, QPalette::HighlightedText,
+            p.color(QPalette::Active, QPalette::HighlightedText));
+        qApp->setPalette(p);
+    }
+#else
+    Q_UNUSED(event);
+#endif
+}
+
+void FindWidget::updateButtons()
+{
+    TRACE_OBJ
+    const bool enable = !editFind->text().isEmpty();
+    toolNext->setEnabled(enable);
+    toolPrevious->setEnabled(enable);
+}
+
+void FindWidget::textChanged(const QString &text)
+{
+    TRACE_OBJ
+    emit find(text, true);
+}
+
+bool FindWidget::eventFilter(QObject *object, QEvent *e)
+{
+    TRACE_OBJ
+    if (e->type() == QEvent::KeyPress) {
+        if ((static_cast<QKeyEvent*>(e))->key() == Qt::Key_Escape) {
+            hide();
+            emit escapePressed();
+        }
+    }
+    return QWidget::eventFilter(object, e);
+}
+
+QToolButton* FindWidget::setupToolButton(const QString &text, const QString &icon)
+{
+    TRACE_OBJ
+    QToolButton *toolButton = new QToolButton(this);
+
+    toolButton->setText(text);
+    toolButton->setAutoRaise(true);
+    toolButton->setIcon(QIcon(icon));
+    toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+
+    return toolButton;
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/findwidget.h
===================================================================
--- trunk/tools/assistant/tools/assistant/findwidget.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/findwidget.h	(revision 846)
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef FINDWIDGET_H
+#define FINDWIDGET_H
+
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QToolButton;
+
+class FindWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    FindWidget(QWidget *parent = 0);
+    ~FindWidget();
+
+    void show();
+    void showAndClear();
+
+    QString text() const;
+    bool caseSensitive() const;
+
+    void setPalette(bool found);
+    void setTextWrappedVisible(bool visible);
+
+signals:
+    void escapePressed();
+
+    void findNext();
+    void findPrevious();
+    void find(const QString &text, bool forward);
+
+protected:
+    void hideEvent(QHideEvent* event);
+    void showEvent(QShowEvent * event);
+
+private slots:
+    void updateButtons();
+    void textChanged(const QString &text);
+
+private:
+    bool eventFilter(QObject *object, QEvent *e);
+    QToolButton* setupToolButton(const QString &text, const QString &icon);
+
+private:
+    QPalette appPalette;
+
+    QLineEdit *editFind;
+    QCheckBox *checkCase;
+    QLabel *labelWrapped;
+    QToolButton *toolNext;
+    QToolButton *toolClose;
+    QToolButton *toolPrevious;
+};
+
+QT_END_NAMESPACE
+
+#endif  // FINDWIDGET_H
Index: trunk/tools/assistant/tools/assistant/helpenginewrapper.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/helpenginewrapper.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpenginewrapper.cpp	(revision 846)
@@ -0,0 +1,835 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "tracer.h"
+
+#include "helpenginewrapper.h"
+#include "../shared/collectionconfiguration.h"
+
+#include <QtCore/QDateTime>
+#include <QtCore/QFileInfo>
+#include <QtCore/QFileSystemWatcher>
+#include <QtCore/QPair>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QTimer>
+#include <QtHelp/QHelpContentModel>
+#include <QtHelp/QHelpEngine>
+#include <QtHelp/QHelpIndexModel>
+#include <QtHelp/QHelpSearchEngine>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+    const QString Unfiltered;
+    const QString AppFontKey(QLatin1String("appFont"));
+    const QString AppWritingSystemKey(QLatin1String("appWritingSystem"));
+    const QString BookmarksKey(QLatin1String("Bookmarks"));
+    const QString BrowserFontKey(QLatin1String("browserFont"));
+    const QString BrowserWritingSystemKey(QLatin1String("browserWritingSystem"));
+    const QString HomePageKey(QLatin1String("homepage"));
+    const QString MainWindowKey(QLatin1String("MainWindow"));
+    const QString MainWindowGeometryKey(QLatin1String("MainWindowGeometry"));
+    const QString SearchWasAttachedKey(QLatin1String("SearchWasAttached"));
+    const QString StartOptionKey(QLatin1String("StartOption"));
+    const QString UseAppFontKey(QLatin1String("useAppFont"));
+    const QString UseBrowserFontKey(QLatin1String("useBrowserFont"));
+    const QString VersionKey(QString(QLatin1String("qtVersion%1$$$%2")).
+                             arg(QLatin1String(QT_VERSION_STR)));
+} // anonymous namespace
+
+class TimeoutForwarder : public QObject
+{
+    Q_OBJECT
+public:
+    TimeoutForwarder(const QString &fileName);
+private slots:
+    void forward();
+private:
+    friend class HelpEngineWrapperPrivate;
+
+    const QString m_fileName;
+};
+
+class HelpEngineWrapperPrivate : public QObject
+{
+    Q_OBJECT
+    friend class HelpEngineWrapper;
+    friend class TimeoutForwarder;
+private slots:
+    void qchFileChanged(const QString &fileName);
+
+signals:
+    void documentationRemoved(const QString &namespaceName);
+    void documentationUpdated(const QString &namespaceName);
+
+private:
+    HelpEngineWrapperPrivate(const QString &collectionFile);
+
+    void initFileSystemWatchers();
+    void checkDocFilesWatched();
+    void qchFileChanged(const QString &fileName, bool fromTimeout);
+
+    static const int UpdateGracePeriod = 2000;
+
+    QHelpEngine * const m_helpEngine;
+    QFileSystemWatcher * const m_qchWatcher;
+    typedef QPair<QDateTime, QSharedPointer<TimeoutForwarder> > RecentSignal;
+    QMap<QString, RecentSignal> m_recentQchUpdates;
+};
+
+const QString HelpEngineWrapper::TrUnfiltered = HelpEngineWrapper::tr("Unfiltered");
+
+HelpEngineWrapper *HelpEngineWrapper::helpEngineWrapper = 0;
+
+HelpEngineWrapper &HelpEngineWrapper::instance(const QString &collectionFile)
+{
+    TRACE_OBJ
+    /*
+     * Note that this Singleton cannot be static, because it has to be
+     * deleted before the QApplication.
+     */
+    if (helpEngineWrapper == 0)
+        helpEngineWrapper = new HelpEngineWrapper(collectionFile);
+    return *helpEngineWrapper;
+}
+
+void HelpEngineWrapper::removeInstance()
+{
+    TRACE_OBJ
+    delete helpEngineWrapper;
+    helpEngineWrapper = 0;
+}
+
+HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile)
+    : d(new HelpEngineWrapperPrivate(collectionFile))
+{
+    TRACE_OBJ
+
+    /*
+     * Otherwise we will waste time if several new docs are found,
+     * because we will start to index them, only to be interrupted
+     * by the next request. Also, there is a nasty SQLITE bug that will
+     * cause the application to hang for minutes in that case.
+     * This call is reverted by initalDocSetupDone(), which must be
+     * called after the new docs have been installed.
+     */
+    disconnect(d->m_helpEngine, SIGNAL(setupFinished()),
+            searchEngine(), SLOT(indexDocumentation()));
+
+    connect(d, SIGNAL(documentationRemoved(QString)),
+            this, SIGNAL(documentationRemoved(QString)));
+    connect(d, SIGNAL(documentationUpdated(QString)),
+            this, SIGNAL(documentationUpdated(QString)));
+    connect(d->m_helpEngine, SIGNAL(currentFilterChanged(QString)),
+            this, SLOT(handleCurrentFilterChanged(QString)));
+    connect(d->m_helpEngine, SIGNAL(setupFinished()),
+            this, SIGNAL(setupFinished()));
+}
+
+HelpEngineWrapper::~HelpEngineWrapper()
+{
+    TRACE_OBJ
+    const QStringList &namespaces = d->m_helpEngine->registeredDocumentations();
+    foreach (const QString &nameSpace, namespaces) {
+        const QString &docFile
+            = d->m_helpEngine->documentationFileName(nameSpace);
+        d->m_qchWatcher->removePath(docFile);
+    }
+
+    delete d;
+}
+
+void HelpEngineWrapper::initialDocSetupDone()
+{
+    TRACE_OBJ
+    connect(d->m_helpEngine, SIGNAL(setupFinished()),
+            searchEngine(), SLOT(indexDocumentation()));
+    setupData();
+}
+
+QHelpSearchEngine *HelpEngineWrapper::searchEngine() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->searchEngine();
+}
+
+QHelpContentModel *HelpEngineWrapper::contentModel() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->contentModel();
+}
+
+QHelpIndexModel *HelpEngineWrapper::indexModel() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->indexModel();
+}
+
+QHelpContentWidget *HelpEngineWrapper::contentWidget()
+{
+    TRACE_OBJ
+    return d->m_helpEngine->contentWidget();
+}
+
+QHelpIndexWidget *HelpEngineWrapper::indexWidget()
+{
+    TRACE_OBJ
+    return d->m_helpEngine->indexWidget();
+}
+
+const QStringList HelpEngineWrapper::registeredDocumentations() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->registeredDocumentations();
+}
+
+const QString HelpEngineWrapper::collectionFile() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->collectionFile();
+}
+
+bool HelpEngineWrapper::registerDocumentation(const QString &docFile)
+{
+    TRACE_OBJ
+    d->checkDocFilesWatched();
+    if (!d->m_helpEngine->registerDocumentation(docFile))
+        return false;
+    d->m_qchWatcher->addPath(docFile);
+    d->checkDocFilesWatched();
+    return true;
+}
+
+bool HelpEngineWrapper::unregisterDocumentation(const QString &namespaceName)
+{
+    TRACE_OBJ
+    d->checkDocFilesWatched();
+    const QString &file = d->m_helpEngine->documentationFileName(namespaceName);
+    if (!d->m_helpEngine->unregisterDocumentation(namespaceName))
+        return false;
+    d->m_qchWatcher->removePath(file);
+    d->checkDocFilesWatched();
+    return true;
+}
+
+bool HelpEngineWrapper::setupData()
+{
+    TRACE_OBJ
+    return d->m_helpEngine->setupData();
+}
+
+bool HelpEngineWrapper::addCustomFilter(const QString &filterName,
+                                        const QStringList &attributes)
+{
+    TRACE_OBJ
+    return d->m_helpEngine->addCustomFilter(filterName, attributes);
+}
+
+bool HelpEngineWrapper::removeCustomFilter(const QString &filterName)
+{
+    TRACE_OBJ
+    return d->m_helpEngine->removeCustomFilter(filterName);
+}
+
+void HelpEngineWrapper::setCurrentFilter(const QString &currentFilter)
+{
+    TRACE_OBJ
+    const QString &filter
+        = currentFilter == TrUnfiltered ? Unfiltered : currentFilter;
+    d->m_helpEngine->setCurrentFilter(filter);
+}
+
+const QString HelpEngineWrapper::currentFilter() const
+{
+    TRACE_OBJ
+    const QString &filter = d->m_helpEngine->currentFilter();
+    return filter == Unfiltered ? TrUnfiltered : filter;
+}
+
+const QStringList HelpEngineWrapper::customFilters() const
+{
+    TRACE_OBJ
+    QStringList filters = d->m_helpEngine->customFilters();
+    filters.removeOne(Unfiltered);
+    filters.prepend(TrUnfiltered);
+    return filters;
+}
+
+QUrl HelpEngineWrapper::findFile(const QUrl &url) const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->findFile(url);
+}
+
+QByteArray HelpEngineWrapper::fileData(const QUrl &url) const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->fileData(url);
+}
+
+QMap<QString, QUrl> HelpEngineWrapper::linksForIdentifier(const QString &id) const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->linksForIdentifier(id);
+}
+
+const QStringList HelpEngineWrapper::filterAttributes() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->filterAttributes();
+}
+
+const QStringList HelpEngineWrapper::filterAttributes(const QString &filterName) const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->filterAttributes(filterName);
+}
+
+QString HelpEngineWrapper::error() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->error();
+}
+
+const QStringList HelpEngineWrapper::qtDocInfo(const QString &component) const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(VersionKey.arg(component)).toString().
+        split(CollectionConfiguration::ListSeparator);
+}
+
+void HelpEngineWrapper::setQtDocInfo(const QString &component,
+                                     const QStringList &doc)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(VersionKey.arg(component),
+                              doc.join(CollectionConfiguration::ListSeparator));
+}
+
+const QStringList HelpEngineWrapper::lastShownPages() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::lastShownPages(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setLastShownPages(const QStringList &lastShownPages)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setLastShownPages(*d->m_helpEngine, lastShownPages);
+}
+
+const QStringList HelpEngineWrapper::lastZoomFactors() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::lastZoomFactors(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setLastZoomFactors(const QStringList &lastZoomFactors)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setLastZoomFactors(*d->m_helpEngine, lastZoomFactors);
+}
+
+const QString HelpEngineWrapper::cacheDir() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::cacheDir(*d->m_helpEngine);
+}
+
+bool HelpEngineWrapper::cacheDirIsRelativeToCollection() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::cacheDirIsRelativeToCollection(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setCacheDir(const QString &cacheDir,
+                                    bool relativeToCollection)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setCacheDir(*d->m_helpEngine, cacheDir,
+                                         relativeToCollection);
+}
+
+bool HelpEngineWrapper::filterFunctionalityEnabled() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::filterFunctionalityEnabled(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setFilterFunctionalityEnabled(bool enabled)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setFilterFunctionalityEnabled(*d->m_helpEngine,
+                                                           enabled);
+}
+
+bool HelpEngineWrapper::filterToolbarVisible() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::filterToolbarVisible(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setFilterToolbarVisible(bool visible)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setFilterToolbarVisible(*d->m_helpEngine, visible);
+}
+
+bool HelpEngineWrapper::addressBarEnabled() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::addressBarEnabled(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAddressBarEnabled(bool enabled)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAddressBarEnabled(*d->m_helpEngine, enabled);
+}
+
+bool HelpEngineWrapper::addressBarVisible() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::addressBarVisible(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAddressBarVisible(bool visible)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAddressBarVisible(*d->m_helpEngine, visible);
+}
+
+bool HelpEngineWrapper::documentationManagerEnabled() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::documentationManagerEnabled(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setDocumentationManagerEnabled(bool enabled)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setDocumentationManagerEnabled(*d->m_helpEngine,
+                                                            enabled);
+}
+
+const QByteArray HelpEngineWrapper::aboutMenuTexts() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::aboutMenuTexts(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAboutMenuTexts(const QByteArray &texts)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAboutMenuTexts(*d->m_helpEngine, texts);
+}
+
+const QByteArray HelpEngineWrapper::aboutIcon() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::aboutIcon(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAboutIcon(const QByteArray &icon)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAboutIcon(*d->m_helpEngine, icon);
+}
+
+const QByteArray HelpEngineWrapper::aboutImages() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::aboutImages(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAboutImages(const QByteArray &images)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAboutImages(*d->m_helpEngine, images);
+}
+
+const QByteArray HelpEngineWrapper::aboutTexts() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::aboutTexts(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setAboutTexts(const QByteArray &texts)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setAboutTexts(*d->m_helpEngine, texts);
+}
+
+const QString HelpEngineWrapper::windowTitle() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::windowTitle(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setWindowTitle(const QString &windowTitle)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setWindowTitle(*d->m_helpEngine, windowTitle);
+}
+
+const QByteArray HelpEngineWrapper::applicationIcon() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::applicationIcon(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setApplicationIcon(const QByteArray &icon)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setApplicationIcon(*d->m_helpEngine, icon);
+}
+
+const QByteArray HelpEngineWrapper::mainWindow() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(MainWindowKey).toByteArray();
+}
+
+void HelpEngineWrapper::setMainWindow(const QByteArray &mainWindow)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(MainWindowKey, mainWindow);
+}
+
+const QByteArray HelpEngineWrapper::mainWindowGeometry() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(MainWindowGeometryKey).toByteArray();
+}
+
+void HelpEngineWrapper::setMainWindowGeometry(const QByteArray &geometry)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(MainWindowGeometryKey, geometry);
+}
+
+const QByteArray HelpEngineWrapper::bookmarks() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(BookmarksKey).toByteArray();
+}
+
+void HelpEngineWrapper::setBookmarks(const QByteArray &bookmarks)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(BookmarksKey, bookmarks);
+}
+
+int HelpEngineWrapper::lastTabPage() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::lastTabPage(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setLastTabPage(int lastPage)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setLastTabPage(*d->m_helpEngine, lastPage);
+}
+
+bool HelpEngineWrapper::searchWasAttached() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(SearchWasAttachedKey).toBool();
+}
+
+void HelpEngineWrapper::setSearchWasAttached(bool attached)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(SearchWasAttachedKey, attached);
+}
+
+int HelpEngineWrapper::startOption() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(StartOptionKey, ShowLastPages).toInt();
+}
+
+void HelpEngineWrapper::setStartOption(int option)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(StartOptionKey, option);
+}
+
+const QString HelpEngineWrapper::homePage() const
+{
+    TRACE_OBJ
+    const QString &homePage
+        = d->m_helpEngine->customValue(HomePageKey).toString();
+    if (!homePage.isEmpty())
+        return homePage;
+    return defaultHomePage();
+}
+
+void HelpEngineWrapper::setHomePage(const QString &page)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(HomePageKey, page);
+
+}
+
+const QString HelpEngineWrapper::defaultHomePage() const
+{
+    TRACE_OBJ
+    return CollectionConfiguration::defaultHomePage(*d->m_helpEngine);
+}
+
+void HelpEngineWrapper::setDefaultHomePage(const QString &page)
+{
+    TRACE_OBJ
+    CollectionConfiguration::setDefaultHomePage(*d->m_helpEngine, page);
+}
+
+bool HelpEngineWrapper::hasFontSettings() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(UseAppFontKey).isValid();
+}
+
+bool HelpEngineWrapper::usesAppFont() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(UseAppFontKey).toBool();
+}
+
+void HelpEngineWrapper::setUseAppFont(bool useAppFont)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(UseAppFontKey, useAppFont);
+}
+
+bool HelpEngineWrapper::usesBrowserFont() const
+{
+    TRACE_OBJ
+    return d->m_helpEngine->customValue(UseBrowserFontKey, false).toBool();
+}
+
+void HelpEngineWrapper::setUseBrowserFont(bool useBrowserFont)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(UseBrowserFontKey, useBrowserFont);
+}
+
+const QFont HelpEngineWrapper::appFont() const
+{
+    TRACE_OBJ
+    return qVariantValue<QFont>(d->m_helpEngine->customValue(AppFontKey));
+}
+
+void HelpEngineWrapper::setAppFont(const QFont &font)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(AppFontKey, font);
+}
+
+QFontDatabase::WritingSystem HelpEngineWrapper::appWritingSystem() const
+{
+    TRACE_OBJ
+    return static_cast<QFontDatabase::WritingSystem>(
+        d->m_helpEngine->customValue(AppWritingSystemKey).toInt());
+}
+
+void HelpEngineWrapper::setAppWritingSystem(QFontDatabase::WritingSystem system)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(AppWritingSystemKey, system);
+}
+
+const QFont HelpEngineWrapper::browserFont() const
+{
+    TRACE_OBJ
+    return qVariantValue<QFont>(d->m_helpEngine->customValue(BrowserFontKey));
+}
+
+void HelpEngineWrapper::setBrowserFont(const QFont &font)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(BrowserFontKey, font);
+}
+
+QFontDatabase::WritingSystem HelpEngineWrapper::browserWritingSystem() const
+{
+    TRACE_OBJ
+    return static_cast<QFontDatabase::WritingSystem>(
+        d->m_helpEngine->customValue(BrowserWritingSystemKey).toInt());
+}
+
+void HelpEngineWrapper::setBrowserWritingSystem(QFontDatabase::WritingSystem system)
+{
+    TRACE_OBJ
+    d->m_helpEngine->setCustomValue(BrowserWritingSystemKey, system);
+}
+
+void HelpEngineWrapper::handleCurrentFilterChanged(const QString &filter)
+{
+    const QString &filterToReport
+        = filter == Unfiltered ? TrUnfiltered : filter;
+    emit currentFilterChanged(filterToReport);
+}
+
+
+TimeoutForwarder::TimeoutForwarder(const QString &fileName)
+    : m_fileName(fileName)
+{
+    TRACE_OBJ
+}
+
+void TimeoutForwarder::forward()
+{
+    TRACE_OBJ
+    HelpEngineWrapper::instance().d->qchFileChanged(m_fileName, true);
+}
+
+
+HelpEngineWrapperPrivate::HelpEngineWrapperPrivate(const QString &collectionFile)
+    : m_helpEngine(new QHelpEngine(collectionFile, this)),
+      m_qchWatcher(new QFileSystemWatcher(this))
+{
+    TRACE_OBJ
+    if (!m_helpEngine->customFilters().contains(Unfiltered))
+        m_helpEngine->addCustomFilter(Unfiltered, QStringList());
+    initFileSystemWatchers();
+}
+
+void HelpEngineWrapperPrivate::initFileSystemWatchers()
+{
+    TRACE_OBJ
+    foreach(const QString &ns, m_helpEngine->registeredDocumentations()) {
+        const QString &docFile = m_helpEngine->documentationFileName(ns);
+        m_qchWatcher->addPath(docFile);
+        connect(m_qchWatcher, SIGNAL(fileChanged(QString)),
+                this, SLOT(qchFileChanged(QString)));
+    }
+    checkDocFilesWatched();
+}
+
+void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName)
+{
+    TRACE_OBJ
+    qchFileChanged(fileName, false);
+}
+
+void HelpEngineWrapperPrivate::checkDocFilesWatched()
+{
+    TRACE_OBJ
+    const int watchedFilesCount = m_qchWatcher->files().count();
+    const int docFilesCount = m_helpEngine->registeredDocumentations().count();
+    if (watchedFilesCount != docFilesCount) {
+        qWarning("Strange: Have %d docs, but %d are being watched",
+                 watchedFilesCount, docFilesCount);
+    }
+}
+
+void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName,
+                                              bool fromTimeout)
+{
+    TRACE_OBJ
+
+    /*
+     * We don't use QHelpEngineCore::namespaceName(fileName), because the file
+     * may not exist anymore or contain a different namespace.
+     */
+    QString ns;
+    foreach (const QString &curNs, m_helpEngine->registeredDocumentations()) {
+        if (m_helpEngine->documentationFileName(curNs) == fileName) {
+            ns = curNs;
+            break;
+        }
+    }
+
+    /*
+     * We can't do an assertion here, because QFileSystemWatcher may send the
+     * signal more than  once.
+     */
+    if (ns.isEmpty()) {
+        m_recentQchUpdates.remove(fileName);
+        return;
+    }
+
+    /*
+     * Since the QFileSystemWatcher typically sends the signal more than once,
+     * we repeatedly delay our reaction a bit until we think the last signal
+     * was sent.
+     */
+
+    QMap<QString, RecentSignal>::Iterator it = m_recentQchUpdates.find(fileName);
+    const QDateTime &now = QDateTime::currentDateTime();
+
+     // Case 1: This is the first recent signal for the file.
+    if (it == m_recentQchUpdates.end()) {
+        QSharedPointer<TimeoutForwarder> forwarder(new TimeoutForwarder(fileName));
+        m_recentQchUpdates.insert(fileName, RecentSignal(now, forwarder));
+        QTimer::singleShot(UpdateGracePeriod, forwarder.data(), SLOT(forward()));
+        return;
+    }
+
+    // Case 2: The last signal for this file has not expired yet.
+    if (it.value().first > now.addMSecs(-UpdateGracePeriod)) {
+        if (!fromTimeout)
+            it.value().first = now;
+        else
+            QTimer::singleShot(UpdateGracePeriod, it.value().second.data(),
+                               SLOT(forward()));
+        return;
+    }
+
+    // Case 3: The last signal for this file has expired.
+    if (m_helpEngine->unregisterDocumentation(ns)) {
+        if (!QFileInfo(fileName).exists()
+            || !m_helpEngine->registerDocumentation(fileName)) {
+            m_qchWatcher->removePath(fileName);
+            emit documentationRemoved(ns);
+        } else {
+            emit documentationUpdated(ns);
+        }
+        m_helpEngine->setupData();
+    }
+    m_recentQchUpdates.erase(it);
+}
+
+
+QT_END_NAMESPACE
+
+#include "helpenginewrapper.moc"
Index: trunk/tools/assistant/tools/assistant/helpenginewrapper.h
===================================================================
--- trunk/tools/assistant/tools/assistant/helpenginewrapper.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpenginewrapper.h	(revision 846)
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HELPENGINEWRAPPER_H
+#define HELPENGINEWRAPPER_H
+
+#include <QtCore/QMap>
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QUrl>
+#include <QtGui/QFont>
+#include <QtGui/QFontDatabase>
+
+QT_BEGIN_NAMESPACE
+
+class QFileSystemWatcher;
+class QHelpContentModel;
+class QHelpContentWidget;
+class QHelpIndexModel;
+class QHelpIndexWidget;
+class QHelpSearchEngine;
+
+enum {
+    ShowHomePage = 0,
+    ShowBlankPage = 1,
+    ShowLastPages = 2
+};
+
+class HelpEngineWrapperPrivate;
+class TimeoutForwarder;
+
+class HelpEngineWrapper : public QObject
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(HelpEngineWrapper)
+    friend class TimeoutForwarder;
+public:
+    static HelpEngineWrapper &instance(const QString &collectionFile = QString());
+    static void removeInstance();
+
+    // Forwarded help engine member functions, possibly enriched.
+    QHelpSearchEngine *searchEngine() const;
+    QHelpContentModel *contentModel() const;
+    QHelpIndexModel *indexModel() const;
+    QHelpContentWidget *contentWidget();
+    QHelpIndexWidget *indexWidget();
+    bool setupData();
+    const QStringList registeredDocumentations() const;
+    const QString collectionFile() const;
+    bool registerDocumentation(const QString &docFile);
+    bool unregisterDocumentation(const QString &namespaceName);
+    bool addCustomFilter(const QString &filterName,
+                         const QStringList &attributes);
+    bool removeCustomFilter(const QString &filterName);
+    void setCurrentFilter(const QString &filterName);
+    const QString currentFilter() const;
+    const QStringList customFilters() const;
+    QUrl findFile(const QUrl &url) const;
+    QByteArray fileData(const QUrl &url) const;
+    QMap<QString, QUrl>	linksForIdentifier(const QString &id) const;
+    const QStringList filterAttributes() const;
+    const QStringList filterAttributes(const QString &filterName) const;
+    QString	error() const;   
+
+    /*
+     * To be called after assistant has finished looking for new documentation.
+     * This will mainly cause the search index to be updated, if necessary.
+     */
+    void initialDocSetupDone();
+
+    const QStringList qtDocInfo(const QString &component) const;
+    void setQtDocInfo(const QString &component, const QStringList &doc);
+
+    const QString homePage() const;
+    void setHomePage(const QString &page);
+    const QString defaultHomePage() const;
+    void setDefaultHomePage(const QString &page);
+
+    int lastTabPage() const;
+    void setLastTabPage(int lastPage);
+
+    // TODO: Don't allow last pages and zoom factors to be set in isolation
+    //       Perhaps also fill up missing elements automatically or assert.
+    const QStringList lastShownPages() const;
+    void setLastShownPages(const QStringList &lastShownPages);
+    const QStringList lastZoomFactors() const;
+    void setLastZoomFactors(const QStringList &lastZoomFactors);
+
+    const QString cacheDir() const;
+    bool cacheDirIsRelativeToCollection() const;
+    void setCacheDir(const QString &cacheDir, bool relativeToCollection);
+
+    bool filterFunctionalityEnabled() const;
+    void setFilterFunctionalityEnabled(bool enabled);
+
+    bool filterToolbarVisible() const;
+    void setFilterToolbarVisible(bool visible);
+
+    bool addressBarEnabled() const;
+    void setAddressBarEnabled(bool enabled);
+
+    bool addressBarVisible() const;
+    void setAddressBarVisible(bool visible);
+
+    bool documentationManagerEnabled() const;
+    void setDocumentationManagerEnabled(bool enabled);
+
+    const QByteArray aboutMenuTexts() const;
+    void setAboutMenuTexts(const QByteArray &texts);
+    const QByteArray aboutTexts() const;
+    void setAboutTexts(const QByteArray &texts);
+    const QByteArray aboutIcon() const;
+    void setAboutIcon(const QByteArray &icon);
+    const QByteArray aboutImages() const;
+    void setAboutImages(const QByteArray &images);
+
+    const QString windowTitle() const;
+    void setWindowTitle(const QString &windowTitle);
+
+    const QByteArray applicationIcon() const;
+    void setApplicationIcon(const QByteArray &icon);
+
+    const QByteArray mainWindow() const;
+    void setMainWindow(const QByteArray &mainWindow);
+    const QByteArray mainWindowGeometry() const;
+    void setMainWindowGeometry(const QByteArray &geometry);
+
+    const QByteArray bookmarks() const;
+    void setBookmarks(const QByteArray &bookmarks);
+
+    int startOption() const;
+    void setStartOption(int option);
+
+    bool searchWasAttached() const;
+    void setSearchWasAttached(bool attached);
+
+    bool hasFontSettings() const;
+    bool usesAppFont() const;
+    void setUseAppFont(bool useAppFont);
+    bool usesBrowserFont() const;
+    void setUseBrowserFont(bool useBrowserFont);
+    const QFont appFont() const;
+    void setAppFont(const QFont &font);
+    QFontDatabase::WritingSystem appWritingSystem() const;
+    void setAppWritingSystem(QFontDatabase::WritingSystem system);
+    const QFont browserFont() const;
+    void setBrowserFont(const QFont &font);
+    QFontDatabase::WritingSystem browserWritingSystem() const;
+    void setBrowserWritingSystem(QFontDatabase::WritingSystem system);
+
+    static const QString TrUnfiltered;
+
+signals:
+
+    // For asynchronous doc updates triggered by external actions.
+    void documentationRemoved(const QString &namespaceName);
+    void documentationUpdated(const QString &namespaceName);
+
+    // Forwarded from QHelpEngineCore.
+    void currentFilterChanged(const QString &currentFilter);
+    void setupFinished();
+
+private slots:
+    void handleCurrentFilterChanged(const QString &filter);
+
+private:
+    HelpEngineWrapper(const QString &collectionFile);
+    ~HelpEngineWrapper();
+
+    static HelpEngineWrapper *helpEngineWrapper;
+
+    HelpEngineWrapperPrivate *d;
+};
+
+QT_END_NAMESPACE
+
+#endif // HELPENGINEWRAPPER_H
Index: trunk/tools/assistant/tools/assistant/helpviewer.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/helpviewer.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,589 +39,142 @@
 **
 ****************************************************************************/
+#include "helpviewer.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
 
-#include "helpviewer.h"
-#include "centralwidget.h"
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFileInfo>
+#include <QtCore/QStringBuilder>
+#include <QtCore/QTemporaryFile>
+#include <QtCore/QUrl>
 
-#include <QtCore/QDir>
-#include <QtCore/QEvent>
-#include <QtCore/QVariant>
-#include <QtCore/QByteArray>
-#include <QtCore/QTimer>
-
-#include <QtGui/QMenu>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QClipboard>
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
 #include <QtGui/QDesktopServices>
-
-#include <QtHelp/QHelpEngine>
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QNetworkRequest>
 
 QT_BEGIN_NAMESPACE
 
-#if !defined(QT_NO_WEBKIT)
+const QLatin1String AbstractHelpViewer::DocPath("qthelp://com.trolltech.");
 
-class HelpNetworkReply : public QNetworkReply
-{
-public:
-    HelpNetworkReply(const QNetworkRequest &request, const QByteArray &fileData,
-        const QString &mimeType);
+const QString AbstractHelpViewer::AboutBlank =
+    QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
 
-    virtual void abort();
+const QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://"
+    "com.trolltech.com.assistantinternal-1.0.0/assistant/assistant.html");
 
-    virtual qint64 bytesAvailable() const
-        { return data.length() + QNetworkReply::bytesAvailable(); }
+const QString AbstractHelpViewer::PageNotFoundMessage =
+    QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div "
+    "align=\"center\"><br><br><h1>The page could not be found</h1><br><h3>'%1'"
+    "</h3></div>");
 
-protected:
-    virtual qint64 readData(char *data, qint64 maxlen);
-
-private:
-    QByteArray data;
-    qint64 origLen;
+struct ExtensionMap {
+    const char *extension;
+    const char *mimeType;
+} extensionMap[] = {
+    { ".bmp", "image/bmp" },
+    { ".css", "text/css" },
+    { ".gif", "image/gif" },
+    { ".html", "text/html" },
+    { ".htm", "text/html" },
+    { ".ico", "image/x-icon" },
+    { ".jpeg", "image/jpeg" },
+    { ".jpg", "image/jpeg" },
+    { ".js", "application/x-javascript" },
+    { ".mng", "video/x-mng" },
+    { ".pbm", "image/x-portable-bitmap" },
+    { ".pgm", "image/x-portable-graymap" },
+    { ".pdf", "application/pdf" },
+    { ".png", "image/png" },
+    { ".ppm", "image/x-portable-pixmap" },
+    { ".rss", "application/rss+xml" },
+    { ".svg", "image/svg+xml" },
+    { ".svgz", "image/svg+xml" },
+    { ".text", "text/plain" },
+    { ".tif", "image/tiff" },
+    { ".tiff", "image/tiff" },
+    { ".txt", "text/plain" },
+    { ".xbm", "image/x-xbitmap" },
+    { ".xml", "text/xml" },
+    { ".xpm", "image/x-xpm" },
+    { ".xsl", "text/xsl" },
+    { ".xhtml", "application/xhtml+xml" },
+    { ".wml", "text/vnd.wap.wml" },
+    { ".wmlc", "application/vnd.wap.wmlc" },
+    { "about:blank", 0 },
+    { 0, 0 }
 };
 
-HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
-        const QByteArray &fileData, const QString& mimeType)
-    : data(fileData), origLen(fileData.length())
-{
-    setRequest(request);
-    setOpenMode(QIODevice::ReadOnly);
+// -- AbstractHelpViewer
 
-    setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
-    setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
-    QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
-    QTimer::singleShot(0, this, SIGNAL(readyRead()));
-}
-
-void HelpNetworkReply::abort()
-{
-    // nothing to do
-}
-
-qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
-{
-    qint64 len = qMin(qint64(data.length()), maxlen);
-    if (len) {
-        qMemCopy(buffer, data.constData(), len);
-        data.remove(0, len);
-    }
-    if (!data.length())
-        QTimer::singleShot(0, this, SIGNAL(finished()));
-    return len;
-}
-
-class HelpNetworkAccessManager : public QNetworkAccessManager
-{
-public:
-    HelpNetworkAccessManager(QHelpEngine *engine, QObject *parent);
-
-protected:
-    virtual QNetworkReply *createRequest(Operation op,
-        const QNetworkRequest &request, QIODevice *outgoingData = 0);
-
-private:
-    QHelpEngine *helpEngine;
-};
-
-HelpNetworkAccessManager::HelpNetworkAccessManager(QHelpEngine *engine,
-        QObject *parent)
-    : QNetworkAccessManager(parent), helpEngine(engine)
+AbstractHelpViewer::AbstractHelpViewer()
 {
 }
 
-QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
-    const QNetworkRequest &request, QIODevice* /*outgoingData*/)
-{
-    const QUrl& url = request.url();
-    QString mimeType = url.toString();
-    if (mimeType.endsWith(QLatin1String(".svg"))
-        || mimeType.endsWith(QLatin1String(".svgz"))) {
-            mimeType = QLatin1String("image/svg+xml");
-    } else if (mimeType.endsWith(QLatin1String(".css"))) {
-        mimeType = QLatin1String("text/css");
-    } else if (mimeType.endsWith(QLatin1String(".js"))) {
-        mimeType = QLatin1String("text/javascript");
-    } else if (mimeType.endsWith(QLatin1String(".txt"))) {
-        mimeType = QLatin1String("text/plain");
-    } else {
-        mimeType = QLatin1String("text/html");
-    }
-
-    const QByteArray &data = helpEngine->findFile(url).isValid()
-        ? helpEngine->fileData(url) : QByteArray("File not found!");
-    return new HelpNetworkReply(request, data, mimeType);
-}
-
-class HelpPage : public QWebPage
-{
-public:
-    HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent);
-
-protected:
-    virtual QWebPage *createWindow(QWebPage::WebWindowType);
-    virtual void triggerAction(WebAction action, bool checked = false);
-
-    virtual bool acceptNavigationRequest(QWebFrame *frame,
-        const QNetworkRequest &request, NavigationType type);
-
-private:
-    CentralWidget *centralWidget;
-    QHelpEngine *helpEngine;
-    bool closeNewTabIfNeeded;
-
-    friend class HelpViewer;
-    Qt::MouseButtons m_pressedButtons;
-    Qt::KeyboardModifiers m_keyboardModifiers;
-};
-
-HelpPage::HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent)
-    : QWebPage(parent)
-    , centralWidget(central)
-    , helpEngine(engine)
-    , closeNewTabIfNeeded(false)
-    , m_pressedButtons(Qt::NoButton)
-    , m_keyboardModifiers(Qt::NoModifier)
+AbstractHelpViewer::~AbstractHelpViewer()
 {
 }
 
-QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
+bool AbstractHelpViewer::isLocalUrl(const QUrl &url)
 {
-    HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page());
-    if (newPage)
-        newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
-    closeNewTabIfNeeded = false;
-    return newPage;
-}
-
-static bool isLocalUrl(const QUrl &url)
-{
-    const QString scheme = url.scheme();
-    if (scheme.isEmpty()
+    TRACE_OBJ
+    const QString &scheme = url.scheme();
+    return scheme.isEmpty()
         || scheme == QLatin1String("file")
         || scheme == QLatin1String("qrc")
         || scheme == QLatin1String("data")
         || scheme == QLatin1String("qthelp")
-        || scheme == QLatin1String("about"))
-        return true;
-    return false;
+        || scheme == QLatin1String("about");
 }
 
-void HelpPage::triggerAction(WebAction action, bool checked)
+bool AbstractHelpViewer::canOpenPage(const QString &url)
 {
-    switch (action) {
-        case OpenLinkInNewWindow:
-            closeNewTabIfNeeded = true;
-        default:        // fall through
-            QWebPage::triggerAction(action, checked);
-            break;
-    }
+    TRACE_OBJ
+    return !mimeFromUrl(url).isEmpty();
 }
 
-bool HelpPage::acceptNavigationRequest(QWebFrame *,
-    const QNetworkRequest &request, QWebPage::NavigationType type)
+QString AbstractHelpViewer::mimeFromUrl(const QUrl &url)
 {
-    const QUrl &url = request.url();
-    const bool closeNewTab = closeNewTabIfNeeded;
-    closeNewTabIfNeeded = false;
+    TRACE_OBJ
+    const QString &path = url.path();
+    const int index = path.lastIndexOf(QLatin1Char('.'));
+    const QByteArray &ext = path.mid(index).toUtf8().toLower();
 
-    if (isLocalUrl(url)) {
-        const QString& path = url.path();
-        if (path.endsWith(QLatin1String(".pdf"))) {
-            const int lastDash = path.lastIndexOf(QChar('/'));
-            QString fileName = QDir::tempPath() + QDir::separator();
-            if (lastDash < 0)
-                fileName += path;
-            else
-                fileName += path.mid(lastDash + 1, path.length());
-
-            QFile tmpFile(QDir::cleanPath(fileName));
-            if (tmpFile.open(QIODevice::ReadWrite)) {
-                tmpFile.write(helpEngine->fileData(url));
-                tmpFile.close();
-            }
-            QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
-
-            if (closeNewTab)
-                QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab");
-            return false;
-        }
-
-        if (type == QWebPage::NavigationTypeLinkClicked
-            && (m_keyboardModifiers & Qt::ControlModifier
-            || m_pressedButtons == Qt::MidButton)) {
-                HelpViewer* viewer = centralWidget->newEmptyTab();
-                if (viewer)
-                    CentralWidget::instance()->setSource(url);
-                m_pressedButtons = Qt::NoButton;
-                m_keyboardModifiers = Qt::NoModifier;
-                return false;
-        }
-        return true;
+    const ExtensionMap *e = extensionMap;
+    while (e->extension) {
+        if (ext == e->extension)
+            return QLatin1String(e->mimeType);
+        ++e;
     }
-
-    QDesktopServices::openUrl(url);
-    return false;
+    return QLatin1String("");
 }
 
-HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
-    : QWebView(parent)
-    , helpEngine(engine)
-    , parentWidget(parent)
-    , loadFinished(false)
+bool AbstractHelpViewer::launchWithExternalApp(const QUrl &url)
 {
-    setAcceptDrops(false);
+    TRACE_OBJ
+    if (isLocalUrl(url)) {
+        const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+        const QUrl &resolvedUrl = helpEngine.findFile(url);
+        if (!resolvedUrl.isValid())
+            return false;
 
-    setPage(new HelpPage(parent, helpEngine, this));
+        const QString& path = resolvedUrl.path();
+        if (!canOpenPage(path)) {
+            QTemporaryFile tmpTmpFile;
+            if (!tmpTmpFile.open())
+                return false;
 
-    page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this));
+            const QString &extension = QFileInfo(path).completeSuffix();
+            QFile actualTmpFile(tmpTmpFile.fileName() % QLatin1String(".")
+                % extension);
+            if (!actualTmpFile.open(QIODevice::ReadWrite | QIODevice::Truncate))
+                return false;
 
-    QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
-    action->setText(tr("Open Link in New Tab"));
-    if (!parent)
-        action->setVisible(false);
-
-    pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
-    pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
-    pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);
-
-    connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
-        SLOT(actionChanged()));
-    connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
-        SLOT(actionChanged()));
-    connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
-        SLOT(actionChanged()));
-    connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
-        SIGNAL(highlighted(QString)));
-    connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
-    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
-}
-
-void HelpViewer::setSource(const QUrl &url)
-{
-    loadFinished = false;
-    if (url.toString() == QLatin1String("help")) {
-        load(QUrl(QLatin1String("qthelp://com.trolltech.com."
-            "assistantinternal-1.0.0/assistant/assistant.html")));
-    } else {
-        load(url);
-    }
-}
-
-void HelpViewer::resetZoom()
-{
-    setTextSizeMultiplier(1.0);
-}
-
-void HelpViewer::zoomIn(qreal range)
-{
-    setTextSizeMultiplier(textSizeMultiplier() + range / 10.0);
-}
-
-void HelpViewer::zoomOut(qreal range)
-{
-    setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - range / 10.0));
-}
-
-void HelpViewer::home()
-{
-    QString homepage = helpEngine->customValue(QLatin1String("homepage"),
-        QLatin1String("")).toString();
-
-    if (homepage.isEmpty()) {
-        homepage = helpEngine->customValue(QLatin1String("defaultHomepage"),
-            QLatin1String("help")).toString();
-    }
-
-    setSource(homepage);
-}
-
-void HelpViewer::wheelEvent(QWheelEvent *e)
-{
-    if (e->modifiers() & Qt::ControlModifier) {
-        const int delta = e->delta();
-        if (delta > 0)
-            zoomIn(delta / 120);
-        else if (delta < 0)
-            zoomOut(-delta / 120);
-        e->accept();
-        return;
-    }
-    QWebView::wheelEvent(e);
-}
-
-void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::XButton1) {
-        triggerPageAction(QWebPage::Back);
-        return;
-    }
-
-    if (e->button() == Qt::XButton2) {
-        triggerPageAction(QWebPage::Forward);
-        return;
-    }
-
-    QWebView::mouseReleaseEvent(e);
-}
-
-void HelpViewer::actionChanged()
-{
-    QAction *a = qobject_cast<QAction *>(sender());
-    if (a == pageAction(QWebPage::Copy))
-        emit copyAvailable(a->isEnabled());
-    else if (a == pageAction(QWebPage::Back))
-        emit backwardAvailable(a->isEnabled());
-    else if (a == pageAction(QWebPage::Forward))
-        emit forwardAvailable(a->isEnabled());
-}
-
-void HelpViewer::mousePressEvent(QMouseEvent *event)
-{
-    HelpPage *currentPage = static_cast<HelpPage*>(page());
-    if (currentPage) {
-        currentPage->m_pressedButtons = event->buttons();
-        currentPage->m_keyboardModifiers = event->modifiers();
-    }
-    QWebView::mousePressEvent(event);
-}
-
-void HelpViewer::setLoadFinished(bool ok)
-{
-    loadFinished = ok;
-    emit sourceChanged(url());
-}
-
-#else  // !defined(QT_NO_WEBKIT)
-
-HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
-    : QTextBrowser(parent)
-    , zoomCount(0)
-    , controlPressed(false)
-    , lastAnchor(QString())
-    , helpEngine(engine)
-    , parentWidget(parent)
-{
-   document()->setDocumentMargin(8);
-}
-
-void HelpViewer::setSource(const QUrl &url)
-{
-    bool help = url.toString() == QLatin1String("help");
-    if (url.isValid() && !help) {
-        if (launchedWithExternalApp(url))
-            return;
-
-        QUrl u = helpEngine->findFile(url);
-        if (u.isValid()) {
-            QTextBrowser::setSource(u);
-            return;
+            actualTmpFile.write(helpEngine.fileData(resolvedUrl));
+            actualTmpFile.close();
+            return QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
         }
-    }
-
-    if (help) {
-        QTextBrowser::setSource(QUrl(QLatin1String("qthelp://com.trolltech.com."
-            "assistantinternal-1.0.0/assistant/assistant.html")));
-    } else {
-        QTextBrowser::setSource(url);
-        setHtml(tr("<title>Error 404...</title><div align=\"center\"><br><br>"
-            "<h1>The page could not be found</h1><br><h3>'%1'</h3></div>")
-            .arg(url.toString()));
-        emit sourceChanged(url);
-    }
-}
-
-void HelpViewer::resetZoom()
-{
-    if (zoomCount == 0)
-        return;
-
-    QTextBrowser::zoomOut(zoomCount);
-    zoomCount = 0;
-}
-
-void HelpViewer::zoomIn(int range)
-{
-    if (zoomCount == 10)
-        return;
-
-    QTextBrowser::zoomIn(range);
-    zoomCount++;
-}
-
-void HelpViewer::zoomOut(int range)
-{
-    if (zoomCount == -5)
-        return;
-
-    QTextBrowser::zoomOut(range);
-    zoomCount--;
-}
-
-bool HelpViewer::launchedWithExternalApp(const QUrl &url)
-{
-    bool isPdf = url.path().endsWith(QLatin1String(".pdf"));
-    if (url.scheme() == QLatin1String("http")
-        || url.scheme() == QLatin1String("ftp")
-        || url.scheme() == QLatin1String("mailto") || isPdf) {
-        bool launched = false;
-        if (isPdf && url.scheme() == QLatin1String("qthelp")) {
-            const QString& path = url.path();
-            const int lastDash = path.lastIndexOf(QChar('/'));
-            QString fileName = QDir::tempPath() + QDir::separator();
-            if (lastDash < 0)
-                fileName += path;
-            else
-                fileName += path.mid(lastDash + 1, path.length());
-
-            QFile tmpFile(QDir::cleanPath(fileName));
-            if (tmpFile.open(QIODevice::ReadWrite)) {
-                tmpFile.write(helpEngine->fileData(url));
-                tmpFile.close();
-            }
-            launched = QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
-        } else {
-            launched = QDesktopServices::openUrl(url);
-        }
-
-        if (!launched) {
-            QMessageBox::information(this, tr("Help"),
-                tr("Unable to launch external application.\n"), tr("OK"));
-        }
-        return true;
+    } else if (url.scheme() == QLatin1String("http")) {
+        return QDesktopServices::openUrl(url);
     }
     return false;
 }
 
-QVariant HelpViewer::loadResource(int type, const QUrl &name)
-{
-    QByteArray ba;
-    if (type < 4) {
-        ba = helpEngine->fileData(name);
-        if (name.toString().endsWith(QLatin1String(".svg"), Qt::CaseInsensitive)) {
-            QImage image;
-            image.loadFromData(ba, "svg");
-            if (!image.isNull())
-                return image;
-        }
-    }
-    return ba;
-}
-
-void HelpViewer::openLinkInNewTab()
-{
-    if(lastAnchor.isEmpty())
-        return;
-
-    parentWidget->setSourceInNewTab(QUrl(lastAnchor));
-    lastAnchor.clear();
-}
-
-void HelpViewer::openLinkInNewTab(const QString &link)
-{
-    lastAnchor = link;
-    openLinkInNewTab();
-}
-
-bool HelpViewer::hasAnchorAt(const QPoint& pos)
-{
-    lastAnchor = anchorAt(pos);
-    if (lastAnchor.isEmpty())
-        return false;
-
-    lastAnchor = source().resolved(lastAnchor).toString();
-    if (lastAnchor.at(0) == QLatin1Char('#')) {
-        QString src = source().toString();
-        int hsh = src.indexOf(QLatin1Char('#'));
-        lastAnchor = (hsh>=0 ? src.left(hsh) : src) + lastAnchor;
-    }
-
-    return true;
-}
-
-void HelpViewer::contextMenuEvent(QContextMenuEvent *e)
-{
-    QMenu menu(QLatin1String(""), 0);
-
-    QUrl link;
-    QAction *copyAnchorAction = 0;
-    if (hasAnchorAt(e->pos())) {
-        link = anchorAt(e->pos());
-        if (link.isRelative())
-            link = source().resolved(link);
-        copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
-        copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
-
-        menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), this,
-            SLOT(openLinkInNewTab()));
-        menu.addSeparator();
-    }
-    menu.addActions(parentWidget->globalActions());
-    QAction *action = menu.exec(e->globalPos());
-    if (action == copyAnchorAction)
-        QApplication::clipboard()->setText(link.toString());
-}
-
-void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::XButton1) {
-        QTextBrowser::backward();
-        return;
-    }
-
-    if (e->button() == Qt::XButton2) {
-        QTextBrowser::forward();
-        return;
-    }
-
-    controlPressed = e->modifiers() & Qt::ControlModifier;
-    if ((controlPressed && hasAnchorAt(e->pos())) ||
-        (e->button() == Qt::MidButton && hasAnchorAt(e->pos()))) {
-        openLinkInNewTab();
-        return;
-    }
-
-    QTextBrowser::mouseReleaseEvent(e);
-}
-
-void HelpViewer::keyPressEvent(QKeyEvent *e)
-{
-    if ((e->key() == Qt::Key_Home && e->modifiers() != Qt::NoModifier)
-        || (e->key() == Qt::Key_End && e->modifiers() != Qt::NoModifier)) {
-        QKeyEvent* event = new QKeyEvent(e->type(), e->key(), Qt::NoModifier,
-            e->text(), e->isAutoRepeat(), e->count());
-        e = event;
-    }
-    QTextBrowser::keyPressEvent(e);
-}
-
-void HelpViewer::home()
-{
-    QString homepage = helpEngine->customValue(QLatin1String("homepage"),
-        QLatin1String("")).toString();
-
-    if (homepage.isEmpty()) {
-        homepage = helpEngine->customValue(QLatin1String("defaultHomepage"),
-            QLatin1String("help")).toString();
-    }
-
-    setSource(homepage);
-}
-
-void HelpViewer::wheelEvent(QWheelEvent *e)
-{
-    if (e->modifiers() == Qt::CTRL) {
-        e->accept();
-        (e->delta() > 0) ? zoomIn() : zoomOut();
-    } else {
-        e->ignore();
-        QTextBrowser::wheelEvent(e);
-    }
-}
-
-#endif  // !defined(QT_NO_WEBKIT)
-
 QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/helpviewer.h
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/helpviewer.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,138 +39,45 @@
 **
 ****************************************************************************/
-
 #ifndef HELPVIEWER_H
 #define HELPVIEWER_H
 
-#include <QtCore/QUrl>
-#include <QtCore/QVariant>
-#include <QtGui/QTextBrowser>
-#include <QtGui/QAction>
+#include <QtCore/QString>
 
-#if !defined(QT_NO_WEBKIT)
-#include <QWebView>
-#endif
+#include <QtGui/QFont>
 
 QT_BEGIN_NAMESPACE
 
-class QHelpEngine;
-class CentralWidget;
+class QMouseEvent;
+class QUrl;
 
-class QPoint;
-class QString;
-class QKeyEvent;
-class QMouseEvent;
-class QContextMenuEvent;
+class AbstractHelpViewer
+{
+public:
+    AbstractHelpViewer();
+    virtual ~AbstractHelpViewer();
 
-#if !defined(QT_NO_WEBKIT)
+    virtual QFont viewerFont() const = 0;
+    virtual void setViewerFont(const QFont &font) = 0;
 
-class HelpViewer : public QWebView
-{
-    Q_OBJECT
+    virtual void scaleUp() = 0;
+    virtual void scaleDown() = 0;
+    
+    virtual void resetScale() = 0;
+    virtual qreal scale() const = 0;
 
-public:
-    HelpViewer(QHelpEngine *helpEngine, CentralWidget *parent);
-    void setSource(const QUrl &url);
+    virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0;
 
-    inline QUrl source() const
-    { return url(); }
+    static const QLatin1String DocPath;
+    static const QString AboutBlank;
+    static const QString LocalHelpFile;
+    static const QString PageNotFoundMessage;
 
-    inline QString documentTitle() const
-    { return title(); }
-
-    inline bool hasSelection() const
-    { return !selectedText().isEmpty(); } // ### this is suboptimal
-
-    void resetZoom();
-    void zoomIn(qreal range = 1);
-    void zoomOut(qreal range = 1);
-
-    inline void copy()
-    { return triggerPageAction(QWebPage::Copy); }
-
-    inline bool isForwardAvailable() const
-    { return pageAction(QWebPage::Forward)->isEnabled(); }
-    inline bool isBackwardAvailable() const
-    { return pageAction(QWebPage::Back)->isEnabled(); }
-    inline bool hasLoadFinished() const
-    { return loadFinished; }
-    inline qreal zoom() const
-    { return textSizeMultiplier(); }
-
-public Q_SLOTS:
-    void home();
-    void backward() { back(); }
-
-Q_SIGNALS:
-    void copyAvailable(bool enabled);
-    void forwardAvailable(bool enabled);
-    void backwardAvailable(bool enabled);
-    void highlighted(const QString &);
-    void sourceChanged(const QUrl &);
-
-protected:
-    virtual void wheelEvent(QWheelEvent *);
-    void mouseReleaseEvent(QMouseEvent *e);
-    void mousePressEvent(QMouseEvent *event);
-
-private Q_SLOTS:
-    void actionChanged();
-    void setLoadFinished(bool ok);
-
-private:
-    QHelpEngine *helpEngine;
-    CentralWidget* parentWidget;
-    bool loadFinished;
+    static bool isLocalUrl(const QUrl &url);
+    static bool canOpenPage(const QString &url);
+    static QString mimeFromUrl(const QUrl &url);
+    static bool launchWithExternalApp(const QUrl &url);
 };
-
-#else
-
-class HelpViewer : public QTextBrowser
-{
-    Q_OBJECT
-
-public:
-    HelpViewer(QHelpEngine *helpEngine, CentralWidget *parent);
-    void setSource(const QUrl &url);
-
-    void resetZoom();
-    void zoomIn(int range = 1);
-    void zoomOut(int range = 1);
-    int zoom() const { return zoomCount; }
-    void setZoom(int zoom) { zoomCount = zoom; }
-
-    inline bool hasSelection() const
-    { return textCursor().hasSelection(); }
-
-    bool launchedWithExternalApp(const QUrl &url);
-
-public Q_SLOTS:
-    void home();
-
-protected:
-    void wheelEvent(QWheelEvent *e);
-
-private:
-    QVariant loadResource(int type, const QUrl &name);    
-    void openLinkInNewTab(const QString &link);
-    bool hasAnchorAt(const QPoint& pos);
-    void contextMenuEvent(QContextMenuEvent *e);
-    void mouseReleaseEvent(QMouseEvent *e);
-    void keyPressEvent(QKeyEvent *e);
-
-private slots:
-    void openLinkInNewTab();
-
-private:
-    int zoomCount;
-    bool controlPressed;
-    QString lastAnchor;
-    QHelpEngine *helpEngine;
-    CentralWidget* parentWidget;
-};
-
-#endif
 
 QT_END_NAMESPACE
 
-#endif
+#endif  // HELPVIEWER_H
Index: trunk/tools/assistant/tools/assistant/helpviewer_qtb.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer_qtb.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpviewer_qtb.cpp	(revision 846)
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "helpviewer_qtb.h"
+
+#include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
+
+#include <QtCore/QStringBuilder>
+
+#include <QtGui/QContextMenuEvent>
+#include <QtGui/QMenu>
+#include <QtGui/QClipboard>
+#include <QtGui/QApplication>
+
+QT_BEGIN_NAMESPACE
+
+HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
+    : QTextBrowser(parent)
+    , zoomCount(zoom)
+    , controlPressed(false)
+    , lastAnchor(QString())
+    , parentWidget(parent)
+    , helpEngine(HelpEngineWrapper::instance())
+    , forceFont(false)
+{
+    TRACE_OBJ
+    installEventFilter(this);
+    document()->setDocumentMargin(8);
+
+    QFont font = viewerFont();
+    font.setPointSize(int(font.pointSize() + zoom));
+    setViewerFont(font);
+}
+
+HelpViewer::~HelpViewer()
+{
+    TRACE_OBJ
+}
+
+QFont HelpViewer::viewerFont() const
+{
+    TRACE_OBJ
+    if (HelpEngineWrapper::instance().usesBrowserFont())
+        return helpEngine.browserFont();
+    return qApp->font();
+}
+
+void HelpViewer::setViewerFont(const QFont &newFont)
+{
+    TRACE_OBJ
+    if (font() != newFont) {
+        forceFont = true;
+        setFont(newFont);
+        forceFont = false;
+    }
+}
+
+void HelpViewer::scaleUp()
+{
+    TRACE_OBJ
+    if (zoomCount < 10) {
+        ++zoomCount;
+        forceFont = true;
+        zoomIn();
+        forceFont = false;
+    }
+}
+
+void HelpViewer::scaleDown()
+{
+    TRACE_OBJ
+    if (zoomCount > -5) {
+        --zoomCount;
+        forceFont = true;
+        zoomOut();
+        forceFont = false;
+    }
+}
+
+void HelpViewer::resetScale()
+{
+    TRACE_OBJ
+    if (zoomCount != 0) {
+        forceFont = true;
+        zoomOut(zoomCount);
+        forceFont = false;
+    }
+    zoomCount = 0;
+}
+
+bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e)
+{
+    if (e->button() == Qt::XButton1) {
+        QTextBrowser::backward();
+        return true;
+    }
+
+    if (e->button() == Qt::XButton2) {
+        QTextBrowser::forward();
+        return true;
+    }
+    return false;
+}
+
+void HelpViewer::setSource(const QUrl &url)
+{
+    TRACE_OBJ
+    const QString &string = url.toString();
+    if (url.isValid() && string != QLatin1String("help")) {
+        if (launchWithExternalApp(url))
+            return;
+
+        const QUrl &resolvedUrl = helpEngine.findFile(url);
+        if (resolvedUrl.isValid()) {
+            QTextBrowser::setSource(resolvedUrl);
+            return;
+        } 
+    }
+
+    if (string != QLatin1String("help")) {
+        QTextBrowser::setSource(url);
+        setHtml(string == QLatin1String("about:blank") ? AboutBlank
+            : PageNotFoundMessage.arg(url.toString()));
+        emit sourceChanged(url);
+    } else {
+        QTextBrowser::setSource(LocalHelpFile);
+    }
+}
+
+QVariant HelpViewer::loadResource(int type, const QUrl &name)
+{
+    TRACE_OBJ
+    QByteArray ba;
+    if (type < 4) {
+        ba = helpEngine.fileData(name);
+        if (name.toString().endsWith(QLatin1String(".svg"), Qt::CaseInsensitive)) {
+            QImage image;
+            image.loadFromData(ba, "svg");
+            if (!image.isNull())
+                return image;
+        }
+    }
+    return ba;
+}
+
+void HelpViewer::openLinkInNewTab()
+{
+    TRACE_OBJ
+    if(lastAnchor.isEmpty())
+        return;
+
+    parentWidget->setSourceInNewTab(QUrl(lastAnchor));
+    lastAnchor.clear();
+}
+
+void HelpViewer::openLinkInNewTab(const QString &link)
+{
+    TRACE_OBJ
+    lastAnchor = link;
+    openLinkInNewTab();
+}
+
+bool HelpViewer::hasAnchorAt(const QPoint& pos)
+{
+    TRACE_OBJ
+    lastAnchor = anchorAt(pos);
+    if (lastAnchor.isEmpty())
+        return false;
+
+    lastAnchor = source().resolved(lastAnchor).toString();
+    if (lastAnchor.at(0) == QLatin1Char('#')) {
+        QString src = source().toString();
+        int hsh = src.indexOf(QLatin1Char('#'));
+        lastAnchor = (hsh>=0 ? src.left(hsh) : src) + lastAnchor;
+    }
+
+    return true;
+}
+
+void HelpViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+    TRACE_OBJ
+    QMenu menu(QLatin1String(""), 0);
+
+    QUrl link;
+    QAction *copyAnchorAction = 0;
+    if (hasAnchorAt(e->pos())) {
+        link = anchorAt(e->pos());
+        if (link.isRelative())
+            link = source().resolved(link);
+        copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
+        copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
+
+        menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), this,
+            SLOT(openLinkInNewTab()));
+        menu.addSeparator();
+    }
+    menu.addActions(parentWidget->globalActions());
+    QAction *action = menu.exec(e->globalPos());
+    if (action == copyAnchorAction)
+        QApplication::clipboard()->setText(link.toString());
+}
+
+void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
+{
+    TRACE_OBJ
+#ifndef Q_OS_LINUX
+    if (handleForwardBackwardMouseButtons(e))
+        return;
+#endif
+
+    controlPressed = e->modifiers() & Qt::ControlModifier;
+    if ((controlPressed && hasAnchorAt(e->pos())) ||
+        (e->button() == Qt::MidButton && hasAnchorAt(e->pos()))) {
+        openLinkInNewTab();
+        return;
+    }
+
+    QTextBrowser::mouseReleaseEvent(e);
+}
+
+void HelpViewer::mousePressEvent(QMouseEvent *e)
+{
+#ifdef Q_OS_LINUX
+    if (handleForwardBackwardMouseButtons(e))
+        return;
+#endif
+    QTextBrowser::mousePressEvent(e);
+}
+
+void HelpViewer::keyPressEvent(QKeyEvent *e)
+{
+    TRACE_OBJ
+    if ((e->key() == Qt::Key_Home && e->modifiers() != Qt::NoModifier)
+        || (e->key() == Qt::Key_End && e->modifiers() != Qt::NoModifier)) {
+        QKeyEvent* event = new QKeyEvent(e->type(), e->key(), Qt::NoModifier,
+            e->text(), e->isAutoRepeat(), e->count());
+        e = event;
+    }
+    QTextBrowser::keyPressEvent(e);
+}
+
+void HelpViewer::home()
+{
+    TRACE_OBJ
+    setSource(helpEngine.homePage());
+}
+
+void HelpViewer::wheelEvent(QWheelEvent *e)
+{
+    TRACE_OBJ
+    if (e->modifiers() == Qt::ControlModifier) {
+        e->accept();
+        e->delta() > 0 ? scaleUp() : scaleDown();
+    } else {
+        QTextBrowser::wheelEvent(e);
+    }
+}
+
+bool HelpViewer::eventFilter(QObject *obj, QEvent *event)
+{
+    TRACE_OBJ
+    if (event->type() == QEvent::FontChange && !forceFont)
+        return true;
+    return QTextBrowser::eventFilter(obj, event);
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/helpviewer_qtb.h
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer_qtb.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpviewer_qtb.h	(revision 846)
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef HELPVIEWERQTB_H
+#define HELPVIEWERQTB_H
+
+#include "helpviewer.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QVariant>
+
+#include <QtGui/QTextBrowser>
+
+QT_BEGIN_NAMESPACE
+
+class CentralWidget;
+class HelpEngineWrapper;
+class QContextMenuEvent;
+class QKeyEvent;
+class QMouseEvent;
+
+class HelpViewer : public QTextBrowser, public AbstractHelpViewer
+{
+    Q_OBJECT
+
+public:
+    explicit HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+    ~HelpViewer();
+
+    QFont viewerFont() const;
+    void setViewerFont(const QFont &font);
+
+    void scaleUp();
+    void scaleDown();
+    void resetScale();
+    qreal scale() const { return zoomCount; }
+
+    bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+
+    void setSource(const QUrl &url);
+
+    inline bool hasSelection() const
+    { return textCursor().hasSelection(); }
+
+public Q_SLOTS:
+    void home();
+
+protected:
+    void wheelEvent(QWheelEvent *e);
+    bool eventFilter(QObject *obj, QEvent *event);
+
+private:
+    QVariant loadResource(int type, const QUrl &name);
+    void openLinkInNewTab(const QString &link);
+    bool hasAnchorAt(const QPoint& pos);
+    void contextMenuEvent(QContextMenuEvent *e);
+    void mouseReleaseEvent(QMouseEvent *e);
+    void keyPressEvent(QKeyEvent *e);
+    void mousePressEvent(QMouseEvent *e);
+
+private slots:
+    void openLinkInNewTab();
+
+private:
+    int zoomCount;
+    bool controlPressed;
+    QString lastAnchor;
+    CentralWidget* parentWidget;
+    HelpEngineWrapper &helpEngine;
+
+    bool forceFont;
+};
+
+QT_END_NAMESPACE
+
+#endif  // HELPVIEWERQTB_H
Index: trunk/tools/assistant/tools/assistant/helpviewer_qwv.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer_qwv.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpviewer_qwv.cpp	(revision 846)
@@ -0,0 +1,427 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "helpviewer_qwv.h"
+
+#include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "tracer.h"
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QString>
+#include <QtCore/QStringBuilder>
+#include <QtCore/QTimer>
+
+#include <QtGui/QWheelEvent>
+
+#include <QtNetwork/QNetworkAccessManager>
+#include <QtNetwork/QNetworkReply>
+#include <QtNetwork/QNetworkRequest>
+
+QT_BEGIN_NAMESPACE
+
+class HelpNetworkReply : public QNetworkReply
+{
+public:
+    HelpNetworkReply(const QNetworkRequest &request, const QByteArray &fileData,
+        const QString &mimeType);
+
+    virtual void abort();
+
+    virtual qint64 bytesAvailable() const
+        { return data.length() + QNetworkReply::bytesAvailable(); }
+
+protected:
+    virtual qint64 readData(char *data, qint64 maxlen);
+
+private:
+    QByteArray data;
+    qint64 origLen;
+};
+
+HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
+        const QByteArray &fileData, const QString& mimeType)
+    : data(fileData), origLen(fileData.length())
+{
+    TRACE_OBJ
+    setRequest(request);
+    setOpenMode(QIODevice::ReadOnly);
+
+    setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
+    setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
+    QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
+    QTimer::singleShot(0, this, SIGNAL(readyRead()));
+}
+
+void HelpNetworkReply::abort()
+{
+    TRACE_OBJ
+}
+
+qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
+{
+    TRACE_OBJ
+    qint64 len = qMin(qint64(data.length()), maxlen);
+    if (len) {
+        memcpy(buffer, data.constData(), len);
+        data.remove(0, len);
+    }
+    if (!data.length())
+        QTimer::singleShot(0, this, SIGNAL(finished()));
+    return len;
+}
+
+class HelpNetworkAccessManager : public QNetworkAccessManager
+{
+public:
+    HelpNetworkAccessManager(QObject *parent);
+
+protected:
+    virtual QNetworkReply *createRequest(Operation op,
+        const QNetworkRequest &request, QIODevice *outgoingData = 0);
+};
+
+HelpNetworkAccessManager::HelpNetworkAccessManager(QObject *parent)
+    : QNetworkAccessManager(parent)
+{
+    TRACE_OBJ
+}
+
+QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
+    const QNetworkRequest &request, QIODevice* /*outgoingData*/)
+{
+    TRACE_OBJ
+    QString url = request.url().toString();
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+
+    // TODO: For some reason the url to load is already wrong (passed from webkit)
+    // though the css file and the references inside should work that way. One 
+    // possible problem might be that the css is loaded at the same level as the
+    // html, thus a path inside the css like (../images/foo.png) might cd out of
+    // the virtual folder
+    if (!helpEngine.findFile(url).isValid()) {
+        if (url.startsWith(AbstractHelpViewer::DocPath)) {
+            QUrl newUrl = request.url();
+            if (!newUrl.path().startsWith(QLatin1String("/qdoc/"))) {
+                newUrl.setPath(QLatin1String("qdoc") + newUrl.path());
+                url = newUrl.toString();
+            }
+        }
+    }
+
+    const QString &mimeType = AbstractHelpViewer::mimeFromUrl(url);
+    const QByteArray &data = helpEngine.findFile(url).isValid()
+        ? helpEngine.fileData(url)
+        : AbstractHelpViewer::PageNotFoundMessage.arg(url).toUtf8();
+    return new HelpNetworkReply(request, data, mimeType.isEmpty()
+        ? QLatin1String("application/octet-stream") : mimeType);
+}
+
+class HelpPage : public QWebPage
+{
+public:
+    HelpPage(CentralWidget *central, QObject *parent);
+
+protected:
+    virtual QWebPage *createWindow(QWebPage::WebWindowType);
+    virtual void triggerAction(WebAction action, bool checked = false);
+
+    virtual bool acceptNavigationRequest(QWebFrame *frame,
+        const QNetworkRequest &request, NavigationType type);
+
+private:
+    CentralWidget *centralWidget;
+    bool closeNewTabIfNeeded;
+
+    friend class HelpViewer;
+    QUrl m_loadingUrl;
+    Qt::MouseButtons m_pressedButtons;
+    Qt::KeyboardModifiers m_keyboardModifiers;
+};
+
+HelpPage::HelpPage(CentralWidget *central, QObject *parent)
+    : QWebPage(parent)
+    , centralWidget(central)
+    , closeNewTabIfNeeded(false)
+    , m_pressedButtons(Qt::NoButton)
+    , m_keyboardModifiers(Qt::NoModifier)
+{
+    TRACE_OBJ
+}
+
+QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
+{
+    TRACE_OBJ
+    HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page());
+    if (newPage)
+        newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
+    closeNewTabIfNeeded = false;
+    return newPage;
+}
+
+void HelpPage::triggerAction(WebAction action, bool checked)
+{
+    TRACE_OBJ
+    switch (action) {
+        case OpenLinkInNewWindow:
+            closeNewTabIfNeeded = true;
+        default:        // fall through
+            QWebPage::triggerAction(action, checked);
+            break;
+    }
+}
+
+bool HelpPage::acceptNavigationRequest(QWebFrame *,
+    const QNetworkRequest &request, QWebPage::NavigationType type)
+{
+    TRACE_OBJ
+    const bool closeNewTab = closeNewTabIfNeeded;
+    closeNewTabIfNeeded = false;
+
+    const QUrl &url = request.url();
+    if (AbstractHelpViewer::launchWithExternalApp(url)) {
+        if (closeNewTab)
+            QMetaObject::invokeMethod(centralWidget, "closeTab");
+        return false;
+    }
+
+    if (type == QWebPage::NavigationTypeLinkClicked
+        && (m_keyboardModifiers & Qt::ControlModifier
+        || m_pressedButtons == Qt::MidButton)) {
+            if (centralWidget->newEmptyTab())
+                centralWidget->setSource(url);
+            m_pressedButtons = Qt::NoButton;
+            m_keyboardModifiers = Qt::NoModifier;
+            return false;
+    }
+
+    m_loadingUrl = url; // because of async page loading, we will hit some kind
+    // of race condition while using a remote command, like a combination of
+    // SetSource; SyncContent. SetSource would be called and SyncContents shortly
+    // afterwards, but the page might not have finished loading and the old url
+    // would be returned.
+    return true;
+}
+
+// -- HelpViewer
+
+HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
+    : QWebView(parent)
+    , parentWidget(parent)
+    , loadFinished(false)
+    , helpEngine(HelpEngineWrapper::instance())
+{
+    TRACE_OBJ
+    setAcceptDrops(false);
+
+    setPage(new HelpPage(parent, this));
+
+    page()->setNetworkAccessManager(new HelpNetworkAccessManager(this));
+
+    QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
+    action->setText(tr("Open Link in New Tab"));
+    if (!parent)
+        action->setVisible(false);
+
+    pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
+    pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
+    pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);
+
+    connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
+        SLOT(actionChanged()));
+    connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
+        SLOT(actionChanged()));
+    connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
+        SLOT(actionChanged()));
+    connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
+        SIGNAL(highlighted(QString)));
+    connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
+    connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
+    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
+    connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));
+
+    setFont(viewerFont());
+    setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
+}
+
+HelpViewer::~HelpViewer()
+{
+    TRACE_OBJ
+}
+
+QFont HelpViewer::viewerFont() const
+{
+    TRACE_OBJ
+    if (helpEngine.usesBrowserFont())
+        return helpEngine.browserFont();
+
+    QWebSettings *webSettings = QWebSettings::globalSettings();
+    return QFont(webSettings->fontFamily(QWebSettings::StandardFont),
+        webSettings->fontSize(QWebSettings::DefaultFontSize));
+}
+
+void HelpViewer::setViewerFont(const QFont &font)
+{
+    TRACE_OBJ
+    QWebSettings *webSettings = settings();
+    webSettings->setFontFamily(QWebSettings::StandardFont, font.family());
+    webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
+}
+
+void HelpViewer::scaleUp()
+{
+    TRACE_OBJ
+    setTextSizeMultiplier(textSizeMultiplier() + 0.1);
+}
+
+void HelpViewer::scaleDown()
+{
+    TRACE_OBJ
+    setTextSizeMultiplier(qMax(0.0, textSizeMultiplier() - 0.1));
+}
+
+void HelpViewer::resetScale()
+{
+    TRACE_OBJ
+    setTextSizeMultiplier(1.0);
+}
+
+bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e)
+{
+    TRACE_OBJ
+    if (e->button() == Qt::XButton1) {
+        triggerPageAction(QWebPage::Back);
+        return true;
+    }
+
+    if (e->button() == Qt::XButton2) {
+        triggerPageAction(QWebPage::Forward);
+        return true;
+    }
+
+    return false;
+}
+
+QUrl HelpViewer::source() const
+{
+    HelpPage *currentPage = static_cast<HelpPage*> (page());
+    if (currentPage && !hasLoadFinished()) {
+        // see HelpPage::acceptNavigationRequest(...)
+        return currentPage->m_loadingUrl;
+    }
+    return url();
+}
+
+void HelpViewer::setSource(const QUrl &url)
+{
+    TRACE_OBJ
+    load(url.toString() == QLatin1String("help") ? LocalHelpFile : url);
+}
+
+void HelpViewer::home()
+{
+    TRACE_OBJ
+    setSource(helpEngine.homePage());
+}
+
+void HelpViewer::wheelEvent(QWheelEvent *e)
+{
+    TRACE_OBJ
+    if (e->modifiers()& Qt::ControlModifier) {
+        e->accept();
+        e->delta() > 0 ? scaleUp() : scaleDown();
+    } else {
+        QWebView::wheelEvent(e);
+    }
+}
+
+void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
+{
+    TRACE_OBJ
+#ifndef Q_OS_LINUX
+    if (handleForwardBackwardMouseButtons(e))
+        return;
+#endif
+
+    QWebView::mouseReleaseEvent(e);
+}
+
+void HelpViewer::actionChanged()
+{
+    TRACE_OBJ
+    QAction *a = qobject_cast<QAction *>(sender());
+    if (a == pageAction(QWebPage::Copy))
+        emit copyAvailable(a->isEnabled());
+    else if (a == pageAction(QWebPage::Back))
+        emit backwardAvailable(a->isEnabled());
+    else if (a == pageAction(QWebPage::Forward))
+        emit forwardAvailable(a->isEnabled());
+}
+
+void HelpViewer::mousePressEvent(QMouseEvent *event)
+{
+    TRACE_OBJ
+#ifdef Q_OS_LINUX
+    if (handleForwardBackwardMouseButtons(event))
+        return;
+#endif
+
+    HelpPage *currentPage = static_cast<HelpPage*>(page());
+    if (currentPage) {
+        currentPage->m_pressedButtons = event->buttons();
+        currentPage->m_keyboardModifiers = event->modifiers();
+    }
+    QWebView::mousePressEvent(event);
+}
+
+void HelpViewer::setLoadStarted()
+{
+    loadFinished = false;
+}
+
+void HelpViewer::setLoadFinished(bool ok)
+{
+    TRACE_OBJ
+    loadFinished = ok;
+    emit sourceChanged(url());
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/helpviewer_qwv.h
===================================================================
--- trunk/tools/assistant/tools/assistant/helpviewer_qwv.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/helpviewer_qwv.h	(revision 846)
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HELPVIEWERQWV_H
+#define HELPVIEWERQWV_H
+
+#include "helpviewer.h"
+
+#include <QtGui/QAction>
+#include <QtWebKit/QWebView>
+
+QT_BEGIN_NAMESPACE
+
+class CentralWidget;
+class HelpEngineWrapper;
+class QMouseEvent;
+
+class HelpViewer : public QWebView, public AbstractHelpViewer
+{
+    Q_OBJECT
+
+public:
+    explicit HelpViewer(CentralWidget *parent, qreal zoom = 0.0);
+    ~HelpViewer();
+
+    QFont viewerFont() const;
+    void setViewerFont(const QFont &font);
+
+    void scaleUp();
+    void scaleDown();
+    void resetScale();
+    qreal scale() const { return textSizeMultiplier(); }
+
+    bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+
+    QUrl source() const;
+    void setSource(const QUrl &url);
+
+    inline QString documentTitle() const
+    { return title(); }
+
+    inline bool hasSelection() const
+    { return !selectedText().isEmpty(); } // ### this is suboptimal
+
+    inline void copy()
+    { return triggerPageAction(QWebPage::Copy); }
+
+    inline bool isForwardAvailable() const
+    { return pageAction(QWebPage::Forward)->isEnabled(); }
+    inline bool isBackwardAvailable() const
+    { return pageAction(QWebPage::Back)->isEnabled(); }
+    inline bool hasLoadFinished() const
+    { return loadFinished; }
+
+public Q_SLOTS:
+    void home();
+    void backward() { back(); }
+
+Q_SIGNALS:
+    void copyAvailable(bool enabled);
+    void forwardAvailable(bool enabled);
+    void backwardAvailable(bool enabled);
+    void highlighted(const QString &);
+    void sourceChanged(const QUrl &);
+    void printRequested();
+
+protected:
+    virtual void wheelEvent(QWheelEvent *);
+    void mouseReleaseEvent(QMouseEvent *e);
+    void mousePressEvent(QMouseEvent *event);
+
+private Q_SLOTS:
+    void actionChanged();
+    void setLoadStarted();
+    void setLoadFinished(bool ok);
+
+private:
+    CentralWidget* parentWidget;
+    bool loadFinished;
+    HelpEngineWrapper &helpEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif  // HELPVIEWERQWV_H
Index: trunk/tools/assistant/tools/assistant/indexwindow.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/indexwindow.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/indexwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,7 +39,10 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "indexwindow.h"
 #include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "helpviewer.h"
 #include "topicchooser.h"
 
@@ -52,20 +55,18 @@
 #include <QtGui/QListWidgetItem>
 
-#include <QtHelp/QHelpEngine>
 #include <QtHelp/QHelpIndexWidget>
 
 QT_BEGIN_NAMESPACE
 
-IndexWindow::IndexWindow(QHelpEngine *helpEngine, QWidget *parent)
+IndexWindow::IndexWindow(QWidget *parent)
     : QWidget(parent)
-    , m_searchLineEdit(0)
-    , m_indexWidget(0)
-    , m_helpEngine(helpEngine)
-{
+    , m_searchLineEdit(new QLineEdit)
+    , m_indexWidget(HelpEngineWrapper::instance().indexWidget())
+{
+    TRACE_OBJ
     QVBoxLayout *layout = new QVBoxLayout(this);
     QLabel *l = new QLabel(tr("&Look for:"));
     layout->addWidget(l);
 
-    m_searchLineEdit = new QLineEdit();
     l->setBuddy(m_searchLineEdit);
     connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this,
@@ -75,9 +76,9 @@
     layout->addWidget(m_searchLineEdit);
 
-    m_indexWidget = m_helpEngine->indexWidget();
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
     m_indexWidget->installEventFilter(this);
-    connect(m_helpEngine->indexModel(), SIGNAL(indexCreationStarted()), this,
+    connect(helpEngine.indexModel(), SIGNAL(indexCreationStarted()), this,
         SLOT(disableSearchLineEdit()));
-    connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), this,
+    connect(helpEngine.indexModel(), SIGNAL(indexCreated()), this,
         SLOT(enableSearchLineEdit()));
     connect(m_indexWidget, SIGNAL(linkActivated(QUrl,QString)), this,
@@ -94,8 +95,10 @@
 IndexWindow::~IndexWindow()
 {
+    TRACE_OBJ
 }
 
 void IndexWindow::filterIndices(const QString &filter)
 {
+    TRACE_OBJ
     if (filter.contains(QLatin1Char('*')))
         m_indexWidget->filterIndices(filter, filter);
@@ -106,4 +109,5 @@
 bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
 {
+    TRACE_OBJ
     if (obj == m_searchLineEdit && e->type() == QEvent::KeyPress) {
         QKeyEvent *ke = static_cast<QKeyEvent*>(e);
@@ -171,4 +175,5 @@
 void IndexWindow::enableSearchLineEdit()
 {
+    TRACE_OBJ
     m_searchLineEdit->setDisabled(false);
     filterIndices(m_searchLineEdit->text());
@@ -177,4 +182,5 @@
 void IndexWindow::disableSearchLineEdit()
 {
+    TRACE_OBJ
     m_searchLineEdit->setDisabled(true);
 }
@@ -182,4 +188,5 @@
 void IndexWindow::setSearchLineEditText(const QString &text)
 {
+    TRACE_OBJ
     m_searchLineEdit->setText(text);
 }
@@ -187,4 +194,5 @@
 void IndexWindow::focusInEvent(QFocusEvent *e)
 {
+    TRACE_OBJ
     if (e->reason() != Qt::MouseFocusReason) {
         m_searchLineEdit->selectAll();
@@ -195,4 +203,5 @@
 void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
 {
+    TRACE_OBJ
     QHelpIndexModel *model = qobject_cast<QHelpIndexModel*>(indexWidget->model());
     if (model) {
@@ -211,5 +220,5 @@
         }
 
-        if (url.path().endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive))
+        if (!AbstractHelpViewer::canOpenPage(url.path()))
             CentralWidget::instance()->setSource(url);
         else
Index: trunk/tools/assistant/tools/assistant/indexwindow.h
===================================================================
--- trunk/tools/assistant/tools/assistant/indexwindow.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/indexwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -50,5 +50,4 @@
 
 class QHelpIndexWidget;
-class QHelpEngine;
 class QModelIndex;
 
@@ -58,5 +57,5 @@
 
 public:
-    IndexWindow(QHelpEngine *helpEngine, QWidget *parent = 0);
+    IndexWindow(QWidget *parent = 0);
     ~IndexWindow();
 
@@ -85,5 +84,4 @@
     QLineEdit *m_searchLineEdit;
     QHelpIndexWidget *m_indexWidget;
-    QHelpEngine *m_helpEngine;
 };
 
Index: trunk/tools/assistant/tools/assistant/installdialog.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/installdialog.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/installdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,4 +39,5 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "installdialog.h"
@@ -67,4 +68,5 @@
     : QDialog(parent), m_helpEngine(helpEngine), m_host(host), m_port(port)
 {
+    TRACE_OBJ
     m_ui.setupUi(this);
     
@@ -95,8 +97,10 @@
 InstallDialog::~InstallDialog()
 {
+    TRACE_OBJ
 }
 
 QStringList InstallDialog::installedDocumentations() const
 {
+    TRACE_OBJ
     return m_installedDocumentations;
 }
@@ -104,4 +108,5 @@
 void InstallDialog::init()
 {
+    TRACE_OBJ
     m_ui.statusLabel->setText(tr("Downloading documentation info..."));
     m_ui.progressBar->show();
@@ -123,4 +128,5 @@
 void InstallDialog::updateInstallButton()
 {
+    TRACE_OBJ
     QListWidgetItem *item = 0;
     for (int i=0; i<m_ui.listWidget->count(); ++i) {
@@ -137,4 +143,5 @@
 void InstallDialog::updateDocItemList()
 {
+    TRACE_OBJ
     QStringList registeredDocs = m_helpEngine->registeredDocumentations();
     QListWidgetItem *item = 0;
@@ -152,4 +159,5 @@
 void InstallDialog::cancelDownload()
 {
+    TRACE_OBJ
     m_ui.statusLabel->setText(tr("Download canceled."));
     m_httpAborted = true;
@@ -163,4 +171,5 @@
 void InstallDialog::install()
 {
+    TRACE_OBJ
     QListWidgetItem *item = 0;
     for (int i=0; i<m_ui.listWidget->count(); ++i) {
@@ -175,4 +184,5 @@
 void InstallDialog::downloadNextFile()
 {
+    TRACE_OBJ
     if (!m_itemsToInstall.count()) {
         m_ui.cancelButton->setEnabled(false);
@@ -227,4 +237,5 @@
 void InstallDialog::httpRequestFinished(int requestId, bool error)
 {
+    TRACE_OBJ
     if (requestId == m_docInfoId  && m_buffer) {        
         m_ui.progressBar->hide();
@@ -297,4 +308,5 @@
 void InstallDialog::installFile(const QString &fileName)
 {
+    TRACE_OBJ
     if (m_helpEngine->registerDocumentation(fileName)) {
         m_installedDocumentations
@@ -309,4 +321,5 @@
 void InstallDialog::readResponseHeader(const QHttpResponseHeader &responseHeader)
 {
+    TRACE_OBJ
     if (responseHeader.statusCode() != 200) {
         QMessageBox::information(this, m_windowTitle,
@@ -322,4 +335,5 @@
 void InstallDialog::updateDataReadProgress(int bytesRead, int totalBytes)
 {
+    TRACE_OBJ
     if (m_httpAborted)
         return;
@@ -331,4 +345,5 @@
 void InstallDialog::browseDirectories()
 {
+    TRACE_OBJ
     QString dir = QFileDialog::getExistingDirectory(this, m_windowTitle,
         m_ui.pathLineEdit->text());
Index: trunk/tools/assistant/tools/assistant/installdialog.h
===================================================================
--- trunk/tools/assistant/tools/assistant/installdialog.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/installdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -62,5 +62,5 @@
 
 public:
-    InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0,
+    explicit InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0,
         const QString &host = QString(), int port = -1);
     ~InstallDialog();
Index: trunk/tools/assistant/tools/assistant/main.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/main.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,17 +39,20 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include <QtCore/QDir>
 #include <QtCore/QFileInfo>
+#include <QtCore/QLibraryInfo>
 #include <QtCore/QLocale>
+#include <QtCore/QScopedPointer>
+#include <QtCore/QStringList>
 #include <QtCore/QTranslator>
-#include <QtCore/QLibraryInfo>
 #include <QtCore/QUrl>
-#include <QtCore/QStringList>
 
 #include <QtGui/QApplication>
 #include <QtGui/QDesktopServices>
 
-#include <QtHelp/QHelpEngineCore>
+#include <QtHelp/QHelpEngine>
+#include <QtHelp/QHelpSearchEngine>
 
 #include <QtNetwork/QLocalSocket>
@@ -57,6 +60,10 @@
 #include <QtSql/QSqlDatabase>
 
+#include "../shared/collectionconfiguration.h"
+#include "helpenginewrapper.h"
 #include "mainwindow.h"
 #include "cmdlineparser.h"
+
+// #define TRACING_REQUESTED
 
 QT_USE_NAMESPACE
@@ -67,34 +74,20 @@
 #endif
 
+namespace {
+
 void
 updateLastPagesOnUnregister(QHelpEngineCore& helpEngine, const QString& nsName)
 {
-    int lastPage = helpEngine.customValue(QLatin1String("LastTabPage")).toInt();
-
-    QLatin1String sep("|");
-    QLatin1String pages("LastShownPages");
-#if !defined(QT_NO_WEBKIT)
-    QLatin1String zoom("LastPagesZoomWebView");
-#else
-    QLatin1String zoom("LastPagesZoomTextBrowser");
-#endif
-
-    QStringList currentPages =
-        helpEngine.customValue(pages).toString().
-        split(QLatin1Char('|'), QString::SkipEmptyParts);
-
+    TRACE_OBJ
+    int lastPage = CollectionConfiguration::lastTabPage(helpEngine);
+    QStringList currentPages = CollectionConfiguration::lastShownPages(helpEngine);
     if (!currentPages.isEmpty()) {
-        QVector<QString>zoomList = helpEngine.customValue(zoom).toString().
-            split(sep, QString::SkipEmptyParts).toVector();
-        if (zoomList.isEmpty())
-            zoomList.fill(QLatin1String("0.0"), currentPages.size());
-        else if(zoomList.count() < currentPages.count()) {
-            zoomList.insert(zoomList.count(),
-                currentPages.count() - zoomList.count(), QLatin1String("0.0"));
-        }
+        QStringList zoomList = CollectionConfiguration::lastZoomFactors(helpEngine);
+        while (zoomList.count() < currentPages.count())
+            zoomList.append(CollectionConfiguration::DefaultZoomFactor);
 
         for (int i = currentPages.count(); --i >= 0;) {
             if (QUrl(currentPages.at(i)).host() == nsName) {
-                zoomList.remove(i);
+                zoomList.removeAt(i);
                 currentPages.removeAt(i);
                 lastPage = (lastPage == (i + 1)) ? 1 : lastPage;
@@ -102,7 +95,7 @@
         }
 
-        helpEngine.setCustomValue(pages, currentPages.join(sep));
-        helpEngine.setCustomValue(QLatin1String("LastTabPage"), lastPage);
-        helpEngine.setCustomValue(zoom, QStringList(zoomList.toList()).join(sep));
+        CollectionConfiguration::setLastShownPages(helpEngine, currentPages);
+        CollectionConfiguration::setLastTabPage(helpEngine, lastPage);
+        CollectionConfiguration::setLastZoomFactors(helpEngine, zoomList);
     }
 }
@@ -111,72 +104,25 @@
 updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller)
 {
-    const uint callerCollectionCreationTime = caller.
-        customValue(QLatin1String("CreationTime"), 0).toUInt();
-    const uint userCollectionCreationTime = user.
-        customValue(QLatin1String("CreationTime"), 1).toUInt();
-
-    if (callerCollectionCreationTime <= userCollectionCreationTime)
+    TRACE_OBJ
+    if (!CollectionConfiguration::isNewer(caller, user))
         return false;
-
-    user.setCustomValue(QLatin1String("CreationTime"),
-        callerCollectionCreationTime);
-    user.setCustomValue(QLatin1String("WindowTitle"),
-        caller.customValue(QLatin1String("WindowTitle")));
-    user.setCustomValue(QLatin1String("LastShownPages"),
-        caller.customValue(QLatin1String("LastShownPages")));
-#if !defined(QT_NO_WEBKIT)
-    const QLatin1String zoomKey("LastPagesZoomWebView");
-#else
-    const QLatin1String zoomKey("LastPagesZoomTextBrowser");
-#endif
-    user.setCustomValue(zoomKey, caller.customValue(zoomKey));
-    user.setCustomValue(QLatin1String("CurrentFilter"),
-        caller.customValue(QLatin1String("CurrentFilter")));
-    user.setCustomValue(QLatin1String("CacheDirectory"),
-        caller.customValue(QLatin1String("CacheDirectory")));
-    user.setCustomValue(QLatin1String("EnableFilterFunctionality"),
-        caller.customValue(QLatin1String("EnableFilterFunctionality")));
-    user.setCustomValue(QLatin1String("HideFilterFunctionality"),
-        caller.customValue(QLatin1String("HideFilterFunctionality")));
-    user.setCustomValue(QLatin1String("EnableDocumentationManager"),
-        caller.customValue(QLatin1String("EnableDocumentationManager")));
-    user.setCustomValue(QLatin1String("EnableAddressBar"),
-        caller.customValue(QLatin1String("EnableAddressBar")));
-    user.setCustomValue(QLatin1String("HideAddressBar"),
-        caller.customValue(QLatin1String("HideAddressBar")));
-    user.setCustomValue(QLatin1String("ApplicationIcon"),
-        caller.customValue(QLatin1String("ApplicationIcon")));
-    user.setCustomValue(QLatin1String("AboutMenuTexts"),
-        caller.customValue(QLatin1String("AboutMenuTexts")));
-    user.setCustomValue(QLatin1String("AboutIcon"),
-        caller.customValue(QLatin1String("AboutIcon")));
-    user.setCustomValue(QLatin1String("AboutTexts"),
-        caller.customValue(QLatin1String("AboutTexts")));
-    user.setCustomValue(QLatin1String("AboutImages"),
-        caller.customValue(QLatin1String("AboutImages")));
-    user.setCustomValue(QLatin1String("defaultHomepage"),
-        caller.customValue(QLatin1String("defaultHomepage")));
-
+    CollectionConfiguration::copyConfiguration(caller, user);
     return true;
 }
 
-bool
-referencedHelpFilesExistAll(QHelpEngineCore& user, QStringList& nameSpaces)
-{
-    QFileInfo fi;
-    int counter = nameSpaces.count();
-    for (int i = counter; --i >= 0;) {
-        const QString& nameSpace = nameSpaces.at(i);
-        fi.setFile(user.documentationFileName(nameSpace));
-        if (!fi.exists() || !fi.isFile()) {
-            user.unregisterDocumentation(nameSpace);
-            nameSpaces.removeAll(nameSpace);
-        }
-    }
-    return (counter != nameSpaces.count()) ? false : true;
+void stripNonexistingDocs(QHelpEngineCore& collection)
+{
+    TRACE_OBJ
+    const QStringList &namespaces = collection.registeredDocumentations();
+    foreach (const QString &ns, namespaces) {
+        QFileInfo fi(collection.documentationFileName(ns));
+        if (!fi.exists() || !fi.isFile())
+            collection.unregisterDocumentation(ns);
+    }
 }
 
 QString indexFilesFolder(const QString &collectionFile)
 {
+    TRACE_OBJ
     QString indexFilesFolder = QLatin1String(".fulltextsearch");
     if (!collectionFile.isEmpty()) {
@@ -188,28 +134,192 @@
 }
 
-int main(int argc, char *argv[])
-{
-#ifndef Q_OS_WIN 
-    // First do a quick search for arguments that imply command-line mode.
+/*
+ * Returns the expected absolute file path of the cached collection file
+ * correspondinging to the given collection's file.
+ * It may or may not exist yet.
+ */
+QString constructCachedCollectionFilePath(const QHelpEngineCore &collection)
+{
+    TRACE_OBJ
+    const QString &filePath = collection.collectionFile();
+    const QString &fileName = QFileInfo(filePath).fileName();
+    const QString &cacheDir = CollectionConfiguration::cacheDir(collection);
+    const QString &dir = !cacheDir.isEmpty()
+        && CollectionConfiguration::cacheDirIsRelativeToCollection(collection)
+            ? QFileInfo(filePath).dir().absolutePath()
+                + QDir::separator() + cacheDir
+            : MainWindow::collectionFileDirectory(false, cacheDir);
+    return dir + QDir::separator() + fileName;
+}
+
+bool synchronizeDocs(QHelpEngineCore &collection,
+                     QHelpEngineCore &cachedCollection,
+                     CmdLineParser &cmd)
+{
+    TRACE_OBJ
+    const QDateTime &lastCollectionRegisterTime =
+        CollectionConfiguration::lastRegisterTime(collection);
+    if (!lastCollectionRegisterTime.isValid() || lastCollectionRegisterTime
+        < CollectionConfiguration::lastRegisterTime(cachedCollection))
+        return true;
+
+    const QStringList &docs = collection.registeredDocumentations();
+    const QStringList &cachedDocs = cachedCollection.registeredDocumentations();
+
+    /*
+     * Ensure that the cached collection contains all docs that
+     * the collection contains.
+     */
+    foreach (const QString &doc, docs) {
+        if (!cachedDocs.contains(doc)) {
+            const QString &docFile = collection.documentationFileName(doc);
+            if (!cachedCollection.registerDocumentation(docFile)) {
+                cmd.showMessage(QCoreApplication::translate("Assistant",
+                                    "Error registering documentation file '%1': %2").
+                                arg(docFile).arg(cachedCollection.error()), true);
+                return false;
+            }
+        }
+    }
+
+    CollectionConfiguration::updateLastRegisterTime(cachedCollection);
+
+    return true;
+}
+
+bool removeSearchIndex(const QString &collectionFile)
+{
+    TRACE_OBJ
+    QString path = QFileInfo(collectionFile).path();
+    path += QLatin1Char('/') + indexFilesFolder(collectionFile);
+
+    QLocalSocket localSocket;
+    localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
+                                .arg(QLatin1String(QT_VERSION_STR)));
+
+    QDir dir(path); // check if there is no other instance ruinning
+    if (!dir.exists() || localSocket.waitForConnected())
+        return false;
+
+    QStringList lst = dir.entryList(QDir::Files | QDir::Hidden);
+    foreach (const QString &item, lst)
+        dir.remove(item);
+    return true;
+}
+
+bool rebuildSearchIndex(QCoreApplication &app, const QString &collectionFile,
+                        CmdLineParser &cmd)
+{
+    TRACE_OBJ
+    QHelpEngine engine(collectionFile);
+    if (!engine.setupData()) {
+        cmd.showMessage(QCoreApplication::translate("Assistant", "Error: %1")
+                        .arg(engine.error()), true);
+        return false;
+    }
+
+    QHelpSearchEngine * const searchEngine = engine.searchEngine();
+    QObject::connect(searchEngine, SIGNAL(indexingFinished()), &app,
+                     SLOT(quit()));
+    searchEngine->reindexDocumentation();
+    return app.exec() == 0;
+}
+
+bool useGui(int argc, char *argv[])
+{
+    TRACE_OBJ
+    bool gui = true;
+#ifndef Q_OS_WIN
+    // Look for arguments that imply command-line mode.
     const char * cmdModeArgs[] = {
-        "-help", "-register", "-unregister", "-remove-search-index"
+        "-help", "-register", "-unregister", "-remove-search-index",
+        "-rebuild-search-index"
     };
-    bool useGui = true;
     for (int i = 1; i < argc; ++i) {
         for (size_t j = 0; j < sizeof cmdModeArgs/sizeof *cmdModeArgs; ++j) {
             if(strcmp(argv[i], cmdModeArgs[j]) == 0) {
-                useGui = false;
+                gui = false;
                 break;
             }
         }
     }
-    QApplication a(argc, argv, useGui);
 #else
-    QApplication a(argc, argv);
+    Q_UNUSED(argc)
+    Q_UNUSED(argv)
 #endif
+    return gui;
+}
+
+bool registerDocumentation(QHelpEngineCore &collection, CmdLineParser &cmd,
+                           bool printSuccess)
+{
+    TRACE_OBJ
+    if (!collection.registerDocumentation(cmd.helpFile())) {
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                     "Could not register documentation file\n%1\n\nReason:\n%2")
+                     .arg(cmd.helpFile()).arg(collection.error()), true);
+        return false;
+    }
+    if (printSuccess)
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                            "Documentation successfully registered."),
+                        false);
+    CollectionConfiguration::updateLastRegisterTime(collection);
+    return true;
+}
+
+bool unregisterDocumentation(QHelpEngineCore &collection,
+    const QString &namespaceName, CmdLineParser &cmd, bool printSuccess)
+{
+    TRACE_OBJ
+    if (!collection.unregisterDocumentation(namespaceName)) {
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                             "Could not unregister documentation"
+                             " file\n%1\n\nReason:\n%2").
+                        arg(cmd.helpFile()).arg(collection.error()), true);
+        return false;
+    }
+    updateLastPagesOnUnregister(collection, namespaceName);
+    if (printSuccess)
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                            "Documentation successfully unregistered."),
+                        false);
+    return true;
+}
+
+void setupTranslation(const QString &fileName, const QString &dir)
+{
+    QTranslator *translator = new QTranslator(QCoreApplication::instance());
+    if (translator->load(fileName, dir)) {
+        QCoreApplication::installTranslator(translator);
+    } else if (!fileName.endsWith(QLatin1String("en_US"))) {
+        qWarning("Could not load translation file %s in directory %s.",
+                 qPrintable(fileName), qPrintable(dir));
+    }
+}
+
+void setupTranslations()
+{
+    TRACE_OBJ
+    const QString& locale = QLocale::system().name();
+    const QString &resourceDir
+        = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    setupTranslation(QLatin1String("assistant_") + locale, resourceDir);
+    setupTranslation(QLatin1String("qt_") + locale, resourceDir);
+    setupTranslation(QLatin1String("qt_help_") + locale, resourceDir);
+}
+
+} // Anonymous namespace.
+
+int main(int argc, char *argv[])
+{
+    TRACE_OBJ
+    QApplication a(argc, argv, useGui(argc, argv));
     a.addLibraryPath(a.applicationDirPath() + QLatin1String("/plugins"));
-
-    CmdLineParser cmd;
-    CmdLineParser::Result res = cmd.parse(a.arguments());
+    setupTranslations();
+
+    // Parse arguments.
+    CmdLineParser cmd(a.arguments());
+    CmdLineParser::Result res = cmd.parse();
     if (res == CmdLineParser::Help)
         return 0;
@@ -217,162 +327,113 @@
         return -1;
 
-    QString cmdCollectionFile = cmd.collectionFile();
+    /*
+     * Create the collection objects that we need. We always have the
+     * cached collection file. Depending on whether the user specified
+     * one, we also may have an input collection file.
+     */
+    const QString collectionFile = cmd.collectionFile();
+    const bool collectionFileGiven = !collectionFile.isEmpty();
+    QScopedPointer<QHelpEngineCore> collection;
+    if (collectionFileGiven) {
+        collection.reset(new QHelpEngineCore(collectionFile));
+        if (!collection->setupData()) {
+            cmd.showMessage(QCoreApplication::translate("Assistant",
+                                "Error reading collection file '%1': %2.").
+                arg(collectionFile).arg(collection->error()), true);
+            return EXIT_FAILURE;
+        }
+    }
+    const QString &cachedCollectionFile = collectionFileGiven
+        ? constructCachedCollectionFilePath(*collection)
+        : MainWindow::defaultHelpCollectionFileName();
+    if (collectionFileGiven && !QFileInfo(cachedCollectionFile).exists()
+        && !collection->copyCollectionFile(cachedCollectionFile)) {
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                            "Error creating collection file '%1': %2.").
+                arg(cachedCollectionFile).arg(collection->error()), true);
+        return EXIT_FAILURE;
+    }
+    QHelpEngineCore cachedCollection(cachedCollectionFile);
+    if (!cachedCollection.setupData()) {
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                            "Error reading collection file '%1': %2.").
+                        arg(cachedCollectionFile).
+                        arg(cachedCollection.error()), true);
+        return EXIT_FAILURE;
+    }
+
+    stripNonexistingDocs(cachedCollection);
+    if (collectionFileGiven) {
+        if (CollectionConfiguration::isNewer(*collection, cachedCollection))
+            CollectionConfiguration::copyConfiguration(*collection,
+                                                       cachedCollection);
+        if (!synchronizeDocs(*collection, cachedCollection, cmd))
+            return EXIT_FAILURE;
+    }
+
     if (cmd.registerRequest() != CmdLineParser::None) {
-        if (cmdCollectionFile.isEmpty())
-            cmdCollectionFile = MainWindow::defaultHelpCollectionFileName();
-        QHelpEngineCore help(cmdCollectionFile);
-        help.setupData();
+        const QStringList &cachedDocs =
+            cachedCollection.registeredDocumentations();
+        const QString &namespaceName =
+            QHelpEngineCore::namespaceName(cmd.helpFile());
         if (cmd.registerRequest() == CmdLineParser::Register) {
-            if (!help.registerDocumentation(cmd.helpFile())) {
-                cmd.showMessage(
-                    QObject::tr("Could not register documentation file\n%1\n\nReason:\n%2")
-                    .arg(cmd.helpFile()).arg(help.error()), true);
-                return -1;
-            } else {
-                cmd.showMessage(QObject::tr("Documentation successfully registered."),
-                    false);
-            }
-        } else {
-            QString nsName = QHelpEngineCore::namespaceName(cmd.helpFile());
-            if (help.unregisterDocumentation(nsName)) {
-                updateLastPagesOnUnregister(help, nsName);
-                cmd.showMessage(
-                    QObject::tr("Documentation successfully unregistered."),
-                    false);
-            } else {
-                cmd.showMessage(QObject::tr("Could not unregister documentation"
-                    " file\n%1\n\nReason:\n%2").arg(cmd.helpFile()).
-                    arg(help.error()), true);
-                return -1;
-            }
-        }
-        help.setCustomValue(QLatin1String("DocUpdate"), true);
-        return 0;
+            if (collectionFileGiven
+                && !registerDocumentation(*collection, cmd, true))
+                return EXIT_FAILURE;
+            if (!cachedDocs.contains(namespaceName)
+                && !registerDocumentation(cachedCollection, cmd, !collectionFileGiven))
+                return EXIT_FAILURE;
+            return EXIT_SUCCESS;
+        }
+        if (cmd.registerRequest() == CmdLineParser::Unregister) {
+            if (collectionFileGiven
+                && !unregisterDocumentation(*collection, namespaceName, cmd, true))
+                return EXIT_FAILURE;
+            if (cachedDocs.contains(namespaceName)
+                && !unregisterDocumentation(cachedCollection, namespaceName,
+                                            cmd, !collectionFileGiven))
+                return EXIT_FAILURE;
+            return EXIT_SUCCESS;
+        }
     }
 
     if (cmd.removeSearchIndex()) {
-        QString file = cmdCollectionFile;
-        if (file.isEmpty())
-            file = MainWindow::defaultHelpCollectionFileName();
-        QString path = QFileInfo(file).path();
-        path += QLatin1Char('/') + indexFilesFolder(file);
-
-        QLocalSocket localSocket;
-        localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
-            .arg(QLatin1String(QT_VERSION_STR)));
-
-        QDir dir(path); // check if there is no other instance ruinning
-        if (!localSocket.waitForConnected() && dir.exists()) {
-            QStringList lst = dir.entryList(QDir::Files | QDir::Hidden);
-            foreach (const QString &item, lst)
-                dir.remove(item);
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-
-    {
-        QSqlDatabase db;
-        QStringList sqlDrivers(db.drivers());
-        if (sqlDrivers.isEmpty()
-            || !sqlDrivers.contains(QLatin1String("QSQLITE"))) {
-            cmd.showMessage(QObject::tr("Cannot load sqlite database driver!"),
-                true);
-            return -1;
-        }
-    }
-
-    if (!cmdCollectionFile.isEmpty()) {
-        QHelpEngineCore caller(cmdCollectionFile);
-        if (!caller.setupData()) {
-            cmd.showMessage(QObject::tr("The specified collection file could "
-                "not be read!"), true);
-            return -1;
-        }
-
-        QString fileName = QFileInfo(cmdCollectionFile).fileName();
-        QString dir = MainWindow::collectionFileDirectory(false,
-            caller.customValue(QLatin1String("CacheDirectory"),
-            QString()).toString());
-
-        bool collectionFileExists = true;
-        QFileInfo fi(dir + QDir::separator() + fileName);
-        if (!fi.exists()) {
-            collectionFileExists = false;
-            if (!caller.copyCollectionFile(fi.absoluteFilePath())) {
-                cmd.showMessage(caller.error(), true);
-                return -1;
-            }
-        }
-
-        if (collectionFileExists) {
-            QHelpEngineCore user(fi.absoluteFilePath());
-            if (user.setupData()) {
-                // some docs might have been un/registered
-                bool docUpdate = caller.
-                    customValue(QLatin1String("DocUpdate"), false).toBool();
-
-                // update in case the passed collection file changed
-                if (updateUserCollection(user, caller))
-                    docUpdate = true;
-
-                QStringList userDocs = user.registeredDocumentations();
-                // update user collection file, docs might have been (re)moved
-                if (!referencedHelpFilesExistAll(user, userDocs))
-                    docUpdate = true;
-
-                if (docUpdate) {
-                    QStringList callerDocs = caller.registeredDocumentations();
-                    foreach (const QString &doc, callerDocs) {
-                        if (!userDocs.contains(doc)) {
-                            user.registerDocumentation(
-                                caller.documentationFileName(doc));
-                        }
-                    }
-
-                    QLatin1String intern("com.trolltech.com.assistantinternal-");
-                    foreach (const QString &doc, userDocs) {
-                        if (!callerDocs.contains(doc) && !doc.startsWith(intern))
-                            user.unregisterDocumentation(doc);
-                    }
-
-                    caller.setCustomValue(QLatin1String("DocUpdate"), false);
-                }
-            }
-        }
-        cmd.setCollectionFile(fi.absoluteFilePath());
+        return removeSearchIndex(cachedCollectionFile)
+            ? EXIT_SUCCESS : EXIT_FAILURE;
+    }
+
+    if (cmd.rebuildSearchIndex()) {
+        return rebuildSearchIndex(a, cachedCollectionFile, cmd)
+            ? EXIT_SUCCESS : EXIT_FAILURE;
+    }
+
+    if (!QSqlDatabase::isDriverAvailable(QLatin1String("QSQLITE"))) {
+        cmd.showMessage(QCoreApplication::translate("Assistant",
+                            "Cannot load sqlite database driver!"),
+                        true);
+        return EXIT_FAILURE;
     }
 
     if (!cmd.currentFilter().isEmpty()) {
-        QString collectionFile;
-        if (cmdCollectionFile.isEmpty()) {
-            MainWindow::collectionFileDirectory(true);
-            cmdCollectionFile = MainWindow::defaultHelpCollectionFileName();
-        }
-
-        QHelpEngineCore user(cmdCollectionFile);
-        if (user.setupData())
-            user.setCurrentFilter(cmd.currentFilter());
-    }
-
-    const QString& locale = QLocale::system().name();
-    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
-
-    QTranslator translator(0);
-    translator.load(QLatin1String("assistant_") + locale, resourceDir);
-    a.installTranslator(&translator);
-
-    QTranslator qtTranslator(0);
-    qtTranslator.load(QLatin1String("qt_") + locale, resourceDir);
-    a.installTranslator(&qtTranslator);
-
-    QTranslator qtHelpTranslator(0);
-    qtHelpTranslator.load(QLatin1String("qt_help_") + locale, resourceDir);
-    a.installTranslator(&qtHelpTranslator);
-
-    MainWindow w(&cmd);
-    w.show();
+        if (collectionFileGiven)
+            collection->setCurrentFilter(cmd.currentFilter());
+        cachedCollection.setCurrentFilter(cmd.currentFilter());
+    }
+
+    if (collectionFileGiven)
+        cmd.setCollectionFile(cachedCollectionFile);
+
+    MainWindow *w = new MainWindow(&cmd);
+    w->show();
     a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
-    return a.exec();
-}
+
+    /*
+     * We need to be careful here: The main window has to be deleted before
+     * the help engine wrapper, which has to be deleted before the
+     * QApplication.
+     */
+    const int retval = a.exec();
+    delete w;
+    HelpEngineWrapper::removeInstance();
+    return retval;
+}
Index: trunk/tools/assistant/tools/assistant/mainwindow.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/mainwindow.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,13 +39,15 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "mainwindow.h"
+
+#include "bookmarkmanager.h"
 #include "centralwidget.h"
-#include "helpviewer.h"
 #include "indexwindow.h"
 #include "topicchooser.h"
 #include "contentwindow.h"
 #include "preferencesdialog.h"
-#include "bookmarkmanager.h"
+#include "helpenginewrapper.h"
 #include "remotecontrol.h"
 #include "cmdlineparser.h"
@@ -54,7 +56,12 @@
 #include "qtdocinstaller.h"
 
+// #define TRACING_REQUESTED
+
 #include <QtCore/QDir>
 #include <QtCore/QTimer>
+#include <QtCore/QDateTime>
 #include <QtCore/QDebug>
+#include <QtCore/QFileSystemWatcher>
+#include <QtCore/QPair>
 #include <QtCore/QResource>
 #include <QtCore/QByteArray>
@@ -77,6 +84,7 @@
 #include <QtGui/QDesktopServices>
 #include <QtGui/QToolButton>
-
-#include <QtHelp/QHelpEngine>
+#include <QtGui/QFileDialog>
+
+#include <QtHelp/QHelpEngineCore>
 #include <QtHelp/QHelpSearchEngine>
 #include <QtHelp/QHelpContentModel>
@@ -87,4 +95,5 @@
 MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
     : QMainWindow(parent)
+    , m_bookmarkWidget(0)
     , m_filterCombo(0)
     , m_toolBarMenu(0)
@@ -94,18 +103,22 @@
     , m_connectedInitSignals(false)
 {
+    TRACE_OBJ
+
     setToolButtonStyle(Qt::ToolButtonFollowStyle);
 
+    QString collectionFile;
     if (usesDefaultCollection()) {
         MainWindow::collectionFileDirectory(true);
-        m_helpEngine = new QHelpEngine(MainWindow::defaultHelpCollectionFileName(),
-            this);
+        collectionFile = MainWindow::defaultHelpCollectionFileName();
     } else {
-        m_helpEngine = new QHelpEngine(cmdLine->collectionFile(), this);
-    }
-
-    m_centralWidget = new CentralWidget(m_helpEngine, this);
+        collectionFile = cmdLine->collectionFile();
+    }
+    HelpEngineWrapper &helpEngineWrapper =
+        HelpEngineWrapper::instance(collectionFile);
+
+    m_centralWidget = new CentralWidget(this);
     setCentralWidget(m_centralWidget);
 
-    m_indexWindow = new IndexWindow(m_helpEngine);
+    m_indexWindow = new IndexWindow(this);
     QDockWidget *indexDock = new QDockWidget(tr("Index"), this);
     indexDock->setObjectName(QLatin1String("IndexWindow"));
@@ -113,5 +126,5 @@
     addDockWidget(Qt::LeftDockWidgetArea, indexDock);
 
-    m_contentWindow = new ContentWindow(m_helpEngine);
+    m_contentWindow = new ContentWindow;
     QDockWidget *contentDock = new QDockWidget(tr("Contents"), this);
     contentDock->setObjectName(QLatin1String("ContentWindow"));
@@ -119,10 +132,22 @@
     addDockWidget(Qt::LeftDockWidgetArea, contentDock);
 
-    QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
-    bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
-    bookmarkDock->setWidget(setupBookmarkWidget());
-    addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);
-
-    QHelpSearchEngine *searchEngine = m_helpEngine->searchEngine();
+    QDockWidget *bookmarkDock = 0;
+    if (BookmarkManager *manager = BookmarkManager::instance()) {
+        bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
+        bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
+        bookmarkDock->setWidget(m_bookmarkWidget = manager->bookmarkDockWidget());
+        addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);
+
+        connect(manager, SIGNAL(escapePressed()), this,
+            SLOT(activateCurrentCentralWidgetTab()));
+        connect(manager, SIGNAL(setSource(QUrl)), m_centralWidget,
+            SLOT(setSource(QUrl)));
+        connect(manager, SIGNAL(setSourceInNewTab(QUrl)), m_centralWidget,
+            SLOT(setSourceInNewTab(QUrl)));
+        connect(m_centralWidget, SIGNAL(addBookmark(QString, QString)), manager,
+            SLOT(addBookmark(QString, QString)));
+    }
+
+    QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine();
     connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
     connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));
@@ -137,20 +162,11 @@
     statusBar()->show();
 
-    if (initHelpDB()) {
+    if (initHelpDB(!cmdLine->collectionFileGiven())) {
         setupFilterToolbar();
         setupAddressToolbar();
 
-        m_bookmarkManager->setupBookmarkModels();
-        m_bookmarkMenu->addSeparator();
-        m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu);
-        connect(m_bookmarkMenu, SIGNAL(triggered(QAction*)), this,
-            SLOT(showBookmark(QAction*)));
-        connect(m_bookmarkManager, SIGNAL(bookmarksChanged()), this,
-            SLOT(updateBookmarkMenu()));
-
-        setWindowTitle(m_helpEngine->customValue(QLatin1String("WindowTitle"),
-            defWindowTitle).toString());
-        QByteArray iconArray = m_helpEngine->customValue(QLatin1String("ApplicationIcon"),
-            QByteArray()).toByteArray();
+        const QString windowTitle = helpEngineWrapper.windowTitle();
+        setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
+        QByteArray iconArray = helpEngineWrapper.applicationIcon();
         if (iconArray.size() > 0) {
             QPixmap pix;
@@ -166,27 +182,26 @@
         // on x11.
         show();
-        QByteArray ba(m_helpEngine->customValue(QLatin1String("MainWindow")).toByteArray());
+        QByteArray ba(helpEngineWrapper.mainWindow());
         if (!ba.isEmpty())
             restoreState(ba);
 
-        ba = m_helpEngine->customValue(QLatin1String("MainWindowGeometry")).toByteArray();
+        ba = helpEngineWrapper.mainWindowGeometry();
         if (!ba.isEmpty()) {
             restoreGeometry(ba);
         } else {
             tabifyDockWidget(contentDock, indexDock);
-            tabifyDockWidget(indexDock, bookmarkDock);
+            if (bookmarkDock)
+                tabifyDockWidget(indexDock, bookmarkDock);
             contentDock->raise();
             resize(QSize(800, 600));
         }
 
-        if (!m_helpEngine->customValue(QLatin1String("useAppFont")).isValid()) {
-            m_helpEngine->setCustomValue(QLatin1String("useAppFont"), false);
-            m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), false);
-            m_helpEngine->setCustomValue(QLatin1String("appFont"), qApp->font());
-            m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"),
-                QFontDatabase::Latin);
-            m_helpEngine->setCustomValue(QLatin1String("browserFont"), qApp->font());
-            m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"),
-                QFontDatabase::Latin);
+        if (!helpEngineWrapper.hasFontSettings()) {
+            helpEngineWrapper.setUseAppFont(false);
+            helpEngineWrapper.setUseBrowserFont(false);
+            helpEngineWrapper.setAppFont(qApp->font());
+            helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin);
+            helpEngineWrapper.setBrowserFont(qApp->font());
+            helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin);
         } else {
             updateApplicationFont();
@@ -197,5 +212,5 @@
         QTimer::singleShot(0, this, SLOT(insertLastPages()));
         if (m_cmdLine->enableRemoteControl())
-            (void)new RemoteControl(this, m_helpEngine);
+            (void)new RemoteControl(this);
 
         if (m_cmdLine->contents() == CmdLineParser::Show)
@@ -210,7 +225,7 @@
 
         if (m_cmdLine->bookmarks() == CmdLineParser::Show)
-            showBookmarks();
+            showBookmarksDockWidget();
         else if (m_cmdLine->bookmarks() == CmdLineParser::Hide)
-            hideBookmarks();
+            hideBookmarksDockWidget();
 
         if (m_cmdLine->search() == CmdLineParser::Show)
@@ -224,10 +239,10 @@
             showIndex();
         else if (m_cmdLine->bookmarks() == CmdLineParser::Activate)
-            showBookmarks();
+            showBookmarksDockWidget();
 
         if (!m_cmdLine->currentFilter().isEmpty()) {
             const QString &curFilter = m_cmdLine->currentFilter();
-            if (m_helpEngine->customFilters().contains(curFilter))
-                m_helpEngine->setCurrentFilter(curFilter);
+            if (helpEngineWrapper.customFilters().contains(curFilter))
+                helpEngineWrapper.setCurrentFilter(curFilter);
         }
 
@@ -236,4 +251,9 @@
         else
             checkInitState();
+
+        connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)),
+                this, SLOT(documentationRemoved(QString)));
+        connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)),
+                this, SLOT(documentationUpdated(QString)));
     }
     setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
@@ -242,4 +262,5 @@
 MainWindow::~MainWindow()
 {
+    TRACE_OBJ
     if (m_qtDocInstaller)
         delete m_qtDocInstaller;
@@ -248,4 +269,5 @@
 bool MainWindow::usesDefaultCollection() const
 {
+    TRACE_OBJ
     return m_cmdLine->collectionFile().isEmpty();
 }
@@ -253,20 +275,26 @@
 void MainWindow::closeEvent(QCloseEvent *e)
 {
-    m_bookmarkManager->saveBookmarks();
-    m_helpEngine->setCustomValue(QLatin1String("MainWindow"), saveState());
-    m_helpEngine->setCustomValue(QLatin1String("MainWindowGeometry"),
-        saveGeometry());
-
+    TRACE_OBJ
+    BookmarkManager::destroy();
+    HelpEngineWrapper::instance().setMainWindow(saveState());
+    HelpEngineWrapper::instance().setMainWindowGeometry(saveGeometry());
     QMainWindow::closeEvent(e);
 }
 
-bool MainWindow::initHelpDB()
-{
-    if (!m_helpEngine->setupData())
+bool MainWindow::initHelpDB(bool registerInternalDoc)
+{
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngineWrapper = HelpEngineWrapper::instance();
+    if (!helpEngineWrapper.setupData())
         return false;
 
+    if (!registerInternalDoc) {
+        if (helpEngineWrapper.defaultHomePage() == QLatin1String("help"))
+            helpEngineWrapper.setDefaultHomePage(QLatin1String("about:blank"));
+        return true;
+    }
     bool assistantInternalDocRegistered = false;
     QString intern(QLatin1String("com.trolltech.com.assistantinternal-"));
-    foreach (const QString &ns, m_helpEngine->registeredDocumentations()) {
+    foreach (const QString &ns, helpEngineWrapper.registeredDocumentations()) {
         if (ns.startsWith(intern)) {
             intern = ns;
@@ -276,6 +304,5 @@
     }
 
-    const QString &collectionFile = m_helpEngine->collectionFile();
-
+    const QString &collectionFile = helpEngineWrapper.collectionFile();
     QFileInfo fi(collectionFile);
     QString helpFile;
@@ -294,28 +321,11 @@
             file.close();
         }
-        QHelpEngineCore hc(fi.absoluteFilePath());
-        hc.setupData();
-        hc.unregisterDocumentation(intern);
-        hc.registerDocumentation(helpFile);
+        helpEngineWrapper.unregisterDocumentation(intern);
+        helpEngineWrapper.registerDocumentation(helpFile);
         needsSetup = true;
     }
 
-    const QLatin1String unfiltered("UnfilteredFilterInserted");
-    if (1 != m_helpEngine->customValue(unfiltered).toInt()) {
-        {
-            QHelpEngineCore hc(collectionFile);
-            hc.setupData();
-            hc.addCustomFilter(tr("Unfiltered"), QStringList());
-            hc.setCustomValue(unfiltered, 1);
-        }
-
-        m_helpEngine->blockSignals(true);
-        m_helpEngine->setCurrentFilter(tr("Unfiltered"));
-        m_helpEngine->blockSignals(false);
-        needsSetup = true;
-    }
-
     if (needsSetup)
-        m_helpEngine->setupData();
+        helpEngineWrapper.setupData();
     return true;
 }
@@ -323,26 +333,31 @@
 void MainWindow::lookForNewQtDocumentation()
 {
-    m_qtDocInstaller = new QtDocInstaller(m_helpEngine->collectionFile());
-    connect(m_qtDocInstaller, SIGNAL(errorMessage(QString)), this,
-        SLOT(displayInstallationError(QString)));
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    QStringList docs;
+    docs << QLatin1String("assistant")
+        << QLatin1String("designer")
+        << QLatin1String("linguist")
+        << QLatin1String("qmake")
+        << QLatin1String("qt");
+    QList<QtDocInstaller::DocInfo> qtDocInfos;
+    foreach (const QString &doc, docs)
+        qtDocInfos.append(QtDocInstaller::DocInfo(doc, helpEngine.qtDocInfo(doc)));
+
+    m_qtDocInstaller = new QtDocInstaller(qtDocInfos);
     connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), this,
-        SLOT(qtDocumentationInstalled(bool)));
-
-    QString versionKey = QString(QLatin1String("qtVersion%1$$$qt")).
-        arg(QLatin1String(QT_VERSION_STR));
-    if (m_helpEngine->customValue(versionKey, 0).toInt() != 1)
+        SLOT(qtDocumentationInstalled()));
+    connect(m_qtDocInstaller, SIGNAL(qchFileNotFound(QString)), this,
+            SLOT(resetQtDocInfo(QString)));
+    connect(m_qtDocInstaller, SIGNAL(registerDocumentation(QString, QString)),
+            this, SLOT(registerDocumentation(QString, QString)));
+    if (helpEngine.qtDocInfo(QLatin1String("qt")).count() != 2)
         statusBar()->showMessage(tr("Looking for Qt Documentation..."));
     m_qtDocInstaller->installDocs();
 }
 
-void MainWindow::displayInstallationError(const QString &errorMessage)
-{
-    QMessageBox::warning(this, tr("Qt Assistant"), errorMessage);
-}
-
-void MainWindow::qtDocumentationInstalled(bool newDocsInstalled)
-{
-    if (newDocsInstalled)
-        m_helpEngine->setupData();
+void MainWindow::qtDocumentationInstalled()
+{
+    TRACE_OBJ
     statusBar()->clearMessage();
     checkInitState();
@@ -351,13 +366,16 @@
 void MainWindow::checkInitState()
 {
+    TRACE_OBJ
+    HelpEngineWrapper::instance().initialDocSetupDone();
     if (!m_cmdLine->enableRemoteControl())
         return;
 
-    if (m_helpEngine->contentModel()->isCreatingContents()
-        || m_helpEngine->indexModel()->isCreatingIndex()) {
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    if (helpEngine.contentModel()->isCreatingContents()
+        || helpEngine.indexModel()->isCreatingIndex()) {
         if (!m_connectedInitSignals) {
-            connect(m_helpEngine->contentModel(), SIGNAL(contentsCreated()),
+            connect(helpEngine.contentModel(), SIGNAL(contentsCreated()),
                 this, SLOT(checkInitState()));
-            connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), this,
+            connect(helpEngine.indexModel(), SIGNAL(indexCreated()), this,
                 SLOT(checkInitState()));
             m_connectedInitSignals = true;
@@ -365,6 +383,6 @@
     } else {
         if (m_connectedInitSignals) {
-            disconnect(m_helpEngine->contentModel(), 0, this, 0);
-            disconnect(m_helpEngine->indexModel(), 0, this, 0);
+            disconnect(helpEngine.contentModel(), 0, this, 0);
+            disconnect(helpEngine.indexModel(), 0, this, 0);
         }
         emit initDone();
@@ -372,29 +390,7 @@
 }
 
-void MainWindow::updateBookmarkMenu()
-{
-    if (m_bookmarkManager) {
-        m_bookmarkMenu->removeAction(m_bookmarkMenuAction);
-        
-        m_bookmarkMenu->clear();
-        
-        m_bookmarkMenu->addAction(m_bookmarkMenuAction);
-        m_bookmarkMenu->addSeparator();
-        
-        m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu);
-    }
-}
-
-void MainWindow::showBookmark(QAction *action)
-{
-    if (m_bookmarkManager) {
-        const QUrl &url = m_bookmarkManager->urlForAction(action);
-        if (url.isValid())
-            m_centralWidget->setSource(url);
-    }
-}
-
 void MainWindow::insertLastPages()
 {
+    TRACE_OBJ
     if (m_cmdLine->url().isValid())
         m_centralWidget->setSource(m_cmdLine->url());
@@ -408,4 +404,5 @@
 void MainWindow::setupActions()
 {
+    TRACE_OBJ
     QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
 #ifdef Q_OS_MAC
@@ -418,4 +415,9 @@
     QMenu *menu = menuBar()->addMenu(tr("&File"));
 
+    m_newTabAction = menu->addAction(tr("New &Tab"), m_centralWidget, SLOT(newTab()));
+    m_newTabAction->setShortcut(QKeySequence::AddTab);
+
+    menu->addSeparator();
+
     m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget,
         SLOT(pageSetup()));
@@ -430,14 +432,16 @@
     menu->addSeparator();
 
-    m_newTabAction = menu->addAction(tr("New &Tab"), m_centralWidget, SLOT(newTab()));
-    m_newTabAction->setShortcut(QKeySequence::AddTab);
-
     m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget,
         SLOT(closeTab()));
     m_closeTabAction->setShortcuts(QKeySequence::Close);
 
-    QAction *tmp = menu->addAction(tr("&Quit"), this, SLOT(close()));
+    QAction *tmp = menu->addAction(QIcon::fromTheme("application-exit"),
+                                   tr("&Quit"), this, SLOT(close()));
+    tmp->setMenuRole(QAction::QuitRole);
+#ifdef Q_OS_WIN
+    tmp->setShortcut(QKeySequence(tr("CTRL+Q")));
+#else
     tmp->setShortcut(QKeySequence::Quit);
-    tmp->setMenuRole(QAction::QuitRole);
+#endif
 
     menu = menuBar()->addMenu(tr("&Edit"));
@@ -493,5 +497,5 @@
     m_viewMenu->addAction(tr("Index"), this, SLOT(showIndex()),
         QKeySequence(tr("ALT+I")));
-    m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarks()),
+    m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarksDockWidget()),
         QKeySequence(tr("ALT+O")));
     m_viewMenu->addAction(tr("Search"), this, SLOT(showSearchWidget()),
@@ -529,8 +533,6 @@
         << QKeySequence(Qt::CTRL + Qt::Key_PageUp));
 
-    m_bookmarkMenu = menuBar()->addMenu(tr("&Bookmarks"));
-    m_bookmarkMenuAction = m_bookmarkMenu->addAction(tr("Add Bookmark..."),
-        this, SLOT(addBookmark()));
-    m_bookmarkMenuAction->setShortcut(tr("CTRL+D"));
+    if (BookmarkManager *manager = BookmarkManager::instance())
+        manager->takeBookmarksMenu(menuBar()->addMenu(tr("&Bookmarks")));
 
     menu = menuBar()->addMenu(tr("&Help"));
@@ -539,4 +541,6 @@
 
 #ifdef Q_WS_X11
+    m_newTabAction->setIcon(QIcon::fromTheme("tab-new", m_newTabAction->icon()));
+    m_closeTabAction->setIcon(QIcon::fromTheme("window-close", m_closeTabAction->icon()));
     m_backAction->setIcon(QIcon::fromTheme("go-previous" , m_backAction->icon()));
     m_nextAction->setIcon(QIcon::fromTheme("go-next" , m_nextAction->icon()));
@@ -548,5 +552,8 @@
     m_findAction->setIcon(QIcon::fromTheme("edit-find" , m_findAction->icon()));
     m_homeAction->setIcon(QIcon::fromTheme("go-home" , m_homeAction->icon()));
+    m_pageSetupAction->setIcon(QIcon::fromTheme("document-page-setup", m_pageSetupAction->icon()));
+    m_printPreviewAction->setIcon(QIcon::fromTheme("document-print-preview", m_printPreviewAction->icon()));
     m_printAction->setIcon(QIcon::fromTheme("document-print" , m_printAction->icon()));
+    m_aboutAction->setIcon(QIcon::fromTheme("help-about", m_aboutAction->icon()));
 #endif
 
@@ -593,12 +600,4 @@
     connect(m_centralWidget, SIGNAL(highlighted(QString)), statusBar(),
         SLOT(showMessage(QString)));
-    connect(m_centralWidget, SIGNAL(addNewBookmark(QString,QString)), this,
-        SLOT(addNewBookmark(QString,QString)));
-
-    // bookmarks
-    connect(m_bookmarkWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget,
-        SLOT(setSource(QUrl)));
-    connect(m_bookmarkWidget, SIGNAL(escapePressed()), this,
-        SLOT(activateCurrentCentralWidgetTab()));
 
     // index window
@@ -625,4 +624,5 @@
 QMenu *MainWindow::toolBarMenu()
 {
+    TRACE_OBJ
     if (!m_toolBarMenu) {
         m_viewMenu->addSeparator();
@@ -634,6 +634,7 @@
 void MainWindow::setupFilterToolbar()
 {
-    if (!m_helpEngine->
-            customValue(QLatin1String("EnableFilterFunctionality"), true).toBool())
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    if (!helpEngine.filterFunctionalityEnabled())
         return;
 
@@ -648,14 +649,13 @@
     filterToolBar->addWidget(m_filterCombo);
 
-    const QLatin1String hideFilter("HideFilterFunctionality");
-    if (m_helpEngine->customValue(hideFilter, true).toBool())
+    if (!helpEngine.filterToolbarVisible())
         filterToolBar->hide();
     toolBarMenu()->addAction(filterToolBar->toggleViewAction());
 
-    connect(m_helpEngine, SIGNAL(setupFinished()), this,
-        SLOT(setupFilterCombo()));
+    connect(&helpEngine, SIGNAL(setupFinished()), this,
+        SLOT(setupFilterCombo()), Qt::QueuedConnection);
     connect(m_filterCombo, SIGNAL(activated(QString)), this,
         SLOT(filterDocumentation(QString)));
-    connect(m_helpEngine, SIGNAL(currentFilterChanged(QString)), this,
+    connect(&helpEngine, SIGNAL(currentFilterChanged(QString)), this,
         SLOT(currentFilterChanged(QString)));
 
@@ -665,5 +665,7 @@
 void MainWindow::setupAddressToolbar()
 {
-    if (!m_helpEngine->customValue(QLatin1String("EnableAddressBar"), true).toBool())
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    if (!helpEngine.addressBarEnabled())
         return;
 
@@ -677,5 +679,5 @@
     addressToolBar->addWidget(m_addressLineEdit);
 
-    if (m_helpEngine->customValue(QLatin1String("HideAddressBar"), true).toBool())
+    if (!helpEngine.addressBarVisible())
         addressToolBar->hide();
     toolBarMenu()->addAction(addressToolBar->toggleViewAction());
@@ -692,29 +694,27 @@
 void MainWindow::updateAboutMenuText()
 {
-    if (m_helpEngine) {
-        QByteArray ba = m_helpEngine->customValue(QLatin1String("AboutMenuTexts"),
-            QByteArray()).toByteArray();
-        if (ba.size() > 0) {
-            QString lang;
-            QString str;
-            QString trStr;
-            QString currentLang = QLocale::system().name();
-            int i = currentLang.indexOf(QLatin1Char('_'));
-            if (i > -1)
-                currentLang = currentLang.left(i);
-            QDataStream s(&ba, QIODevice::ReadOnly);
-            while (!s.atEnd()) {
-                s >> lang;
-                s >> str;
-                if (lang == QLatin1String("default") && trStr.isEmpty()) {
-                    trStr = str;
-                } else if (lang == currentLang) {
-                    trStr = str;
-                    break;
-                }
+    TRACE_OBJ
+    QByteArray ba = HelpEngineWrapper::instance().aboutMenuTexts();
+    if (ba.size() > 0) {
+        QString lang;
+        QString str;
+        QString trStr;
+        QString currentLang = QLocale::system().name();
+        int i = currentLang.indexOf(QLatin1Char('_'));
+        if (i > -1)
+            currentLang = currentLang.left(i);
+        QDataStream s(&ba, QIODevice::ReadOnly);
+        while (!s.atEnd()) {
+            s >> lang;
+            s >> str;
+            if (lang == QLatin1String("default") && trStr.isEmpty()) {
+                trStr = str;
+            } else if (lang == currentLang) {
+                trStr = str;
+                break;
             }
-            if (!trStr.isEmpty())
-                m_aboutAction->setText(trStr);
         }
+        if (!trStr.isEmpty())
+            m_aboutAction->setText(trStr);
     }
 }
@@ -722,4 +722,5 @@
 void MainWindow::showNewAddress()
 {
+    TRACE_OBJ
     showNewAddress(m_centralWidget->currentSource());
 }
@@ -727,15 +728,11 @@
 void MainWindow::showNewAddress(const QUrl &url)
 {
+    TRACE_OBJ
     m_addressLineEdit->setText(url.toString());
 }
 
-void MainWindow::addBookmark()
-{
-    addNewBookmark(m_centralWidget->currentTitle(),
-        m_centralWidget->currentSource().toString());
-}
-
 void MainWindow::gotoAddress()
 {
+    TRACE_OBJ
     m_centralWidget->setSource(m_addressLineEdit->text());
 }
@@ -743,4 +740,5 @@
 void MainWindow::updateNavigationItems()
 {
+    TRACE_OBJ
     bool hasCurrentViewer = m_centralWidget->isHomeAvailable();
     m_copyAction->setEnabled(m_centralWidget->hasSelection());
@@ -756,4 +754,5 @@
 void MainWindow::updateTabCloseAction()
 {
+    TRACE_OBJ
     m_closeTabAction->setEnabled(m_centralWidget->enableTabCloseAction());
 }
@@ -762,4 +761,5 @@
                                   const QString &keyword)
 {
+    TRACE_OBJ
     TopicChooser tc(this, keyword, links);
     if (tc.exec() == QDialog::Accepted) {
@@ -770,11 +770,10 @@
 void MainWindow::showPreferences()
 {
-    PreferencesDialog dia(m_helpEngine, this);
-
+    TRACE_OBJ
+    PreferencesDialog dia(this);
     connect(&dia, SIGNAL(updateApplicationFont()), this,
         SLOT(updateApplicationFont()));
     connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget,
         SLOT(updateBrowserFont()));
-
     dia.showDialog();
 }
@@ -782,4 +781,5 @@
 void MainWindow::syncContents()
 {
+    TRACE_OBJ
     qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
     const QUrl url = m_centralWidget->currentSource();
@@ -793,38 +793,30 @@
 void MainWindow::copyAvailable(bool yes)
 {
+    TRACE_OBJ
     m_copyAction->setEnabled(yes);
 }
 
-void MainWindow::addNewBookmark(const QString &title, const QString &url)
-{
-    if (url.isEmpty() || url == QLatin1String("about:blank"))
-        return;
-
-    m_bookmarkManager->showBookmarkDialog(this, title, url);
-}
-
 void MainWindow::showAboutDialog()
 {
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
     QByteArray contents;
-    if (m_helpEngine) {
-        QByteArray ba = m_helpEngine->customValue(QLatin1String("AboutTexts"),
-            QByteArray()).toByteArray();
-        if (!ba.isEmpty()) {
-            QString lang;
-            QByteArray cba;
-            QString currentLang = QLocale::system().name();
-            int i = currentLang.indexOf(QLatin1Char('_'));
-            if (i > -1)
-                currentLang = currentLang.left(i);
-            QDataStream s(&ba, QIODevice::ReadOnly);
-            while (!s.atEnd()) {
-                s >> lang;
-                s >> cba;
-                if (lang == QLatin1String("default") && contents.isEmpty()) {
-                    contents = cba;
-                } else if (lang == currentLang) {
-                    contents = cba;
-                    break;
-                }
+    QByteArray ba = helpEngine.aboutTexts();
+    if (!ba.isEmpty()) {
+        QString lang;
+        QByteArray cba;
+        QString currentLang = QLocale::system().name();
+        int i = currentLang.indexOf(QLatin1Char('_'));
+        if (i > -1)
+            currentLang = currentLang.left(i);
+        QDataStream s(&ba, QIODevice::ReadOnly);
+        while (!s.atEnd()) {
+            s >> lang;
+            s >> cba;
+            if (lang == QLatin1String("default") && contents.isEmpty()) {
+                contents = cba;
+            } else if (lang == currentLang) {
+                contents = cba;
+                break;
             }
         }
@@ -835,9 +827,6 @@
     QByteArray iconArray;
     if (!contents.isEmpty()) {
-        iconArray = m_helpEngine->customValue(QLatin1String("AboutIcon"),
-            QByteArray()).toByteArray();
-        QByteArray resources =
-            m_helpEngine->customValue(QLatin1String("AboutImages"),
-            QByteArray()).toByteArray();
+        iconArray = helpEngine.aboutIcon();
+        QByteArray resources = helpEngine.aboutImages();
         QPixmap pix;
         pix.loadFromData(iconArray);
@@ -848,8 +837,8 @@
     } else {
         QByteArray resources;
-        aboutDia.setText(QString::fromLatin1("<center>"
+        aboutDia.setText(tr("<center>"
             "<h3>%1</h3>"
             "<p>Version %2</p></center>"
-            "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>")
+            "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>")
             .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)),
             resources);
@@ -862,21 +851,93 @@
 }
 
+void MainWindow::setContentsVisible(bool visible)
+{
+    TRACE_OBJ
+    if (visible)
+        showContents();
+    else
+        hideContents();
+}
+
 void MainWindow::showContents()
 {
+    TRACE_OBJ
     activateDockWidget(m_contentWindow);
 }
 
+void MainWindow::hideContents()
+{
+    TRACE_OBJ
+    m_contentWindow->parentWidget()->hide();
+}
+
+void MainWindow::setIndexVisible(bool visible)
+{
+    TRACE_OBJ
+    if (visible)
+        showIndex();
+    else
+        hideIndex();
+}
+
 void MainWindow::showIndex()
 {
+    TRACE_OBJ
     activateDockWidget(m_indexWindow);
 }
 
-void MainWindow::showBookmarks()
-{
-    activateDockWidget(m_bookmarkWidget);
+void MainWindow::hideIndex()
+{
+    TRACE_OBJ
+    m_indexWindow->parentWidget()->hide();
+}
+
+void MainWindow::setBookmarksVisible(bool visible)
+{
+    TRACE_OBJ
+    if (visible)
+        showBookmarksDockWidget();
+    else
+        hideBookmarksDockWidget();
+}
+
+void MainWindow::showBookmarksDockWidget()
+{
+    TRACE_OBJ
+    if (m_bookmarkWidget)
+        activateDockWidget(m_bookmarkWidget);
+}
+
+void MainWindow::hideBookmarksDockWidget()
+{
+    TRACE_OBJ
+    if (m_bookmarkWidget)
+        m_bookmarkWidget->parentWidget()->hide();
+}
+
+void MainWindow::setSearchVisible(bool visible)
+{
+    TRACE_OBJ
+    if (visible)
+        showSearch();
+    else
+        hideSearch();
+}
+
+void MainWindow::showSearch()
+{
+    TRACE_OBJ
+    m_centralWidget->activateSearchWidget();
+}
+
+void MainWindow::hideSearch()
+{
+    TRACE_OBJ
+    m_centralWidget->removeSearchWidget();
 }
 
 void MainWindow::activateDockWidget(QWidget *w)
 {
+    TRACE_OBJ
     w->parentWidget()->show();
     w->parentWidget()->raise();
@@ -884,21 +945,7 @@
 }
 
-void MainWindow::hideContents()
-{
-    m_contentWindow->parentWidget()->hide();
-}
-
-void MainWindow::hideIndex()
-{
-    m_indexWindow->parentWidget()->hide();
-}
-
-void MainWindow::hideBookmarks()
-{
-    m_bookmarkWidget->parentWidget()->hide();
-}
-
 void MainWindow::setIndexString(const QString &str)
 {
+    TRACE_OBJ
     m_indexWindow->setSearchLineEditText(str);
 }
@@ -906,4 +953,5 @@
 void MainWindow::activateCurrentBrowser()
 {
+    TRACE_OBJ
     CentralWidget *cw = CentralWidget::instance();
     if (cw) {
@@ -914,38 +962,36 @@
 void MainWindow::activateCurrentCentralWidgetTab()
 {
+    TRACE_OBJ
     m_centralWidget->activateTab();
 }
 
-void MainWindow::showSearch()
-{
-    m_centralWidget->activateSearchWidget();
-}
-
 void MainWindow::showSearchWidget()
 {
+    TRACE_OBJ
     m_centralWidget->activateSearchWidget(true);
 }
 
-void MainWindow::hideSearch()
-{
-    m_centralWidget->removeSearchWidget();
-}
-
 void MainWindow::updateApplicationFont()
 {
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
     QFont font = qApp->font();
-    if (m_helpEngine->customValue(QLatin1String("useAppFont")).toBool())
-        font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("appFont")));
-
-    qApp->setFont(font, "QWidget");
+    if (helpEngine.usesAppFont())
+        font = helpEngine.appFont();
+
+    const QWidgetList &widgets = qApp->allWidgets();
+    foreach (QWidget* widget, widgets)
+        widget->setFont(font);
 }
 
 void MainWindow::setupFilterCombo()
 {
+    TRACE_OBJ
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
     QString curFilter = m_filterCombo->currentText();
     if (curFilter.isEmpty())
-        curFilter = m_helpEngine->currentFilter();
+        curFilter = helpEngine.currentFilter();
     m_filterCombo->clear();
-    m_filterCombo->addItems(m_helpEngine->customFilters());
+    m_filterCombo->addItems(helpEngine.customFilters());
     int idx = m_filterCombo->findText(curFilter);
     if (idx < 0)
@@ -956,9 +1002,12 @@
 void MainWindow::filterDocumentation(const QString &customFilter)
 {
-    m_helpEngine->setCurrentFilter(customFilter);
+    TRACE_OBJ
+    HelpEngineWrapper::instance().setCurrentFilter(customFilter);
 }
 
 void MainWindow::expandTOC(int depth)
 {
+    TRACE_OBJ
+    Q_ASSERT(depth >= -1);
     m_contentWindow->expandToDepth(depth);
 }
@@ -966,4 +1015,5 @@
 void MainWindow::indexingStarted()
 {
+    TRACE_OBJ
     if (!m_progressWidget) {
         m_progressWidget = new QWidget();
@@ -991,4 +1041,5 @@
 void MainWindow::indexingFinished()
 {
+    TRACE_OBJ
     statusBar()->removeWidget(m_progressWidget);
     delete m_progressWidget;
@@ -996,14 +1047,7 @@
 }
 
-QWidget* MainWindow::setupBookmarkWidget()
-{
-    m_bookmarkManager = new BookmarkManager(m_helpEngine);
-    m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, this);
-    connect(m_bookmarkWidget, SIGNAL(addBookmark()), this, SLOT(addBookmark()));
-    return m_bookmarkWidget;
-}
-
 QString MainWindow::collectionFileDirectory(bool createDir, const QString &cacheDir)
 {
+    TRACE_OBJ
     QString collectionPath =
         QDesktopServices::storageLocation(QDesktopServices::DataLocation);
@@ -1031,5 +1075,7 @@
 QString MainWindow::defaultHelpCollectionFileName()
 {
-    return collectionFileDirectory() + QDir::separator() +
+    TRACE_OBJ
+    // forces creation of the default collection file path
+    return collectionFileDirectory(true) + QDir::separator() +
         QString(QLatin1String("qthelpcollection_%1.qhc")).
         arg(QLatin1String(QT_VERSION_STR));
@@ -1038,4 +1084,5 @@
 void MainWindow::currentFilterChanged(const QString &filter)
 {
+    TRACE_OBJ
     const int index = m_filterCombo->findText(filter);
     Q_ASSERT(index != -1);
@@ -1043,3 +1090,49 @@
 }
 
+void MainWindow::documentationRemoved(const QString &namespaceName)
+{
+    TRACE_OBJ
+    CentralWidget* widget = CentralWidget::instance();
+    widget->closeOrReloadTabs(widget->currentSourceFileList().
+        keys(namespaceName), false);
+}
+
+void MainWindow::documentationUpdated(const QString &namespaceName)
+{
+    TRACE_OBJ
+    CentralWidget* widget = CentralWidget::instance();
+    widget->closeOrReloadTabs(widget->currentSourceFileList().
+        keys(namespaceName), true);
+}
+
+void MainWindow::resetQtDocInfo(const QString &component)
+{
+    TRACE_OBJ
+    HelpEngineWrapper::instance().setQtDocInfo(component,
+        QStringList(QDateTime().toString(Qt::ISODate)));
+}
+
+void MainWindow::registerDocumentation(const QString &component,
+                                       const QString &absFileName)
+{
+    TRACE_OBJ
+    QString ns = QHelpEngineCore::namespaceName(absFileName);
+    if (ns.isEmpty())
+        return;
+
+    HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+    if (helpEngine.registeredDocumentations().contains(ns))
+        helpEngine.unregisterDocumentation(ns);
+    if (!helpEngine.registerDocumentation(absFileName)) {
+        QMessageBox::warning(this, tr("Qt Assistant"),
+            tr("Could not register file '%1': %2").
+            arg(absFileName).arg(helpEngine.error()));
+    } else {
+        QStringList docInfo;
+        docInfo << QFileInfo(absFileName).lastModified().toString(Qt::ISODate)
+                << absFileName;
+        helpEngine.setQtDocInfo(component, docInfo);
+    }
+}
+
 QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/mainwindow.h
===================================================================
--- trunk/tools/assistant/tools/assistant/mainwindow.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -49,4 +49,5 @@
 
 class QAction;
+class QFileSystemWatcher;
 class QLineEdit;
 class QComboBox;
@@ -58,6 +59,4 @@
 class CentralWidget;
 class ContentWindow;
-class BookmarkManager;
-class BookmarkWidget;
 class CmdLineParser;
 class QtDocInstaller;
@@ -68,5 +67,5 @@
 
 public:
-    MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0);
+    explicit MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0);
     ~MainWindow();
 
@@ -77,8 +76,4 @@
 
 public:
-    void hideContents();
-    void hideIndex();
-    void hideBookmarks();
-    void hideSearch();
     void setIndexString(const QString &str);
     void expandTOC(int depth);
@@ -89,8 +84,8 @@
 
 public slots:
-    void showContents();
-    void showIndex();
-    void showBookmarks();
-    void showSearch();
+    void setContentsVisible(bool visible);
+    void setIndexVisible(bool visible);
+    void setBookmarksVisible(bool visible);
+    void setSearchVisible(bool visible);
     void showSearchWidget();
     void syncContents();
@@ -99,6 +94,8 @@
 
 private slots:
+    void showContents();
+    void showIndex();
+    void showSearch();
     void insertLastPages();
-    void addBookmark();
     void gotoAddress();
     void showPreferences();
@@ -109,5 +106,4 @@
     void updateTabCloseAction();
     void showNewAddress(const QUrl &url);
-    void addNewBookmark(const QString &title, const QString &url);
     void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword);
     void updateApplicationFont();
@@ -117,13 +113,14 @@
     void indexingStarted();
     void indexingFinished();
-    void displayInstallationError(const QString &errorMessage);
-    void qtDocumentationInstalled(bool newDocsInstalled);
+    void qtDocumentationInstalled();
+    void registerDocumentation(const QString &component,
+        const QString &absFileName);
+    void resetQtDocInfo(const QString &component);
     void checkInitState();
-
-    void updateBookmarkMenu();
-    void showBookmark(QAction *action);
+    void documentationRemoved(const QString &namespaceName);
+    void documentationUpdated(const QString &namespaceName);
 
 private:
-    bool initHelpDB();
+    bool initHelpDB(bool registerInternalDoc);
     void setupActions();
     void closeEvent(QCloseEvent *e);
@@ -133,12 +130,19 @@
     void setupAddressToolbar();
     QMenu *toolBarMenu();
-    QWidget *setupBookmarkWidget();
+    void hideContents();
+    void hideIndex();
+    void hideSearch();
 
-    QHelpEngine *m_helpEngine;
+private slots:
+    void showBookmarksDockWidget();
+    void hideBookmarksDockWidget();
+
+private:
+    QWidget *m_bookmarkWidget;
+
+private:
     CentralWidget *m_centralWidget;
     IndexWindow *m_indexWindow;
     ContentWindow *m_contentWindow;
-    BookmarkWidget *m_bookmarkWidget;
-    BookmarkManager *m_bookmarkManager;
     QLineEdit *m_addressLineEdit;
     QComboBox *m_filterCombo;
@@ -162,6 +166,4 @@
     QMenu *m_viewMenu;
     QMenu *m_toolBarMenu;
-    QMenu *m_bookmarkMenu;
-    QAction *m_bookmarkMenuAction;
 
     CmdLineParser *m_cmdLine;
Index: trunk/tools/assistant/tools/assistant/preferencesdialog.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/preferencesdialog.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/preferencesdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,21 +39,22 @@
 **
 ****************************************************************************/
-
 #include "preferencesdialog.h"
+
+#include "centralwidget.h"
 #include "filternamedialog.h"
+#include "fontpanel.h"
+#include "helpenginewrapper.h"
 #include "installdialog.h"
-#include "fontpanel.h"
-#include "centralwidget.h"
-#include "aboutdialog.h"
-
-#include <QtAlgorithms>
-
+#include "tracer.h"
+
+#include <QtCore/QtAlgorithms>
+#include <QtCore/QFileSystemWatcher>
+
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QFileDialog>
+#include <QtGui/QFontDatabase>
 #include <QtGui/QHeaderView>
-#include <QtGui/QFileDialog>
+#include <QtGui/QMenu>
 #include <QtGui/QMessageBox>
-#include <QtGui/QMenu>
-#include <QtGui/QFontDatabase>
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
 
 #include <QtHelp/QHelpEngineCore>
@@ -61,10 +62,11 @@
 QT_BEGIN_NAMESPACE
 
-PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent)
+PreferencesDialog::PreferencesDialog(QWidget *parent)
     : QDialog(parent)
-    , m_helpEngine(helpEngine)
     , m_appFontChanged(false)
     , m_browserFontChanged(false)
-{
+    , helpEngine(HelpEngineWrapper::instance())
+{
+    TRACE_OBJ
     m_ui.setupUi(this);
 
@@ -74,9 +76,6 @@
         this, SLOT(reject()));
 
-    QLatin1String key("EnableFilterFunctionality");
-    m_hideFiltersTab = !m_helpEngine->customValue(key, true).toBool();
-
-    key = QLatin1String("EnableDocumentationManager");
-    m_hideDocsTab = !m_helpEngine->customValue(key, true).toBool();
+    m_hideFiltersTab = !helpEngine.filterFunctionalityEnabled();
+    m_hideDocsTab = !helpEngine.documentationManagerEnabled();
 
     if (!m_hideFiltersTab) {
@@ -107,5 +106,5 @@
             SLOT(removeDocumentation()));
 
-        m_docsBackup = m_helpEngine->registeredDocumentations();
+        m_docsBackup = helpEngine.registeredDocumentations();
         m_ui.registeredDocsListWidget->addItems(m_docsBackup);
     } else {
@@ -115,33 +114,23 @@
     updateFontSettingsPage();
     updateOptionsPage();
+
+    if (helpEngine.usesAppFont())
+        setFont(helpEngine.appFont());
 }
 
 PreferencesDialog::~PreferencesDialog()
 {
-    QLatin1String key("");
+    TRACE_OBJ
     if (m_appFontChanged) {
-        key = QLatin1String("appFont");
-        m_helpEngine->setCustomValue(key, m_appFontPanel->selectedFont());
-
-        key = QLatin1String("useAppFont");
-        m_helpEngine->setCustomValue(key, m_appFontPanel->isChecked());
-
-        key = QLatin1String("appWritingSystem");
-        m_helpEngine->setCustomValue(key, m_appFontPanel->writingSystem());
+        helpEngine.setAppFont(m_appFontPanel->selectedFont());
+        helpEngine.setUseAppFont(m_appFontPanel->isChecked());
+        helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem());
+        emit updateApplicationFont();
     }
 
     if (m_browserFontChanged) {
-        key = QLatin1String("browserFont");
-        m_helpEngine->setCustomValue(key, m_browserFontPanel->selectedFont());
-
-        key = QLatin1String("useBrowserFont");
-        m_helpEngine->setCustomValue(key, m_browserFontPanel->isChecked());
-
-        key = QLatin1String("browserWritingSystem");
-        m_helpEngine->setCustomValue(key, m_browserFontPanel->writingSystem());
-    }
-
-    if (m_appFontChanged || m_browserFontChanged) {
-        emit updateApplicationFont();
+        helpEngine.setBrowserFont(m_browserFontPanel->selectedFont());
+        helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked());
+        helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem());
         emit updateBrowserFont();
     }
@@ -150,12 +139,13 @@
     if (homePage.isEmpty())
         homePage = QLatin1String("help");
-    m_helpEngine->setCustomValue(QLatin1String("homepage"), homePage);
+    helpEngine.setHomePage(homePage);
 
     int option = m_ui.helpStartComboBox->currentIndex();
-    m_helpEngine->setCustomValue(QLatin1String("StartOption"), option);
+    helpEngine.setStartOption(option);
 }
 
 void PreferencesDialog::showDialog()
 {
+    TRACE_OBJ
     if (exec() != Accepted)
         m_appFontChanged = m_browserFontChanged = false;
@@ -164,16 +154,14 @@
 void PreferencesDialog::updateFilterPage()
 {
-    if (!m_helpEngine)
-        return;
-
+    TRACE_OBJ
     m_ui.filterWidget->clear();
     m_ui.attributeWidget->clear();
 
-    QHelpEngineCore help(m_helpEngine->collectionFile(), 0);
-    help.setupData();
     m_filterMapBackup.clear();
-    const QStringList filters = help.customFilters();
+    const QStringList &filters = helpEngine.customFilters();
     foreach (const QString &filter, filters) {
-        QStringList atts = help.filterAttributes(filter);
+        if (filter == HelpEngineWrapper::TrUnfiltered)
+            continue;
+        QStringList atts = helpEngine.filterAttributes(filter);
         m_filterMapBackup.insert(filter, atts);
         if (!m_filterMap.contains(filter))
@@ -183,8 +171,8 @@
     m_ui.filterWidget->addItems(m_filterMap.keys());
 
-    foreach (const QString &a, help.filterAttributes())
+    foreach (const QString &a, helpEngine.filterAttributes())
         new QTreeWidgetItem(m_ui.attributeWidget, QStringList() << a);
 
-    if (m_filterMap.keys().count())
+    if (!m_filterMap.keys().isEmpty())
         m_ui.filterWidget->setCurrentRow(0);
 }
@@ -192,4 +180,5 @@
 void PreferencesDialog::updateAttributes(QListWidgetItem *item)
 {
+    TRACE_OBJ
     QStringList checkedList;
     if (item)
@@ -207,4 +196,5 @@
 void PreferencesDialog::updateFilterMap()
 {
+    TRACE_OBJ
     if (!m_ui.filterWidget->currentItem())
         return;
@@ -225,4 +215,5 @@
 void PreferencesDialog::addFilter()
 {
+    TRACE_OBJ
     FilterNameDialog dia(this);
     if (dia.exec() == QDialog::Rejected)
@@ -242,4 +233,5 @@
 void PreferencesDialog::removeFilter()
 {
+    TRACE_OBJ
     QListWidgetItem *item =
         m_ui.filterWidget ->takeItem(m_ui.filterWidget->currentRow());
@@ -256,4 +248,5 @@
 void PreferencesDialog::addDocumentationLocal()
 {
+    TRACE_OBJ
     const QStringList fileNames = QFileDialog::getOpenFileNames(this,
         tr("Add Documentation"), QString(), tr("Qt Compressed Help Files (*.qch)"));
@@ -276,8 +269,9 @@
         }
 
-        m_helpEngine->registerDocumentation(fileName);
-        m_ui.registeredDocsListWidget->addItem(nameSpace);
-        m_regDocs.append(nameSpace);
-        m_unregDocs.removeAll(nameSpace);
+        if (helpEngine.registerDocumentation(fileName)) {
+            m_ui.registeredDocsListWidget->addItem(nameSpace);
+            m_regDocs.append(nameSpace);
+            m_unregDocs.removeAll(nameSpace);
+        }
     }
 
@@ -308,4 +302,5 @@
 void PreferencesDialog::removeDocumentation()
 {
+    TRACE_OBJ
     bool foundBefore = false;
     CentralWidget* widget = CentralWidget::instance();
@@ -339,4 +334,5 @@
 void PreferencesDialog::applyChanges()
 {
+    TRACE_OBJ
     bool filtersWereChanged = false;
     if (!m_hideFiltersTab) {
@@ -371,26 +367,19 @@
     if (filtersWereChanged) {
         foreach (const QString &filter, m_removedFilters)
-            m_helpEngine->removeCustomFilter(filter);
+            helpEngine.removeCustomFilter(filter);
         QMapIterator<QString, QStringList> it(m_filterMap);
         while (it.hasNext()) {
             it.next();
-            m_helpEngine->addCustomFilter(it.key(), it.value());
-        }
-    }
-
-    qSort(m_TabsToClose);
-    CentralWidget* widget = CentralWidget::instance();
-    for (int i = m_TabsToClose.count(); --i >= 0;)
-        widget->closeTabAt(m_TabsToClose.at(i));
-    if (widget->availableHelpViewer()== 0)
-        widget->setSource(QUrl(QLatin1String("about:blank")));
-
-    if (m_unregDocs.count()) {
-        foreach (const QString &doc, m_unregDocs)
-            m_helpEngine->unregisterDocumentation(doc);
-    }
-
-    if (filtersWereChanged || m_regDocs.count() || m_unregDocs.count())
-        m_helpEngine->setupData();
+            helpEngine.addCustomFilter(it.key(), it.value());
+        }
+    }
+
+    CentralWidget::instance()->closeOrReloadTabs(m_TabsToClose, false);
+
+    foreach (const QString &doc, m_unregDocs)
+        helpEngine.unregisterDocumentation(doc);
+
+    if (filtersWereChanged || !m_regDocs.isEmpty() || !m_unregDocs.isEmpty())
+        helpEngine.setupData();
 
     accept();
@@ -399,4 +388,5 @@
 void PreferencesDialog::updateFontSettingsPage()
 {
+    TRACE_OBJ
     m_browserFontPanel = new FontPanel(this);
     m_browserFontPanel->setCheckable(true);
@@ -412,29 +402,21 @@
     m_appFontPanel->setTitle(customSettings);
 
-    QLatin1String key = QLatin1String("appFont");
-    QFont font = qVariantValue<QFont>(m_helpEngine->customValue(key));
+    QFont font = helpEngine.appFont();
     m_appFontPanel->setSelectedFont(font);
 
-    key = QLatin1String("appWritingSystem");
-    QFontDatabase::WritingSystem system = static_cast<QFontDatabase::WritingSystem>
-        (m_helpEngine->customValue(key).toInt());
+    QFontDatabase::WritingSystem system = helpEngine.appWritingSystem();
     m_appFontPanel->setWritingSystem(system);
 
-    key = QLatin1String("useAppFont");
-    m_appFontPanel->setChecked(m_helpEngine->customValue(key).toBool());
+    m_appFontPanel->setChecked(helpEngine.usesAppFont());
 
     m_browserFontPanel->setTitle(customSettings);
 
-    key = QLatin1String("browserFont");
-    font = qVariantValue<QFont>(m_helpEngine->customValue(key));
+    font = helpEngine.browserFont();
     m_browserFontPanel->setSelectedFont(font);
 
-    key = QLatin1String("browserWritingSystem");
-    system = static_cast<QFontDatabase::WritingSystem>
-        (m_helpEngine->customValue(key).toInt());
+    system = helpEngine.browserWritingSystem();
     m_browserFontPanel->setWritingSystem(system);
 
-    key = QLatin1String("useBrowserFont");
-    m_browserFontPanel->setChecked(m_helpEngine->customValue(key).toBool());
+    m_browserFontPanel->setChecked(helpEngine.usesBrowserFont());
 
     connect(m_appFontPanel, SIGNAL(toggled(bool)), this,
@@ -458,4 +440,5 @@
 void PreferencesDialog::appFontSettingToggled(bool on)
 {
+    TRACE_OBJ
     Q_UNUSED(on)
     m_appFontChanged = true;
@@ -464,4 +447,5 @@
 void PreferencesDialog::appFontSettingChanged(int index)
 {
+    TRACE_OBJ
     Q_UNUSED(index)
     m_appFontChanged = true;
@@ -470,4 +454,5 @@
 void PreferencesDialog::browserFontSettingToggled(bool on)
 {
+    TRACE_OBJ
     Q_UNUSED(on)
     m_browserFontChanged = true;
@@ -476,4 +461,5 @@
 void PreferencesDialog::browserFontSettingChanged(int index)
 {
+    TRACE_OBJ
     Q_UNUSED(index)
     m_browserFontChanged = true;
@@ -482,15 +468,8 @@
 void PreferencesDialog::updateOptionsPage()
 {
-    QString homepage = m_helpEngine->customValue(QLatin1String("homepage"),
-        QLatin1String("")).toString();
-
-    if (homepage.isEmpty()) {
-        homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"),
-            QLatin1String("help")).toString();
-    }
-    m_ui.homePageLineEdit->setText(homepage);
-
-    int option = m_helpEngine->customValue(QLatin1String("StartOption"),
-        ShowLastPages).toInt();
+    TRACE_OBJ
+    m_ui.homePageLineEdit->setText(helpEngine.homePage());
+
+    int option = helpEngine.startOption();
     m_ui.helpStartComboBox->setCurrentIndex(option);
 
@@ -502,4 +481,5 @@
 void PreferencesDialog::setBlankPage()
 {
+    TRACE_OBJ
     m_ui.homePageLineEdit->setText(QLatin1String("about:blank"));
 }
@@ -507,4 +487,5 @@
 void PreferencesDialog::setCurrentPage()
 {
+    TRACE_OBJ
     QString homepage = CentralWidget::instance()->currentSource().toString();
     if (homepage.isEmpty())
@@ -516,7 +497,6 @@
 void PreferencesDialog::setDefaultPage()
 {
-    QString homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"),
-        QLatin1String("help")).toString();
-    m_ui.homePageLineEdit->setText(homepage);
+    TRACE_OBJ
+    m_ui.homePageLineEdit->setText(helpEngine.defaultHomePage());
 }
 
Index: trunk/tools/assistant/tools/assistant/preferencesdialog.h
===================================================================
--- trunk/tools/assistant/tools/assistant/preferencesdialog.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/preferencesdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -49,11 +49,6 @@
 
 class FontPanel;
-class QHelpEngineCore;
-
-enum {
-    ShowHomePage = 0,
-    ShowBlankPage = 1,
-    ShowLastPages = 2
-};
+class HelpEngineWrapper;
+class QFileSystemWatcher;
 
 class PreferencesDialog : public QDialog
@@ -62,5 +57,5 @@
 
 public:
-    PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent = 0);
+    PreferencesDialog(QWidget *parent = 0);
     ~PreferencesDialog();
 
@@ -94,5 +89,4 @@
 
     Ui::PreferencesDialogClass m_ui;
-    QHelpEngineCore *m_helpEngine;
     bool m_hideFiltersTab;
     bool m_hideDocsTab;
@@ -108,4 +102,5 @@
     bool m_appFontChanged;
     bool m_browserFontChanged;
+    HelpEngineWrapper &helpEngine;
 };
 
Index: trunk/tools/assistant/tools/assistant/qtdocinstaller.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/qtdocinstaller.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/qtdocinstaller.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,21 +39,25 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include <QtCore/QDir>
 #include <QtCore/QLibraryInfo>
 #include <QtCore/QDateTime>
+#include <QtCore/QFileSystemWatcher>
 #include <QtHelp/QHelpEngineCore>
+#include "helpenginewrapper.h"
 #include "qtdocinstaller.h"
 
 QT_BEGIN_NAMESPACE
 
-QtDocInstaller::QtDocInstaller(const QString &collectionFile)
+QtDocInstaller::QtDocInstaller(const QList<DocInfo> &docInfos)
+    : m_abort(false), m_docInfos(docInfos)
 {
-    m_abort = false;
-    m_collectionFile = collectionFile;
+    TRACE_OBJ
 }
 
 QtDocInstaller::~QtDocInstaller()
 {
+    TRACE_OBJ
     if (!isRunning())
         return;
@@ -66,4 +70,5 @@
 void QtDocInstaller::installDocs()
 {
+    TRACE_OBJ
     start(LowPriority);
 }
@@ -71,20 +76,14 @@
 void QtDocInstaller::run()
 {
-    QHelpEngineCore *helpEngine = new QHelpEngineCore(m_collectionFile);
-    helpEngine->setupData();
+    TRACE_OBJ
+    m_qchDir = QLibraryInfo::location(QLibraryInfo::DocumentationPath)
+        + QDir::separator() + QLatin1String("qch");
+    m_qchFiles = m_qchDir.entryList(QStringList() << QLatin1String("*.qch"));
+
     bool changes = false;
-
-    QStringList docs;
-    docs << QLatin1String("assistant")
-        << QLatin1String("designer")
-        << QLatin1String("linguist")
-        << QLatin1String("qmake")
-        << QLatin1String("qt");
-
-    foreach (const QString &doc, docs) {
-        changes |= installDoc(doc, helpEngine);
+    foreach (const DocInfo &docInfo, m_docInfos) {
+        changes |= installDoc(docInfo);
         m_mutex.lock();
         if (m_abort) {
-            delete helpEngine;
             m_mutex.unlock();
             return;
@@ -92,58 +91,36 @@
         m_mutex.unlock();
     }
-    delete helpEngine;
     emit docsInstalled(changes);
 }
 
-bool QtDocInstaller::installDoc(const QString &name, QHelpEngineCore *helpEngine)
+bool QtDocInstaller::installDoc(const DocInfo &docInfo)
 {
-    QString versionKey = QString(QLatin1String("qtVersion%1$$$%2")).
-        arg(QLatin1String(QT_VERSION_STR)).arg(name);
-
-    QString info = helpEngine->customValue(versionKey, QString()).toString();
-    QStringList lst = info.split(QLatin1String("|"));
-
+    TRACE_OBJ
+    const QString &component = docInfo.first;
+    const QStringList &info = docInfo.second;
     QDateTime dt;
-    if (lst.count() && !lst.first().isEmpty())
-        dt = QDateTime::fromString(lst.first(), Qt::ISODate);
+    if (!info.isEmpty() && !info.first().isEmpty())
+        dt = QDateTime::fromString(info.first(), Qt::ISODate);
 
     QString qchFile;
-    if (lst.count() == 2)
-        qchFile = lst.last();
+    if (info.count() == 2)
+        qchFile = info.last();
 
-    QDir dir(QLibraryInfo::location(QLibraryInfo::DocumentationPath)
-        + QDir::separator() + QLatin1String("qch"));
-
-    const QStringList files = dir.entryList(QStringList() << QLatin1String("*.qch"));
-    if (files.isEmpty()) {
-        helpEngine->setCustomValue(versionKey, QDateTime().toString(Qt::ISODate)
-            + QLatin1String("|"));
+    if (m_qchFiles.isEmpty()) {
+        emit qchFileNotFound(component);
         return false;
     }
-    foreach (const QString &f, files) {
-        if (f.startsWith(name)) {
-            QFileInfo fi(dir.absolutePath() + QDir::separator() + f);
-            if (dt.isValid() && fi.lastModified().toString(Qt::ISODate) == dt.toString(Qt::ISODate)
+    foreach (const QString &f, m_qchFiles) {
+        if (f.startsWith(component)) {
+            QFileInfo fi(m_qchDir.absolutePath() + QDir::separator() + f);
+            if (dt.isValid() && fi.lastModified().toTime_t() == dt.toTime_t()
                 && qchFile == fi.absoluteFilePath())
                 return false;
-
-            QString namespaceName = QHelpEngineCore::namespaceName(fi.absoluteFilePath());
-            if (namespaceName.isEmpty())
-                continue;
-
-            if (helpEngine->registeredDocumentations().contains(namespaceName))
-                helpEngine->unregisterDocumentation(namespaceName);
-
-            if (!helpEngine->registerDocumentation(fi.absoluteFilePath())) {
-                emit errorMessage(
-                    tr("The file %1 could not be registered successfully!\n\nReason: %2")
-                    .arg(fi.absoluteFilePath()).arg(helpEngine->error()));
-            }
-
-            helpEngine->setCustomValue(versionKey, fi.lastModified().toString(Qt::ISODate)
-                + QLatin1String("|") + fi.absoluteFilePath());
+            emit registerDocumentation(component, fi.absoluteFilePath());
             return true;
         }
     }
+
+    emit qchFileNotFound(component);
     return false;
 }
Index: trunk/tools/assistant/tools/assistant/qtdocinstaller.h
===================================================================
--- trunk/tools/assistant/tools/assistant/qtdocinstaller.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/qtdocinstaller.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,10 +43,13 @@
 #define QTDOCINSTALLER
 
+#include <QtCore/QDir>
+#include <QtCore/QMutex>
+#include <QtCore/QPair>
+#include <QtCore/QStringList>
 #include <QtCore/QThread>
-#include <QtCore/QMutex>
 
 QT_BEGIN_NAMESPACE
 
-class QHelpEngineCore;
+class HelpEngineWrapper;
 
 class QtDocInstaller : public QThread
@@ -55,20 +58,24 @@
 
 public:
-    QtDocInstaller(const QString &collectionFile);
+    typedef QPair<QString, QStringList> DocInfo;
+    QtDocInstaller(const QList<DocInfo> &docInfos);
     ~QtDocInstaller();
     void installDocs();
 
 signals:
-    void errorMessage(const QString &msg);
+    void qchFileNotFound(const QString &component);
+    void registerDocumentation(const QString &component,
+                               const QString &absFileName);
     void docsInstalled(bool newDocsInstalled);
 
 private:
     void run();
-    bool installDoc(const QString &name,
-        QHelpEngineCore *helpEngine);
+    bool installDoc(const DocInfo &docInfo);
 
     bool m_abort;
-    QString m_collectionFile;
     QMutex m_mutex;
+    QStringList m_qchFiles;
+    QDir m_qchDir;
+    QList<DocInfo> m_docInfos;
 };
 
Index: trunk/tools/assistant/tools/assistant/remotecontrol.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/remotecontrol.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/remotecontrol.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,10 +39,14 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "remotecontrol.h"
 #include "mainwindow.h"
 #include "centralwidget.h"
+#include "helpenginewrapper.h"
 
 #include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QFileSystemWatcher>
 #include <QtCore/QThread>
 #include <QtCore/QTextStream>
@@ -66,8 +70,10 @@
     : QThread(parent)
 {
+    TRACE_OBJ
 }
 
 StdInListenerWin::~StdInListenerWin()
 {
+    TRACE_OBJ
     terminate();
     wait();
@@ -78,4 +84,5 @@
 void StdInListenerWin::run()
 {
+    TRACE_OBJ
     char chBuf[4096];
     size_t pos = 0;
@@ -121,4 +128,5 @@
 void StdInListenerWin::run()
 {
+    TRACE_OBJ
     bool ok = true;
     char chBuf[4096];
@@ -145,7 +153,7 @@
 
     while (ok) {
-        ok = ReadFile(hStdinDup, chBuf, 4096, &dwRead, NULL);
+        ok = ReadFile(hStdinDup, chBuf, sizeof(chBuf), &dwRead, NULL);
         if (ok && dwRead != 0)
-            emit receivedCommand(QString::fromLocal8Bit(chBuf));
+            emit receivedCommand(QString::fromLocal8Bit(chBuf, dwRead));
     }
 }
@@ -155,14 +163,15 @@
 #endif // defined(Q_OS_WIN) || defined(Q_OS_OS2)
 
-RemoteControl::RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine)
+RemoteControl::RemoteControl(MainWindow *mainWindow)
     : QObject(mainWindow)
     , m_mainWindow(mainWindow)
-    , m_helpEngine(helpEngine)
     , m_debug(false)
     , m_caching(true)
     , m_syncContents(false)
-    , m_expandTOC(-3)
-
-{
+    , m_expandTOC(-2)
+    , helpEngine(HelpEngineWrapper::instance())
+
+{
+    TRACE_OBJ
     connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache()));
 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
@@ -181,4 +190,5 @@
 void RemoteControl::receivedData()
 {
+    TRACE_OBJ
     QByteArray ba;
     while (true) {
@@ -196,17 +206,10 @@
 void RemoteControl::handleCommandString(const QString &cmdString)
 {
+    TRACE_OBJ
     QStringList cmds = cmdString.split(QLatin1Char(';'));
     QStringList::const_iterator it = cmds.constBegin();
-    QString cmdLine, cmd, arg;
     while (it != cmds.constEnd()) {
-        cmdLine = (*it).trimmed();
-        cmd = cmdLine;
-        arg.clear();
-        int i = cmdLine.indexOf(QLatin1Char(' '));
-        if (i > 0) {
-            cmd = cmdLine.left(i);
-            arg = cmdLine.mid(i+1);
-        }
-        cmd = cmd.toLower();
+        QString cmd, arg;
+        splitInputString(*it, cmd, arg);
 
         if (m_debug)
@@ -214,89 +217,29 @@
                 tr("Received Command: %1 %2").arg(cmd).arg(arg));
 
-        if (cmd == QLatin1String("debug")) {
-            if (arg == QLatin1String("on"))
-                m_debug = true;
-            else
-                m_debug = false;
-        } else if (cmd == QLatin1String("show")) {
-            if (arg.toLower() == QLatin1String("contents")) {
-                m_mainWindow->showContents();
-            } else if (arg.toLower() == QLatin1String("index")) {
-                m_mainWindow->showIndex();
-            } else if (arg.toLower() == QLatin1String("bookmarks")) {
-                m_mainWindow->showBookmarks();
-            } else if (arg.toLower() == QLatin1String("search")) {
-                m_mainWindow->showSearch();
-            }
-        } else if (cmd == QLatin1String("hide")) {
-            if (arg.toLower() == QLatin1String("contents")) {
-                m_mainWindow->hideContents();
-            } else if (arg.toLower() == QLatin1String("index")) {
-                m_mainWindow->hideIndex();
-            } else if (arg.toLower() == QLatin1String("bookmarks")) {
-                m_mainWindow->hideBookmarks();
-            } else if (arg.toLower() == QLatin1String("search")) {
-                m_mainWindow->hideSearch();
-            }
-        } else if (cmd == QLatin1String("setsource")) {
-            QUrl url(arg);
-            if (url.isValid()) {
-                if (url.isRelative())
-                    url = CentralWidget::instance()->currentSource().resolved(url);
-                if (m_caching) {
-                    clearCache();
-                    m_setSource = url;
-                } else {
-                    CentralWidget::instance()->setSource(url);
-                }
-            }
-        } else if (cmd == QLatin1String("synccontents")) {
-            if (m_caching)
-                m_syncContents = true;
-            else
-                m_mainWindow->syncContents();
-        } else if (cmd == QLatin1String("activatekeyword")) {
-            if (m_caching) {
-                clearCache();
-                m_activateKeyword = arg;
-            } else {
-                m_mainWindow->setIndexString(arg);
-                if (!arg.isEmpty())
-                    m_helpEngine->indexWidget()->activateCurrentItem();
-            }
-        } else if (cmd == QLatin1String("activateidentifier")) {
-            if (m_caching) {
-                clearCache();
-                m_activateIdentifier = arg;
-            } else {
-                QMap<QString, QUrl> links =
-                    m_helpEngine->linksForIdentifier(arg);
-                if (links.count())
-                    CentralWidget::instance()->setSource(links.constBegin().value());
-            }
-        } else if (cmd == QLatin1String("expandtoc")) {
-            bool ok = false;
-            int depth = -1;
-            if (!arg.isEmpty())
-                depth = arg.toInt(&ok);
-            if (!ok)
-                depth = -1;
-
-            if (m_caching)
-                m_expandTOC = depth;
-            else
-                m_mainWindow->expandTOC(depth);
-        } else if (cmd == QLatin1String("setcurrentfilter")) {
-            if (!m_helpEngine->customFilters().contains(arg))
-                return;
-            if (m_caching) {
-                clearCache();
-                m_currentFilter = arg;
-            } else {
-                m_helpEngine->setCurrentFilter(arg);
-            }
-        } else {
+        if (cmd == QLatin1String("debug"))
+            handleDebugCommand(arg);
+         else if (cmd == QLatin1String("show"))
+            handleShowOrHideCommand(arg, true);
+         else if (cmd == QLatin1String("hide"))
+            handleShowOrHideCommand(arg, false);
+         else if (cmd == QLatin1String("setsource"))
+            handleSetSourceCommand(arg);
+         else if (cmd == QLatin1String("synccontents"))
+            handleSyncContentsCommand();
+         else if (cmd == QLatin1String("activatekeyword"))
+            handleActivateKeywordCommand(arg);
+         else if (cmd == QLatin1String("activateidentifier"))
+            handleActivateIdentifierCommand(arg);
+         else if (cmd == QLatin1String("expandtoc"))
+            handleExpandTocCommand(arg);
+         else if (cmd == QLatin1String("setcurrentfilter"))
+            handleSetCurrentFilterCommand(arg);
+         else if (cmd == QLatin1String("register"))
+            handleRegisterCommand(arg);
+         else if (cmd == QLatin1String("unregister"))
+            handleUnregisterCommand(arg);
+         else
             return;
-        }
+
         ++it;
     }
@@ -305,18 +248,153 @@
 }
 
+void RemoteControl::splitInputString(const QString &input, QString &cmd,
+                                     QString &arg)
+{
+    TRACE_OBJ
+    QString cmdLine = input.trimmed();
+    int i = cmdLine.indexOf(QLatin1Char(' '));
+    cmd = cmdLine.left(i);
+    arg = cmdLine.mid(i+1);
+    cmd = cmd.toLower();
+}
+
+void RemoteControl::handleDebugCommand(const QString &arg)
+{
+    TRACE_OBJ
+    m_debug = arg == QLatin1String("on");
+}
+
+void RemoteControl::handleShowOrHideCommand(const QString &arg, bool show)
+{
+    TRACE_OBJ
+    if (arg.toLower() == QLatin1String("contents"))
+        m_mainWindow->setContentsVisible(show);
+    else if (arg.toLower() == QLatin1String("index"))
+        m_mainWindow->setIndexVisible(show);
+    else if (arg.toLower() == QLatin1String("bookmarks"))
+        m_mainWindow->setBookmarksVisible(show);
+    else if (arg.toLower() == QLatin1String("search"))
+        m_mainWindow->setSearchVisible(show);
+}
+
+void RemoteControl::handleSetSourceCommand(const QString &arg)
+{
+    TRACE_OBJ
+    QUrl url(arg);
+    if (url.isValid()) {
+        if (url.isRelative())
+            url = CentralWidget::instance()->currentSource().resolved(url);
+        if (m_caching) {
+            clearCache();
+            m_setSource = url;
+        } else {
+            CentralWidget::instance()->setSource(url);
+        }
+    }
+}
+
+void RemoteControl::handleSyncContentsCommand()
+{
+    TRACE_OBJ
+    if (m_caching)
+        m_syncContents = true;
+    else
+        m_mainWindow->syncContents();
+}
+
+void RemoteControl::handleActivateKeywordCommand(const QString &arg)
+{
+    TRACE_OBJ
+    if (m_caching) {
+        clearCache();
+        m_activateKeyword = arg;
+    } else {
+        m_mainWindow->setIndexString(arg);
+        if (!arg.isEmpty())
+            helpEngine.indexWidget()->activateCurrentItem();
+    }
+}
+
+void RemoteControl::handleActivateIdentifierCommand(const QString &arg)
+{
+    TRACE_OBJ
+    if (m_caching) {
+        clearCache();
+        m_activateIdentifier = arg;
+    } else {
+        const QMap<QString, QUrl> &links = helpEngine.linksForIdentifier(arg);
+        if (!links.isEmpty())
+            CentralWidget::instance()->setSource(links.constBegin().value());
+    }
+}
+
+void RemoteControl::handleExpandTocCommand(const QString &arg)
+{
+    TRACE_OBJ
+    bool ok = false;
+    int depth = -2;
+    if (!arg.isEmpty())
+        depth = arg.toInt(&ok);
+    if (!ok || depth < -2)
+        depth = -2;
+
+    if (m_caching)
+        m_expandTOC = depth;
+    else if (depth != -2)
+        m_mainWindow->expandTOC(depth);
+}
+
+void RemoteControl::handleSetCurrentFilterCommand(const QString &arg)
+{
+    TRACE_OBJ
+    if (helpEngine.customFilters().contains(arg)) {
+        if (m_caching) {
+            clearCache();
+            m_currentFilter = arg;
+        } else {
+            helpEngine.setCurrentFilter(arg);
+        }
+    }
+}
+
+void RemoteControl::handleRegisterCommand(const QString &arg)
+{
+    TRACE_OBJ
+    const QString &absFileName = QFileInfo(arg).absoluteFilePath();
+    if (helpEngine.registeredDocumentations().
+        contains(QHelpEngineCore::namespaceName(absFileName)))
+        return;
+    if (helpEngine.registerDocumentation(absFileName))
+        helpEngine.setupData();
+}
+
+void RemoteControl::handleUnregisterCommand(const QString &arg)
+{
+    TRACE_OBJ
+    const QString &absFileName = QFileInfo(arg).absoluteFilePath();
+    const QString &ns = QHelpEngineCore::namespaceName(absFileName);
+    if (helpEngine.registeredDocumentations().contains(ns)) {
+        CentralWidget* widget = CentralWidget::instance();
+        widget->closeOrReloadTabs(widget->currentSourceFileList().keys(ns), false);
+        if (helpEngine.unregisterDocumentation(ns))
+            helpEngine.setupData();
+    }
+}
+
 void RemoteControl::applyCache()
 {
+    TRACE_OBJ
     if (m_setSource.isValid()) {
         CentralWidget::instance()->setSource(m_setSource);
     } else if (!m_activateKeyword.isEmpty()) {
         m_mainWindow->setIndexString(m_activateKeyword);
-        m_helpEngine->indexWidget()->activateCurrentItem();
+        helpEngine.indexWidget()->activateCurrentItem();
     } else if (!m_activateIdentifier.isEmpty()) {
         QMap<QString, QUrl> links =
-            m_helpEngine->linksForIdentifier(m_activateIdentifier);
-        if (links.count())
+            helpEngine.linksForIdentifier(m_activateIdentifier);
+        if (!links.isEmpty())
             CentralWidget::instance()->setSource(links.constBegin().value());
     } else if (!m_currentFilter.isEmpty()) {
-        m_helpEngine->setCurrentFilter(m_currentFilter);
+        helpEngine.setCurrentFilter(m_currentFilter);
     }
 
@@ -324,5 +402,6 @@
         m_mainWindow->syncContents();
 
-    if (m_expandTOC != -3)
+    Q_ASSERT(m_expandTOC >= -2);
+    if (m_expandTOC != -2)
         m_mainWindow->expandTOC(m_expandTOC);
 
@@ -332,4 +411,5 @@
 void RemoteControl::clearCache()
 {
+    TRACE_OBJ
     m_currentFilter.clear();
     m_setSource.clear();
Index: trunk/tools/assistant/tools/assistant/remotecontrol.h
===================================================================
--- trunk/tools/assistant/tools/assistant/remotecontrol.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/remotecontrol.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,10 +44,11 @@
 
 #include <QtCore/QObject>
+#include <QtCore/QString>
 #include <QtCore/QUrl>
 
 QT_BEGIN_NAMESPACE
 
+class HelpEngineWrapper;
 class MainWindow;
-class QHelpEngine;
 
 class RemoteControl : public QObject
@@ -56,5 +57,5 @@
 
 public:
-    RemoteControl(MainWindow *mainWindow, QHelpEngine *helpEngine);
+    RemoteControl(MainWindow *mainWindow);
 
 private slots:
@@ -65,8 +66,18 @@
 private:
     void clearCache();
+    void splitInputString(const QString &input, QString &cmd, QString &arg);
+    void handleDebugCommand(const QString &arg);
+    void handleShowOrHideCommand(const QString &arg, bool show);
+    void handleSetSourceCommand(const QString &arg);
+    void handleSyncContentsCommand();
+    void handleActivateKeywordCommand(const QString &arg);
+    void handleActivateIdentifierCommand(const QString &arg);
+    void handleExpandTocCommand(const QString &arg);
+    void handleSetCurrentFilterCommand(const QString &arg);
+    void handleRegisterCommand(const QString &arg);
+    void handleUnregisterCommand(const QString &arg);
 
 private:
     MainWindow *m_mainWindow;
-    QHelpEngine *m_helpEngine;
     bool m_debug;
 
@@ -78,4 +89,5 @@
     int m_expandTOC;
     QString m_currentFilter;
+    HelpEngineWrapper &helpEngine;
 };
 
Index: trunk/tools/assistant/tools/assistant/remotecontrol_win.h
===================================================================
--- trunk/tools/assistant/tools/assistant/remotecontrol_win.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/remotecontrol_win.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/assistant/searchwidget.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/searchwidget.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/searchwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,4 +39,5 @@
 **
 ****************************************************************************/
+#include "tracer.h"
 
 #include "mainwindow.h"
@@ -66,4 +67,5 @@
     , searchEngine(engine)
 {
+    TRACE_OBJ
     QVBoxLayout *vLayout = new QVBoxLayout(this);
 
@@ -92,4 +94,5 @@
 SearchWidget::~SearchWidget()
 {
+    TRACE_OBJ
     // nothing todo
 }
@@ -97,4 +100,5 @@
 void SearchWidget::zoomIn()
 {
+    TRACE_OBJ
     QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
     if (browser && zoomCount != 10) {
@@ -106,4 +110,5 @@
 void SearchWidget::zoomOut()
 {
+    TRACE_OBJ
     QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
     if (browser && zoomCount != -5) {
@@ -115,4 +120,5 @@
 void SearchWidget::resetZoom()
 {
+    TRACE_OBJ
     if (zoomCount == 0)
         return;
@@ -127,4 +133,5 @@
 bool SearchWidget::isAttached() const
 {
+    TRACE_OBJ
     return attached;
 }
@@ -132,4 +139,5 @@
 void SearchWidget::setAttached(bool state)
 {
+    TRACE_OBJ
     attached = state;
 }
@@ -137,4 +145,5 @@
 void SearchWidget::search() const
 {
+    TRACE_OBJ
     QList<QHelpSearchQuery> query = searchEngine->queryWidget()->query();
     searchEngine->search(query);
@@ -143,4 +152,5 @@
 void SearchWidget::searchingStarted()
 {
+    TRACE_OBJ
     qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 }
@@ -148,4 +158,5 @@
 void SearchWidget::searchingFinished(int hits)
 {
+    TRACE_OBJ
     Q_UNUSED(hits)
     qApp->restoreOverrideCursor();
@@ -154,4 +165,5 @@
 bool SearchWidget::eventFilter(QObject* o, QEvent *e)
 {
+    TRACE_OBJ
     QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
     if (browser && o == browser->viewport()
@@ -172,4 +184,5 @@
 void SearchWidget::keyPressEvent(QKeyEvent *keyEvent)
 {
+    TRACE_OBJ
     if (keyEvent->key() == Qt::Key_Escape)
         MainWindow::activateCurrentBrowser();
@@ -180,4 +193,5 @@
 void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
 {
+    TRACE_OBJ
     QMenu menu;
     QPoint point = contextMenuEvent->globalPos();
Index: trunk/tools/assistant/tools/assistant/searchwidget.h
===================================================================
--- trunk/tools/assistant/tools/assistant/searchwidget.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/searchwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -59,5 +59,5 @@
 
 public:
-    SearchWidget(QHelpSearchEngine *engine, QWidget *parent = 0);
+    explicit SearchWidget(QHelpSearchEngine *engine, QWidget *parent = 0);
     ~SearchWidget();
 
Index: trunk/tools/assistant/tools/assistant/topicchooser.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/topicchooser.cpp	(revision 769)
+++ trunk/tools/assistant/tools/assistant/topicchooser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,7 +39,5 @@
 **
 ****************************************************************************/
-
-#include <QtCore/QMap>
-#include <QtCore/QUrl>
+#include "tracer.h"
 
 #include "topicchooser.h"
@@ -51,11 +49,13 @@
     : QDialog(parent)
 {
+    TRACE_OBJ
     ui.setupUi(this);
     ui.label->setText(tr("Choose a topic for <b>%1</b>:").arg(keyword));
 
-    m_links = links;
-    QMap<QString, QUrl>::const_iterator it = m_links.constBegin();
-    for (; it != m_links.constEnd(); ++it)
+    QMap<QString, QUrl>::const_iterator it = links.constBegin();
+    for (; it != links.constEnd(); ++it) {
         ui.listWidget->addItem(it.key());
+        m_links.append(it.value());
+    }
     
     if (ui.listWidget->count() != 0)
@@ -63,14 +63,13 @@
     ui.listWidget->setFocus();
 
-    connect(ui.buttonDisplay, SIGNAL(clicked()),
-        this, SLOT(accept()));
-    connect(ui.buttonCancel, SIGNAL(clicked()),
-        this, SLOT(reject()));
-    connect(ui.listWidget, SIGNAL(itemActivated(QListWidgetItem*)),
-        this, SLOT(accept()));
+    connect(ui.buttonDisplay, SIGNAL(clicked()), this, SLOT(accept()));
+    connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+    connect(ui.listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this,
+        SLOT(accept()));
 }
 
 QUrl TopicChooser::link() const
 {
+    TRACE_OBJ
     QListWidgetItem *item = ui.listWidget->currentItem();
     if (!item)
@@ -78,8 +77,10 @@
 
     QString title = item->text();
-    if (title.isEmpty() || !m_links.contains(title))
+    if (title.isEmpty())
         return QUrl();
 
-    return m_links.value(title);
+    const int row = ui.listWidget->row(item);
+    Q_ASSERT(row < m_links.count());
+    return m_links.at(row);
 }
 
Index: trunk/tools/assistant/tools/assistant/topicchooser.h
===================================================================
--- trunk/tools/assistant/tools/assistant/topicchooser.h	(revision 769)
+++ trunk/tools/assistant/tools/assistant/topicchooser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,7 +45,8 @@
 #include "ui_topicchooser.h"
 
-#include <QUrl>
-#include <QMap>
-#include <QString>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QUrl>
 
 #include <QtGui/QDialog>
@@ -65,5 +66,5 @@
 private:
     Ui::TopicChooser ui;
-    QMap<QString, QUrl> m_links;
+    QList<QUrl> m_links;
 };
 
Index: trunk/tools/assistant/tools/assistant/tracer.h
===================================================================
--- trunk/tools/assistant/tools/assistant/tracer.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/tracer.h	(revision 846)
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TRACER_H
+#define TRACER_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+class Tracer
+{
+public:
+    Tracer(const char *func) : m_func(func)
+    {
+        qDebug("Entering function %s.", m_func);
+    }
+
+    ~Tracer()
+    {
+        qDebug("Leaving function %s.", m_func);
+    }
+
+private:
+    const char * const m_func;
+};
+
+QT_END_NAMESPACE
+
+// #define TRACING_REQUESTED
+#ifdef TRACING_REQUESTED
+#define TRACE_OBJ Tracer traceObj__(Q_FUNC_INFO);
+#else
+#define TRACE_OBJ
+#endif
+
+#endif // TRACER_H
Index: trunk/tools/assistant/tools/assistant/xbelsupport.cpp
===================================================================
--- trunk/tools/assistant/tools/assistant/xbelsupport.cpp	(revision 846)
+++ trunk/tools/assistant/tools/assistant/xbelsupport.cpp	(revision 846)
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "tracer.h"
+
+#include "xbelsupport.h"
+
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
+
+#include <QtCore/QDate>
+#include <QtCore/QModelIndex>
+
+QT_BEGIN_NAMESPACE
+
+struct Bookmark {
+    QString title;
+    QString url;
+    bool folded;
+};
+
+XbelWriter::XbelWriter(BookmarkModel *model)
+    : QXmlStreamWriter()
+    , bookmarkModel(model)
+{
+    TRACE_OBJ
+    setAutoFormatting(true);
+}
+
+void XbelWriter::writeToFile(QIODevice *device)
+{
+    TRACE_OBJ
+    setDevice(device);
+
+    writeStartDocument();
+    writeDTD(QLatin1String("<!DOCTYPE xbel>"));
+    writeStartElement(QLatin1String("xbel"));
+    writeAttribute(QLatin1String("version"), QLatin1String("1.0"));
+
+    const QModelIndex &root = bookmarkModel->index(0,0, QModelIndex());
+    for (int i = 0; i < bookmarkModel->rowCount(root); ++i)
+        writeData(bookmarkModel->index(i, 0, root));
+    writeEndDocument();
+}
+
+void XbelWriter::writeData(const QModelIndex &index)
+{
+    TRACE_OBJ
+    if (index.isValid()) {
+        Bookmark entry;
+        entry.title = index.data().toString();
+        entry.url = index.data(UserRoleUrl).toString();
+
+        if (index.data(UserRoleFolder).toBool()) {
+            writeStartElement(QLatin1String("folder"));
+            entry.folded = !index.data(UserRoleExpanded).toBool();
+            writeAttribute(QLatin1String("folded"), entry.folded
+                ? QLatin1String("yes") : QLatin1String("no"));
+            writeTextElement(QLatin1String("title"), entry.title);
+
+            for (int i = 0; i < bookmarkModel->rowCount(index); ++i)
+                writeData(bookmarkModel->index(i, 0 , index));
+            writeEndElement();
+        } else {
+            writeStartElement(QLatin1String("bookmark"));
+            writeAttribute(QLatin1String("href"), entry.url);
+            writeTextElement(QLatin1String("title"), entry.title);
+            writeEndElement();
+        }
+    }
+}
+
+// -- XbelReader
+
+XbelReader::XbelReader(BookmarkModel *model)
+    : QXmlStreamReader()
+    , bookmarkModel(model)
+{
+    TRACE_OBJ
+}
+
+bool XbelReader::readFromFile(QIODevice *device)
+{
+    TRACE_OBJ
+    setDevice(device);
+
+    while (!atEnd()) {
+        readNext();
+
+        if (isStartElement()) {
+            if (name() == QLatin1String("xbel")
+                && attributes().value(QLatin1String("version"))
+                    == QLatin1String("1.0")) {
+                const QModelIndex &root = bookmarkModel->index(0,0, QModelIndex());
+                parents.append(bookmarkModel->addItem(root, true));
+                readXBEL();
+                bookmarkModel->setData(parents.first(),
+                    QDate::currentDate().toString(Qt::ISODate), Qt::EditRole);
+            } else {
+                raiseError(QLatin1String("The file is not an XBEL version 1.0 file."));
+            }
+        }
+    }
+
+    return !error();
+}
+
+void XbelReader::readXBEL()
+{
+    TRACE_OBJ
+    while (!atEnd()) {
+        readNext();
+
+        if (isEndElement())
+            break;
+
+        if (isStartElement()) {
+            if (name() == QLatin1String("folder"))
+                readFolder();
+            else if (name() == QLatin1String("bookmark"))
+                readBookmark();
+            else
+                readUnknownElement();
+        }
+    }
+}
+
+void XbelReader::readFolder()
+{
+    TRACE_OBJ
+    parents.append(bookmarkModel->addItem(parents.last(), true));
+    bookmarkModel->setData(parents.last(),
+        attributes().value(QLatin1String("folded")) == QLatin1String("no"),
+        UserRoleExpanded);
+
+    while (!atEnd()) {
+        readNext();
+
+        if (isEndElement())
+            break;
+
+        if (isStartElement()) {
+            if (name() == QLatin1String("title")) {
+                bookmarkModel->setData(parents.last(), readElementText(),
+                    Qt::EditRole);
+            } else if (name() == QLatin1String("folder"))
+                readFolder();
+            else if (name() == QLatin1String("bookmark"))
+                readBookmark();
+            else
+                readUnknownElement();
+        }
+    }
+
+    parents.removeLast();
+}
+
+void XbelReader::readBookmark()
+{
+    TRACE_OBJ
+    const QModelIndex &index = bookmarkModel->addItem(parents.last(), false);
+    if (BookmarkItem* item = bookmarkModel->itemFromIndex(index)) {
+        item->setData(UserRoleUrl, attributes().value(QLatin1String("href"))
+            .toString());
+    }
+
+    while (!atEnd()) {
+        readNext();
+
+        if (isEndElement())
+            break;
+
+        if (isStartElement()) {
+            if (name() == QLatin1String("title"))
+                bookmarkModel->setData(index, readElementText(), Qt::EditRole);
+            else
+                readUnknownElement();
+        }
+    }
+}
+
+void XbelReader::readUnknownElement()
+{
+    TRACE_OBJ
+    while (!atEnd()) {
+        readNext();
+
+        if (isEndElement())
+            break;
+
+        if (isStartElement())
+            readUnknownElement();
+    }
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/assistant/xbelsupport.h
===================================================================
--- trunk/tools/assistant/tools/assistant/xbelsupport.h	(revision 846)
+++ trunk/tools/assistant/tools/assistant/xbelsupport.h	(revision 846)
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef XBELSUPPORT_H
+#define XBELSUPPORT_H
+
+#include <QtXml/QXmlStreamReader>
+#include <QtCore/QPersistentModelIndex>
+
+QT_FORWARD_DECLARE_CLASS(QIODevice)
+QT_FORWARD_DECLARE_CLASS(QModelIndex)
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkModel;
+
+class XbelWriter : public QXmlStreamWriter
+{
+public:
+    XbelWriter(BookmarkModel *model);
+    void writeToFile(QIODevice *device);
+
+private:
+    void writeData(const QModelIndex &index);
+
+private:
+    BookmarkModel *bookmarkModel;
+};
+
+class XbelReader : public QXmlStreamReader
+{
+public:
+    XbelReader(BookmarkModel *model);
+    bool readFromFile(QIODevice *device);
+
+private:
+    void readXBEL();
+    void readFolder();
+    void readBookmark();
+    void readUnknownElement();
+
+private:
+    BookmarkModel *bookmarkModel;
+    QList<QPersistentModelIndex> parents;
+};
+
+QT_END_NAMESPACE
+
+#endif  // XBELSUPPORT_H
Index: trunk/tools/assistant/tools/qcollectiongenerator/main.cpp
===================================================================
--- trunk/tools/assistant/tools/qcollectiongenerator/main.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qcollectiongenerator/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,20 +40,28 @@
 ****************************************************************************/
 
+#include "../shared/collectionconfiguration.h"
 #include "../shared/helpgenerator.h"
 
+#include <private/qhelpgenerator_p.h>
+#include <private/qhelpprojectdata_p.h>
+
+#include <QtCore/QCoreApplication>
 #include <QtCore/QDir>
 #include <QtCore/QMap>
 #include <QtCore/QFileInfo>
-#include <QtCore/QCoreApplication>
 #include <QtCore/QDateTime>
 #include <QtCore/QBuffer>
-
-#include <private/qhelpgenerator_p.h>
-#include <private/qhelpprojectdata_p.h>
+#include <QtCore/QTranslator>
+#include <QtCore/QLocale>
+#include <QtCore/QLibraryInfo>
 #include <QtHelp/QHelpEngineCore>
-
 #include <QtXml/QXmlStreamReader>
 
+
 QT_USE_NAMESPACE
+
+class QCG {
+    Q_DECLARE_TR_FUNCTIONS(QCollectionGenerator)
+};
 
 class CollectionConfigReader : public QXmlStreamReader
@@ -88,4 +96,5 @@
 
     QString cacheDirectory() const { return m_cacheDirectory; }
+    bool cacheDirRelativeToCollection() const { return m_cacheDirRelativeToCollection; }
 
 private:
@@ -116,10 +125,10 @@
     QStringList m_filesToRegister;
     QString m_cacheDirectory;
+    bool m_cacheDirRelativeToCollection;
 };
 
 void CollectionConfigReader::raiseErrorWithLine()
 {
-    raiseError(QObject::tr("Unknown token at line %1.")
-                    .arg(lineNumber()));
+    raiseError(QCG::tr("Unknown token at line %1.").arg(lineNumber()));
 }
 
@@ -140,6 +149,7 @@
                 readConfig();
             else
-                raiseError(QObject::tr("Unknown token at line %1. Expected \"QtHelpCollectionProject\"!")
-                .arg(lineNumber()));
+                raiseError(QCG::tr("Unknown token at line %1. "
+                                   "Expected \"QtHelpCollectionProject\".")
+                           .arg(lineNumber()));
         }
     }
@@ -163,5 +173,5 @@
     }
     if (!ok && !hasError())
-        raiseError(QLatin1String("Missing end tags."));
+        raiseError(QCG::tr("Missing end tags."));
 }
 
@@ -199,4 +209,7 @@
                 readAboutDialog();
             } else if (name() == "cacheDirectory") {
+                m_cacheDirRelativeToCollection =
+                    attributes().value(QLatin1String("base"))
+                    == QLatin1String("collection");
                 m_cacheDirectory = readElementText();
             } else {
@@ -302,5 +315,5 @@
     }
     if (input.isEmpty() || output.isEmpty()) {
-        raiseError(QLatin1String("Missing input or output file for help file generation!"));
+        raiseError(QCG::tr("Missing input or output file for help file generation."));
         return;
     }
@@ -320,4 +333,12 @@
             break;
         }
+    }
+}
+
+namespace {
+    QString absoluteFileName(const QString &basePath, const QString &fileName)
+    {
+        return QFileInfo(fileName).isAbsolute() ?
+            fileName : basePath + QDir::separator() + fileName;
     }
 }
@@ -333,4 +354,20 @@
     bool showVersion = false;
 
+    QCoreApplication app(argc, argv);
+#ifndef Q_OS_WIN32
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QTranslator qt_helpTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)
+        && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+        app.installTranslator(&qt_helpTranslator);
+    }
+#endif // Q_OS_WIN32
+
     for (int i=1; i<argc; ++i) {
         arg = QString::fromLocal8Bit(argv[i]);
@@ -340,5 +377,5 @@
                 collectionFile = fi.absoluteFilePath();
             } else {
-                error = QObject::tr("Missing output file name!");
+                error = QCG::tr("Missing output file name.");
             }
         } else if (arg == QLatin1String("-h")) {
@@ -354,12 +391,13 @@
 
     if (showVersion) {
-        fprintf(stdout, "Qt Collection Generator version 1.0 (Qt %s)\n", QT_VERSION_STR);
+        fputs(qPrintable(QCG::tr("Qt Collection Generator version 1.0 (Qt %1)\n")
+                .arg(QT_VERSION_STR)), stdout);
         return 0;
     }
 
     if (configFile.isEmpty() && !showHelp)
-        error = QObject::tr("Missing collection config file!");
-
-    QString help = QObject::tr("\nUsage:\n\n"
+        error = QCG::tr("Missing collection config file.");
+
+    QString help = QCG::tr("\nUsage:\n\n"
         "qcollectiongenerator <collection-config-file> [options]\n\n"
         "  -o <collection-file>   Generates a collection file\n"
@@ -371,5 +409,5 @@
 
     if (showHelp) {
-        fprintf(stdout, "%s", qPrintable(help));
+        fputs(qPrintable(help), stdout);
         return 0;
     }else if (!error.isEmpty()) {
@@ -380,5 +418,5 @@
     QFile file(configFile);
     if (!file.open(QIODevice::ReadOnly)) {
-        fprintf(stderr, "Could not open %s!\n", qPrintable(configFile));
+        fputs(qPrintable(QCG::tr("Could not open %1.\n").arg(configFile)), stderr);
         return -1;
     }
@@ -390,11 +428,10 @@
     }
 
-    QCoreApplication app(argc, argv);
-
-    fprintf(stdout, "Reading collection config file...\n");
+    fputs(qPrintable(QCG::tr("Reading collection config file...\n")), stdout);
     CollectionConfigReader config;
     config.readData(file.readAll());
     if (config.hasError()) {
-        fprintf(stderr, "Collection config file error: %s\n", qPrintable(config.errorString()));
+        fputs(qPrintable(QCG::tr("Collection config file error: %1\n")
+                         .arg(config.errorString())), stderr);
         return -1;
     }
@@ -402,7 +439,7 @@
     QMap<QString, QString>::const_iterator it = config.filesToGenerate().constBegin();
     while (it != config.filesToGenerate().constEnd()) {
-        fprintf(stdout, "Generating help for %s...\n", qPrintable(it.key()));
+        fputs(qPrintable(QCG::tr("Generating help for %1...\n").arg(it.key())), stdout);
         QHelpProjectData helpData;
-        if (!helpData.readData(basePath + QDir::separator() + it.key())) {
+        if (!helpData.readData(absoluteFileName(basePath, it.key()))) {
             fprintf(stderr, "%s\n", qPrintable(helpData.errorMessage()));
             return -1;
@@ -410,5 +447,5 @@
 
         HelpGenerator helpGenerator;
-        if (!helpGenerator.generate(&helpData, basePath + QDir::separator() + it.value())) {
+        if (!helpGenerator.generate(&helpData, absoluteFileName(basePath, it.value()))) {
             fprintf(stderr, "%s\n", qPrintable(helpGenerator.error()));
             return -1;
@@ -417,10 +454,11 @@
     }
 
-    fprintf(stdout, "Creating collection file...\n");
+    fputs(qPrintable(QCG::tr("Creating collection file...\n")), stdout);
 
     QFileInfo colFi(collectionFile);
     if (colFi.exists()) {
         if (!colFi.dir().remove(colFi.fileName())) {
-            fprintf(stderr, "The file %s cannot be overwritten!\n", qPrintable(collectionFile));
+            fputs(qPrintable(QCG::tr("The file %1 cannot be overwritten.\n")
+                             .arg(collectionFile)), stderr);
             return -1;
         }
@@ -434,47 +472,54 @@
 
     foreach (const QString &file, config.filesToRegister()) {
-        if (!helpEngine.registerDocumentation(basePath + QDir::separator() + file)) {
+        if (!helpEngine.registerDocumentation(absoluteFileName(basePath, file))) {
             fprintf(stderr, "%s\n", qPrintable(helpEngine.error()));
             return -1;
         }
     }
+    if (!config.filesToRegister().isEmpty())
+        CollectionConfiguration::updateLastRegisterTime(helpEngine);
 
     if (!config.title().isEmpty())
-        helpEngine.setCustomValue(QLatin1String("WindowTitle"), config.title());
+        CollectionConfiguration::setWindowTitle(helpEngine, config.title());
 
     if (!config.homePage().isEmpty()) {
-        helpEngine.setCustomValue(QLatin1String("defaultHomepage"),
-        config.homePage());
-    }
-
-    if (!config.startPage().isEmpty())
-        helpEngine.setCustomValue(QLatin1String("LastShownPages"), config.startPage());
-
-    if (!config.currentFilter().isEmpty())
-        helpEngine.setCustomValue(QLatin1String("CurrentFilter"), config.currentFilter());
-
-    if (!config.cacheDirectory().isEmpty())
-        helpEngine.setCustomValue(QLatin1String("CacheDirectory"), config.cacheDirectory());
-
-    helpEngine.setCustomValue(QLatin1String("EnableFilterFunctionality"),
+        CollectionConfiguration::setDefaultHomePage(helpEngine,
+            config.homePage());
+    }
+
+    if (!config.startPage().isEmpty()) {
+        CollectionConfiguration::setLastShownPages(helpEngine,
+            QStringList(config.startPage()));
+    }
+
+    if (!config.currentFilter().isEmpty()) {
+        helpEngine.setCurrentFilter(config.currentFilter());
+    }
+
+    if (!config.cacheDirectory().isEmpty()) {
+        CollectionConfiguration::setCacheDir(helpEngine, config.cacheDirectory(),
+            config.cacheDirRelativeToCollection());
+    }
+
+    CollectionConfiguration::setFilterFunctionalityEnabled(helpEngine,
         config.enableFilterFunctionality());
-    helpEngine.setCustomValue(QLatin1String("HideFilterFunctionality"),
-        config.hideFilterFunctionality());
-    helpEngine.setCustomValue(QLatin1String("EnableDocumentationManager"),
+    CollectionConfiguration::setFilterToolbarVisible(helpEngine,
+        !config.hideFilterFunctionality());
+    CollectionConfiguration::setDocumentationManagerEnabled(helpEngine,
         config.enableDocumentationManager());
-    helpEngine.setCustomValue(QLatin1String("EnableAddressBar"),
+    CollectionConfiguration::setAddressBarEnabled(helpEngine,
         config.enableAddressBar());
-    helpEngine.setCustomValue(QLatin1String("HideAddressBar"),
-        config.hideAddressBar());
-    helpEngine.setCustomValue(QLatin1String("CreationTime"),
+    CollectionConfiguration::setAddressBarVisible(helpEngine,
+         !config.hideAddressBar());
+    CollectionConfiguration::setCreationTime(helpEngine,
         QDateTime::currentDateTime().toTime_t());
 
     if (!config.applicationIcon().isEmpty()) {
-        QFile icon(basePath + QDir::separator() + config.applicationIcon());
+        QFile icon(absoluteFileName(basePath, config.applicationIcon()));
         if (!icon.open(QIODevice::ReadOnly)) {
-            fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName()));
+            fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr);
             return -1;
         }
-        helpEngine.setCustomValue(QLatin1String("ApplicationIcon"), icon.readAll());
+        CollectionConfiguration::setApplicationIcon(helpEngine, icon.readAll());
     }
 
@@ -488,14 +533,14 @@
             ++it;
         }
-        helpEngine.setCustomValue(QLatin1String("AboutMenuTexts"), ba);
+        CollectionConfiguration::setAboutMenuTexts(helpEngine, ba);
     }
 
     if (!config.aboutIcon().isEmpty()) {
-        QFile icon(basePath + QDir::separator() + config.aboutIcon());
+        QFile icon(absoluteFileName(basePath, config.aboutIcon()));
         if (!icon.open(QIODevice::ReadOnly)) {
-            fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName()));
+            fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr);
             return -1;
         }
-        helpEngine.setCustomValue(QLatin1String("AboutIcon"), icon.readAll());
+        CollectionConfiguration::setAboutIcon(helpEngine, icon.readAll());
     }
 
@@ -513,8 +558,8 @@
         while (it != config.aboutTextFiles().constEnd()) {
             s << it.key();
-            QFileInfo fi(basePath + QDir::separator() + it.value());
+            QFileInfo fi(absoluteFileName(basePath, it.value()));
             QFile f(fi.absoluteFilePath());
             if (!f.open(QIODevice::ReadOnly)) {
-                fprintf(stderr, "Cannot open %s!\n", qPrintable(f.fileName()));
+                fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(f.fileName())), stderr);
                 return -1;
             }
@@ -538,6 +583,6 @@
                             imgData.insert(src, img.readAll());
                     } else {
-                        fprintf(stderr, "Cannot open referenced image file %s!\n",
-                            qPrintable(img.fileName()));
+                        fputs(qPrintable(QCG::tr("Cannot open referenced image file %1.\n")
+                                         .arg(img.fileName())), stderr);
                     }
                 }
@@ -545,5 +590,5 @@
             ++it;
         }
-        helpEngine.setCustomValue(QLatin1String("AboutTexts"), ba);
+        CollectionConfiguration::setAboutTexts(helpEngine, ba);
         if (imgData.count()) {
             QByteArray imageData;
@@ -552,5 +597,5 @@
             QDataStream out(&buffer);
             out << imgData;
-            helpEngine.setCustomValue(QLatin1String("AboutImages"), imageData);
+            CollectionConfiguration::setAboutImages(helpEngine, imageData);
         }
     }
Index: trunk/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro
===================================================================
--- trunk/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro	(revision 769)
+++ trunk/tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro	(revision 846)
@@ -1,14 +1,17 @@
-QT += xml network
+QT += xml \
+    network
 TEMPLATE = app
 DESTDIR = ../../../../bin
 TARGET = qcollectiongenerator
-CONFIG += qt warn_on help console
+CONFIG += qt \
+    warn_on \
+    help \
+    console
 CONFIG -= app_bundle
-
-target.path=$$[QT_INSTALL_BINS]
+target.path = $$[QT_INSTALL_BINS]
 INSTALLS += target
-
 SOURCES += ../shared/helpgenerator.cpp \
-           main.cpp
-
-HEADERS += ../shared/helpgenerator.h
+    main.cpp \
+    ../shared/collectionconfiguration.cpp
+HEADERS += ../shared/helpgenerator.h \
+    ../shared/collectionconfiguration.h
Index: trunk/tools/assistant/tools/qhelpconverter/adpreader.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/adpreader.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/adpreader.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/adpreader.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/adpreader.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/adpreader.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/conversionwizard.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/conversionwizard.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/conversionwizard.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/conversionwizard.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/conversionwizard.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/conversionwizard.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/filespage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/filespage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/filespage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -60,6 +60,6 @@
         this, SLOT(removeAllFiles()));
 
-    m_ui.fileLabel->setText(tr("<p><b>Warning:</b> Be aware "
-        "when removing images or stylesheets since those files "
+    m_ui.fileLabel->setText(tr("<p><b>Warning:</b> "
+        "When removing images or stylesheets, be aware that those files "
         "are not directly referenced by the .adp or .dcf "
         "file.</p>"));
Index: trunk/tools/assistant/tools/qhelpconverter/filespage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/filespage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/filespage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/filterpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/filterpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/filterpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -51,5 +51,5 @@
     setSubTitle(tr("Specify the filter attributes for the "
         "documentation. If filter attributes are used, "
-        "also define a custom filter for it. Both, the "
+        "also define a custom filter for it. Both the "
         "filter attributes and the custom filters are "
         "optional."));
@@ -128,5 +128,5 @@
     QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.customFilterWidget);
     item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsSelectable);
-    item->setText(0, QLatin1String("unfiltered"));
+    item->setText(0, tr("unfiltered", "list of available documentation"));
     item->setText(1, QLatin1String(""));
     m_ui.customFilterWidget->editItem(item, 0);
Index: trunk/tools/assistant/tools/qhelpconverter/filterpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/filterpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/filterpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/finishpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/finishpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/finishpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -53,6 +53,5 @@
 {
     setTitle(tr("Converting File"));
-    setSubTitle(QLatin1String("Creating the new Qt help files from the "
-        "old .adp file."));
+    setSubTitle(tr("Creating the new Qt help files from the old ADP file."));
     setFinalPage(true);
 
Index: trunk/tools/assistant/tools/qhelpconverter/finishpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/finishpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/finishpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/generalpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/generalpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/generalpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/generalpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/generalpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/generalpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/helpwindow.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/helpwindow.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/helpwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,5 +65,5 @@
     layout = new QVBoxLayout(frame);
     layout->setMargin(2);
-    QLabel *l = new QLabel(QLatin1String("<center><b>Wizard Assistant</b></center>"));
+    QLabel *l = new QLabel(tr("<center><b>Wizard Assistant</b></center>"));
     layout->addWidget(l);
     m_textEdit = new QTextEdit();
Index: trunk/tools/assistant/tools/qhelpconverter/helpwindow.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/helpwindow.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/helpwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/identifierpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/identifierpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/identifierpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/identifierpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/identifierpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/identifierpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/inputpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/inputpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/inputpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/inputpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/inputpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/inputpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -55,5 +55,5 @@
 
 public:
-    InputPage(AdpReader *reader, QWidget *parent = 0);
+    explicit InputPage(AdpReader *reader, QWidget *parent = 0);
     
 private slots:
Index: trunk/tools/assistant/tools/qhelpconverter/main.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/main.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -41,4 +41,7 @@
 
 #include <QtCore/QFileInfo>
+#include <QtCore/QTranslator>
+#include <QtCore/QLocale>
+#include <QtCore/QLibraryInfo>
 #include <QtGui/QApplication>
 
@@ -50,4 +53,16 @@
 {
     QApplication app(argc, argv);
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QTranslator qt_helpTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)
+        && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+        app.installTranslator(&qt_helpTranslator);
+    }
 
     ConversionWizard w;
Index: trunk/tools/assistant/tools/qhelpconverter/outputpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/outputpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/outputpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/outputpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/outputpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/outputpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/pathpage.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/pathpage.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/pathpage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/pathpage.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/pathpage.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/pathpage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/qhcpwriter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/qhpwriter.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/qhpwriter.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/qhpwriter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpconverter/qhpwriter.h
===================================================================
--- trunk/tools/assistant/tools/qhelpconverter/qhpwriter.h	(revision 769)
+++ trunk/tools/assistant/tools/qhelpconverter/qhpwriter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/assistant/tools/qhelpgenerator/main.cpp
===================================================================
--- trunk/tools/assistant/tools/qhelpgenerator/main.cpp	(revision 769)
+++ trunk/tools/assistant/tools/qhelpgenerator/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,8 +45,15 @@
 #include <QtCore/QFileInfo>
 #include <QtCore/QCoreApplication>
+#include <QtCore/QTranslator>
+#include <QtCore/QLocale>
+#include <QtCore/QLibraryInfo>
 
 #include <private/qhelpprojectdata_p.h>
 
 QT_USE_NAMESPACE
+
+class QHG {
+    Q_DECLARE_TR_FUNCTIONS(QHelpGenerator)
+};
 
 int main(int argc, char *argv[])
@@ -59,4 +66,21 @@
     bool showHelp = false;
     bool showVersion = false;
+    bool checkLinks = false;
+
+    QCoreApplication app(argc, argv);
+#ifndef Q_OS_WIN32
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QTranslator qt_helpTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)
+        && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+        app.installTranslator(&qt_helpTranslator);
+    }
+#endif // Q_OS_WIN32
 
     for (int i = 1; i < argc; ++i) {
@@ -67,5 +91,5 @@
                 compressedFile = fi.absoluteFilePath();
             } else {
-                error = QObject::tr("Missing output file name!");
+                error = QHG::tr("Missing output file name.");
             }
         } else if (arg == QLatin1String("-v")) {
@@ -73,4 +97,6 @@
         } else if (arg == QLatin1String("-h")) {
             showHelp = true;
+        } else if (arg == QLatin1String("-c")) {
+            checkLinks = true;
         } else {
             QFileInfo fi(arg);
@@ -81,12 +107,13 @@
 
     if (showVersion) {
-        fprintf(stdout, "Qt Help Generator version 1.0 (Qt %s)\n", QT_VERSION_STR);
+        fputs(qPrintable(QHG::tr("Qt Help Generator version 1.0 (Qt %1)\n")
+                         .arg(QT_VERSION_STR)), stdout);
         return 0;
     }
 
     if (projectFile.isEmpty() && !showHelp)
-        error = QObject::tr("Missing Qt help project file!");
+        error = QHG::tr("Missing Qt help project file.");
 
-    QString help = QObject::tr("\nUsage:\n\n"
+    QString help = QHG::tr("\nUsage:\n\n"
         "qhelpgenerator <help-project-file> [options]\n\n"
         "  -o <compressed-file>   Generates a Qt compressed help\n"
@@ -94,9 +121,11 @@
         "                         If this option is not specified\n"
         "                         a default name will be used.\n"
+        "  -c                     Checks whether all links in HTML files\n"
+        "                         point to files in this help project.\n"
         "  -v                     Displays the version of \n"
         "                         qhelpgenerator.\n\n");
 
     if (showHelp) {
-        fprintf(stdout, "%s", qPrintable(help));
+        fputs(qPrintable(help), stdout);
         return 0;
     }else if (!error.isEmpty()) {
@@ -107,12 +136,14 @@
     QFile file(projectFile);
     if (!file.open(QIODevice::ReadOnly)) {
-        fprintf(stderr, "Could not open %s!\n", qPrintable(projectFile));
+        fputs(qPrintable(QHG::tr("Could not open %1.\n").arg(projectFile)), stderr);
         return -1;
     }
 
     if (compressedFile.isEmpty()) {
-        QFileInfo fi(projectFile);
-        compressedFile = basePath + QDir::separator()
-            + fi.baseName() + QLatin1String(".qch");
+        if (!checkLinks) {
+            QFileInfo fi(projectFile);
+            compressedFile = basePath + QDir::separator()
+                             + fi.baseName() + QLatin1String(".qch");
+        }
     } else {
         // check if the output dir exists -- create if it doesn't
@@ -121,6 +152,6 @@
         if (!parentDir.exists()) {
             if (!parentDir.mkpath(QLatin1String("."))) {
-                fprintf(stderr, "Could not create output directory: %s\n",
-                        qPrintable(parentDir.path()));
+                fputs(qPrintable(QHG::tr("Could not create output directory: %1\n")
+                                 .arg(parentDir.path())), stderr);
             }
         }
@@ -133,7 +164,10 @@
     }
 
-    QCoreApplication app(argc, argv);
     HelpGenerator generator;
-    bool success = generator.generate(helpData, compressedFile);
+    bool success = true;
+    if (checkLinks)
+        success = generator.checkLinks(*helpData);
+    if (success && !compressedFile.isEmpty())
+        success = generator.generate(helpData, compressedFile);
     delete helpData;
     if (!success) {
Index: trunk/tools/assistant/tools/shared/collectionconfiguration.cpp
===================================================================
--- trunk/tools/assistant/tools/shared/collectionconfiguration.cpp	(revision 846)
+++ trunk/tools/assistant/tools/shared/collectionconfiguration.cpp	(revision 846)
@@ -0,0 +1,313 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "collectionconfiguration.h"
+
+#include <QtHelp/QHelpEngineCore>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+    const QString AboutIconKey(QLatin1String("AboutIcon"));
+    const QString AboutImagesKey(QLatin1String("AboutImages"));
+    const QString AboutMenuTextsKey(QLatin1String("AboutMenuTexts"));
+    const QString AboutTextsKey(QLatin1String("AboutTexts"));
+    const QString ApplicationIconKey(QLatin1String("ApplicationIcon"));
+    const QString CacheDirKey(QLatin1String("CacheDirectory"));
+    const QString CacheDirRelativeToCollectionKey(QLatin1String("CacheDirRelativeToCollection"));
+    const QString CreationTimeKey(QLatin1String("CreationTime"));
+    const QString DefaultHomePageKey(QLatin1String("defaultHomepage"));
+    const QString EnableAddressBarKey(QLatin1String("EnableAddressBar"));
+    const QString EnableDocManagerKey(QLatin1String("EnableDocumentationManager"));
+    const QString EnableFilterKey(QLatin1String("EnableFilterFunctionality"));
+    const QString HideAddressBarKey(QLatin1String("HideAddressBar"));
+    const QString FilterToolbarHiddenKey(QLatin1String("HideFilterFunctionality"));
+    const QString LastPageKey(QLatin1String("LastTabPage"));
+    const QString LastRegisterTime(QLatin1String("LastRegisterTime"));
+    const QString LastShownPagesKey(QLatin1String("LastShownPages"));
+    const QString LastZoomFactorsKey(QLatin1String(
+#if !defined(QT_NO_WEBKIT)
+            "LastPagesZoomWebView"
+#else
+            "LastPagesZoomTextBrowser"
+#endif
+            ));
+    const QString WindowTitleKey(QLatin1String("WindowTitle"));
+} // anonymous namespace
+
+const QString CollectionConfiguration::DefaultZoomFactor(QLatin1String("0.0"));
+const QString CollectionConfiguration::ListSeparator(QLatin1String("|"));
+
+uint CollectionConfiguration::creationTime(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(CreationTimeKey, 0).toUInt();
+}
+
+void CollectionConfiguration::setCreationTime(QHelpEngineCore &helpEngine, uint time)
+{
+    helpEngine.setCustomValue(CreationTimeKey, time);
+}
+
+const QString CollectionConfiguration::windowTitle(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(WindowTitleKey).toString();
+}
+
+void CollectionConfiguration::setWindowTitle(QHelpEngineCore &helpEngine,
+                                             const QString &windowTitle)
+{
+    helpEngine.setCustomValue(WindowTitleKey, windowTitle);
+}
+
+bool CollectionConfiguration::filterFunctionalityEnabled(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(EnableFilterKey, true).toBool();
+}
+
+void CollectionConfiguration::setFilterFunctionalityEnabled(QHelpEngineCore &helpEngine,
+                                                            bool enabled)
+{
+    helpEngine.setCustomValue(EnableFilterKey, enabled);
+}
+
+bool CollectionConfiguration::filterToolbarVisible(const QHelpEngineCore &helpEngine)
+{
+    return !helpEngine.customValue(FilterToolbarHiddenKey, true).toBool();
+}
+
+void CollectionConfiguration::setFilterToolbarVisible(QHelpEngineCore &helpEngine,
+                                                      bool visible)
+{
+    helpEngine.setCustomValue(FilterToolbarHiddenKey, !visible);
+}
+
+bool CollectionConfiguration::addressBarEnabled(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(EnableAddressBarKey, true).toBool();
+}
+
+void CollectionConfiguration::setAddressBarEnabled(QHelpEngineCore &helpEngine,
+                                                   bool enabled)
+{
+    helpEngine.setCustomValue(EnableAddressBarKey, enabled);
+}
+
+bool CollectionConfiguration::addressBarVisible(const QHelpEngineCore &helpEngine)
+{
+    return !helpEngine.customValue(HideAddressBarKey, true).toBool();
+}
+
+void CollectionConfiguration::setAddressBarVisible(QHelpEngineCore &helpEngine,
+                                                   bool visible)
+{
+    helpEngine.setCustomValue(HideAddressBarKey, !visible);
+}
+
+const QString CollectionConfiguration::cacheDir(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(CacheDirKey).toString();
+}
+
+bool CollectionConfiguration::cacheDirIsRelativeToCollection(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(CacheDirRelativeToCollectionKey).toBool();
+}
+
+void CollectionConfiguration::setCacheDir(QHelpEngineCore &helpEngine,
+                            const QString &cacheDir, bool relativeToCollection)
+{
+    helpEngine.setCustomValue(CacheDirKey, cacheDir);
+    helpEngine.setCustomValue(CacheDirRelativeToCollectionKey,
+                              relativeToCollection);
+}
+
+bool CollectionConfiguration::documentationManagerEnabled(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(EnableDocManagerKey, true).toBool();
+}
+
+void CollectionConfiguration::setDocumentationManagerEnabled(QHelpEngineCore &helpEngine,
+                                                             bool enabled)
+{
+    helpEngine.setCustomValue(EnableDocManagerKey, enabled);
+}
+
+const QByteArray CollectionConfiguration::applicationIcon(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(ApplicationIconKey).toByteArray();
+}
+
+void CollectionConfiguration::setApplicationIcon(QHelpEngineCore &helpEngine,
+                                                 const QByteArray &icon)
+{
+    helpEngine.setCustomValue(ApplicationIconKey, icon);
+}
+
+const QByteArray CollectionConfiguration::aboutMenuTexts(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(AboutMenuTextsKey).toByteArray();
+}
+
+void CollectionConfiguration::setAboutMenuTexts(QHelpEngineCore &helpEngine,
+                                                const QByteArray &texts)
+{
+    helpEngine.setCustomValue(AboutMenuTextsKey, texts);
+}
+
+const QByteArray CollectionConfiguration::aboutIcon(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(AboutIconKey).toByteArray();
+}
+
+void CollectionConfiguration::setAboutIcon(QHelpEngineCore &helpEngine,
+                                           const QByteArray &icon)
+{
+    helpEngine.setCustomValue(AboutIconKey, icon);
+}
+
+const QByteArray CollectionConfiguration::aboutTexts(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(AboutTextsKey).toByteArray();
+}
+
+void CollectionConfiguration::setAboutTexts(QHelpEngineCore &helpEngine,
+                                            const QByteArray &texts)
+{
+    helpEngine.setCustomValue(AboutTextsKey, texts);
+}
+
+const QByteArray CollectionConfiguration::aboutImages(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(AboutImagesKey).toByteArray();
+}
+
+void CollectionConfiguration::setAboutImages(QHelpEngineCore &helpEngine,
+                                             const QByteArray &images)
+{
+    helpEngine.setCustomValue(AboutImagesKey, images);
+}
+
+const QString CollectionConfiguration::defaultHomePage(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(DefaultHomePageKey, QLatin1String("help")).
+        toString();
+}
+
+void CollectionConfiguration::setDefaultHomePage(QHelpEngineCore &helpEngine,
+                                                 const QString &page)
+{
+    helpEngine.setCustomValue(DefaultHomePageKey, page);
+}
+
+const QStringList CollectionConfiguration::lastShownPages(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(LastShownPagesKey).toString().
+        split(ListSeparator, QString::SkipEmptyParts);
+}
+
+void CollectionConfiguration::setLastShownPages(QHelpEngineCore &helpEngine,
+                                             const QStringList &lastShownPages)
+{
+    helpEngine.setCustomValue(LastShownPagesKey,
+                              lastShownPages.join(ListSeparator));
+}
+
+const QStringList CollectionConfiguration::lastZoomFactors(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(LastZoomFactorsKey).toString().
+        split(ListSeparator, QString::SkipEmptyParts);
+}
+
+void CollectionConfiguration::setLastZoomFactors(QHelpEngineCore &helpEngine,
+                                             const QStringList &lastZoomFactors)
+{
+    helpEngine.setCustomValue(LastZoomFactorsKey,
+                              lastZoomFactors.join(ListSeparator));
+}
+
+int CollectionConfiguration::lastTabPage(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(LastPageKey, 1).toInt();
+}
+
+void CollectionConfiguration::setLastTabPage(QHelpEngineCore &helpEngine,
+                                             int lastPage)
+{
+    helpEngine.setCustomValue(LastPageKey, lastPage);
+}
+
+const QDateTime CollectionConfiguration::lastRegisterTime(const QHelpEngineCore &helpEngine)
+{
+    return helpEngine.customValue(LastRegisterTime, QDateTime()).toDateTime();
+}
+
+void CollectionConfiguration::updateLastRegisterTime(QHelpEngineCore &helpEngine)
+{
+    helpEngine.setCustomValue(LastRegisterTime, QDateTime::currentDateTime());
+}
+
+bool CollectionConfiguration::isNewer(const QHelpEngineCore &newer,
+                                const QHelpEngineCore &older)
+{
+    return creationTime(newer) > creationTime(older);
+}
+
+void CollectionConfiguration::copyConfiguration(const QHelpEngineCore &source,
+                                                QHelpEngineCore &target)
+{
+    setCreationTime(target, creationTime(source));
+    setWindowTitle(target, windowTitle(source));
+    target.setCurrentFilter(source.currentFilter());
+    setCacheDir(target, cacheDir(source), cacheDirIsRelativeToCollection(source));
+    setFilterFunctionalityEnabled(target, filterFunctionalityEnabled(source));
+    setFilterToolbarVisible(target, filterToolbarVisible(source));
+    setAddressBarEnabled(target, addressBarEnabled(source));
+    setAddressBarVisible(target, addressBarVisible(source));
+    setDocumentationManagerEnabled(target, documentationManagerEnabled(source));
+    setApplicationIcon(target, applicationIcon(source));
+    setAboutMenuTexts(target, aboutMenuTexts(source));
+    setAboutIcon(target, aboutIcon(source));
+    setAboutTexts(target, aboutTexts(source));
+    setAboutImages(target, aboutImages(source));
+    setDefaultHomePage(target, defaultHomePage(source));
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/assistant/tools/shared/collectionconfiguration.h
===================================================================
--- trunk/tools/assistant/tools/shared/collectionconfiguration.h	(revision 846)
+++ trunk/tools/assistant/tools/shared/collectionconfiguration.h	(revision 846)
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COLLECTIONCONFIGURATION_H
+#define COLLECTIONCONFIGURATION_H
+
+#include <QtCore/QByteArray>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDateTime>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+
+QT_BEGIN_NAMESPACE
+
+class QHelpEngineCore;
+
+class CollectionConfiguration
+{
+public:
+    static const QString windowTitle(const QHelpEngineCore &helpEngine);
+    static void setWindowTitle(QHelpEngineCore &helpEngine,
+                               const QString &windowTitle);
+
+    static const QString cacheDir(const QHelpEngineCore &helpEngine);
+    static bool cacheDirIsRelativeToCollection(const QHelpEngineCore &helpEngine);
+    static void setCacheDir(QHelpEngineCore &helpEngine,
+                            const QString &cacheDir, bool relativeToCollection);
+
+    static uint creationTime(const QHelpEngineCore &helpEngine);
+    static void setCreationTime(QHelpEngineCore &helpEngine, uint time);
+
+    static bool filterFunctionalityEnabled(const QHelpEngineCore &helpEngine);
+    static void setFilterFunctionalityEnabled(QHelpEngineCore &helpEngine,
+                                              bool enabled);
+
+    static bool filterToolbarVisible(const QHelpEngineCore &helpEngine);
+    static void setFilterToolbarVisible(QHelpEngineCore &helpEngine,
+                                        bool visible);
+
+    static bool addressBarEnabled(const QHelpEngineCore &helpEngine);
+    static void setAddressBarEnabled(QHelpEngineCore &helpEngine, bool enabled);
+
+    static bool addressBarVisible(const QHelpEngineCore &helpEngine);
+    static void setAddressBarVisible(QHelpEngineCore &helpEngine, bool visible);
+
+
+    static bool documentationManagerEnabled(const QHelpEngineCore &helpEngine);
+    static void setDocumentationManagerEnabled(QHelpEngineCore &helpEngine,
+                                               bool enabled);
+
+    static const QByteArray applicationIcon(const QHelpEngineCore &helpEngine);
+    static void setApplicationIcon(QHelpEngineCore &helpEngine,
+                                   const QByteArray &icon);
+
+    // TODO: Encapsulate encoding from/to QByteArray here
+    static const QByteArray aboutMenuTexts(const QHelpEngineCore &helpEngine);
+    static void setAboutMenuTexts(QHelpEngineCore &helpEngine,
+                                  const QByteArray &texts);
+
+    static const QByteArray aboutIcon(const QHelpEngineCore &helpEngine);
+    static void setAboutIcon(QHelpEngineCore &helpEngine,
+                             const QByteArray &icon);
+
+    // TODO: Encapsulate encoding from/to QByteArray here
+    static const QByteArray aboutTexts(const QHelpEngineCore &helpEngine);
+    static void setAboutTexts(QHelpEngineCore &helpEngine,
+                              const QByteArray &texts);
+
+    static const QByteArray aboutImages(const QHelpEngineCore &helpEngine);
+    static void setAboutImages(QHelpEngineCore &helpEngine,
+                               const QByteArray &images);
+
+    static const QString defaultHomePage(const QHelpEngineCore &helpEngine);
+    static void setDefaultHomePage(QHelpEngineCore &helpEngine,
+                                   const QString &page);
+
+    // TODO: Don't allow last pages and zoom factors to be set in isolation
+    //       Perhaps also fill up missing elements automatically or assert.
+    static const QStringList lastShownPages(const QHelpEngineCore &helpEngine);
+    static void setLastShownPages(QHelpEngineCore &helpEngine,
+                                  const QStringList &lastShownPages);
+    static const QStringList lastZoomFactors(const QHelpEngineCore &helpEngine);
+    static void setLastZoomFactors(QHelpEngineCore &helPEngine,
+                                   const QStringList &lastZoomFactors);
+
+    static int lastTabPage(const QHelpEngineCore &helpEngine);
+    static void setLastTabPage(QHelpEngineCore &helpEngine, int lastPage);
+
+    static bool isNewer(const QHelpEngineCore &newer,
+                        const QHelpEngineCore &older);
+    static void copyConfiguration(const QHelpEngineCore &source,
+                                  QHelpEngineCore &target);
+
+    /*
+     * Note that this only reflects register actions caused by the
+     * "-register" command line switch, not GUI or remote control actions.
+     */
+    static const QDateTime lastRegisterTime(const QHelpEngineCore &helpEngine);
+    static void updateLastRegisterTime(QHelpEngineCore &helpEngine);
+
+    static const QString DefaultZoomFactor;
+    static const QString ListSeparator;
+};
+
+QT_END_NAMESPACE
+
+#endif // COLLECTIONCONFIGURATION_H
Index: trunk/tools/assistant/tools/shared/helpgenerator.cpp
===================================================================
--- trunk/tools/assistant/tools/shared/helpgenerator.cpp	(revision 769)
+++ trunk/tools/assistant/tools/shared/helpgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -62,4 +62,9 @@
 }
 
+bool HelpGenerator::checkLinks(const QHelpDataInterface &helpData)
+{
+    return generator->checkLinks(helpData);
+}
+
 QString HelpGenerator::error() const
 {
@@ -69,10 +74,10 @@
 void HelpGenerator::printStatus(const QString &msg)
 {
-    fprintf(stdout, "%s\n", qPrintable(msg));
+    puts(qPrintable(msg));
 }
 
 void HelpGenerator::printWarning(const QString &msg)
 {
-    fprintf(stdout, "Warning: %s\n", qPrintable(msg));
+    puts(qPrintable(tr("Warning: %1").arg(msg)));
 }
 
Index: trunk/tools/assistant/tools/shared/helpgenerator.h
===================================================================
--- trunk/tools/assistant/tools/shared/helpgenerator.h	(revision 769)
+++ trunk/tools/assistant/tools/shared/helpgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -58,4 +58,5 @@
     bool generate(QHelpDataInterface *helpData,
         const QString &outputFileName);
+    bool checkLinks(const QHelpDataInterface &helpData);
     QString error() const;
 
Index: trunk/tools/checksdk/cesdkhandler.cpp
===================================================================
--- trunk/tools/checksdk/cesdkhandler.cpp	(revision 769)
+++ trunk/tools/checksdk/cesdkhandler.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/checksdk/cesdkhandler.h
===================================================================
--- trunk/tools/checksdk/cesdkhandler.h	(revision 769)
+++ trunk/tools/checksdk/cesdkhandler.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/checksdk/main.cpp
===================================================================
--- trunk/tools/checksdk/main.cpp	(revision 769)
+++ trunk/tools/checksdk/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/configure/configure.pro
===================================================================
--- trunk/tools/configure/configure.pro	(revision 769)
+++ trunk/tools/configure/configure.pro	(revision 846)
@@ -1,4 +1,4 @@
 TARGET    = configure
-DESTDIR   = ../..
+DESTDIR   = $$PWD/../..  # build directly in source dir
 
 CONFIG   += console flat
@@ -9,5 +9,5 @@
 win32 : LIBS += -lole32 -ladvapi32
 win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc
-win32-g++ : LIBS += -luuid
+win32-g++* : LIBS += -luuid
 
 win32-msvc* {
@@ -24,9 +24,10 @@
 PRECOMPILED_HEADER = configure_pch.h
 
-INCPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \
+INCLUDEPATH += \
+           $$QT_SOURCE_TREE/src/corelib/arch/generic \
            $$QT_SOURCE_TREE/src/corelib/global \
            $$QT_BUILD_TREE/include \
            $$QT_BUILD_TREE/include/QtCore \
-           $$QT_BUILD_TREE/tools/shared
+           $$QT_SOURCE_TREE/tools/shared
 
 HEADERS  = configureapp.h environment.h tools.h\
@@ -63,6 +64,6 @@
            $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \
            $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \
-           $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.h \
-           $$QT_SOURCE_TREE/tools/shared/windows/registry.h
+           $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \
+           $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h
 
 
@@ -92,4 +93,5 @@
            $$QT_SOURCE_TREE/src/corelib/io/qtextstream.cpp \
            $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.cpp \
+           $$QT_SOURCE_TREE/src/corelib/plugin/qsystemlibrary.cpp \
            $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.cpp \
            $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.cpp \
@@ -120,2 +122,3 @@
 INCLUDEPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \
                $$QT_SOURCE_TREE/include/QtCore \
+               $$QT_SOURCE_TREE/tools/shared
Index: trunk/tools/configure/configure_pch.h
===================================================================
--- trunk/tools/configure/configure_pch.h	(revision 769)
+++ trunk/tools/configure/configure_pch.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/configure/configureapp.cpp
===================================================================
--- trunk/tools/configure/configureapp.cpp	(revision 769)
+++ trunk/tools/configure/configureapp.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -62,5 +62,5 @@
 QT_BEGIN_NAMESPACE
 
-std::ostream &operator<<( std::ostream &s, const QString &val ) {
+std::ostream &operator<<(std::ostream &s, const QString &val) {
     s << val.toLocal8Bit().data();
     return s;
@@ -90,5 +90,5 @@
 }
 
-Configure::Configure( int& argc, char** argv )
+Configure::Configure(int& argc, char** argv)
 {
     useUnixSeparators = false;
@@ -112,5 +112,5 @@
     dictionary[ "CONFIGCMD" ] = argv[ 0 ];
 
-    for ( i = 1; i < argc; i++ )
+    for (i = 1; i < argc; i++)
         configCmdLine += argv[ i ];
 
@@ -128,5 +128,5 @@
     const QString installPath = buildPath;
 #endif
-    if(sourceDir != buildDir) { //shadow builds!
+    if (sourceDir != buildDir) { //shadow builds!
         if (!findFile("perl") && !findFile("perl.exe")) {
             cout << "Error: Creating a shadow build of Qt requires" << endl
@@ -141,23 +141,23 @@
             QStack<QString> qmake_dirs;
             qmake_dirs.push("qmake");
-            while(!qmake_dirs.isEmpty()) {
+            while (!qmake_dirs.isEmpty()) {
                 QString dir = qmake_dirs.pop();
                 QString od(buildPath + "/" + dir);
                 QString id(sourcePath + "/" + dir);
                 QFileInfoList entries = QDir(id).entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries);
-                for(int i = 0; i < entries.size(); ++i) {
+                for (int i = 0; i < entries.size(); ++i) {
                     QFileInfo fi(entries.at(i));
-                    if(fi.isDir()) {
+                    if (fi.isDir()) {
                         qmake_dirs.push(dir + "/" + fi.fileName());
                         QDir().mkpath(od + "/" + fi.fileName());
                     } else {
-                        QDir().mkpath(od );
+                        QDir().mkpath(od);
                         bool justCopy = true;
                         const QString fname = fi.fileName();
                         const QString outFile(od + "/" + fname), inFile(id + "/" + fname);
-                        if(fi.fileName() == "Makefile") { //ignore
-                        } else if(fi.suffix() == "h" || fi.suffix() == "cpp") {
+                        if (fi.fileName() == "Makefile") { //ignore
+                        } else if (fi.suffix() == "h" || fi.suffix() == "cpp") {
                             QTemporaryFile tmpFile;
-                            if(tmpFile.open()) {
+                            if (tmpFile.open()) {
                                 QTextStream stream(&tmpFile);
                                 stream << "#include \"" << inFile << "\"" << endl;
@@ -165,5 +165,5 @@
                                 stream.flush();
                                 tmpFile.flush();
-                                if(filesDiffer(tmpFile.fileName(), outFile)) {
+                                if (filesDiffer(tmpFile.fileName(), outFile)) {
                                     QFile::remove(outFile);
                                     tmpFile.copy(outFile);
@@ -171,5 +171,5 @@
                             }
                         }
-                        if(justCopy && filesDiffer(inFile, outFile))
+                        if (justCopy && filesDiffer(inFile, outFile))
                             QFile::copy(inFile, outFile);
                     }
@@ -180,5 +180,5 @@
         { //make a syncqt script(s) that can be used in the shadow
             QFile syncqt(buildPath + "/bin/syncqt");
-            if(syncqt.open(QFile::WriteOnly)) {
+            if (syncqt.open(QFile::WriteOnly)) {
                 QTextStream stream(&syncqt);
                 stream << "#!/usr/bin/perl -w" << endl
@@ -186,5 +186,5 @@
             }
             QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
-            if(syncqt_bat.open(QFile::WriteOnly)) {
+            if (syncqt_bat.open(QFile::WriteOnly)) {
                 QTextStream stream(&syncqt_bat);
                 stream << "@echo off" << endl
@@ -196,11 +196,38 @@
         }
 
+        // make patch_capabilities and createpackage scripts for Symbian that can be used from the shadow build
+        QFile patch_capabilities(buildPath + "/bin/patch_capabilities");
+        if (patch_capabilities.open(QFile::WriteOnly)) {
+            QTextStream stream(&patch_capabilities);
+            stream << "#!/usr/bin/perl -w" << endl
+                   << "require \"" << sourcePath + "/bin/patch_capabilities\";" << endl;
+        }
+        QFile patch_capabilities_bat(buildPath + "/bin/patch_capabilities.bat");
+        if (patch_capabilities_bat.open(QFile::WriteOnly)) {
+            QTextStream stream(&patch_capabilities_bat);
+            stream << "@echo off" << endl
+                   << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/patch_capabilities.bat %*") << endl;
+            patch_capabilities_bat.close();
+        }
+        QFile createpackage(buildPath + "/bin/createpackage");
+        if (createpackage.open(QFile::WriteOnly)) {
+            QTextStream stream(&createpackage);
+            stream << "#!/usr/bin/perl -w" << endl
+                   << "require \"" << sourcePath + "/bin/createpackage\";" << endl;
+        }
+        QFile createpackage_bat(buildPath + "/bin/createpackage.bat");
+        if (createpackage_bat.open(QFile::WriteOnly)) {
+            QTextStream stream(&createpackage_bat);
+            stream << "@echo off" << endl
+                   << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/createpackage.bat %*") << endl;
+            createpackage_bat.close();
+        }
+
         // For Windows CE and shadow builds we need to copy these to the
         // build directory.
         QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat");
-
         //copy the mkspecs
         buildDir.mkpath("mkspecs");
-        if(!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
+        if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
             cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
             dictionary["DONE"] = "error";
@@ -249,7 +276,9 @@
     dictionary[ "MULTIMEDIA" ]      = "yes";
     dictionary[ "AUDIO_BACKEND" ]   = "auto";
+    dictionary[ "WMSDK" ]           = "auto";
     dictionary[ "DIRECTSHOW" ]      = "no";
     dictionary[ "WEBKIT" ]          = "auto";
     dictionary[ "DECLARATIVE" ]     = "auto";
+    dictionary[ "DECLARATIVE_DEBUG" ]= "yes";
     dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
 
@@ -277,5 +306,5 @@
     {
         QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
-        if(version_re.exactMatch(version)) {
+        if (version_re.exactMatch(version)) {
             dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
             dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
@@ -314,5 +343,5 @@
     dictionary[ "OPENGL" ]          = "yes";
     dictionary[ "OPENVG" ]          = "no";
-    dictionary[ "IPV6" ]            = "yes"; // Always, dynamicly loaded
+    dictionary[ "IPV6" ]            = "yes"; // Always, dynamically loaded
     dictionary[ "OPENSSL" ]         = "auto";
     dictionary[ "DBUS" ]            = "auto";
@@ -345,7 +374,7 @@
     QString tmp = dictionary[ "QMAKESPEC" ];
     if (tmp.contains("\\")) {
-        tmp = tmp.mid( tmp.lastIndexOf( "\\" ) + 1 );
+        tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
     } else {
-        tmp = tmp.mid( tmp.lastIndexOf("/") + 1 );
+        tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
     }
     dictionary[ "QMAKESPEC" ] = tmp;
@@ -354,4 +383,5 @@
     dictionary[ "LTCG" ]            = "no";
     dictionary[ "NATIVE_GESTURES" ] = "yes";
+    dictionary[ "MSVC_MP" ] = "no";
 }
 
@@ -365,9 +395,17 @@
 }
 
-QString Configure::fixSeparators(QString somePath)
-{
-    return useUnixSeparators ?
-           QDir::fromNativeSeparators(somePath) :
-           QDir::toNativeSeparators(somePath);
+QString Configure::fixSeparators(const QString &somePath, bool escape)
+{
+    if (useUnixSeparators)
+        return QDir::fromNativeSeparators(somePath);
+    QString ret = QDir::toNativeSeparators(somePath);
+    return escape ? escapeSeparators(ret) : ret;
+}
+
+QString Configure::escapeSeparators(const QString &somePath)
+{
+    QString out = somePath;
+    out.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
+    return out;
 }
 
@@ -404,10 +442,10 @@
     if (argCount < 1) // skip rest if no arguments
         ;
-    else if( configCmdLine.at(i) == "-redo" ) {
+    else if (configCmdLine.at(i) == "-redo") {
         dictionary[ "REDO" ] = "yes";
         configCmdLine.clear();
         reloadCmdLine();
     }
-    else if( configCmdLine.at(i) == "-loadconfig" ) {
+    else if (configCmdLine.at(i) == "-loadconfig") {
         ++i;
         if (i != argCount) {
@@ -425,7 +463,7 @@
 
     // Look first for XQMAKESPEC
-    for(int j = 0 ; j < argCount; ++j)
+    for (int j = 0 ; j < argCount; ++j)
     {
-        if( configCmdLine.at(j) == "-xplatform") {
+        if (configCmdLine.at(j) == "-xplatform") {
             ++j;
             if (j == argCount)
@@ -437,44 +475,44 @@
     }
 
-    for( ; i<configCmdLine.size(); ++i ) {
+    for (; i<configCmdLine.size(); ++i) {
         bool continueElse[] = {false, false};
-        if( configCmdLine.at(i) == "-help"
+        if (configCmdLine.at(i) == "-help"
             || configCmdLine.at(i) == "-h"
-            || configCmdLine.at(i) == "-?" )
+            || configCmdLine.at(i) == "-?")
             dictionary[ "HELP" ] = "yes";
 
 #if !defined(EVAL)
-        else if( configCmdLine.at(i) == "-qconfig" ) {
+        else if (configCmdLine.at(i) == "-qconfig") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QCONFIG" ] = configCmdLine.at(i);
         }
 
-        else if ( configCmdLine.at(i) == "-buildkey" ) {
+        else if (configCmdLine.at(i) == "-buildkey") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-release" ) {
+        else if (configCmdLine.at(i) == "-release") {
             dictionary[ "BUILD" ] = "release";
             if (dictionary[ "BUILDALL" ] == "auto")
                 dictionary[ "BUILDALL" ] = "no";
-        } else if( configCmdLine.at(i) == "-debug" ) {
+        } else if (configCmdLine.at(i) == "-debug") {
             dictionary[ "BUILD" ] = "debug";
             if (dictionary[ "BUILDALL" ] == "auto")
                 dictionary[ "BUILDALL" ] = "no";
-        } else if( configCmdLine.at(i) == "-debug-and-release" )
+        } else if (configCmdLine.at(i) == "-debug-and-release")
             dictionary[ "BUILDALL" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-shared" )
+        else if (configCmdLine.at(i) == "-shared")
             dictionary[ "SHARED" ] = "yes";
-        else if( configCmdLine.at(i) == "-static" )
+        else if (configCmdLine.at(i) == "-static")
             dictionary[ "SHARED" ] = "no";
-        else if( configCmdLine.at(i) == "-developer-build" )
+        else if (configCmdLine.at(i) == "-developer-build")
             dictionary[ "BUILDDEV" ] = "yes";
-        else if( configCmdLine.at(i) == "-nokia-developer" ) {
+        else if (configCmdLine.at(i) == "-nokia-developer") {
             cout << "Detected -nokia-developer option" << endl;
             cout << "Nokia employees and agents are allowed to use this software under" << endl;
@@ -487,27 +525,34 @@
             }
         }
-        else if( configCmdLine.at(i) == "-opensource" ) {
+        else if (configCmdLine.at(i) == "-opensource") {
             dictionary[ "BUILDTYPE" ] = "opensource";
         }
-        else if( configCmdLine.at(i) == "-commercial" ) {
+        else if (configCmdLine.at(i) == "-commercial") {
             dictionary[ "BUILDTYPE" ] = "commercial";
         }
-        else if( configCmdLine.at(i) == "-ltcg" ) {
+        else if (configCmdLine.at(i) == "-ltcg") {
             dictionary[ "LTCG" ] = "yes";
         }
-        else if( configCmdLine.at(i) == "-no-ltcg" ) {
+        else if (configCmdLine.at(i) == "-no-ltcg") {
             dictionary[ "LTCG" ] = "no";
         }
+        else if (configCmdLine.at(i) == "-mp") {
+            dictionary[ "MSVC_MP" ] = "yes";
+        }
+        else if (configCmdLine.at(i) == "-no-mp") {
+            dictionary[ "MSVC_MP" ] = "no";
+        }
+
 #endif
 
-        else if( configCmdLine.at(i) == "-platform" ) {
+        else if (configCmdLine.at(i) == "-platform") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
         dictionary[ "QMAKESPEC_FROM" ] = "commandline";
-        } else if( configCmdLine.at(i) == "-arch" ) {
+        } else if (configCmdLine.at(i) == "-arch") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "ARCHITECTURE" ] = configCmdLine.at(i);
@@ -516,7 +561,7 @@
                 qtConfig += "boundschecker";                // but also needs this CONFIG option
             }
-        } else if( configCmdLine.at(i) == "-embedded" ) {
+        } else if (configCmdLine.at(i) == "-embedded") {
             dictionary[ "EMBEDDED" ] = "yes";
-        } else if( configCmdLine.at(i) == "-xplatform") {
+        } else if (configCmdLine.at(i) == "-xplatform") {
             ++i;
             // do nothing
@@ -525,5 +570,5 @@
 
 #if !defined(EVAL)
-        else if( configCmdLine.at(i) == "-no-zlib" ) {
+        else if (configCmdLine.at(i) == "-no-zlib") {
             // No longer supported since Qt 4.4.0
             // But save the information for later so that we can print a warning
@@ -537,70 +582,62 @@
 
             dictionary[ "ZLIB_FORCED" ] = "yes";
-        } else if( configCmdLine.at(i) == "-qt-zlib" ) {
+        } else if (configCmdLine.at(i) == "-qt-zlib") {
             dictionary[ "ZLIB" ] = "qt";
-        } else if( configCmdLine.at(i) == "-system-zlib" ) {
+        } else if (configCmdLine.at(i) == "-system-zlib") {
             dictionary[ "ZLIB" ] = "system";
         }
 
         // Image formats --------------------------------------------
-        else if( configCmdLine.at(i) == "-no-gif" )
+        else if (configCmdLine.at(i) == "-no-gif")
             dictionary[ "GIF" ] = "no";
-        else if( configCmdLine.at(i) == "-qt-gif" )
-            dictionary[ "GIF" ] = "auto";
-
-        else if( configCmdLine.at(i) == "-no-libtiff" ) {
-              dictionary[ "TIFF"] = "no";
-              dictionary[ "LIBTIFF" ] = "no";
-        } else if( configCmdLine.at(i) == "-qt-libtiff" ) {
-            dictionary[ "TIFF" ] = "plugin";
+        else if (configCmdLine.at(i) == "-qt-gif")
+            dictionary[ "GIF" ] = "plugin";
+
+        else if (configCmdLine.at(i) == "-no-libtiff") {
+            dictionary[ "TIFF"] = "no";
+            dictionary[ "LIBTIFF" ] = "no";
+        } else if (configCmdLine.at(i) == "-qt-libtiff") {
             dictionary[ "LIBTIFF" ] = "qt";
-        } else if( configCmdLine.at(i) == "-system-libtiff" ) {
-              dictionary[ "TIFF" ] = "plugin";
-              dictionary[ "LIBTIFF" ] = "system";
-        }
-
-        else if( configCmdLine.at(i) == "-no-libjpeg" ) {
+        } else if (configCmdLine.at(i) == "-system-libtiff") {
+            dictionary[ "LIBTIFF" ] = "system";
+        }
+
+        else if (configCmdLine.at(i) == "-no-libjpeg") {
             dictionary[ "JPEG" ] = "no";
             dictionary[ "LIBJPEG" ] = "no";
-        } else if( configCmdLine.at(i) == "-qt-libjpeg" ) {
-            dictionary[ "JPEG" ] = "plugin";
+        } else if (configCmdLine.at(i) == "-qt-libjpeg") {
             dictionary[ "LIBJPEG" ] = "qt";
-        } else if( configCmdLine.at(i) == "-system-libjpeg" ) {
-            dictionary[ "JPEG" ] = "plugin";
+        } else if (configCmdLine.at(i) == "-system-libjpeg") {
             dictionary[ "LIBJPEG" ] = "system";
         }
 
-        else if( configCmdLine.at(i) == "-no-libpng" ) {
+        else if (configCmdLine.at(i) == "-no-libpng") {
             dictionary[ "PNG" ] = "no";
             dictionary[ "LIBPNG" ] = "no";
-        } else if( configCmdLine.at(i) == "-qt-libpng" ) {
-            dictionary[ "PNG" ] = "qt";
+        } else if (configCmdLine.at(i) == "-qt-libpng") {
             dictionary[ "LIBPNG" ] = "qt";
-        } else if( configCmdLine.at(i) == "-system-libpng" ) {
-            dictionary[ "PNG" ] = "qt";
+        } else if (configCmdLine.at(i) == "-system-libpng") {
             dictionary[ "LIBPNG" ] = "system";
         }
 
-        else if( configCmdLine.at(i) == "-no-libmng" ) {
+        else if (configCmdLine.at(i) == "-no-libmng") {
             dictionary[ "MNG" ] = "no";
             dictionary[ "LIBMNG" ] = "no";
-        } else if( configCmdLine.at(i) == "-qt-libmng" ) {
-            dictionary[ "MNG" ] = "qt";
+        } else if (configCmdLine.at(i) == "-qt-libmng") {
             dictionary[ "LIBMNG" ] = "qt";
-        } else if( configCmdLine.at(i) == "-system-libmng" ) {
-            dictionary[ "MNG" ] = "qt";
+        } else if (configCmdLine.at(i) == "-system-libmng") {
             dictionary[ "LIBMNG" ] = "system";
         }
 
         // Text Rendering --------------------------------------------
-        else if( configCmdLine.at(i) == "-no-freetype" )
+        else if (configCmdLine.at(i) == "-no-freetype")
             dictionary[ "FREETYPE" ] = "no";
-        else if( configCmdLine.at(i) == "-qt-freetype" )
+        else if (configCmdLine.at(i) == "-qt-freetype")
             dictionary[ "FREETYPE" ] = "yes";
 
         // CE- C runtime --------------------------------------------
-        else if( configCmdLine.at(i) == "-crt" ) {
+        else if (configCmdLine.at(i) == "-crt") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             QDir cDir(configCmdLine.at(i));
@@ -626,7 +663,7 @@
         }
         // Qt/CE - signing tool -------------------------------------
-        else if( configCmdLine.at(i) == "-signature") {
+        else if (configCmdLine.at(i) == "-signature") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             QFileInfo info(configCmdLine.at(i));
@@ -637,55 +674,55 @@
         }
         // Styles ---------------------------------------------------
-        else if( configCmdLine.at(i) == "-qt-style-windows" )
+        else if (configCmdLine.at(i) == "-qt-style-windows")
             dictionary[ "STYLE_WINDOWS" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-windows" )
+        else if (configCmdLine.at(i) == "-no-style-windows")
             dictionary[ "STYLE_WINDOWS" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-windowsce" )
+        else if (configCmdLine.at(i) == "-qt-style-windowsce")
             dictionary[ "STYLE_WINDOWSCE" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-windowsce" )
+        else if (configCmdLine.at(i) == "-no-style-windowsce")
             dictionary[ "STYLE_WINDOWSCE" ] = "no";
-        else if( configCmdLine.at(i) == "-qt-style-windowsmobile" )
+        else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
             dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-windowsmobile" )
+        else if (configCmdLine.at(i) == "-no-style-windowsmobile")
             dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-windowsxp" )
+        else if (configCmdLine.at(i) == "-qt-style-windowsxp")
             dictionary[ "STYLE_WINDOWSXP" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-windowsxp" )
+        else if (configCmdLine.at(i) == "-no-style-windowsxp")
             dictionary[ "STYLE_WINDOWSXP" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-windowsvista" )
+        else if (configCmdLine.at(i) == "-qt-style-windowsvista")
             dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-windowsvista" )
+        else if (configCmdLine.at(i) == "-no-style-windowsvista")
             dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-plastique" )
+        else if (configCmdLine.at(i) == "-qt-style-plastique")
             dictionary[ "STYLE_PLASTIQUE" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-plastique" )
+        else if (configCmdLine.at(i) == "-no-style-plastique")
             dictionary[ "STYLE_PLASTIQUE" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-cleanlooks" )
+        else if (configCmdLine.at(i) == "-qt-style-cleanlooks")
             dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-cleanlooks" )
+        else if (configCmdLine.at(i) == "-no-style-cleanlooks")
             dictionary[ "STYLE_CLEANLOOKS" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-motif" )
+        else if (configCmdLine.at(i) == "-qt-style-motif")
             dictionary[ "STYLE_MOTIF" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-motif" )
+        else if (configCmdLine.at(i) == "-no-style-motif")
             dictionary[ "STYLE_MOTIF" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-cde" )
+        else if (configCmdLine.at(i) == "-qt-style-cde")
             dictionary[ "STYLE_CDE" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-cde" )
+        else if (configCmdLine.at(i) == "-no-style-cde")
             dictionary[ "STYLE_CDE" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-style-s60" )
+        else if (configCmdLine.at(i) == "-qt-style-s60")
             dictionary[ "STYLE_S60" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-style-s60" )
+        else if (configCmdLine.at(i) == "-no-style-s60")
             dictionary[ "STYLE_S60" ] = "no";
 
         // Qt 3 Support ---------------------------------------------
-        else if( configCmdLine.at(i) == "-no-qt3support" )
+        else if (configCmdLine.at(i) == "-no-qt3support")
             dictionary[ "QT3SUPPORT" ] = "no";
 
@@ -697,157 +734,171 @@
 
         // OpenGL Support -------------------------------------------
-        else if( configCmdLine.at(i) == "-no-opengl" ) {
+        else if (configCmdLine.at(i) == "-no-opengl") {
             dictionary[ "OPENGL" ]    = "no";
-        } else if ( configCmdLine.at(i) == "-opengl-es-cm" ) {
+        } else if (configCmdLine.at(i) == "-opengl-es-cm") {
             dictionary[ "OPENGL" ]          = "yes";
             dictionary[ "OPENGL_ES_CM" ]    = "yes";
-        } else if ( configCmdLine.at(i) == "-opengl-es-cl" ) {
-            dictionary[ "OPENGL" ]          = "yes";
-            dictionary[ "OPENGL_ES_CL" ]    = "yes";
-        } else if ( configCmdLine.at(i) == "-opengl-es-2" ) {
+        } else if (configCmdLine.at(i) == "-opengl-es-2") {
             dictionary[ "OPENGL" ]          = "yes";
             dictionary[ "OPENGL_ES_2" ]     = "yes";
+        } else if (configCmdLine.at(i) == "-opengl") {
+            dictionary[ "OPENGL" ]          = "yes";
+            i++;
+            if (i == argCount)
+                break;
+
+            if (configCmdLine.at(i) == "es1") {
+                dictionary[ "OPENGL_ES_CM" ]    = "yes";
+            } else if ( configCmdLine.at(i) == "es2" ) {
+                dictionary[ "OPENGL_ES_2" ]     = "yes";
+            } else if ( configCmdLine.at(i) == "desktop" ) {
+                dictionary[ "OPENGL_ES_2" ]     = "yes";
+            } else {
+                cout << "Argument passed to -opengl option is not valid." << endl;
+                dictionary[ "DONE" ] = "error";
+                break;
+            }
         }
 
         // OpenVG Support -------------------------------------------
-        else if( configCmdLine.at(i) == "-openvg" ) {
+        else if (configCmdLine.at(i) == "-openvg") {
             dictionary[ "OPENVG" ]    = "yes";
-        } else if( configCmdLine.at(i) == "-no-openvg" ) {
+        } else if (configCmdLine.at(i) == "-no-openvg") {
             dictionary[ "OPENVG" ]    = "no";
         }
 
         // Databases ------------------------------------------------
-        else if( configCmdLine.at(i) == "-qt-sql-mysql" )
+        else if (configCmdLine.at(i) == "-qt-sql-mysql")
             dictionary[ "SQL_MYSQL" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-mysql" )
+        else if (configCmdLine.at(i) == "-plugin-sql-mysql")
             dictionary[ "SQL_MYSQL" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-mysql" )
+        else if (configCmdLine.at(i) == "-no-sql-mysql")
             dictionary[ "SQL_MYSQL" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-odbc" )
+        else if (configCmdLine.at(i) == "-qt-sql-odbc")
             dictionary[ "SQL_ODBC" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-odbc" )
+        else if (configCmdLine.at(i) == "-plugin-sql-odbc")
             dictionary[ "SQL_ODBC" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-odbc" )
+        else if (configCmdLine.at(i) == "-no-sql-odbc")
             dictionary[ "SQL_ODBC" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-oci" )
+        else if (configCmdLine.at(i) == "-qt-sql-oci")
             dictionary[ "SQL_OCI" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-oci" )
+        else if (configCmdLine.at(i) == "-plugin-sql-oci")
             dictionary[ "SQL_OCI" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-oci" )
+        else if (configCmdLine.at(i) == "-no-sql-oci")
             dictionary[ "SQL_OCI" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-psql" )
+        else if (configCmdLine.at(i) == "-qt-sql-psql")
             dictionary[ "SQL_PSQL" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-psql" )
+        else if (configCmdLine.at(i) == "-plugin-sql-psql")
             dictionary[ "SQL_PSQL" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-psql" )
+        else if (configCmdLine.at(i) == "-no-sql-psql")
             dictionary[ "SQL_PSQL" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-tds" )
+        else if (configCmdLine.at(i) == "-qt-sql-tds")
             dictionary[ "SQL_TDS" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-tds" )
+        else if (configCmdLine.at(i) == "-plugin-sql-tds")
             dictionary[ "SQL_TDS" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-tds" )
+        else if (configCmdLine.at(i) == "-no-sql-tds")
             dictionary[ "SQL_TDS" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-db2" )
+        else if (configCmdLine.at(i) == "-qt-sql-db2")
             dictionary[ "SQL_DB2" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-db2" )
+        else if (configCmdLine.at(i) == "-plugin-sql-db2")
             dictionary[ "SQL_DB2" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-db2" )
+        else if (configCmdLine.at(i) == "-no-sql-db2")
             dictionary[ "SQL_DB2" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-sqlite" )
+        else if (configCmdLine.at(i) == "-qt-sql-sqlite")
             dictionary[ "SQL_SQLITE" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-sqlite" )
+        else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
             dictionary[ "SQL_SQLITE" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-sqlite" )
+        else if (configCmdLine.at(i) == "-no-sql-sqlite")
             dictionary[ "SQL_SQLITE" ] = "no";
-        else if( configCmdLine.at(i) == "-system-sqlite" )
+        else if (configCmdLine.at(i) == "-system-sqlite")
             dictionary[ "SQL_SQLITE_LIB" ] = "system";
-        else if( configCmdLine.at(i) == "-qt-sql-sqlite2" )
+        else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
             dictionary[ "SQL_SQLITE2" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-sqlite2" )
+        else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
             dictionary[ "SQL_SQLITE2" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-sqlite2" )
+        else if (configCmdLine.at(i) == "-no-sql-sqlite2")
             dictionary[ "SQL_SQLITE2" ] = "no";
 
-        else if( configCmdLine.at(i) == "-qt-sql-ibase" )
+        else if (configCmdLine.at(i) == "-qt-sql-ibase")
             dictionary[ "SQL_IBASE" ] = "yes";
-        else if( configCmdLine.at(i) == "-plugin-sql-ibase" )
+        else if (configCmdLine.at(i) == "-plugin-sql-ibase")
             dictionary[ "SQL_IBASE" ] = "plugin";
-        else if( configCmdLine.at(i) == "-no-sql-ibase" )
+        else if (configCmdLine.at(i) == "-no-sql-ibase")
             dictionary[ "SQL_IBASE" ] = "no";
 #endif
         // IDE project generation -----------------------------------
-        else if( configCmdLine.at(i) == "-no-dsp" )
+        else if (configCmdLine.at(i) == "-no-dsp")
             dictionary[ "DSPFILES" ] = "no";
-        else if( configCmdLine.at(i) == "-dsp" )
+        else if (configCmdLine.at(i) == "-dsp")
             dictionary[ "DSPFILES" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-no-vcp" )
+        else if (configCmdLine.at(i) == "-no-vcp")
             dictionary[ "VCPFILES" ] = "no";
-        else if( configCmdLine.at(i) == "-vcp" )
+        else if (configCmdLine.at(i) == "-vcp")
             dictionary[ "VCPFILES" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-no-vcproj" )
+        else if (configCmdLine.at(i) == "-no-vcproj")
             dictionary[ "VCPROJFILES" ] = "no";
-        else if( configCmdLine.at(i) == "-vcproj" )
+        else if (configCmdLine.at(i) == "-vcproj")
             dictionary[ "VCPROJFILES" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-no-incredibuild-xge" )
+        else if (configCmdLine.at(i) == "-no-incredibuild-xge")
             dictionary[ "INCREDIBUILD_XGE" ] = "no";
-        else if( configCmdLine.at(i) == "-incredibuild-xge" )
+        else if (configCmdLine.at(i) == "-incredibuild-xge")
             dictionary[ "INCREDIBUILD_XGE" ] = "yes";
-        else if( configCmdLine.at(i) == "-native-gestures" )
+        else if (configCmdLine.at(i) == "-native-gestures")
             dictionary[ "NATIVE_GESTURES" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-native-gestures" )
+        else if (configCmdLine.at(i) == "-no-native-gestures")
             dictionary[ "NATIVE_GESTURES" ] = "no";
 #if !defined(EVAL)
         // Symbian Support -------------------------------------------
-        else if (configCmdLine.at(i) == "-fpu" )
+        else if (configCmdLine.at(i) == "-fpu")
         {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-s60" )
+        else if (configCmdLine.at(i) == "-s60")
             dictionary[ "S60" ]    = "yes";
-        else if( configCmdLine.at(i) == "-no-s60" )
+        else if (configCmdLine.at(i) == "-no-s60")
             dictionary[ "S60" ]    = "no";
 
-        else if( configCmdLine.at(i) == "-usedeffiles" )
+        else if (configCmdLine.at(i) == "-usedeffiles")
             dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-usedeffiles" )
+        else if (configCmdLine.at(i) == "-no-usedeffiles")
             dictionary[ "SYMBIAN_DEFFILES" ] = "no";
 
         // Others ---------------------------------------------------
-        else if (configCmdLine.at(i) == "-fast" )
+        else if (configCmdLine.at(i) == "-fast")
             dictionary[ "FAST" ] = "yes";
-        else if (configCmdLine.at(i) == "-no-fast" )
+        else if (configCmdLine.at(i) == "-no-fast")
             dictionary[ "FAST" ] = "no";
 
-        else if( configCmdLine.at(i) == "-stl" )
+        else if (configCmdLine.at(i) == "-stl")
             dictionary[ "STL" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-stl" )
+        else if (configCmdLine.at(i) == "-no-stl")
             dictionary[ "STL" ] = "no";
 
-        else if ( configCmdLine.at(i) == "-exceptions" )
+        else if (configCmdLine.at(i) == "-exceptions")
             dictionary[ "EXCEPTIONS" ] = "yes";
-        else if ( configCmdLine.at(i) == "-no-exceptions" )
+        else if (configCmdLine.at(i) == "-no-exceptions")
             dictionary[ "EXCEPTIONS" ] = "no";
 
-        else if ( configCmdLine.at(i) == "-rtti" )
+        else if (configCmdLine.at(i) == "-rtti")
             dictionary[ "RTTI" ] = "yes";
-        else if ( configCmdLine.at(i) == "-no-rtti" )
+        else if (configCmdLine.at(i) == "-no-rtti")
             dictionary[ "RTTI" ] = "no";
 
-        else if( configCmdLine.at(i) == "-accessibility" )
+        else if (configCmdLine.at(i) == "-accessibility")
             dictionary[ "ACCESSIBILITY" ] = "yes";
-        else if( configCmdLine.at(i) == "-no-accessibility" ) {
+        else if (configCmdLine.at(i) == "-no-accessibility") {
             dictionary[ "ACCESSIBILITY" ] = "no";
             cout << "Setting accessibility to NO" << endl;
@@ -875,61 +926,67 @@
             dictionary[ "IWMMXT" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-no-openssl" ) {
+        else if (configCmdLine.at(i) == "-no-openssl") {
               dictionary[ "OPENSSL"] = "no";
-        } else if( configCmdLine.at(i) == "-openssl" ) {
+        } else if (configCmdLine.at(i) == "-openssl") {
               dictionary[ "OPENSSL" ] = "yes";
-        } else if( configCmdLine.at(i) == "-openssl-linked" ) {
+        } else if (configCmdLine.at(i) == "-openssl-linked") {
               dictionary[ "OPENSSL" ] = "linked";
-        } else if( configCmdLine.at(i) == "-no-qdbus" ) {
+        } else if (configCmdLine.at(i) == "-no-qdbus") {
             dictionary[ "DBUS" ] = "no";
-        } else if( configCmdLine.at(i) == "-qdbus" ) {
+        } else if (configCmdLine.at(i) == "-qdbus") {
             dictionary[ "DBUS" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-dbus" ) {
+        } else if (configCmdLine.at(i) == "-no-dbus") {
             dictionary[ "DBUS" ] = "no";
-        } else if( configCmdLine.at(i) == "-dbus" ) {
+        } else if (configCmdLine.at(i) == "-dbus") {
             dictionary[ "DBUS" ] = "yes";
-        } else if( configCmdLine.at(i) == "-dbus-linked" ) {
+        } else if (configCmdLine.at(i) == "-dbus-linked") {
             dictionary[ "DBUS" ] = "linked";
-        } else if( configCmdLine.at(i) == "-no-script" ) {
+        } else if (configCmdLine.at(i) == "-no-script") {
             dictionary[ "SCRIPT" ] = "no";
-        } else if( configCmdLine.at(i) == "-script" ) {
+        } else if (configCmdLine.at(i) == "-script") {
             dictionary[ "SCRIPT" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-scripttools" ) {
+        } else if (configCmdLine.at(i) == "-no-scripttools") {
             dictionary[ "SCRIPTTOOLS" ] = "no";
-        } else if( configCmdLine.at(i) == "-scripttools" ) {
+        } else if (configCmdLine.at(i) == "-scripttools") {
             dictionary[ "SCRIPTTOOLS" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-xmlpatterns" ) {
+        } else if (configCmdLine.at(i) == "-no-xmlpatterns") {
             dictionary[ "XMLPATTERNS" ] = "no";
-        } else if( configCmdLine.at(i) == "-xmlpatterns" ) {
+        } else if (configCmdLine.at(i) == "-xmlpatterns") {
             dictionary[ "XMLPATTERNS" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-multimedia" ) {
+        } else if (configCmdLine.at(i) == "-no-multimedia") {
             dictionary[ "MULTIMEDIA" ] = "no";
-        } else if( configCmdLine.at(i) == "-multimedia" ) {
+        } else if (configCmdLine.at(i) == "-multimedia") {
             dictionary[ "MULTIMEDIA" ] = "yes";
-        } else if( configCmdLine.at(i) == "-audio-backend" ) {
+        } else if (configCmdLine.at(i) == "-audio-backend") {
             dictionary[ "AUDIO_BACKEND" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-audio-backend" ) {
+        } else if (configCmdLine.at(i) == "-no-audio-backend") {
             dictionary[ "AUDIO_BACKEND" ] = "no";
-        } else if( configCmdLine.at(i) == "-no-phonon" ) {
+        } else if (configCmdLine.at(i) == "-no-phonon") {
             dictionary[ "PHONON" ] = "no";
-        } else if( configCmdLine.at(i) == "-phonon" ) {
+        } else if (configCmdLine.at(i) == "-phonon") {
             dictionary[ "PHONON" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-phonon-backend" ) {
+        } else if (configCmdLine.at(i) == "-no-phonon-backend") {
             dictionary[ "PHONON_BACKEND" ] = "no";
-        } else if( configCmdLine.at(i) == "-phonon-backend" ) {
+        } else if (configCmdLine.at(i) == "-phonon-backend") {
             dictionary[ "PHONON_BACKEND" ] = "yes";
-        } else if( configCmdLine.at(i) == "-phonon-wince-ds9" ) {
+        } else if (configCmdLine.at(i) == "-phonon-wince-ds9") {
             dictionary[ "DIRECTSHOW" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-webkit" ) {
+        } else if (configCmdLine.at(i) == "-no-webkit") {
             dictionary[ "WEBKIT" ] = "no";
-        } else if( configCmdLine.at(i) == "-webkit" ) {
+        } else if (configCmdLine.at(i) == "-webkit") {
             dictionary[ "WEBKIT" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-declarative" ) {
+        } else if (configCmdLine.at(i) == "-webkit-debug") {
+            dictionary[ "WEBKIT" ] = "debug";
+        } else if (configCmdLine.at(i) == "-no-declarative") {
             dictionary[ "DECLARATIVE" ] = "no";
-        } else if( configCmdLine.at(i) == "-declarative" ) {
+        } else if (configCmdLine.at(i) == "-declarative") {
             dictionary[ "DECLARATIVE" ] = "yes";
-        } else if( configCmdLine.at(i) == "-no-plugin-manifests" ) {
+        } else if (configCmdLine.at(i) == "-no-declarative-debug") {
+            dictionary[ "DECLARATIVE_DEBUG" ] = "no";
+        } else if (configCmdLine.at(i) == "-declarative-debug") {
+            dictionary[ "DECLARATIVE_DEBUG" ] = "yes";
+        } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
             dictionary[ "PLUGIN_MANIFESTS" ] = "no";
-        } else if( configCmdLine.at(i) == "-plugin-manifests" ) {
+        } else if (configCmdLine.at(i) == "-plugin-manifests") {
             dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
         }
@@ -941,31 +998,31 @@
         }
 
-        else if( configCmdLine.at(i) == "-internal" )
+        else if (configCmdLine.at(i) == "-internal")
             dictionary[ "QMAKE_INTERNAL" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-no-qmake" )
+        else if (configCmdLine.at(i) == "-no-qmake")
             dictionary[ "BUILD_QMAKE" ] = "no";
-        else if( configCmdLine.at(i) == "-qmake" )
+        else if (configCmdLine.at(i) == "-qmake")
             dictionary[ "BUILD_QMAKE" ] = "yes";
 
-        else if( configCmdLine.at(i) == "-dont-process" )
+        else if (configCmdLine.at(i) == "-dont-process")
             dictionary[ "NOPROCESS" ] = "yes";
-        else if( configCmdLine.at(i) == "-process" )
+        else if (configCmdLine.at(i) == "-process")
             dictionary[ "NOPROCESS" ] = "no";
 
-        else if( configCmdLine.at(i) == "-no-qmake-deps" )
+        else if (configCmdLine.at(i) == "-no-qmake-deps")
             dictionary[ "DEPENDENCIES" ] = "no";
-        else if( configCmdLine.at(i) == "-qmake-deps" )
+        else if (configCmdLine.at(i) == "-qmake-deps")
             dictionary[ "DEPENDENCIES" ] = "yes";
 
 
-        else if( configCmdLine.at(i) == "-qtnamespace" ) {
+        else if (configCmdLine.at(i) == "-qtnamespace") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
-            qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i);
-        } else if( configCmdLine.at(i) == "-qtlibinfix" ) {
+            dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
+        } else if (configCmdLine.at(i) == "-qtlibinfix") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
@@ -973,18 +1030,20 @@
                 dictionary[ "QT_INSTALL_PLUGINS" ] =
                     QString("\\resource\\qt%1\\plugins").arg(dictionary[ "QT_LIBINFIX" ]);
+                dictionary[ "QT_INSTALL_IMPORTS" ] =
+                    QString("\\resource\\qt%1\\imports").arg(dictionary[ "QT_LIBINFIX" ]);
             }
-        } else if( configCmdLine.at(i) == "-D" ) {
+        } else if (configCmdLine.at(i) == "-D") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             qmakeDefines += configCmdLine.at(i);
-        } else if( configCmdLine.at(i) == "-I" ) {
+        } else if (configCmdLine.at(i) == "-I") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             qmakeIncludes += configCmdLine.at(i);
-        } else if( configCmdLine.at(i) == "-L" ) {
+        } else if (configCmdLine.at(i) == "-L") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             QFileInfo check(configCmdLine.at(i));
@@ -995,23 +1054,29 @@
             }
             qmakeLibs += QString("-L" + configCmdLine.at(i));
-        } else if( configCmdLine.at(i) == "-l" ) {
+        } else if (configCmdLine.at(i) == "-l") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             qmakeLibs += QString("-l" + configCmdLine.at(i));
         } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
             opensslLibs = configCmdLine.at(i);
-        }
-
-        else if( ( configCmdLine.at(i) == "-override-version" ) || ( configCmdLine.at(i) == "-version-override" ) ){
+        } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
+            psqlLibs = configCmdLine.at(i);
+        } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
+            sybase = configCmdLine.at(i);
+        } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
+            sybaseLibs = configCmdLine.at(i);
+        }
+
+        else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "VERSION" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-saveconfig" ) {
+        else if (configCmdLine.at(i) == "-saveconfig") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
@@ -1024,5 +1089,5 @@
         else if (configCmdLine.at(i) == "-nomake") {
             ++i;
-            if (i==argCount)
+            if (i == argCount)
                 break;
             disabledBuildParts += configCmdLine.at(i);
@@ -1030,84 +1095,90 @@
 
         // Directories ----------------------------------------------
-        else if( configCmdLine.at(i) == "-prefix" ) {
+        else if (configCmdLine.at(i) == "-prefix") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-bindir" ) {
+        else if (configCmdLine.at(i) == "-bindir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-libdir" ) {
+        else if (configCmdLine.at(i) == "-libdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-docdir" ) {
+        else if (configCmdLine.at(i) == "-docdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-headerdir" ) {
+        else if (configCmdLine.at(i) == "-headerdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-plugindir" ) {
+        else if (configCmdLine.at(i) == "-plugindir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-datadir" ) {
+        else if (configCmdLine.at(i) == "-importdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
+                break;
+            dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
+        }
+        else if (configCmdLine.at(i) == "-datadir") {
+            ++i;
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-translationdir" ) {
+        else if (configCmdLine.at(i) == "-translationdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-examplesdir" ) {
+        else if (configCmdLine.at(i) == "-examplesdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-demosdir" ) {
+        else if (configCmdLine.at(i) == "-demosdir") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_INSTALL_DEMOS" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-hostprefix" ) {
+        else if (configCmdLine.at(i) == "-hostprefix") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i) == "-make" ) {
+        else if (configCmdLine.at(i) == "-make") {
             ++i;
-            if(i==argCount)
+            if (i == argCount)
                 break;
             dictionary[ "MAKE" ] = configCmdLine.at(i);
@@ -1121,16 +1192,24 @@
             if (system == QLatin1String("raster")
                 || system == QLatin1String("opengl")
-                || system == QLatin1String("openvg"))
+                || system == QLatin1String("openvg")
+                || system == QLatin1String("runtime"))
                 dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i);
         }
 
-        else if( configCmdLine.at(i).indexOf( QRegExp( "^-(en|dis)able-" ) ) != -1 ) {
+        else if (configCmdLine.at(i) == "-runtimegraphicssystem") {
+            ++i;
+            if (i == argCount)
+                break;
+            dictionary["RUNTIME_SYSTEM"] = configCmdLine.at(i);
+        }
+
+        else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
             // Scan to see if any specific modules and drivers are enabled or disabled
-            for( QStringList::Iterator module = modules.begin(); module != modules.end(); ++module ) {
-                if( configCmdLine.at(i) == QString( "-enable-" ) + (*module) ) {
+            for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
+                if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
                     enabledModules += (*module);
                     break;
                 }
-                else if( configCmdLine.at(i) == QString( "-disable-" ) + (*module) ) {
+                else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
                     disabledModules += (*module);
                     break;
@@ -1166,15 +1245,16 @@
         cout << "See the README file for a list of supported operating systems and compilers." << endl;
     } else {
-        if( dictionary[ "QMAKESPEC" ].endsWith( "-icc" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc.net" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc2002" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc2003" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc2005" ) ||
-            dictionary[ "QMAKESPEC" ].endsWith( "-msvc2008" )) {
-            if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "nmake";
+        if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
+            dictionary[ "QMAKESPEC" ].endsWith("-msvc2010")) {
+            if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
             dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
-        } else if ( dictionary[ "QMAKESPEC" ] == QString( "win32-g++" ) ) {
-            if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "mingw32-make";
+        } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
+            if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
             if (Environment::detectExecutable("sh.exe")) {
                 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++-sh";
@@ -1183,5 +1263,5 @@
             }
         } else {
-            if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "make";
+            if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
             dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
         }
@@ -1239,17 +1319,17 @@
 
 #if !defined(EVAL)
-    for( QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis ) {
-        modules.removeAll( (*dis) );
-    }
-    for( QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena ) {
-        if( modules.indexOf( (*ena) ) == -1 )
+    for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
+        modules.removeAll((*dis));
+    }
+    for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
+        if (modules.indexOf((*ena)) == -1)
             modules += (*ena);
     }
     qtConfig += modules;
 
-    for( QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it )
+    for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
         qtConfig.removeAll(*it);
 
-    if( ( dictionary[ "REDO" ] != "yes" ) && ( dictionary[ "HELP" ] != "yes" ) )
+    if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
         saveCmdLine();
 #endif
@@ -1271,5 +1351,5 @@
 
     QStringList::Iterator it;
-    for( it = stringList.begin(); it != stringList.end(); ++it )
+    for (it = stringList.begin(); it != stringList.end(); ++it)
         allConfigs << it->remove("qconfig-").remove(".h");
     allConfigs << "full";
@@ -1292,9 +1372,9 @@
     // If the internal configurations failed, try others.
     QStringList::Iterator config;
-    for( config = allConfigs.begin(); config != allConfigs.end(); ++config ) {
-        if( (*config) == dictionary[ "QCONFIG" ] )
+    for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
+        if ((*config) == dictionary[ "QCONFIG" ])
             break;
     }
-    if( config == allConfigs.end() ) {
+    if (config == allConfigs.end()) {
         dictionary[ "HELP" ] = "yes";
         cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
@@ -1449,5 +1529,5 @@
         dictionary[ "QT_INSTALL_PREFIX" ]   = "";
 
-    } else if(dictionary[ "XQMAKESPEC" ].startsWith("symbian")) {
+    } else if (dictionary[ "XQMAKESPEC" ].startsWith("symbian")) {
         dictionary[ "ACCESSIBILITY" ]       = "no";
         dictionary[ "STYLE_WINDOWSXP" ]     = "no";
@@ -1464,4 +1544,8 @@
         dictionary[ "OPENGL" ]              = "no";
         dictionary[ "OPENSSL" ]             = "yes";
+        // We accidently enabled IPv6 for Qt Symbian in 4.6.x. However the underlying OpenC does not fully support IPV6.
+        // Therefore for 4.7.1 and following we disable it until OpenC either supports it or we have the native Qt
+        // symbian socket engine.
+        dictionary[ "IPV6" ]                = "no";
         dictionary[ "STL" ]                 = "yes";
         dictionary[ "EXCEPTIONS" ]          = "yes";
@@ -1489,4 +1573,5 @@
         dictionary[ "QT_INSTALL_PREFIX" ]   = "";
         dictionary[ "QT_INSTALL_PLUGINS" ]  = "\\resource\\qt\\plugins";
+        dictionary[ "QT_INSTALL_IMPORTS" ]  = "\\resource\\qt\\imports";
         dictionary[ "QT_INSTALL_TRANSLATIONS" ]  = "\\resource\\qt\\translations";
         dictionary[ "ARM_FPU_TYPE" ]        = "softvfp";
@@ -1497,5 +1582,5 @@
         disabledBuildParts << "docs" << "translations";
 
-    } else if(dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
+    } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
       //TODO
         dictionary[ "STYLE_WINDOWSXP" ]     = "no";
@@ -1517,5 +1602,4 @@
 
         dictionary["DECORATIONS"]           = "default windows styled";
-        dictionary[ "QMAKEADDITIONALARGS" ] = "-unix";
     }
 }
@@ -1524,13 +1608,13 @@
 {
     QDir d;
-    for( QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it ) {
+    for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
         // Remove any leading or trailing ", this is commonly used in the environment
         // variables
         QString path = (*it);
-        if ( path.startsWith( "\"" ) )
-            path = path.right( path.length() - 1 );
-        if ( path.endsWith( "\"" ) )
-            path = path.left( path.length() - 1 );
-        if( d.exists(path + QDir::separator() + fileName) ) {
+        if (path.startsWith("\""))
+            path = path.right(path.length() - 1);
+        if (path.endsWith("\""))
+            path = path.left(path.length() - 1);
+        if (d.exists(path + QDir::separator() + fileName)) {
             return (path);
         }
@@ -1539,5 +1623,5 @@
 }
 
-QString Configure::locateFile( const QString &fileName )
+QString Configure::locateFile(const QString &fileName)
 {
     QString file = fileName.toLower();
@@ -1550,5 +1634,5 @@
     if (file.endsWith(".h"))
         paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
-    else if ( file.endsWith( ".lib" ) )
+    else if (file.endsWith(".lib"))
         paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
     else
@@ -1562,9 +1646,9 @@
 bool Configure::displayHelp()
 {
-    if( dictionary[ "HELP" ] == "yes" ) {
+    if (dictionary[ "HELP" ] == "yes") {
         desc("Usage: configure [-buildkey <key>]\n"
 //      desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n"
 //                  "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n"
-//                  "[-datadir <dir>] [-translationdir <dir>]\n"
+//                  "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n"
 //                  "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n"
                     "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
@@ -1589,5 +1673,5 @@
                     "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
                     "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
-                    "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
+                    "[-no-webkit] [-webkit] [-webkit-debug] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
 
         desc("Installation options:\n\n");
@@ -1606,4 +1690,5 @@
         desc(                   "-headerdir <dir>",     "Headers will be installed to dir\n(default PREFIX/include)");
         desc(                   "-plugindir <dir>",     "Plugins will be installed to dir\n(default PREFIX/plugins)");
+        desc(                   "-importdir <dir>",     "Imports for QML will be installed to dir\n(default PREFIX/imports)");
         desc(                   "-datadir <dir>",       "Data used by Qt programs will be installed to dir\n(default PREFIX)");
         desc(                   "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n");
@@ -1670,4 +1755,9 @@
         desc("QT3SUPPORT", "no","-no-qt3support",       "Disables the Qt 3 support functionality.\n");
         desc("OPENGL", "no","-no-opengl",               "Disables OpenGL functionality\n");
+        desc("OPENGL", "no","-opengl <api>",            "Enable OpenGL support with specified API version.\n"
+                                                        "Available values for <api>:");
+        desc("", "", "",                                "  desktop - Enable support for Desktop OpenGL", ' ');
+        desc("OPENGL_ES_CM", "no", "",                  "  es1 - Enable support for OpenGL ES Common Profile", ' ');
+        desc("OPENGL_ES_2",  "no", "",                  "  es2 - Enable support for OpenGL ES 2.0", ' ');
 
         desc("OPENVG", "no","-no-openvg",               "Disables OpenVG functionality\n");
@@ -1691,8 +1781,7 @@
         desc(                   "-graphicssystem <sys>",   "Specify which graphicssystem should be used.\n"
                                 "Available values for <sys>:");
-        desc("GRAPHICS_SYSTEM", "raster", "", "  raster - Software rasterizer", ' ');
-        desc("GRAPHICS_SYSTEM", "opengl", "", "  opengl - Using OpenGL acceleration, experimental!", ' ');
-        desc("GRAPHICS_SYSTEM", "openvg", "", "  openvg - Using OpenVG acceleration, experimental!", ' ');
-
+        desc("GRAPHICS_SYSTEM", "raster", "",  "  raster - Software rasterizer", ' ');
+        desc("GRAPHICS_SYSTEM", "opengl", "",  "  opengl - Using OpenGL acceleration, experimental!", ' ');
+        desc("GRAPHICS_SYSTEM", "openvg", "",  "  openvg - Using OpenVG acceleration, experimental!\n", ' ');
 
         desc(                   "-help, -h, -?",        "Display this information.\n");
@@ -1705,20 +1794,20 @@
         desc("ZLIB", "system",  "-system-zlib",         "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
 
-        desc("GIF", "no",       "-no-gif",              "Do not compile the plugin for GIF reading support.");
-        desc("GIF", "auto",     "-qt-gif",              "Compile the plugin for GIF reading support.\nSee also src/plugins/imageformats/gif/qgifhandler.h\n");
-
-        desc("LIBPNG", "no",    "-no-libpng",           "Do not compile in PNG support.");
+        desc("GIF", "no",       "-no-gif",              "Do not compile GIF reading support.");
+        desc("GIF", "auto",     "-qt-gif",              "Compile GIF reading support.\nSee also src/gui/image/qgifhandler_p.h\n");
+
+        desc("LIBPNG", "no",    "-no-libpng",           "Do not compile PNG support.");
         desc("LIBPNG", "qt",    "-qt-libpng",           "Use the libpng bundled with Qt.");
         desc("LIBPNG", "system","-system-libpng",       "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
 
-        desc("LIBMNG", "no",    "-no-libmng",           "Do not compile in MNG support.");
+        desc("LIBMNG", "no",    "-no-libmng",           "Do not compile MNG support.");
         desc("LIBMNG", "qt",    "-qt-libmng",           "Use the libmng bundled with Qt.");
         desc("LIBMNG", "system","-system-libmng",       "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
 
-        desc("LIBTIFF", "no",    "-no-libtiff",         "Do not compile the plugin for TIFF support.");
+        desc("LIBTIFF", "no",    "-no-libtiff",         "Do not compile TIFF support.");
         desc("LIBTIFF", "qt",    "-qt-libtiff",         "Use the libtiff bundled with Qt.");
         desc("LIBTIFF", "system","-system-libtiff",     "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
 
-        desc("LIBJPEG", "no",    "-no-libjpeg",         "Do not compile the plugin for JPEG support.");
+        desc("LIBJPEG", "no",    "-no-libjpeg",         "Do not compile JPEG support.");
         desc("LIBJPEG", "qt",    "-qt-libjpeg",         "Use the libjpeg bundled with Qt.");
         desc("LIBJPEG", "system","-system-libjpeg",     "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
@@ -1773,4 +1862,5 @@
         desc("WEBKIT", "no",    "-no-webkit",           "Do not compile in the WebKit module");
         desc("WEBKIT", "yes",   "-webkit",              "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
+        desc("WEBKIT", "debug", "-webkit-debug",        "Compile in the WebKit module with debug symbols.");
         desc("SCRIPT", "no",    "-no-script",           "Do not build the QtScript module.");
         desc("SCRIPT", "yes",   "-script",              "Build the QtScript module.");
@@ -1779,4 +1869,6 @@
         desc("DECLARATIVE", "no",    "-no-declarative", "Do not build the declarative module");
         desc("DECLARATIVE", "yes",   "-declarative",    "Build the declarative module");
+        desc("DECLARATIVE_DEBUG", "no",    "-no-declarative-debug", "Do not build the declarative debugging support");
+        desc("DECLARATIVE_DEBUG", "yes",   "-declarative-debug",    "Build the declarative debugging support");
 
         desc(                   "-arch <arch>",         "Specify an architecture.\n"
@@ -1803,4 +1895,6 @@
         desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
         desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.");
+        desc("MSVC_MP", "no", "-no-mp",                 "Do not use multiple processors for compiling with MSVC");
+        desc("MSVC_MP", "yes", "-mp",                   "Use multiple processors for compiling with MSVC (-MP)");
 
 /*      We do not support -qconfig on Windows yet
@@ -1826,7 +1920,5 @@
         desc("CETEST", "yes",      "-cetest",              "Compile Windows CE remote test application");
         desc(                      "-signature <file>",    "Use file for signing the target project");
-        desc("OPENGL_ES_CM", "no", "-opengl-es-cm",        "Enable support for OpenGL ES Common");
-        desc("OPENGL_ES_CL", "no", "-opengl-es-cl",        "Enable support for OpenGL ES Common Lite");
-        desc("OPENGL_ES_2",  "no", "-opengl-es-2",         "Enable support for OpenGL ES 2.0");
+
         desc("DIRECTSHOW", "no",   "-phonon-wince-ds9",    "Enable Phonon Direct Show 9 backend for Windows CE");
 
@@ -1854,13 +1946,13 @@
     QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
     QDir d;
-    for( QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it ) {
+    for (QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it) {
         // Remove any leading or trailing ", this is commonly used in the environment
         // variables
         QString path = (*it);
-        if ( path.startsWith( '\"' ) )
-            path = path.right( path.length() - 1 );
-        if ( path.endsWith( '\"' ) )
-            path = path.left( path.length() - 1 );
-        if( d.exists( path + QDir::separator() + fileName ) )
+        if (path.startsWith('\"'))
+            path = path.right(path.length() - 1);
+        if (path.endsWith('\"'))
+            path = path.left(path.length() - 1);
+        if (d.exists(path + QDir::separator() + fileName))
             return path;
     }
@@ -1868,19 +1960,27 @@
 }
 
-bool Configure::findFile( const QString &fileName )
+bool Configure::findFile(const QString &fileName)
 {
     const QString file = fileName.toLower();
     const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
     const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
-        findFileInPaths("mingw32-g++.exe", pathEnvVar) : QString();
+        findFileInPaths("g++.exe", pathEnvVar) : QString();
 
     QString paths;
     if (file.endsWith(".h")) {
-        if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull())
-		    return true;
+        if (!mingwPath.isNull()) {
+            if (!findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull())
+                return true;
+            //now let's try the additional compiler path
+            QDir mingwLibDir = mingwPath + QLatin1String("/../lib/gcc/mingw32");
+            foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
+                if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
+                    return true;
+            }
+        }
         paths = QString::fromLocal8Bit(getenv("INCLUDE"));
-    } else if ( file.endsWith( ".lib" ) ||  file.endsWith( ".a" ) ) {
+    } else if (file.endsWith(".lib") ||  file.endsWith(".a")) {
         if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../lib")).isNull())
-		    return true;
+            return true;
         paths = QString::fromLocal8Bit(getenv("LIB"));
     } else {
@@ -1905,19 +2005,26 @@
         return "system";
 
-    // We want PNG built-in
+    // PNG is always built-in, never a plugin
     if (option == "PNG")
-        return "qt";
-
-    // The JPEG image library can only be a plugin
-    if (option == "JPEG"
-        || option == "MNG" || option == "TIFF")
-        return "plugin";
-
-    // GIF off by default
-    if (option == "GIF") {
-        if (dictionary["SHARED"] == "yes")
+        return "yes";
+
+    // These database drivers and image formats can be built-in or plugins.
+    // Prefer plugins when Qt is shared.
+    if (dictionary[ "SHARED" ] == "yes") {
+        if (option == "SQL_MYSQL"
+            || option == "SQL_MYSQL"
+            || option == "SQL_ODBC"
+            || option == "SQL_OCI"
+            || option == "SQL_PSQL"
+            || option == "SQL_TDS"
+            || option == "SQL_DB2"
+            || option == "SQL_SQLITE"
+            || option == "SQL_SQLITE2"
+            || option == "SQL_IBASE"
+            || option == "JPEG"
+            || option == "MNG"
+            || option == "TIFF"
+            || option == "GIF")
             return "plugin";
-        else
-            return "yes";
     }
 
@@ -1929,16 +2036,4 @@
         return "no";
 
-    if (option == "SQL_MYSQL"
-        || option == "SQL_MYSQL"
-        || option == "SQL_ODBC"
-        || option == "SQL_OCI"
-        || option == "SQL_PSQL"
-        || option == "SQL_TDS"
-        || option == "SQL_DB2"
-        || option == "SQL_SQLITE"
-        || option == "SQL_SQLITE2"
-        || option == "SQL_IBASE")
-        return "plugin";
-
     if (option == "SYNCQT"
         && (!QFile::exists(sourcePath + "/bin/syncqt") ||
@@ -1957,5 +2052,5 @@
     bool available = false;
     if (part == "STYLE_WINDOWSXP")
-        available = (findFile("uxtheme.h"));
+        available = findFile("uxtheme.h");
 
     else if (part == "ZLIB")
@@ -1989,13 +2084,13 @@
     else if (part == "SQL_SQLITE_LIB") {
         if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
-		    // Symbian has multiple .lib/.dll files we need to find
+            // Symbian has multiple .lib/.dll files we need to find
             if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
-			    available = true; // There is sqlite_symbian plugin which exports the necessary stuff
-			    dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3";
-		    } else {
-			    available = findFile("sqlite3.h") && findFile("sqlite3.lib");
-			    if (available)
-				    dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
-		    }
+                available = true; // There is sqlite_symbian plugin which exports the necessary stuff
+                dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3";
+            } else {
+                available = findFile("sqlite3.h") && findFile("sqlite3.lib");
+                if (available)
+                    dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
+            }
         } else
             available = true;
@@ -2008,6 +2103,4 @@
     else if (part == "OPENGL_ES_CM")
         available = (dictionary[ "ARCHITECTURE" ]  == "windowsce");
-    else if (part == "OPENGL_ES_CL")
-        available = (dictionary[ "ARCHITECTURE" ]  == "windowsce");
     else if (part == "OPENGL_ES_2")
         available = (dictionary[ "ARCHITECTURE" ]  == "windowsce");
@@ -2015,9 +2108,9 @@
         available = (dictionary[ "ARCHITECTURE" ]  == "windowsce");
     else if (part == "SSE2")
-        available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++");
-    else if (part == "3DNOW" )
-        available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h") && (dictionary.value("QMAKESPEC") != "win32-g++");
+        available = (dictionary.value("QMAKESPEC") != "win32-msvc");
+    else if (part == "3DNOW")
+        available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
     else if (part == "MMX" || part == "SSE")
-        available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++");
+        available = (dictionary.value("QMAKESPEC") != "win32-msvc");
     else if (part == "OPENSSL")
         available = findFile("openssl\\ssl.h");
@@ -2048,27 +2141,36 @@
                && dictionary.value("EXCEPTIONS") == "yes";
     } else if (part == "PHONON") {
-        available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
-            && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
-            && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
-            && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
-            && findFile("d3d9.h");
-
-        if (!available) {
-            cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
-                 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
-                 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
-            if (!findFile("vmr9.h"))  cout << "vmr9.h not found" << endl;
-            if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
-            if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
-            if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
-            if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
-            if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
-        }
-    } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS") {
+        if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+            available = true;
+        } else {
+            available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
+                && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
+                && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
+                && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
+                && findFile("d3d9.h");
+
+            if (!available) {
+                cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
+                     << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
+                     << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
+                if (!findFile("vmr9.h"))  cout << "vmr9.h not found" << endl;
+                if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
+                if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
+                if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
+                if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
+                if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
+            }
+        }
+    } else if (part == "WMSDK") {
+        available = findFile("wmsdk.h");
+    } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS" || part == "DECLARATIVE") {
         available = true;
     } else if (part == "WEBKIT") {
-        available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
-    } else if (part == "DECLARATIVE") {
-        available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
+        available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-msvc2010") || (dictionary.value("QMAKESPEC") == "win32-g++");
+        if (dictionary[ "SHARED" ] == "no") {
+            cout << endl << "WARNING: Using static linking will disable the WebKit module." << endl
+                 << endl;
+            available = false;
+        }
     } else if (part == "AUDIO_BACKEND") {
         available = true;
@@ -2095,5 +2197,5 @@
                 available = (paths.size() == 0);
                 if (!available) {
-                    if (epocRoot.isNull() || epocRoot == "")
+                    if (epocRoot.isEmpty())
                         epocRoot = "<empty string>";
                     cout << endl
@@ -2196,5 +2298,5 @@
         dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
     if (dictionary["SCRIPTTOOLS"] == "auto")
-        dictionary["SCRIPTTOOLS"] = checkAvailability("SCRIPTTOOLS") ? "yes" : "no";
+        dictionary["SCRIPTTOOLS"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
     if (dictionary["XMLPATTERNS"] == "auto")
         dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
@@ -2204,7 +2306,11 @@
         dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
     if (dictionary["DECLARATIVE"] == "auto")
-        dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
+        dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
+    if (dictionary["DECLARATIVE_DEBUG"] == "auto")
+        dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no";
     if (dictionary["AUDIO_BACKEND"] == "auto")
         dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
+    if (dictionary["WMSDK"] == "auto")
+        dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
 
     // Qt/WinCE remote test application
@@ -2229,5 +2335,5 @@
              << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
              << "(Press any key to continue..)";
-        if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+        if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
             exit(0);      // Exit cleanly for Ctrl+C
 
@@ -2240,5 +2346,5 @@
              << "Oracle driver, as the current build will most likely fail." << endl;
         cout << "(Press any key to continue..)";
-        if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+        if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
             exit(0);      // Exit cleanly for Ctrl+C
     }
@@ -2247,16 +2353,24 @@
              << "win32-msvc2002 or win32-msvc2003 instead." << endl;
         cout << "(Press any key to continue..)";
-        if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+        if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
             exit(0);      // Exit cleanly for Ctrl+C
     }
-	if (0 != dictionary["ARM_FPU_TYPE"].size())
-	{
-		QStringList l= QStringList()
-			<< "softvfp"
-			<< "softvfp+vfpv2"
-			<< "vfpv2";
-		if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
-			cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
-	}
+    if (0 != dictionary["ARM_FPU_TYPE"].size()) {
+            QStringList l= QStringList()
+                    << "softvfp"
+                    << "softvfp+vfpv2"
+                    << "vfpv2";
+            if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
+                    cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
+    }
+    if (dictionary["DECLARATIVE"] == "yes" && dictionary["SCRIPT"] == "no") {
+        cout << "WARNING: To be able to compile QtDeclarative we need to also compile the" << endl
+             << "QtScript module. If you continue, we will turn on the QtScript module." << endl
+             << "(Press any key to continue..)";
+        if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+            exit(0);      // Exit cleanly for Ctrl+C
+
+        dictionary["SCRIPT"] = "yes";
+    }
 
     return true;
@@ -2331,5 +2445,5 @@
                        "#else\n"
                        // Debug builds
-                       "# if (defined(_DEBUG) || defined(DEBUG))\n"
+                       "# if !defined(QT_NO_DEBUG)\n"
                        "#  if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
                        + build64Key.arg("debug") + "\"\n"
@@ -2354,5 +2468,5 @@
     // Generate variables for output
     // Build key ----------------------------------------------------
-    if ( dictionary.contains("BUILD_KEY") ) {
+    if (dictionary.contains("BUILD_KEY")) {
         qmakeVars += dictionary.value("BUILD_KEY");
     }
@@ -2360,5 +2474,5 @@
     QString build = dictionary[ "BUILD" ];
     bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
-    if ( build == "debug") {
+    if (build == "debug") {
         if (buildAll)
             qtConfig += "release";
@@ -2371,134 +2485,132 @@
 
     // Compression --------------------------------------------------
-    if( dictionary[ "ZLIB" ] == "qt" )
+    if (dictionary[ "ZLIB" ] == "qt")
         qtConfig += "zlib";
-    else if( dictionary[ "ZLIB" ] == "system" )
+    else if (dictionary[ "ZLIB" ] == "system")
         qtConfig += "system-zlib";
 
     // Image formates -----------------------------------------------
-    if( dictionary[ "GIF" ] == "no" )
+    if (dictionary[ "GIF" ] == "no")
         qtConfig += "no-gif";
-    else if( dictionary[ "GIF" ] == "yes" )
+    else if (dictionary[ "GIF" ] == "yes")
         qtConfig += "gif";
-    else if( dictionary[ "GIF" ] == "plugin" )
-        qmakeFormatPlugins += "gif";
-
-    if( dictionary[ "TIFF" ] == "no" )
-          qtConfig += "no-tiff";
-    else if( dictionary[ "TIFF" ] == "plugin" )
-        qmakeFormatPlugins += "tiff";
-    if( dictionary[ "LIBTIFF" ] == "system" )
+
+    if (dictionary[ "TIFF" ] == "no")
+        qtConfig += "no-tiff";
+    else if (dictionary[ "TIFF" ] == "yes")
+        qtConfig += "tiff";
+    if (dictionary[ "LIBTIFF" ] == "system")
         qtConfig += "system-tiff";
 
-    if( dictionary[ "JPEG" ] == "no" )
+    if (dictionary[ "JPEG" ] == "no")
         qtConfig += "no-jpeg";
-    else if( dictionary[ "JPEG" ] == "plugin" )
-        qmakeFormatPlugins += "jpeg";
-    if( dictionary[ "LIBJPEG" ] == "system" )
+    else if (dictionary[ "JPEG" ] == "yes")
+        qtConfig += "jpeg";
+    if (dictionary[ "LIBJPEG" ] == "system")
         qtConfig += "system-jpeg";
 
-    if( dictionary[ "PNG" ] == "no" )
+    if (dictionary[ "PNG" ] == "no")
         qtConfig += "no-png";
-    else if( dictionary[ "PNG" ] == "qt" )
+    else if (dictionary[ "PNG" ] == "yes")
         qtConfig += "png";
-    if( dictionary[ "LIBPNG" ] == "system" )
+    if (dictionary[ "LIBPNG" ] == "system")
         qtConfig += "system-png";
 
-    if( dictionary[ "MNG" ] == "no" )
+    if (dictionary[ "MNG" ] == "no")
         qtConfig += "no-mng";
-    else if( dictionary[ "MNG" ] == "qt" )
+    else if (dictionary[ "MNG" ] == "yes")
         qtConfig += "mng";
-    if( dictionary[ "LIBMNG" ] == "system" )
+    if (dictionary[ "LIBMNG" ] == "system")
         qtConfig += "system-mng";
 
     // Text rendering --------------------------------------------------
-    if( dictionary[ "FREETYPE" ] == "yes" )
+    if (dictionary[ "FREETYPE" ] == "yes")
         qtConfig += "freetype";
 
     // Styles -------------------------------------------------------
-    if ( dictionary[ "STYLE_WINDOWS" ] == "yes" )
+    if (dictionary[ "STYLE_WINDOWS" ] == "yes")
         qmakeStyles += "windows";
 
-    if ( dictionary[ "STYLE_PLASTIQUE" ] == "yes" )
+    if (dictionary[ "STYLE_PLASTIQUE" ] == "yes")
         qmakeStyles += "plastique";
 
-    if ( dictionary[ "STYLE_CLEANLOOKS" ] == "yes" )
+    if (dictionary[ "STYLE_CLEANLOOKS" ] == "yes")
         qmakeStyles += "cleanlooks";
 
-    if ( dictionary[ "STYLE_WINDOWSXP" ] == "yes" )
+    if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
         qmakeStyles += "windowsxp";
 
-    if ( dictionary[ "STYLE_WINDOWSVISTA" ] == "yes" )
+    if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
         qmakeStyles += "windowsvista";
 
-    if ( dictionary[ "STYLE_MOTIF" ] == "yes" )
+    if (dictionary[ "STYLE_MOTIF" ] == "yes")
         qmakeStyles += "motif";
 
-    if ( dictionary[ "STYLE_SGI" ] == "yes" )
+    if (dictionary[ "STYLE_SGI" ] == "yes")
         qmakeStyles += "sgi";
 
-    if ( dictionary[ "STYLE_WINDOWSCE" ] == "yes" )
+    if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
     qmakeStyles += "windowsce";
 
-    if ( dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes" )
+    if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
     qmakeStyles += "windowsmobile";
 
-    if ( dictionary[ "STYLE_CDE" ] == "yes" )
+    if (dictionary[ "STYLE_CDE" ] == "yes")
         qmakeStyles += "cde";
 
-    if ( dictionary[ "STYLE_S60" ] == "yes" )
+    if (dictionary[ "STYLE_S60" ] == "yes")
         qmakeStyles += "s60";
 
     // Databases ----------------------------------------------------
-    if ( dictionary[ "SQL_MYSQL" ] == "yes" )
+    if (dictionary[ "SQL_MYSQL" ] == "yes")
         qmakeSql += "mysql";
-    else if ( dictionary[ "SQL_MYSQL" ] == "plugin" )
+    else if (dictionary[ "SQL_MYSQL" ] == "plugin")
         qmakeSqlPlugins += "mysql";
 
-    if ( dictionary[ "SQL_ODBC" ] == "yes" )
+    if (dictionary[ "SQL_ODBC" ] == "yes")
         qmakeSql += "odbc";
-    else if ( dictionary[ "SQL_ODBC" ] == "plugin" )
+    else if (dictionary[ "SQL_ODBC" ] == "plugin")
         qmakeSqlPlugins += "odbc";
 
-    if ( dictionary[ "SQL_OCI" ] == "yes" )
+    if (dictionary[ "SQL_OCI" ] == "yes")
         qmakeSql += "oci";
-    else if ( dictionary[ "SQL_OCI" ] == "plugin" )
+    else if (dictionary[ "SQL_OCI" ] == "plugin")
         qmakeSqlPlugins += "oci";
 
-    if ( dictionary[ "SQL_PSQL" ] == "yes" )
+    if (dictionary[ "SQL_PSQL" ] == "yes")
         qmakeSql += "psql";
-    else if ( dictionary[ "SQL_PSQL" ] == "plugin" )
+    else if (dictionary[ "SQL_PSQL" ] == "plugin")
         qmakeSqlPlugins += "psql";
 
-    if ( dictionary[ "SQL_TDS" ] == "yes" )
+    if (dictionary[ "SQL_TDS" ] == "yes")
         qmakeSql += "tds";
-    else if ( dictionary[ "SQL_TDS" ] == "plugin" )
+    else if (dictionary[ "SQL_TDS" ] == "plugin")
         qmakeSqlPlugins += "tds";
 
-    if ( dictionary[ "SQL_DB2" ] == "yes" )
+    if (dictionary[ "SQL_DB2" ] == "yes")
         qmakeSql += "db2";
-    else if ( dictionary[ "SQL_DB2" ] == "plugin" )
+    else if (dictionary[ "SQL_DB2" ] == "plugin")
         qmakeSqlPlugins += "db2";
 
-    if ( dictionary[ "SQL_SQLITE" ] == "yes" )
+    if (dictionary[ "SQL_SQLITE" ] == "yes")
         qmakeSql += "sqlite";
-    else if ( dictionary[ "SQL_SQLITE" ] == "plugin" )
+    else if (dictionary[ "SQL_SQLITE" ] == "plugin")
         qmakeSqlPlugins += "sqlite";
 
-    if ( dictionary[ "SQL_SQLITE_LIB" ] == "system" )
+    if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
         qmakeConfig += "system-sqlite";
 
-    if ( dictionary[ "SQL_SQLITE2" ] == "yes" )
+    if (dictionary[ "SQL_SQLITE2" ] == "yes")
         qmakeSql += "sqlite2";
-    else if ( dictionary[ "SQL_SQLITE2" ] == "plugin" )
+    else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
         qmakeSqlPlugins += "sqlite2";
 
-    if ( dictionary[ "SQL_IBASE" ] == "yes" )
+    if (dictionary[ "SQL_IBASE" ] == "yes")
         qmakeSql += "ibase";
-    else if ( dictionary[ "SQL_IBASE" ] == "plugin" )
+    else if (dictionary[ "SQL_IBASE" ] == "plugin")
         qmakeSqlPlugins += "ibase";
 
     // Other options ------------------------------------------------
-    if( dictionary[ "BUILDALL" ] == "yes" ) {
+    if (dictionary[ "BUILDALL" ] == "yes") {
         qmakeConfig += "build_all";
     }
@@ -2506,5 +2618,5 @@
     dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
 
-    if ( dictionary[ "SHARED" ] == "yes" ) {
+    if (dictionary[ "SHARED" ] == "yes") {
         QString version = dictionary[ "VERSION" ];
         if (!version.isEmpty()) {
@@ -2517,12 +2629,12 @@
     }
 
-    if( dictionary[ "ACCESSIBILITY" ] == "yes" )
+    if (dictionary[ "ACCESSIBILITY" ] == "yes")
         qtConfig += "accessibility";
 
-    if( !qmakeLibs.isEmpty() )
-        qmakeVars += "LIBS           += " + qmakeLibs.join( " " );
-
-    if( !dictionary["QT_LFLAGS_SQLITE"].isEmpty() )
-        qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"];
+    if (!qmakeLibs.isEmpty())
+        qmakeVars += "LIBS           += " + escapeSeparators(qmakeLibs.join(" "));
+
+    if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
+        qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]);
 
     if (dictionary[ "QT3SUPPORT" ] == "yes")
@@ -2532,29 +2644,24 @@
         qtConfig += "opengl";
 
-    if ( dictionary["OPENGL_ES_CM"] == "yes" ) {
+    if (dictionary["OPENGL_ES_CM"] == "yes") {
         qtConfig += "opengles1";
         qtConfig += "egl";
     }
 
-    if ( dictionary["OPENGL_ES_2"] == "yes" ) {
+    if (dictionary["OPENGL_ES_2"] == "yes") {
         qtConfig += "opengles2";
         qtConfig += "egl";
     }
 
-    if ( dictionary["OPENGL_ES_CL"] == "yes" ) {
-        qtConfig += "opengles1cl";
-        qtConfig += "egl";
-    }
-
-    if ( dictionary["OPENVG"] == "yes" ) {
+    if (dictionary["OPENVG"] == "yes") {
         qtConfig += "openvg";
         qtConfig += "egl";
     }
 
-    if ( dictionary["S60"] == "yes" ) {
+    if (dictionary["S60"] == "yes") {
         qtConfig += "s60";
     }
 
-     if ( dictionary["DIRECTSHOW"] == "yes" )
+     if (dictionary["DIRECTSHOW"] == "yes")
         qtConfig += "directshow";
 
@@ -2604,11 +2711,24 @@
     }
 
-    if (dictionary["WEBKIT"] == "yes")
-        qtConfig += "webkit";
-
-    if (dictionary["DECLARATIVE"] == "yes")
+    QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri";
+    QFile::remove(dst);
+    if (dictionary["WEBKIT"] != "no") {
+        // This include takes care of adding "webkit" to QT_CONFIG.
+        QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri";
+        QFile::copy(src, dst);
+        if (dictionary["WEBKIT"] == "debug")
+            qtConfig += "webkit-debug";
+    }
+
+    if (dictionary["DECLARATIVE"] == "yes") {
+        if (dictionary[ "SCRIPT" ] == "no") {
+            cout << "QtDeclarative was requested, but it can't be built due to QtScript being "
+                    "disabled." << endl;
+            dictionary[ "DONE" ] = "error";
+        }
         qtConfig += "declarative";
-
-    if( dictionary[ "NATIVE_GESTURES" ] == "yes" )
+    }
+
+    if (dictionary[ "NATIVE_GESTURES" ] == "yes")
         qtConfig += "native-gestures";
 
@@ -2626,5 +2746,5 @@
     QString set_config = dictionary["QCONFIG"];
     if (possible_configs.contains(set_config)) {
-        foreach(QString cfg, possible_configs) {
+        foreach (const QString &cfg, possible_configs) {
             qtConfig += (cfg + "-config");
             if (cfg == set_config)
@@ -2633,5 +2753,5 @@
     }
 
-    if (dictionary.contains("XQMAKESPEC") && ( dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"] ) )
+    if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"]))
             qmakeConfig += "cross_compile";
 
@@ -2641,55 +2761,68 @@
     // if prefix is empty (WINCE), make all of them empty, if they aren't set
     bool qipempty = false;
-    if(dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
+    if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
         qipempty = true;
 
-    if( !dictionary[ "QT_INSTALL_DOCS" ].size() )
-        dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/doc" );
-    if( !dictionary[ "QT_INSTALL_HEADERS" ].size() )
-        dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/include" );
-    if( !dictionary[ "QT_INSTALL_LIBS" ].size() )
-        dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/lib" );
-    if( !dictionary[ "QT_INSTALL_BINS" ].size() )
-        dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" );
-    if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() )
-        dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" );
-    if( !dictionary[ "QT_INSTALL_DATA" ].size() )
-        dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] );
-    if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() )
-        dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/translations" );
-    if( !dictionary[ "QT_INSTALL_EXAMPLES" ].size() )
-        dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
-    if( !dictionary[ "QT_INSTALL_DEMOS" ].size() )
-        dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/demos" );
-
-    if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
+    if (!dictionary[ "QT_INSTALL_DOCS" ].size())
+        dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/doc");
+    if (!dictionary[ "QT_INSTALL_HEADERS" ].size())
+        dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/include");
+    if (!dictionary[ "QT_INSTALL_LIBS" ].size())
+        dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/lib");
+    if (!dictionary[ "QT_INSTALL_BINS" ].size())
+        dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/bin");
+    if (!dictionary[ "QT_INSTALL_PLUGINS" ].size())
+        dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins");
+    if (!dictionary[ "QT_INSTALL_IMPORTS" ].size())
+        dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/imports");
+    if (!dictionary[ "QT_INSTALL_DATA" ].size())
+        dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ]);
+    if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size())
+        dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
+    if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
+        dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
+    if (!dictionary[ "QT_INSTALL_DEMOS" ].size())
+        dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/demos");
+
+    if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
         dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
 
-    qmakeVars += QString("OBJECTS_DIR     = ") + fixSeparators( "tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ] );
-    qmakeVars += QString("MOC_DIR         = ") + fixSeparators( "tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ] );
-    qmakeVars += QString("RCC_DIR         = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"]);
+    qmakeVars += QString("OBJECTS_DIR     = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true);
+    qmakeVars += QString("MOC_DIR         = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true);
+    qmakeVars += QString("RCC_DIR         = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true);
 
     if (!qmakeDefines.isEmpty())
-        qmakeVars += QString("DEFINES        += ") + qmakeDefines.join( " " );
+        qmakeVars += QString("DEFINES        += ") + qmakeDefines.join(" ");
     if (!qmakeIncludes.isEmpty())
-        qmakeVars += QString("INCLUDEPATH    += ") + qmakeIncludes.join( " " );
+        qmakeVars += QString("INCLUDEPATH    += ") + escapeSeparators(qmakeIncludes.join(" "));
     if (!opensslLibs.isEmpty())
         qmakeVars += opensslLibs;
     else if (dictionary[ "OPENSSL" ] == "linked") {
-    	if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("symbian") )
+        if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("symbian"))
             qmakeVars += QString("OPENSSL_LIBS    = -llibssl -llibcrypto");
         else
             qmakeVars += QString("OPENSSL_LIBS    = -lssleay32 -llibeay32");
         }
+    if (!psqlLibs.isEmpty())
+        qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
+
+    {
+        QStringList lflagsTDS;
+        if (!sybase.isEmpty())
+            lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib");
+        if (!sybaseLibs.isEmpty())
+            lflagsTDS += sybaseLibs.section("=", 1);
+        if (!lflagsTDS.isEmpty())
+            qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" ");
+    }
+
     if (!qmakeSql.isEmpty())
-        qmakeVars += QString("sql-drivers    += ") + qmakeSql.join( " " );
+        qmakeVars += QString("sql-drivers    += ") + qmakeSql.join(" ");
     if (!qmakeSqlPlugins.isEmpty())
-        qmakeVars += QString("sql-plugins    += ") + qmakeSqlPlugins.join( " " );
+        qmakeVars += QString("sql-plugins    += ") + qmakeSqlPlugins.join(" ");
     if (!qmakeStyles.isEmpty())
-        qmakeVars += QString("styles         += ") + qmakeStyles.join( " " );
+        qmakeVars += QString("styles         += ") + qmakeStyles.join(" ");
     if (!qmakeStylePlugins.isEmpty())
-        qmakeVars += QString("style-plugins  += ") + qmakeStylePlugins.join( " " );
-    if (!qmakeFormatPlugins.isEmpty())
-        qmakeVars += QString("imageformat-plugins += ") + qmakeFormatPlugins.join( " " );
+        qmakeVars += QString("style-plugins  += ") + qmakeStylePlugins.join(" ");
 
     if (dictionary["QMAKESPEC"].endsWith("-g++")) {
@@ -2703,5 +2836,5 @@
     }
 
-    if( !dictionary[ "QMAKESPEC" ].length() ) {
+    if (!dictionary[ "QMAKESPEC" ].length()) {
         cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
              << "be defined as an environment variable, or specified as an" << endl
@@ -2710,13 +2843,13 @@
 
         QStringList winPlatforms;
-        QDir mkspecsDir( sourcePath + "/mkspecs" );
+        QDir mkspecsDir(sourcePath + "/mkspecs");
         const QFileInfoList &specsList = mkspecsDir.entryInfoList();
-        for(int i = 0; i < specsList.size(); ++i) {
+        for (int i = 0; i < specsList.size(); ++i) {
             const QFileInfo &fi = specsList.at(i);
-            if( fi.fileName().left( 5 ) == "win32" ) {
+            if (fi.fileName().left(5) == "win32") {
                 winPlatforms += fi.fileName();
             }
         }
-        cout << "Available platforms are: " << qPrintable(winPlatforms.join( ", " )) << endl;
+        cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
         dictionary[ "DONE" ] = "error";
     }
@@ -2727,28 +2860,28 @@
 {
     // Generate .qmake.cache
-    QFile cacheFile( buildPath + "/.qmake.cache" );
-    if( cacheFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
-        QTextStream cacheStream( &cacheFile );
-        for( QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var ) {
+    QFile cacheFile(buildPath + "/.qmake.cache");
+    if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
+        QTextStream cacheStream(&cacheFile);
+        for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
             cacheStream << (*var) << endl;
         }
-        cacheStream << "CONFIG         += " << qmakeConfig.join( " " ) << " incremental create_prl link_prl depend_includepath QTDIR_build" << endl;
+        cacheStream << "CONFIG         += " << qmakeConfig.join(" ") << " incremental msvc_mp create_prl link_prl depend_includepath QTDIR_build" << endl;
 
         QStringList buildParts;
         buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
-        foreach(QString item, disabledBuildParts) {
+        foreach (const QString &item, disabledBuildParts) {
             buildParts.removeAll(item);
         }
-        cacheStream << "QT_BUILD_PARTS  = " << buildParts.join( " " ) << endl;
+        cacheStream << "QT_BUILD_PARTS  = " << buildParts.join(" ") << endl;
 
         QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
         QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
-        if(QFile::exists(mkspec_path))
-            cacheStream << "QMAKESPEC       = " << mkspec_path << endl;
+        if (QFile::exists(mkspec_path))
+            cacheStream << "QMAKESPEC       = " << escapeSeparators(mkspec_path) << endl;
         else
-            cacheStream << "QMAKESPEC       = " << fixSeparators(targetSpec) << endl;
-        cacheStream << "ARCH            = " << fixSeparators(dictionary[ "ARCHITECTURE" ]) << endl;
-        cacheStream << "QT_BUILD_TREE   = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ]) << endl;
-        cacheStream << "QT_SOURCE_TREE  = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ]) << endl;
+            cacheStream << "QMAKESPEC       = " << fixSeparators(targetSpec, true) << endl;
+        cacheStream << "ARCH            = " << dictionary[ "ARCHITECTURE" ] << endl;
+        cacheStream << "QT_BUILD_TREE   = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl;
+        cacheStream << "QT_SOURCE_TREE  = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl;
 
         if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
@@ -2756,27 +2889,27 @@
 
         //so that we can build without an install first (which would be impossible)
-        cacheStream << "QMAKE_MOC       = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe") << endl;
-        cacheStream << "QMAKE_UIC       = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe") << endl;
-        cacheStream << "QMAKE_UIC3      = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe") << endl;
-        cacheStream << "QMAKE_RCC       = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe") << endl;
-        cacheStream << "QMAKE_DUMPCPP   = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe") << endl;
-        cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include") << endl;
-        cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib") << endl;
+        cacheStream << "QMAKE_MOC       = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl;
+        cacheStream << "QMAKE_UIC       = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl;
+        cacheStream << "QMAKE_UIC3      = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe", true) << endl;
+        cacheStream << "QMAKE_RCC       = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl;
+        cacheStream << "QMAKE_DUMPCPP   = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl;
+        cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl;
+        cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl;
         if (dictionary["CETEST"] == "yes") {
-            cacheStream << "QT_CE_RAPI_INC  = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ]) << endl;
-            cacheStream << "QT_CE_RAPI_LIB  = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ]) << endl;
+            cacheStream << "QT_CE_RAPI_INC  = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl;
+            cacheStream << "QT_CE_RAPI_LIB  = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl;
         }
 
         // embedded
-        if( !dictionary["KBD_DRIVERS"].isEmpty())
+        if (!dictionary["KBD_DRIVERS"].isEmpty())
             cacheStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
-        if( !dictionary["GFX_DRIVERS"].isEmpty())
+        if (!dictionary["GFX_DRIVERS"].isEmpty())
             cacheStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
-        if( !dictionary["MOUSE_DRIVERS"].isEmpty())
+        if (!dictionary["MOUSE_DRIVERS"].isEmpty())
             cacheStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
-        if( !dictionary["DECORATIONS"].isEmpty())
+        if (!dictionary["DECORATIONS"].isEmpty())
             cacheStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
 
-        if( !dictionary["QMAKE_RPATHDIR"].isEmpty() )
+        if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
             cacheStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
 
@@ -2784,43 +2917,45 @@
         cacheFile.close();
     }
-    QFile configFile( dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri" );
-    if( configFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
-        QTextStream configStream( &configFile );
+    QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
+    if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
+        QTextStream configStream(&configFile);
         configStream << "CONFIG+= ";
         configStream << dictionary[ "BUILD" ];
-        if( dictionary[ "SHARED" ] == "yes" )
+        if (dictionary[ "SHARED" ] == "yes")
             configStream << " shared";
         else
             configStream << " static";
 
-        if( dictionary[ "LTCG" ] == "yes" )
+        if (dictionary[ "LTCG" ] == "yes")
             configStream << " ltcg";
-        if( dictionary[ "STL" ] == "yes" )
+        if (dictionary[ "MSVC_MP" ] == "yes")
+            configStream << " msvc_mp";
+        if (dictionary[ "STL" ] == "yes")
             configStream << " stl";
-        if ( dictionary[ "EXCEPTIONS" ] == "yes" )
+        if (dictionary[ "EXCEPTIONS" ] == "yes")
             configStream << " exceptions";
-        if ( dictionary[ "EXCEPTIONS" ] == "no" )
+        if (dictionary[ "EXCEPTIONS" ] == "no")
             configStream << " exceptions_off";
-        if ( dictionary[ "RTTI" ] == "yes" )
+        if (dictionary[ "RTTI" ] == "yes")
             configStream << " rtti";
-        if ( dictionary[ "MMX" ] == "yes" )
+        if (dictionary[ "MMX" ] == "yes")
             configStream << " mmx";
-        if ( dictionary[ "3DNOW" ] == "yes" )
+        if (dictionary[ "3DNOW" ] == "yes")
             configStream << " 3dnow";
-        if ( dictionary[ "SSE" ] == "yes" )
+        if (dictionary[ "SSE" ] == "yes")
             configStream << " sse";
-        if ( dictionary[ "SSE2" ] == "yes" )
+        if (dictionary[ "SSE2" ] == "yes")
             configStream << " sse2";
-        if ( dictionary[ "IWMMXT" ] == "yes" )
+        if (dictionary[ "IWMMXT" ] == "yes")
             configStream << " iwmmxt";
-        if ( dictionary["INCREDIBUILD_XGE"] == "yes" )
+        if (dictionary["INCREDIBUILD_XGE"] == "yes")
             configStream << " incredibuild_xge";
-        if ( dictionary["PLUGIN_MANIFESTS"] == "no" )
+        if (dictionary["PLUGIN_MANIFESTS"] == "no")
             configStream << " no_plugin_manifest";
 
-        if ( dictionary.contains("SYMBIAN_DEFFILES") ) {
-            if(dictionary["SYMBIAN_DEFFILES"] == "yes" ) {
+        if (dictionary.contains("SYMBIAN_DEFFILES")) {
+            if (dictionary["SYMBIAN_DEFFILES"] == "yes") {
                 configStream << " def_files";
-            } else if ( dictionary["SYMBIAN_DEFFILES"] == "no" ) {
+            } else if (dictionary["SYMBIAN_DEFFILES"] == "no") {
                 configStream << " def_files_disabled";
             }
@@ -2841,10 +2976,10 @@
 
         configStream << "#Qt for Windows CE c-runtime deployment" << endl
-                     << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ]) << endl;
-
-        if(dictionary["CE_SIGNATURE"] != QLatin1String("no"))
+                     << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl;
+
+        if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
             configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
 
-        if(!dictionary["QMAKE_RPATHDIR"].isEmpty())
+        if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
             configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
 
@@ -2853,6 +2988,9 @@
 
         configStream << "#Qt for Symbian FPU settings" << endl;
-        if(!dictionary["ARM_FPU_TYPE"].isEmpty()) {
+        if (!dictionary["ARM_FPU_TYPE"].isEmpty()) {
             configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
+        }
+        if (!dictionary["QT_NAMESPACE"].isEmpty()) {
+            configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
         }
 
@@ -2870,8 +3008,8 @@
     def.replace(QRegExp("="), " ");
 
-    if(def.startsWith("QT_NO_")) {
+    if (def.startsWith("QT_NO_")) {
         defNeg = defD;
         defNeg.replace("QT_NO_", "QT_");
-    } else if(def.startsWith("QT_")) {
+    } else if (def.startsWith("QT_")) {
         defNeg = defD;
         defNeg.replace("QT_", "QT_NO_");
@@ -2899,21 +3037,21 @@
 {
     QDir(buildPath).mkpath("src/corelib/global");
-    QString outName( buildPath + "/src/corelib/global/qconfig.h" );
+    QString outName(buildPath + "/src/corelib/global/qconfig.h");
     QTemporaryFile tmpFile;
     QTextStream tmpStream;
 
-    if(tmpFile.open()) {
+    if (tmpFile.open()) {
         tmpStream.setDevice(&tmpFile);
 
-        if( dictionary[ "QCONFIG" ] == "full" ) {
+        if (dictionary[ "QCONFIG" ] == "full") {
             tmpStream << "/* Everything */" << endl;
         } else {
-            QString configName( "qconfig-" + dictionary[ "QCONFIG" ] + ".h" );
+            QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
             tmpStream << "/* Copied from " << configName << "*/" << endl;
             tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
-            QFile inFile( sourcePath + "/src/corelib/global/" + configName );
-            if( inFile.open( QFile::ReadOnly ) ) {
+            QFile inFile(sourcePath + "/src/corelib/global/" + configName);
+            if (inFile.open(QFile::ReadOnly)) {
                 QByteArray buffer = inFile.readAll();
-                tmpFile.write( buffer.constData(), buffer.size() );
+                tmpFile.write(buffer.constData(), buffer.size());
                 inFile.close();
             }
@@ -2922,5 +3060,5 @@
         tmpStream << endl;
 
-        if( dictionary[ "SHARED" ] == "yes" ) {
+        if (dictionary[ "SHARED" ] == "yes") {
             tmpStream << "#ifndef QT_DLL" << endl;
             tmpStream << "#define QT_DLL" << endl;
@@ -2948,5 +3086,5 @@
         tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
         tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
-        if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
+        if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
             tmpStream << "#define Q_BYTE_ORDER Q_BIG_ENDIAN" << endl;
         else
@@ -2955,69 +3093,75 @@
         tmpStream << endl << "// Compile time features" << endl;
         tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
+        if (dictionary["GRAPHICS_SYSTEM"] == "runtime" && dictionary["RUNTIME_SYSTEM"] != "runtime")
+            tmpStream << "#define QT_DEFAULT_RUNTIME_SYSTEM \"" << dictionary["RUNTIME_SYSTEM"] << "\"" << endl;
+
         QStringList qconfigList;
-        if(dictionary["STL"] == "no")                qconfigList += "QT_NO_STL";
-        if(dictionary["STYLE_WINDOWS"] != "yes")     qconfigList += "QT_NO_STYLE_WINDOWS";
-        if(dictionary["STYLE_PLASTIQUE"] != "yes")   qconfigList += "QT_NO_STYLE_PLASTIQUE";
-        if(dictionary["STYLE_CLEANLOOKS"] != "yes")   qconfigList += "QT_NO_STYLE_CLEANLOOKS";
-        if(dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
+        if (dictionary["STL"] == "no")                qconfigList += "QT_NO_STL";
+        if (dictionary["STYLE_WINDOWS"] != "yes")     qconfigList += "QT_NO_STYLE_WINDOWS";
+        if (dictionary["STYLE_PLASTIQUE"] != "yes")   qconfigList += "QT_NO_STYLE_PLASTIQUE";
+        if (dictionary["STYLE_CLEANLOOKS"] != "yes")   qconfigList += "QT_NO_STYLE_CLEANLOOKS";
+        if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
             qconfigList += "QT_NO_STYLE_WINDOWSXP";
-        if(dictionary["STYLE_WINDOWSVISTA"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
-        if(dictionary["STYLE_MOTIF"] != "yes")       qconfigList += "QT_NO_STYLE_MOTIF";
-        if(dictionary["STYLE_CDE"] != "yes")         qconfigList += "QT_NO_STYLE_CDE";
-        if(dictionary["STYLE_S60"] != "yes")         qconfigList += "QT_NO_STYLE_S60";
-        if(dictionary["STYLE_WINDOWSCE"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSCE";
-        if(dictionary["STYLE_WINDOWSMOBILE"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
-        if(dictionary["STYLE_GTK"] != "yes")         qconfigList += "QT_NO_STYLE_GTK";
-
-        if(dictionary["GIF"] == "yes")              qconfigList += "QT_BUILTIN_GIF_READER=1";
-        if(dictionary["PNG"] == "no")               qconfigList += "QT_NO_IMAGEFORMAT_PNG";
-        if(dictionary["MNG"] == "no")               qconfigList += "QT_NO_IMAGEFORMAT_MNG";
-        if(dictionary["JPEG"] == "no")              qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
-        if(dictionary["TIFF"] == "no")              qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
-        if(dictionary["ZLIB"] == "no") {
+        if (dictionary["STYLE_WINDOWSVISTA"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
+        if (dictionary["STYLE_MOTIF"] != "yes")       qconfigList += "QT_NO_STYLE_MOTIF";
+        if (dictionary["STYLE_CDE"] != "yes")         qconfigList += "QT_NO_STYLE_CDE";
+        if (dictionary["STYLE_S60"] != "yes")         qconfigList += "QT_NO_STYLE_S60";
+        if (dictionary["STYLE_WINDOWSCE"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSCE";
+        if (dictionary["STYLE_WINDOWSMOBILE"] != "yes")   qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
+        if (dictionary["STYLE_GTK"] != "yes")         qconfigList += "QT_NO_STYLE_GTK";
+
+        if (dictionary["GIF"] == "yes")              qconfigList += "QT_BUILTIN_GIF_READER=1";
+        if (dictionary["PNG"] != "yes")              qconfigList += "QT_NO_IMAGEFORMAT_PNG";
+        if (dictionary["MNG"] != "yes")              qconfigList += "QT_NO_IMAGEFORMAT_MNG";
+        if (dictionary["JPEG"] != "yes")             qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
+        if (dictionary["TIFF"] != "yes")             qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
+        if (dictionary["ZLIB"] == "no") {
             qconfigList += "QT_NO_ZLIB";
             qconfigList += "QT_NO_COMPRESS";
         }
 
-        if(dictionary["ACCESSIBILITY"] == "no")     qconfigList += "QT_NO_ACCESSIBILITY";
-        if(dictionary["EXCEPTIONS"] == "no")        qconfigList += "QT_NO_EXCEPTIONS";
-        if(dictionary["OPENGL"] == "no")            qconfigList += "QT_NO_OPENGL";
-        if(dictionary["OPENVG"] == "no")            qconfigList += "QT_NO_OPENVG";
-        if(dictionary["OPENSSL"] == "no")           qconfigList += "QT_NO_OPENSSL";
-        if(dictionary["OPENSSL"] == "linked")       qconfigList += "QT_LINKED_OPENSSL";
-        if(dictionary["DBUS"] == "no")              qconfigList += "QT_NO_DBUS";
-        if(dictionary["IPV6"] == "no")              qconfigList += "QT_NO_IPV6";
-        if(dictionary["WEBKIT"] == "no")            qconfigList += "QT_NO_WEBKIT";
-        if(dictionary["DECLARATIVE"] == "no")       qconfigList += "QT_NO_DECLARATIVE";
-        if(dictionary["PHONON"] == "no")            qconfigList += "QT_NO_PHONON";
-        if(dictionary["MULTIMEDIA"] == "no")        qconfigList += "QT_NO_MULTIMEDIA";
-        if(dictionary["XMLPATTERNS"] == "no")       qconfigList += "QT_NO_XMLPATTERNS";
-        if(dictionary["SCRIPT"] == "no")            qconfigList += "QT_NO_SCRIPT";
-        if(dictionary["SCRIPTTOOLS"] == "no")       qconfigList += "QT_NO_SCRIPTTOOLS";
-        if(dictionary["FREETYPE"] == "no")          qconfigList += "QT_NO_FREETYPE";
-        if(dictionary["S60"] == "no")               qconfigList += "QT_NO_S60";
-        if(dictionary["NATIVE_GESTURES"] == "no")   qconfigList += "QT_NO_NATIVE_GESTURES";
-
-        if(dictionary["OPENGL_ES_CM"] == "yes" ||
-           dictionary["OPENGL_ES_CL"] == "yes" ||
+        if (dictionary["ACCESSIBILITY"] == "no")     qconfigList += "QT_NO_ACCESSIBILITY";
+        if (dictionary["EXCEPTIONS"] == "no")        qconfigList += "QT_NO_EXCEPTIONS";
+        if (dictionary["OPENGL"] == "no")            qconfigList += "QT_NO_OPENGL";
+        if (dictionary["OPENVG"] == "no")            qconfigList += "QT_NO_OPENVG";
+        if (dictionary["OPENSSL"] == "no")           qconfigList += "QT_NO_OPENSSL";
+        if (dictionary["OPENSSL"] == "linked")       qconfigList += "QT_LINKED_OPENSSL";
+        if (dictionary["DBUS"] == "no")              qconfigList += "QT_NO_DBUS";
+        if (dictionary["IPV6"] == "no")              qconfigList += "QT_NO_IPV6";
+        if (dictionary["WEBKIT"] == "no")            qconfigList += "QT_NO_WEBKIT";
+        if (dictionary["DECLARATIVE"] == "no")       qconfigList += "QT_NO_DECLARATIVE";
+        if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL";
+        if (dictionary["PHONON"] == "no")            qconfigList += "QT_NO_PHONON";
+        if (dictionary["MULTIMEDIA"] == "no")        qconfigList += "QT_NO_MULTIMEDIA";
+        if (dictionary["XMLPATTERNS"] == "no")       qconfigList += "QT_NO_XMLPATTERNS";
+        if (dictionary["SCRIPT"] == "no")            qconfigList += "QT_NO_SCRIPT";
+        if (dictionary["SCRIPTTOOLS"] == "no")       qconfigList += "QT_NO_SCRIPTTOOLS";
+        if (dictionary["FREETYPE"] == "no")          qconfigList += "QT_NO_FREETYPE";
+        if (dictionary["S60"] == "no")               qconfigList += "QT_NO_S60";
+        if (dictionary["NATIVE_GESTURES"] == "no")   qconfigList += "QT_NO_NATIVE_GESTURES";
+
+        if (dictionary["OPENGL_ES_CM"] == "no" &&
+           dictionary["OPENGL_ES_2"]  == "no" &&
+           dictionary["OPENVG"]       == "no")      qconfigList += "QT_NO_EGL";
+
+        if (dictionary["OPENGL_ES_CM"] == "yes" ||
            dictionary["OPENGL_ES_2"]  == "yes")     qconfigList += "QT_OPENGL_ES";
 
-        if(dictionary["OPENGL_ES_CM"] == "yes")     qconfigList += "QT_OPENGL_ES_1";
-        if(dictionary["OPENGL_ES_2"]  == "yes")     qconfigList += "QT_OPENGL_ES_2";
-        if(dictionary["OPENGL_ES_CL"] == "yes")     qconfigList += "QT_OPENGL_ES_1_CL";
-
-        if(dictionary["SQL_MYSQL"] == "yes")        qconfigList += "QT_SQL_MYSQL";
-        if(dictionary["SQL_ODBC"] == "yes")         qconfigList += "QT_SQL_ODBC";
-        if(dictionary["SQL_OCI"] == "yes")          qconfigList += "QT_SQL_OCI";
-        if(dictionary["SQL_PSQL"] == "yes")         qconfigList += "QT_SQL_PSQL";
-        if(dictionary["SQL_TDS"] == "yes")          qconfigList += "QT_SQL_TDS";
-        if(dictionary["SQL_DB2"] == "yes")          qconfigList += "QT_SQL_DB2";
-        if(dictionary["SQL_SQLITE"] == "yes")       qconfigList += "QT_SQL_SQLITE";
-        if(dictionary["SQL_SQLITE2"] == "yes")      qconfigList += "QT_SQL_SQLITE2";
-        if(dictionary["SQL_IBASE"] == "yes")        qconfigList += "QT_SQL_IBASE";
-
-        if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG";
-        if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
-        if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
+        if (dictionary["OPENGL_ES_CM"] == "yes")     qconfigList += "QT_OPENGL_ES_1";
+        if (dictionary["OPENGL_ES_2"]  == "yes")     qconfigList += "QT_OPENGL_ES_2";
+        if (dictionary["SQL_MYSQL"] == "yes")        qconfigList += "QT_SQL_MYSQL";
+        if (dictionary["SQL_ODBC"] == "yes")         qconfigList += "QT_SQL_ODBC";
+        if (dictionary["SQL_OCI"] == "yes")          qconfigList += "QT_SQL_OCI";
+        if (dictionary["SQL_PSQL"] == "yes")         qconfigList += "QT_SQL_PSQL";
+        if (dictionary["SQL_TDS"] == "yes")          qconfigList += "QT_SQL_TDS";
+        if (dictionary["SQL_DB2"] == "yes")          qconfigList += "QT_SQL_DB2";
+        if (dictionary["SQL_SQLITE"] == "yes")       qconfigList += "QT_SQL_SQLITE";
+        if (dictionary["SQL_SQLITE2"] == "yes")      qconfigList += "QT_SQL_SQLITE2";
+        if (dictionary["SQL_IBASE"] == "yes")        qconfigList += "QT_SQL_IBASE";
+
+        if (dictionary["GRAPHICS_SYSTEM"] == "openvg")  qconfigList += "QT_GRAPHICSSYSTEM_OPENVG";
+        if (dictionary["GRAPHICS_SYSTEM"] == "opengl")  qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
+        if (dictionary["GRAPHICS_SYSTEM"] == "raster")  qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
+        if (dictionary["GRAPHICS_SYSTEM"] == "runtime") qconfigList += "QT_GRAPHICSSYSTEM_RUNTIME";
 
         if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
@@ -3036,5 +3180,5 @@
             tmpStream << addDefine(qconfigList.at(i));
 
-        if(dictionary["EMBEDDED"] == "yes")
+        if (dictionary["EMBEDDED"] == "yes")
         {
             // Check for keyboard, mouse, gfx.
@@ -3042,6 +3186,6 @@
             QStringList allKbdDrivers;
             allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
-            foreach(QString kbd, allKbdDrivers) {
-                if( !kbdDrivers.contains(kbd))
+            foreach (const QString &kbd, allKbdDrivers) {
+                if (!kbdDrivers.contains(kbd))
                     tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
             }
@@ -3050,6 +3194,6 @@
             QStringList allMouseDrivers;
             allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
-            foreach(QString mouse, allMouseDrivers) {
-                if( !mouseDrivers.contains(mouse) )
+            foreach (const QString &mouse, allMouseDrivers) {
+                if (!mouseDrivers.contains(mouse))
                     tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
             }
@@ -3058,6 +3202,6 @@
             QStringList allGfxDrivers;
             allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
-            foreach(QString gfx, allGfxDrivers) {
-                if( !gfxDrivers.contains(gfx))
+            foreach (const QString &gfx, allGfxDrivers) {
+                if (!gfxDrivers.contains(gfx))
                     tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
             }
@@ -3066,24 +3210,24 @@
 
             QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
-            foreach(QString depth, depths)
+            foreach (const QString &depth, depths)
               tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
         }
 
-        if( dictionary[ "QT_CUPS" ] == "no")
+        if (dictionary[ "QT_CUPS" ] == "no")
           tmpStream<<"#define QT_NO_CUPS"<<endl;
 
-        if( dictionary[ "QT_ICONV" ]  == "no")
+        if (dictionary[ "QT_ICONV" ]  == "no")
           tmpStream<<"#define QT_NO_ICONV"<<endl;
 
-        if(dictionary[ "QT_GLIB" ] == "no")
+        if (dictionary[ "QT_GLIB" ] == "no")
           tmpStream<<"#define QT_NO_GLIB"<<endl;
 
-        if(dictionary[ "QT_LPR" ] == "no")
+        if (dictionary[ "QT_LPR" ] == "no")
           tmpStream<<"#define QT_NO_LPR"<<endl;
 
-        if(dictionary[ "QT_INOTIFY" ] == "no" )
+        if (dictionary[ "QT_INOTIFY" ] == "no")
           tmpStream<<"#define QT_NO_INOTIFY"<<endl;
 
-        if(dictionary[ "QT_SXE" ] == "no")
+        if (dictionary[ "QT_SXE" ] == "no")
           tmpStream<<"#define QT_NO_SXE"<<endl;
 
@@ -3096,14 +3240,4 @@
         tmpFile.copy(outName);
         tmpFile.close();
-
-        if(!QFile::exists(buildPath + "/include/QtCore/qconfig.h")) {
-            if (!writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
-                             buildPath + "/include/QtCore/qconfig.h")
-            || !writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
-                            buildPath + "/include/Qt/qconfig.h")) {
-                dictionary["DONE"] = "error";
-                return;
-            }
-        }
     }
 
@@ -3121,19 +3255,9 @@
     QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
     QString pltSpec = sourcePath + "/mkspecs/" + spec;
-    if (!Environment::cpdir(pltSpec, defSpec)) {
+    QString includeSpec = buildPath + "/mkspecs/" + spec;
+    if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
         cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
         dictionary["DONE"] = "error";
         return;
-    }
-
-    outName = defSpec + "/qmake.conf";
-    ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
-    QFile qmakeConfFile(outName);
-    if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) {
-        QTextStream qmakeConfStream;
-        qmakeConfStream.setDevice(&qmakeConfFile);
-        qmakeConfStream << endl << "QMAKESPEC_ORIGINAL=" << pltSpec << endl;
-        qmakeConfStream.flush();
-        qmakeConfFile.close();
     }
 
@@ -3152,33 +3276,35 @@
                   << "static const char qt_configure_installation          [11  + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
                   << endl;
-        if(!dictionary[ "QT_HOST_PREFIX" ].isNull())
+        if (!dictionary[ "QT_HOST_PREFIX" ].isNull())
             tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
-        tmpStream << "static const char qt_configure_prefix_path_str       [512 + 12] = \"qt_prfxpath=" << QString(dictionary["QT_INSTALL_PREFIX"]).replace( "\\", "\\\\" ) << "\";" << endl
-                  << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << QString(dictionary["QT_INSTALL_DOCS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_headers_path_str      [512 + 12] = \"qt_hdrspath=" << QString(dictionary["QT_INSTALL_HEADERS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_libraries_path_str    [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_binaries_path_str     [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_plugins_path_str      [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_data_path_str         [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl
-                  << "static const char qt_configure_examples_path_str     [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  << "static const char qt_configure_demos_path_str        [512 + 12] = \"qt_demopath=" << QString(dictionary["QT_INSTALL_DEMOS"]).replace( "\\", "\\\\" ) << "\";"  << endl
-                  //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << QString(dictionary["QT_INSTALL_SETTINGS"]).replace( "\\", "\\\\" ) << "\";" << endl
+        tmpStream << "static const char qt_configure_prefix_path_str       [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl
+                  << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";"  << endl
+                  << "static const char qt_configure_headers_path_str      [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";"  << endl
+                  << "static const char qt_configure_libraries_path_str    [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";"  << endl
+                  << "static const char qt_configure_binaries_path_str     [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";"  << endl
+                  << "static const char qt_configure_plugins_path_str      [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";"  << endl
+                  << "static const char qt_configure_imports_path_str      [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";"  << endl
+                  << "static const char qt_configure_data_path_str         [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";"  << endl
+                  << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl
+                  << "static const char qt_configure_examples_path_str     [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";"  << endl
+                  << "static const char qt_configure_demos_path_str        [512 + 12] = \"qt_demopath=" << escapeSeparators(dictionary["QT_INSTALL_DEMOS"]) << "\";"  << endl
+                  //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
                   ;
-        if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
+        if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
              tmpStream << "#else" << endl
-                       << "static const char qt_configure_prefix_path_str       [512 + 12] = \"qt_prfxpath=" << QString(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) << "\";" << endl
-                       << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_headers_path_str      [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_libraries_path_str    [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_binaries_path_str     [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_plugins_path_str      [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_data_path_str         [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl
-                       << "static const char qt_configure_examples_path_str     [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";"  << endl
-                       << "static const char qt_configure_demos_path_str        [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos").replace( "\\", "\\\\" ) <<"\";"  << endl
+                       << "static const char qt_configure_prefix_path_str       [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl
+                       << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";"  << endl
+                       << "static const char qt_configure_headers_path_str      [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";"  << endl
+                       << "static const char qt_configure_libraries_path_str    [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";"  << endl
+                       << "static const char qt_configure_binaries_path_str     [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";"  << endl
+                       << "static const char qt_configure_plugins_path_str      [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";"  << endl
+                       << "static const char qt_configure_imports_path_str      [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";"  << endl
+                       << "static const char qt_configure_data_path_str         [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";"  << endl
+                       << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl
+                       << "static const char qt_configure_examples_path_str     [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";"  << endl
+                       << "static const char qt_configure_demos_path_str        [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos", true) <<"\";"  << endl
                        << "#endif //QT_BOOTSTRAPPED" << endl;
         }
-        tmpStream << "/* strlen( \"qt_lcnsxxxx\" ) == 12 */" << endl
+        tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
                   << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
                   << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
@@ -3189,4 +3315,5 @@
                   << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
                   << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
+                  << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl
                   << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
                   << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
@@ -3200,6 +3327,6 @@
 
         // Replace old qconfig.cpp with new one
-        ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
-        QFile::remove( outName );
+        ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
+        QFile::remove(outName);
         tmpFile2.copy(outName);
         tmpFile2.close();
@@ -3210,5 +3337,5 @@
         tmpStream.setDevice(&tmpFile3);
         tmpStream << "/* Evaluation license key */" << endl
-                  << "static const char qt_eval_key_data              [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
+                  << "static const volatile char qt_eval_key_data              [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
 
         tmpStream.flush();
@@ -3216,6 +3343,6 @@
 
         outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
-        ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
-        QFile::remove( outName );
+        ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
+        QFile::remove(outName);
 
         if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
@@ -3261,7 +3388,7 @@
 
     cout << "Configuration:" << endl;
-    cout << "    " << qmakeConfig.join( "\r\n    " ) << endl;
+    cout << "    " << qmakeConfig.join("\r\n    ") << endl;
     cout << "Qt Configuration:" << endl;
-    cout << "    " << qtConfig.join( "\r\n    " ) << endl;
+    cout << "    " << qtConfig.join("\r\n    ") << endl;
     cout << endl;
 
@@ -3290,6 +3417,12 @@
     cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
     cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
-    cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl;
+    {
+        QString webkit = dictionary[ "WEBKIT" ];
+        if (webkit == "debug")
+            webkit = "yes (debug)";
+        cout << "WebKit support.............." << webkit << endl;
+    }
     cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl;
+    cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl;
     cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
     cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
@@ -3335,4 +3468,5 @@
     cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
     cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
+    cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl;
     cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
     cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
@@ -3354,5 +3488,5 @@
     if (dictionary.contains("SYMBIAN_DEFFILES")) {
         cout << "Symbian DEF files enabled..." << dictionary[ "SYMBIAN_DEFFILES" ] << endl;
-        if(dictionary["SYMBIAN_DEFFILES"] == "no") {
+        if (dictionary["SYMBIAN_DEFFILES"] == "no") {
             cout << "WARNING: Disabling DEF files will mean that Qt is NOT binary compatible with previous versions." << endl;
             cout << "         This feature is only intended for use during development, NEVER for release builds." << endl;
@@ -3360,43 +3494,43 @@
     }
 
-    if(dictionary["ASSISTANT_WEBKIT"] == "yes")
+    if (dictionary["ASSISTANT_WEBKIT"] == "yes")
         cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
 
-    if(checkAvailability("INCREDIBUILD_XGE"))
+    if (checkAvailability("INCREDIBUILD_XGE"))
         cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
-    if( !qmakeDefines.isEmpty() ) {
+    if (!qmakeDefines.isEmpty()) {
         cout << "Defines.....................";
-        for( QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs )
+        for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
             cout << (*defs) << " ";
         cout << endl;
     }
-    if( !qmakeIncludes.isEmpty() ) {
+    if (!qmakeIncludes.isEmpty()) {
         cout << "Include paths...............";
-        for( QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs )
+        for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
             cout << (*incs) << " ";
         cout << endl;
     }
-    if( !qmakeLibs.isEmpty() ) {
+    if (!qmakeLibs.isEmpty()) {
         cout << "Additional libraries........";
-        for( QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs )
+        for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
             cout << (*libs) << " ";
         cout << endl;
     }
-    if( dictionary[ "QMAKE_INTERNAL" ] == "yes" ) {
+    if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
         cout << "Using internal configuration." << endl;
     }
-    if( dictionary[ "SHARED" ] == "no" ) {
+    if (dictionary[ "SHARED" ] == "no") {
         cout << "WARNING: Using static linking will disable the use of plugins." << endl;
         cout << "         Make sure you compile ALL needed modules into the library." << endl;
     }
-    if( dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty() ) {
+    if (dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty()) {
         cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
         cout << "library names through OPENSSL_LIBS." << endl;
         cout << "For example:" << endl;
-        cout << "    configure -openssl-linked OPENSSL_LIBS='-lssleay32 -llibeay32'" << endl;
-    }
-    if( dictionary[ "ZLIB_FORCED" ] == "yes" ) {
+        cout << "    configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
+    }
+    if (dictionary[ "ZLIB_FORCED" ] == "yes") {
         QString which_zlib = "supplied";
-        if( dictionary[ "ZLIB" ] == "system")
+        if (dictionary[ "ZLIB" ] == "system")
             which_zlib = "system";
 
@@ -3427,15 +3561,15 @@
 void Configure::buildQmake()
 {
-    if( dictionary[ "BUILD_QMAKE" ] == "yes" ) {
+    if (dictionary[ "BUILD_QMAKE" ] == "yes") {
         QStringList args;
 
         // Build qmake
         QString pwd = QDir::currentPath();
-        QDir::setCurrent(buildPath + "/qmake" );
+        QDir::setCurrent(buildPath + "/qmake");
 
         QString makefile = "Makefile";
         {
             QFile out(makefile);
-            if(out.open(QFile::WriteOnly | QFile::Text)) {
+            if (out.open(QFile::WriteOnly | QFile::Text)) {
                 QTextStream stream(&out);
                 stream << "#AutoGenerated by configure.exe" << endl
@@ -3450,5 +3584,5 @@
 
                 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
-                if(in.open(QFile::ReadOnly | QFile::Text)) {
+                if (in.open(QFile::ReadOnly | QFile::Text)) {
                     QString d = in.readAll();
                     //### need replaces (like configure.sh)? --Sam
@@ -3465,6 +3599,6 @@
 
         cout << "Creating qmake..." << endl;
-        int exitCode = 0;
-        if( exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
+        int exitCode = Environment::execute(args, QStringList(), QStringList());
+        if (exitCode) {
             args.clear();
             args += dictionary[ "MAKE" ];
@@ -3472,5 +3606,6 @@
             args += makefile;
             args += "clean";
-            if( exitCode = Environment::execute(args, QStringList(), QStringList())) {
+            exitCode = Environment::execute(args, QStringList(), QStringList());
+            if (exitCode) {
                 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
                 dictionary[ "DONE" ] = "error";
@@ -3480,5 +3615,6 @@
                 args += "-f";
                 args += makefile;
-                if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
+                exitCode = Environment::execute(args, QStringList(), QStringList());
+                if (exitCode) {
                     cout << "Building qmake failed, return code " << exitCode << endl << endl;
                     dictionary[ "DONE" ] = "error";
@@ -3486,5 +3622,5 @@
             }
         }
-        QDir::setCurrent( pwd );
+        QDir::setCurrent(pwd);
     }
 }
@@ -3505,5 +3641,5 @@
         << "tools/linguist/lrelease";
 
-    if(dictionary["XQMAKESPEC"].startsWith("wince"))
+    if (dictionary["XQMAKESPEC"].startsWith("wince"))
         hostToolsDirs << "tools/checksdk";
 
@@ -3519,11 +3655,14 @@
         QStringList args;
         args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
-        args << "-spec" << dictionary["QMAKESPEC"] << "-r";
+        // override .qmake.cache because we are not cross-building these.
+        // we need a full path so that a build with -prefix will still find it.
+        args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]);
+        args << "-r";
         args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
 
         QDir().mkpath(toolBuildPath);
         QDir::setCurrent(toolSourcePath);
-        int exitCode = 0;
-        if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
+        int exitCode = Environment::execute(args, QStringList(), QStringList());
+        if (exitCode) {
             cout << "qmake failed, return code " << exitCode << endl << endl;
             dictionary["DONE"] = "error";
@@ -3535,9 +3674,11 @@
         args += dictionary["MAKE"];
         QDir::setCurrent(toolBuildPath);
-        if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
+        exitCode = Environment::execute(args, QStringList(), QStringList());
+        if (exitCode) {
             args.clear();
             args += dictionary["MAKE"];
             args += "clean";
-            if(exitCode = Environment::execute(args, QStringList(), QStringList())) {
+            exitCode = Environment::execute(args, QStringList(), QStringList());
+            if (exitCode) {
                 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
                 dictionary["DONE"] = "error";
@@ -3546,5 +3687,6 @@
                 args.clear();
                 args += dictionary["MAKE"];
-                if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
+                exitCode = Environment::execute(args, QStringList(), QStringList());
+                if (exitCode) {
                     cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
                     dictionary["DONE"] = "error";
@@ -3557,8 +3699,8 @@
 }
 
-void Configure::findProjects( const QString& dirName )
-{
-    if( dictionary[ "NOPROCESS" ] == "no" ) {
-        QDir dir( dirName );
+void Configure::findProjects(const QString& dirName)
+{
+    if (dictionary[ "NOPROCESS" ] == "no") {
+        QDir dir(dirName);
         QString entryName;
         int makeListNumber;
@@ -3566,13 +3708,13 @@
         const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
                                                       QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
-        for(int i = 0; i < list.size(); ++i) {
+        for (int i = 0; i < list.size(); ++i) {
             const QFileInfo &fi = list.at(i);
-            if(fi.fileName() != "qmake.pro") {
+            if (fi.fileName() != "qmake.pro") {
                 entryName = dirName + "/" + fi.fileName();
-                if(fi.isDir()) {
-                    findProjects( entryName );
+                if (fi.isDir()) {
+                    findProjects(entryName);
                 } else {
-                    qmakeTemplate = projectType( fi.absoluteFilePath() );
-                    switch ( qmakeTemplate ) {
+                    qmakeTemplate = projectType(fi.absoluteFilePath());
+                    switch (qmakeTemplate) {
                     case Lib:
                     case Subdirs:
@@ -3601,16 +3743,16 @@
     dir.prepend("/src");
     makeList[inList].append(new MakeItem(sourcePath + dir,
-        item + ".pro", buildPath + dir + "/Makefile", Lib ) );
-    if( dictionary[ "DSPFILES" ] == "yes" ) {
-        makeList[inList].append( new MakeItem(sourcePath + dir,
-            item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib ) );
-    }
-    if( dictionary[ "VCPFILES" ] == "yes" ) {
-        makeList[inList].append( new MakeItem(sourcePath + dir,
-            item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib ) );
-    }
-    if( dictionary[ "VCPROJFILES" ] == "yes" ) {
-        makeList[inList].append( new MakeItem(sourcePath + dir,
-            item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib ) );
+        item + ".pro", buildPath + dir + "/Makefile", Lib));
+    if (dictionary[ "DSPFILES" ] == "yes") {
+        makeList[inList].append(new MakeItem(sourcePath + dir,
+            item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib));
+    }
+    if (dictionary[ "VCPFILES" ] == "yes") {
+        makeList[inList].append(new MakeItem(sourcePath + dir,
+            item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib));
+    }
+    if (dictionary[ "VCPROJFILES" ] == "yes") {
+        makeList[inList].append(new MakeItem(sourcePath + dir,
+            item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
     }
 }
@@ -3618,5 +3760,5 @@
 void Configure::generateMakefiles()
 {
-    if( dictionary[ "NOPROCESS" ] == "no" ) {
+    if (dictionary[ "NOPROCESS" ] == "no") {
 #if !defined(EVAL)
         cout << "Creating makefiles in src..." << endl;
@@ -3624,8 +3766,8 @@
 
         QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
-        if( spec != "win32-msvc" )
+        if (spec != "win32-msvc")
             dictionary[ "DSPFILES" ] = "no";
 
-        if( spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
+        if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
             dictionary[ "VCPROJFILES" ] = "no";
 
@@ -3642,8 +3784,8 @@
                 QStringList args;
 
-                args << fixSeparators( buildPath + "/bin/qmake" );
+                args << fixSeparators(buildPath + "/bin/qmake");
 
                 if (doDsp) {
-                    if( dictionary[ "DEPENDENCIES" ] == "no" )
+                    if (dictionary[ "DEPENDENCIES" ] == "no")
                         args << "-nodepend";
                     args << "-tp" <<  "vc";
@@ -3654,15 +3796,14 @@
                     generate = false; // Now Makefiles will be done
                 }
-                args << "-spec";
-                args << spec;
+                // don't pass -spec - .qmake.cache has it already
                 args << "-r";
                 args << (sourcePath + "/projects.pro");
                 args << "-o";
                 args << buildPath;
-                if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
+                if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
                     args << dictionary[ "QMAKEADDITIONALARGS" ];
 
-                QDir::setCurrent( fixSeparators( dirPath ) );
-                if( int exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
+                QDir::setCurrent(fixSeparators(dirPath));
+                if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
                     cout << "Qmake failed, return code " << exitCode  << endl << endl;
                     dictionary[ "DONE" ] = "error";
@@ -3671,8 +3812,8 @@
         } else {
             findProjects(sourcePath);
-            for ( i=0; i<3; i++ ) {
-                for ( int j=0; j<makeList[i].size(); ++j) {
+            for (i=0; i<3; i++) {
+                for (int j=0; j<makeList[i].size(); ++j) {
                     MakeItem *it=makeList[i][j];
-                    QString dirPath = fixSeparators( it->directory + "/" );
+                    QString dirPath = fixSeparators(it->directory + "/");
                     QString projectName = it->proFile;
                     QString makefileName = buildPath + "/" + dirPath + it->target;
@@ -3685,5 +3826,5 @@
                     QStringList args;
 
-                    args << fixSeparators( buildPath + "/bin/qmake" );
+                    args << fixSeparators(buildPath + "/bin/qmake");
                     args << sourcePath + "/" + dirPath + projectName;
                     args << dictionary[ "QMAKE_ALL_ARGS" ];
@@ -3694,8 +3835,8 @@
                     args << "-spec";
                     args << spec;
-                    if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
+                    if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
                         args << dictionary[ "QMAKEADDITIONALARGS" ];
 
-                    QDir::setCurrent( fixSeparators( dirPath ) );
+                    QDir::setCurrent(fixSeparators(dirPath));
 
                     QFile file(makefileName);
@@ -3715,5 +3856,5 @@
             }
         }
-        QDir::setCurrent( pwd );
+        QDir::setCurrent(pwd);
     } else {
         cout << "Processing of project files have been disabled." << endl;
@@ -3729,5 +3870,5 @@
         cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
         cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
-    } else if(dictionary.value("QMAKESPEC").startsWith("wince")) {
+    } else if (dictionary.value("QMAKESPEC").startsWith("wince")) {
         // we are cross compiling for Windows CE
         cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
@@ -3741,22 +3882,22 @@
 }
 
-Configure::ProjectType Configure::projectType( const QString& proFileName )
-{
-    QFile proFile( proFileName );
-    if( proFile.open( QFile::ReadOnly ) ) {
+Configure::ProjectType Configure::projectType(const QString& proFileName)
+{
+    QFile proFile(proFileName);
+    if (proFile.open(QFile::ReadOnly)) {
         QString buffer = proFile.readLine(1024);
         while (!buffer.isEmpty()) {
-            QStringList segments = buffer.split(QRegExp( "\\s" ));
+            QStringList segments = buffer.split(QRegExp("\\s"));
             QStringList::Iterator it = segments.begin();
 
-            if(segments.size() >= 3) {
+            if (segments.size() >= 3) {
                 QString keyword = (*it++);
                 QString operation = (*it++);
                 QString value = (*it++);
 
-                if( keyword == "TEMPLATE" ) {
-                    if( value == "lib" )
+                if (keyword == "TEMPLATE") {
+                    if (value == "lib")
                         return Lib;
-                    else if( value == "subdirs" )
+                    else if (value == "subdirs")
                         return Subdirs;
                 }
@@ -3844,9 +3985,9 @@
             }
             QStringList licenseContent = QString(file.readAll()).split('\n');
-            while(i < licenseContent.size()) {
+            while (i < licenseContent.size()) {
                 cout << licenseContent.at(i) << endl;
                 if (++i % screenHeight == 0) {
                     cout << "(Press any key for more..)";
-                    if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
+                    if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
                         exit(0);      // Exit cleanly for Ctrl+C
                     cout << "\r";     // Overwrite text above
@@ -3930,11 +4071,11 @@
 void Configure::reloadCmdLine()
 {
-    if( dictionary[ "REDO" ] == "yes" ) {
-        QFile inFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
-        if( inFile.open( QFile::ReadOnly ) ) {
-            QTextStream inStream( &inFile );
+    if (dictionary[ "REDO" ] == "yes") {
+        QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
+        if (inFile.open(QFile::ReadOnly)) {
+            QTextStream inStream(&inFile);
             QString buffer;
             inStream >> buffer;
-            while( buffer.length() ) {
+            while (buffer.length()) {
                 configCmdLine += buffer;
                 inStream >> buffer;
@@ -3947,9 +4088,9 @@
 void Configure::saveCmdLine()
 {
-    if( dictionary[ "REDO" ] != "yes" ) {
-        QFile outFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
-        if( outFile.open( QFile::WriteOnly | QFile::Text ) ) {
-            QTextStream outStream( &outFile );
-            for( QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it ) {
+    if (dictionary[ "REDO" ] != "yes") {
+        QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
+        if (outFile.open(QFile::WriteOnly | QFile::Text)) {
+            QTextStream outStream(&outFile);
+            for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
                 outStream << (*it) << " " << endl;
             }
@@ -3975,21 +4116,21 @@
 {
     QFile file1(fn1), file2(fn2);
-    if(!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
+    if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
         return true;
     const int chunk = 2048;
     int used1 = 0, used2 = 0;
     char b1[chunk], b2[chunk];
-    while(!file1.atEnd() && !file2.atEnd()) {
-        if(!used1)
+    while (!file1.atEnd() && !file2.atEnd()) {
+        if (!used1)
             used1 = file1.read(b1, chunk);
-        if(!used2)
+        if (!used2)
             used2 = file2.read(b2, chunk);
-        if(used1 > 0 && used2 > 0) {
+        if (used1 > 0 && used2 > 0) {
             const int cmp = qMin(used1, used2);
-            if(memcmp(b1, b2, cmp))
+            if (memcmp(b1, b2, cmp))
                 return true;
-            if((used1 -= cmp))
+            if ((used1 -= cmp))
                 memcpy(b1, b1+cmp, used1);
-            if((used2 -= cmp))
+            if ((used2 -= cmp))
                 memcpy(b2, b2+cmp, used2);
         }
Index: trunk/tools/configure/configureapp.h
===================================================================
--- trunk/tools/configure/configureapp.h	(revision 769)
+++ trunk/tools/configure/configureapp.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -123,6 +123,4 @@
     QStringList qmakeStylePlugins;
 
-    QStringList qmakeFormatPlugins;
-
     QStringList qmakeVars;
     QStringList qmakeDefines;
@@ -134,4 +132,7 @@
     QStringList qmakeLibs;
     QString opensslLibs;
+    QString psqlLibs;
+    QString sybase;
+    QString sybaseLibs;
 
     QMap<QString,QString> licenseInfo;
@@ -148,5 +149,6 @@
 
     bool useUnixSeparators;
-    QString fixSeparators(QString somePath);
+    QString fixSeparators(const QString &somePath, bool escape = false);
+    QString escapeSeparators(const QString &somePath);
     bool filesDiffer(const QString &file1, const QString &file2);
 
Index: trunk/tools/configure/environment.cpp
===================================================================
--- trunk/tools/configure/environment.cpp	(revision 769)
+++ trunk/tools/configure/environment.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -61,6 +61,6 @@
 #endif
 
-#include <symbian/epocroot.h> // from tools/shared
-#include <windows/registry.h> // from tools/shared
+#include <symbian/epocroot_p.h> // from tools/shared
+#include <windows/registry_p.h> // from tools/shared
 
 QT_BEGIN_NAMESPACE
@@ -74,5 +74,5 @@
     // The compilers here are sorted in a reversed-preferred order
     {CC_BORLAND, "Borland C++",                                                    0, "bcc32.exe"},
-    {CC_MINGW,   "MinGW (Minimalist GNU for Windows)",                             0, "mingw32-gcc.exe"},
+    {CC_MINGW,   "MinGW (Minimalist GNU for Windows)",                             0, "g++.exe"},
     {CC_INTEL,   "Intel(R) C++ Compiler for 32-bit applications",                  0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe
     {CC_MSVC6,   "Microsoft (R) 32-bit C/C++ Optimizing Compiler (6.x)",           "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++\\ProductDir", "cl.exe"}, // link.exe, lib.exe
@@ -81,4 +81,5 @@
     {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)",  "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
     {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)",  "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
+    {CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
     {CC_UNKNOWN, "Unknown", 0, 0},
 };
@@ -106,4 +107,7 @@
     QString spec;
     switch (detectCompiler()) {
+    case CC_NET2010:
+        spec = "win32-msvc2010";
+        break;
     case CC_NET2008:
         spec = "win32-msvc2008";
@@ -160,5 +164,5 @@
     QStringList pathlist = paths.toLower().split(";");
     for(int i = 0; compiler_info[i].compiler; ++i) {
-        QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
+        QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
         if (productPath.length()) {
             QStringList::iterator it;
@@ -278,6 +282,5 @@
     }
     // add the user environment
-    for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) {
-            QString tmp = *it;
+    foreach (const QString &tmp, environment) {
             uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
             envlist.resize(envlist.size() + tmpSize);
@@ -358,5 +361,5 @@
     QByteArray envlist = qt_create_environment(fullEnv);
 
-    DWORD exitCode = -1;
+    DWORD exitCode = DWORD(-1);
     PROCESS_INFORMATION procInfo;
     memset(&procInfo, 0, sizeof(procInfo));
@@ -379,9 +382,9 @@
 
 
-    if (exitCode == -1) {
+    if (exitCode == DWORD(-1)) {
         switch(GetLastError()) {
         case E2BIG:
             cerr << "execute: Argument list exceeds 1024 bytes" << endl;
-            foreach(QString arg, arguments)
+            foreach (const QString &arg, arguments)
                 cerr << "   (" << arg.toLocal8Bit().constData() << ")" << endl;
             break;
@@ -397,5 +400,5 @@
         default:
             cerr << "execute: Unknown error" << endl;
-            foreach(QString arg, arguments)
+            foreach (const QString &arg, arguments)
                 cerr << "   (" << arg.toLocal8Bit().constData() << ")" << endl;
             break;
@@ -405,8 +408,23 @@
 }
 
-bool Environment::cpdir(const QString &srcDir, const QString &destDir)
+/*!
+    Copies the \a srcDir contents into \a destDir.
+
+    If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes
+    will not be copied over from \a srcDir. Instead a new file will be created
+    in \a destDir with the same name and that file will include a file with the
+    same name from the \a includeSrcDir using relative path and appropriate
+    syntax for the file type.
+
+    Returns true if copying was successful.
+*/
+bool Environment::cpdir(const QString &srcDir,
+                        const QString &destDir,
+                        const QString &includeSrcDir)
 {
     QString cleanSrcName = QDir::cleanPath(srcDir);
     QString cleanDstName = QDir::cleanPath(destDir);
+    QString cleanIncludeName = QDir::cleanPath(includeSrcDir);
+
 #ifdef CONFIGURE_DEBUG_CP_DIR
     qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
@@ -419,4 +437,5 @@
     bool result = true;
     QDir dir = QDir(cleanSrcName);
+    QDir destinationDir = QDir(cleanDstName);
     QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
     for (int i = 0; result && (i < allEntries.count()); ++i) {
@@ -424,6 +443,11 @@
 	bool intermediate = true;
         if (entry.isDir()) {
+            QString newIncSrcDir;
+            if (!includeSrcDir.isEmpty())
+                newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
+
             intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
-                            QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
+                                 QString("%1/%2").arg(cleanDstName).arg(entry.fileName()),
+                                 newIncSrcDir);
         } else {
             QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
@@ -432,6 +456,38 @@
 #endif
 	    QFile::remove(destFile);
-            intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
-            SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
+            QString suffix = entry.suffix();
+            if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) {
+                QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
+                relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath);
+#ifdef CONFIGURE_DEBUG_CP_DIR
+                qDebug() << "...instead generate relative include to" << relativeIncludeFilePath;
+#endif
+                QFile currentFile(destFile);
+                if (currentFile.open(QFile::WriteOnly | QFile::Text)) {
+                    QTextStream fileStream;
+                    fileStream.setDevice(&currentFile);
+
+                    if (suffix == "prf" || suffix == "conf") {
+                        if (entry.fileName() == "qmake.conf") {
+                            // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the
+                            // primary use of this variable by qmake to identify the original mkspec, the
+                            // variable is also used for few special cases where the absolute path is required.
+                            // Conversely, the include of the original qmake.conf must be done using relative path,
+                            // as some Qt binary deployments are done in a manner that doesn't allow for patching
+                            // the paths at the installation time.
+                            fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl;
+                        }
+                        fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl;
+                    } else if (suffix == "h") {
+                        fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl;
+                    }
+
+                    fileStream.flush();
+                    currentFile.close();
+                }
+            } else {
+                intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
+                SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
+            }
         }
 	if(!intermediate) {
@@ -464,6 +520,6 @@
 QString Environment::symbianEpocRoot()
 {
-    // Call function defined in tools/shared/symbian/epocroot.h
-    return ::epocRoot();
+    // Call function defined in tools/shared/symbian/epocroot_p.h
+    return ::qt_epocRoot();
 }
 
Index: trunk/tools/configure/environment.h
===================================================================
--- trunk/tools/configure/environment.h	(revision 769)
+++ trunk/tools/configure/environment.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -57,5 +57,6 @@
     CC_NET2003 = 0x71,
     CC_NET2005 = 0x80,
-    CC_NET2008 = 0x90
+    CC_NET2008 = 0x90,
+    CC_NET2010 = 0x91
 };
 
@@ -69,5 +70,7 @@
 
     static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
-    static bool cpdir(const QString &srcDir, const QString &destDir);
+    static bool cpdir(const QString &srcDir,
+                      const QString &destDir,
+                      const QString &includeSrcDir = QString());
     static bool rmdir(const QString &name);
 
Index: trunk/tools/configure/main.cpp
===================================================================
--- trunk/tools/configure/main.cpp	(revision 769)
+++ trunk/tools/configure/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/configure/tools.cpp
===================================================================
--- trunk/tools/configure/tools.cpp	(revision 769)
+++ trunk/tools/configure/tools.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -92,6 +92,6 @@
                 if ( components.size() >= 2 ) {
                     QStringList::Iterator it = components.begin();
-                    QString key = (*it++).trimmed().replace( "\"", QString() ).toUpper();
-                    QString value = (*it++).trimmed().replace( "\"", QString() );
+                    QString key = (*it++).trimmed().remove('"').toUpper();
+                    QString value = (*it++).trimmed().remove('"');
                     licenseInfo[ key ] = value;
                 }
@@ -112,5 +112,5 @@
     QString licenseKey = licenseInfo["LICENSEKEYEXT"];
     QByteArray clicenseKey = licenseKey.toLatin1();
-    //We check the licence
+    //We check the license
     static const char * const SEP = "-";
     char *licenseParts[NUMBER_OF_PARTS];
@@ -219,5 +219,5 @@
     if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
         // Generic, no-suffix license
-        dictionary["LICENSE_EXTENSION"] = QString();
+        dictionary["LICENSE_EXTENSION"].clear();
     } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
         cout << "License file does not contain proper license key." << endl;
@@ -240,5 +240,5 @@
 
     if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
-        (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) {
+        (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) {
         cout << "Failed to copy license file (" << fromLicenseFile << ")";
         dictionary["DONE"] = "error";
Index: trunk/tools/configure/tools.h
===================================================================
--- trunk/tools/configure/tools.h	(revision 769)
+++ trunk/tools/configure/tools.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/data/generate_header.xsl
===================================================================
--- trunk/tools/designer/data/generate_header.xsl	(revision 769)
+++ trunk/tools/designer/data/generate_header.xsl	(revision 846)
@@ -337,5 +337,5 @@
 <xsl:text>/****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/data/generate_impl.xsl
===================================================================
--- trunk/tools/designer/data/generate_impl.xsl	(revision 769)
+++ trunk/tools/designer/data/generate_impl.xsl	(revision 846)
@@ -1093,5 +1093,5 @@
 <xsl:text>/****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor.cpp
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -406,4 +406,5 @@
     QWidget *neighbour = 0;
     switch (l->layoutDirection()) {
+    case Qt::LayoutDirectionAuto:
     case Qt::LeftToRight: { // Walk right to find next managed neighbour
         const int xEnd = parent->size().width();
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor.h
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor.h	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_global.h
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_global.h	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_instance.cpp
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_instance.cpp	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_instance.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.h
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.h	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.h
===================================================================
--- trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.h	(revision 769)
+++ trunk/tools/designer/src/components/buddyeditor/buddyeditor_tool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/brushmanagerproxy.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/brushmanagerproxy.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/brushmanagerproxy.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/brushmanagerproxy.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/brushmanagerproxy.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/brushmanagerproxy.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_actionprovider.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_actionprovider.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_actionprovider.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_actionprovider.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_actionprovider.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_actionprovider.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_container.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_container.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_container.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_container.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_layoutdecoration.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_layoutdecoration.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_layoutdecoration.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/default_layoutdecoration.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/default_layoutdecoration.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/default_layoutdecoration.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/deviceprofiledialog.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/deviceprofiledialog.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/deviceprofiledialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/deviceprofiledialog.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/deviceprofiledialog.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/deviceprofiledialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/dpi_chooser.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/dpi_chooser.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/dpi_chooser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/dpi_chooser.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/dpi_chooser.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/dpi_chooser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/embeddedoptionspage.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/embeddedoptionspage.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/embeddedoptionspage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/embeddedoptionspage.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/embeddedoptionspage.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/embeddedoptionspage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formeditor.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formeditor.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formeditor.pri
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor.pri	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor.pri	(revision 846)
@@ -9,4 +9,5 @@
 
 HEADERS += $$PWD/qdesigner_resource.h \
+           $$PWD/qdesignerundostack.h \
            $$PWD/formwindow.h \
            $$PWD/formwindow_widgetstack.h \
@@ -42,4 +43,5 @@
 
 SOURCES += $$PWD/qdesigner_resource.cpp \
+           $$PWD/qdesignerundostack.cpp \
            $$PWD/formwindow.cpp \
            $$PWD/formwindow_widgetstack.cpp \
Index: trunk/tools/designer/src/components/formeditor/formeditor.qrc
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor.qrc	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor.qrc	(revision 846)
@@ -64,4 +64,5 @@
     <file>images/qt3logo.png</file>
     <file>images/resetproperty.png</file>
+    <file>images/cleartext.png</file>
     <file>images/sort.png</file>
     <file>images/edit.png</file>
@@ -112,5 +113,4 @@
     <file>images/widgets/vslider.png</file>
     <file>images/widgets/vspacer.png</file>
-    <file>images/widgets/widget.png</file>
     <file>images/widgets/widget.png</file>
     <file>images/widgets/widgetstack.png</file>
Index: trunk/tools/designer/src/components/formeditor/formeditor_global.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor_global.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formeditor_optionspage.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor_optionspage.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor_optionspage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -87,7 +87,9 @@
     const IntList zoomValues = ZoomMenu::zoomValues();
     const IntList::const_iterator cend = zoomValues.constEnd();
-    //: Zoom percentage
-    for (IntList::const_iterator it = zoomValues.constBegin(); it != cend; ++it)
+
+    for (IntList::const_iterator it = zoomValues.constBegin(); it != cend; ++it) {
+        //: Zoom percentage
         m_zoomCombo->addItem(QCoreApplication::translate("FormEditorOptionsPage", "%1 %").arg(*it), QVariant(*it));
+    }
 
     // Layout
Index: trunk/tools/designer/src/components/formeditor/formeditor_optionspage.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formeditor_optionspage.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formeditor_optionspage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindow.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -400,6 +400,5 @@
 {
     if (FormWindowManager *manager = qobject_cast<FormWindowManager*> (core()->formWindowManager())) {
-        m_commandHistory = new QUndoStack(this);
-        manager->undoGroup()->addStack(m_commandHistory);
+        manager->undoGroup()->addStack(m_undoStack.qundoStack());
     }
 
@@ -430,7 +429,6 @@
     m_currentWidget = 0;
 
-    connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SLOT(updateDirty()));
-    connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SIGNAL(changed()));
-    connect(m_commandHistory, SIGNAL(indexChanged(int)), this, SLOT(checkSelection()));
+    connect(&m_undoStack, SIGNAL(changed()), this, SIGNAL(changed()));
+    connect(&m_undoStack, SIGNAL(changed()), this, SLOT(checkSelection()));
 
     core()->metaDataBase()->add(this);
@@ -485,4 +483,5 @@
         sheet->setVisible(sheet->indexOf(QLatin1String("windowIcon")), true);
         sheet->setVisible(sheet->indexOf(QLatin1String("windowModality")), true);
+        sheet->setVisible(sheet->indexOf(QLatin1String("windowOpacity")), true);
         sheet->setVisible(sheet->indexOf(QLatin1String("windowFilePath")), true);
         // ### generalize
@@ -1227,12 +1226,12 @@
         ReparentWidgetCommand *cmd = new ReparentWidgetCommand(this);
         cmd->init(w, container);
-        m_commandHistory->push(cmd);
-    }
-
-    m_commandHistory->push(geom_cmd);
+        m_undoStack.push(cmd);
+    }
+
+    m_undoStack.push(geom_cmd);
 
     InsertWidgetCommand *cmd = new InsertWidgetCommand(this);
     cmd->init(w, already_in_form);
-    m_commandHistory->push(cmd);
+    m_undoStack.push(cmd);
 
     endCommand();
@@ -1277,10 +1276,8 @@
 
     QRect r = geometry;
-    if (m_lastIndex > m_commandHistory->index())
-        m_lastIndex = -1;
     SetPropertyCommand *cmd = new SetPropertyCommand(this);
     cmd->init(widget, QLatin1String("geometry"), r);
     cmd->setText(tr("Resize"));
-    m_commandHistory->push(cmd);
+    m_undoStack.push(cmd);
 }
 
@@ -1428,24 +1425,123 @@
 }
 
-QRect FormWindow::applyValue(const QRect &rect, int val, int key, bool size) const
+// ArrowKeyOperation: Stores a keyboard move or resize (Shift pressed)
+// operation.
+struct ArrowKeyOperation {
+    ArrowKeyOperation() : resize(false), distance(0), arrowKey(Qt::Key_Left) {}
+
+    QRect apply(const QRect &in) const;
+
+    bool resize; // Resize: Shift-Key->drag bottom/right corner, else just move
+    int distance;
+    int arrowKey;
+};
+
+} // namespace
+
+QT_END_NAMESPACE
+Q_DECLARE_METATYPE(qdesigner_internal::ArrowKeyOperation)
+QT_BEGIN_NAMESPACE
+
+namespace qdesigner_internal {
+
+QRect ArrowKeyOperation::apply(const QRect &rect) const
 {
     QRect r = rect;
-    if (size) {
-        if (key == Qt::Key_Left || key == Qt::Key_Right)
-            r.setWidth(val);
+    if (resize) {
+        if (arrowKey == Qt::Key_Left || arrowKey == Qt::Key_Right)
+            r.setWidth(r.width() + distance);
         else
-            r.setHeight(val);
+            r.setHeight(r.height() + distance);
     } else {
-        if (key == Qt::Key_Left || key == Qt::Key_Right)
-            r.moveLeft(val);
+        if (arrowKey == Qt::Key_Left || arrowKey == Qt::Key_Right)
+            r.moveLeft(r.x() + distance);
         else
-            r.moveTop(val);
+            r.moveTop(r.y() + distance);
     }
     return r;
 }
 
+QDebug operator<<(QDebug in, const ArrowKeyOperation &op)
+{
+    in.nospace() << "Resize=" << op.resize << " dist=" << op.distance << " Key=" << op.arrowKey << ' ';
+    return in;
+}
+
+// ArrowKeyPropertyHelper: Applies a struct ArrowKeyOperation
+// (stored as new value) to a list of widgets using to calculate the
+// changed geometry of the widget in setValue(). Thus, the 'newValue'
+// of the property command is the relative move distance, which is the same
+// for all widgets (although resulting in different geometries for the widgets).
+// The command merging can then work as it would when applying the same text
+// to all QLabels.
+
+class ArrowKeyPropertyHelper : public PropertyHelper {
+public:
+    ArrowKeyPropertyHelper(QObject* o, SpecialProperty sp,
+                       QDesignerPropertySheetExtension *s, int i) :
+                       PropertyHelper(o, sp, s, i) {}
+
+    virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
+};
+
+PropertyHelper::Value ArrowKeyPropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask)
+{
+    // Apply operation to obtain the new geometry value.
+    QWidget *w = qobject_cast<QWidget*>(object());
+    const ArrowKeyOperation operation = qvariant_cast<ArrowKeyOperation>(value);
+    const QRect newGeom = operation.apply(w->geometry());
+    return PropertyHelper::setValue(fw, QVariant(newGeom), changed, subPropertyMask);
+}
+
+// ArrowKeyPropertyCommand: Helper factory overwritten to create
+// ArrowKeyPropertyHelper and a merge operation that merges values of
+// the same direction.
+class ArrowKeyPropertyCommand: public SetPropertyCommand {
+public:
+    explicit ArrowKeyPropertyCommand(QDesignerFormWindowInterface *fw,
+                                     QUndoCommand *p = 0);
+
+    void init(QWidgetList &l, const ArrowKeyOperation &op);
+
+protected:
+    virtual PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
+                                                 QDesignerPropertySheetExtension *s, int i) const
+        { return new ArrowKeyPropertyHelper(o, sp, s, i); }
+    virtual QVariant mergeValue(const QVariant &newValue);
+};
+
+ArrowKeyPropertyCommand::ArrowKeyPropertyCommand(QDesignerFormWindowInterface *fw,
+                                                 QUndoCommand *p) :
+    SetPropertyCommand(fw, p)
+{
+    static const int mid = qRegisterMetaType<qdesigner_internal::ArrowKeyOperation>();
+    Q_UNUSED(mid)
+}
+
+void ArrowKeyPropertyCommand::init(QWidgetList &l, const ArrowKeyOperation &op)
+{
+    QObjectList ol;
+    foreach(QWidget *w, l)
+        ol.push_back(w);
+    SetPropertyCommand::init(ol, QLatin1String("geometry"), qVariantFromValue(op));
+
+    setText(op.resize ? FormWindow::tr("Key Resize") : FormWindow::tr("Key Move"));
+}
+
+QVariant ArrowKeyPropertyCommand::mergeValue(const QVariant &newMergeValue)
+{
+    // Merge move operations of the same arrow key
+    if (!qVariantCanConvert<ArrowKeyOperation>(newMergeValue))
+        return QVariant();
+    ArrowKeyOperation mergedOperation = qvariant_cast<ArrowKeyOperation>(newValue());
+    const ArrowKeyOperation newMergeOperation = qvariant_cast<ArrowKeyOperation>(newMergeValue);
+    if (mergedOperation.resize != newMergeOperation.resize || mergedOperation.arrowKey != newMergeOperation.arrowKey)
+        return QVariant();
+    mergedOperation.distance += newMergeOperation.distance;
+    return qVariantFromValue(mergedOperation);
+}
+
 void FormWindow::handleArrowKeyEvent(int key, Qt::KeyboardModifiers modifiers)
 {
-    bool startMacro = false;
     const QDesignerFormWindowCursorInterface *c = cursor();
     if (!c->hasSelection())
@@ -1480,55 +1576,12 @@
     const int newValue = calcValue(oldValue, forward, snap, snapPoint);
 
-    const int offset = newValue - oldValue;
-
-    const int selCount = selection.count();
-    // check if selection is the same as last time
-    if (selCount != m_moveSelection.count() ||
-        m_lastUndoIndex != m_commandHistory->index()) {
-        m_moveSelection.clear();
-        startMacro = true;
-    } else {
-        for (int index = 0; index < selCount; ++index) {
-            if (m_moveSelection[index]->object() != selection.at(index)) {
-                m_moveSelection.clear();
-                startMacro = true;
-                break;
-            }
-        }
-    }
-
-    if (startMacro)
-        beginCommand(tr("Key Move"));
-
-    for (int index = 0; index < selCount; ++index) {
-        QWidget *w = selection.at(index);
-        const QRect oldGeom = w->geometry();
-        const QRect geom = applyValue(oldGeom, getValue(oldGeom, key, size) + offset, key, size);
-
-        SetPropertyCommand *cmd = 0;
-
-        if (m_moveSelection.count() > index)
-            cmd = m_moveSelection[index];
-
-        if (!cmd) {
-            cmd = new SetPropertyCommand(this);
-            cmd->init(w, QLatin1String("geometry"), geom);
-            cmd->setText(tr("Key Move"));
-            m_commandHistory->push(cmd);
-
-            if (m_moveSelection.count() > index)
-                m_moveSelection.replace(index, cmd);
-            else
-                m_moveSelection.append(cmd);
-        } else {
-            cmd->setNewValue(geom);
-            cmd->redo();
-        }
-    }
-
-    if (startMacro) {
-        endCommand();
-        m_lastUndoIndex = m_commandHistory->index();
-    }
+    ArrowKeyOperation operation;
+    operation.resize = modifiers & Qt::ShiftModifier;
+    operation.distance = newValue - oldValue;
+    operation.arrowKey = key;
+
+    ArrowKeyPropertyCommand *cmd = new ArrowKeyPropertyCommand(this);
+    cmd->init(selection, operation);
+    m_undoStack.push(cmd);
 }
 
@@ -1631,8 +1684,11 @@
 QWidget *FormWindow::innerContainer(QWidget *outerContainer) const
 {
-    bool isContainer = m_core->widgetDataBase()->isContainer(outerContainer);
-    if (isContainer)
-        if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(m_core->extensionManager(), outerContainer))
-            return container->widget(container->currentIndex());
+    if (m_core->widgetDataBase()->isContainer(outerContainer))
+        if (const QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(m_core->extensionManager(), outerContainer)) {
+            const int currentIndex = container->currentIndex();
+            return currentIndex >= 0 ?
+                        container->widget(currentIndex) :
+                        static_cast<QWidget *>(0);
+        }
     return outerContainer;
 }
@@ -1654,6 +1710,8 @@
         if (!containerOfW || containerOfW == mainContainer())
             break;
-        // No layouts, must be container
+        // No layouts, must be container. No empty page-based containers.
         containerOfW = innerContainer(containerOfW);
+        if (!containerOfW)
+            break;
         if (LayoutInfo::layoutType(m_core, containerOfW) != LayoutInfo::NoLayout || !m_core->widgetDataBase()->isContainer(containerOfW))
             break;
@@ -1664,4 +1722,6 @@
 
     w = innerContainer(w);
+    if (!w)
+        return 0;
     if (LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout)
         return 0;
@@ -1809,5 +1869,5 @@
                 InsertWidgetCommand *cmd = new InsertWidgetCommand(this);
                 cmd->init(w);
-                m_commandHistory->push(cmd);
+                m_undoStack.push(cmd);
                 selectWidget(w);
             }
@@ -1819,5 +1879,5 @@
                 AddActionCommand *cmd = new AddActionCommand(this);
                 cmd->init(a);
-                m_commandHistory->push(cmd);
+                m_undoStack.push(cmd);
             }
         endCommand();
@@ -1955,12 +2015,10 @@
 void FormWindow::beginCommand(const QString &description)
 {
-    if (m_lastIndex > m_commandHistory->index())
-        m_lastIndex = -1;
-    m_commandHistory->beginMacro(description);
+    m_undoStack.beginMacro(description);
 }
 
 void FormWindow::endCommand()
 {
-    m_commandHistory->endMacro();
+    m_undoStack.endMacro();
 }
 
@@ -1977,5 +2035,5 @@
         RaiseWidgetCommand *cmd = new RaiseWidgetCommand(this);
         cmd->init(widget);
-        m_commandHistory->push(cmd);
+        m_undoStack.push(cmd);
     }
     endCommand();
@@ -1994,5 +2052,5 @@
         LowerWidgetCommand *cmd = new LowerWidgetCommand(this);
         cmd->init(widget);
-        m_commandHistory->push(cmd);
+        m_undoStack.push(cmd);
     }
     endCommand();
@@ -2375,18 +2433,10 @@
 bool FormWindow::isDirty() const
 {
-    return m_dirty;
+    return m_undoStack.isDirty();
 }
 
 void FormWindow::setDirty(bool dirty)
 {
-    m_dirty = dirty;
-
-    if (!m_dirty)
-        m_lastIndex = m_commandHistory->index();
-}
-
-void FormWindow::updateDirty()
-{
-    m_dirty = m_commandHistory->index() != m_lastIndex;
+    m_undoStack.setDirty(dirty);
 }
 
@@ -2757,5 +2807,5 @@
         SetPropertyCommand *cmd = new SetPropertyCommand(this);
         cmd->init(widget, dockWidgetAreaName, v);
-        m_commandHistory->push(cmd);
+        m_undoStack.push(cmd);
     }
 
@@ -2921,5 +2971,11 @@
 }
 
+QUndoStack *FormWindow::commandHistory() const
+{
+    return const_cast<QDesignerUndoStack &>(m_undoStack).qundoStack();
+}
+
 } // namespace
 
 QT_END_NAMESPACE
+
Index: trunk/tools/designer/src/components/formeditor/formwindow.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,5 @@
 
 #include "formeditor_global.h"
+#include "qdesignerundostack.h"
 #include <formwindowbase_p.h>
 
@@ -65,5 +66,4 @@
 class QAction;
 class QMenu;
-class QUndoStack;
 class QRubberBand;
 
@@ -166,7 +166,5 @@
     void unmanageWidget(QWidget *w);
 
-    inline QUndoStack *commandHistory() const
-    { return m_commandHistory; }
-
+    virtual QUndoStack *commandHistory() const;
     void beginCommand(const QString &description);
     void endCommand();
@@ -239,5 +237,4 @@
 private slots:
     void selectionChangedTimerDone();
-    void updateDirty();
     void checkSelection();
     void checkSelectionNow();
@@ -264,5 +261,4 @@
     int getValue(const QRect &rect, int key, bool size) const;
     int calcValue(int val, bool forward, bool snap, int snapOffset) const;
-    QRect applyValue(const QRect &rect, int val, int key, bool size) const;
     void handleClickSelection(QWidget *managedWidget, unsigned mouseFlags);
 
@@ -339,5 +335,5 @@
     QPoint m_startPos;
 
-    QUndoStack *m_commandHistory;
+    QDesignerUndoStack m_undoStack;
 
     QString m_fileName;
@@ -352,7 +348,4 @@
     QTimer *m_checkSelectionTimer;
     QTimer *m_geometryChangedTimer;
-
-    int m_dirty;
-    int m_lastIndex;
 
     FormWindowWidgetStack *m_widgetStack;
@@ -369,6 +362,4 @@
     QStringList m_includeHints;
 
-    QList<SetPropertyCommand*> m_moveSelection;
-    int m_lastUndoIndex;
     QPoint m_contextMenuPosition;
 
Index: trunk/tools/designer/src/components/formeditor/formwindow_dnditem.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow_dnditem.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow_dnditem.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindow_dnditem.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow_dnditem.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow_dnditem.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindow_widgetstack.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowcursor.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowcursor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowcursor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowcursor.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowcursor.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowcursor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowmanager.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -193,4 +193,5 @@
     case QEvent::WhatsThis:
     case QEvent::WhatsThisClicked:
+    case QEvent::WinIdChange:
     case QEvent::DynamicPropertyChange:
     case QEvent::HoverEnter:
@@ -524,8 +525,9 @@
     m_actionShowFormWindowSettingsDialog->setEnabled(false);
 
-
+#ifdef Q_WS_X11
     m_actionCopy->setIcon(QIcon::fromTheme("edit-copy", m_actionCopy->icon()));
     m_actionCut->setIcon(QIcon::fromTheme("edit-cut", m_actionCut->icon()));
     m_actionPaste->setIcon(QIcon::fromTheme("edit-paste", m_actionPaste->icon()));
+    m_actionDelete->setIcon(QIcon::fromTheme("edit-delete", m_actionDelete->icon()));
 
     // These do not currently exist, but will allow theme authors to fill in the gaps
@@ -537,4 +539,5 @@
     m_actionSplitVertical->setIcon(QIcon::fromTheme("designer-split-vertical", m_actionSplitVertical->icon()));
     m_actionAdjustSize->setIcon(QIcon::fromTheme("designer-adjust-size", m_actionAdjustSize->icon()));
+#endif
 }
 
Index: trunk/tools/designer/src/components/formeditor/formwindowmanager.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowmanager.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowsettings.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowsettings.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowsettings.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowsettings.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowsettings.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowsettings.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/formwindowsettings.ui
===================================================================
--- trunk/tools/designer/src/components/formeditor/formwindowsettings.ui	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/formwindowsettings.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/iconcache.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/iconcache.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/iconcache.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/iconcache.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/iconcache.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/iconcache.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/itemview_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/itemview_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/itemview_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/itemview_propertysheet.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/itemview_propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/itemview_propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/layout_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/layout_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/layout_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/layout_propertysheet.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/layout_propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/layout_propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/line_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/line_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/line_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/line_propertysheet.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/line_propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/line_propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/previewactiongroup.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/previewactiongroup.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/previewactiongroup.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/previewactiongroup.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/previewactiongroup.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/previewactiongroup.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qdesigner_resource.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qdesigner_resource.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qdesigner_resource.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,5 +54,4 @@
 #include "qmdiarea_container.h"
 #include "qwizard_container.h"
-#include "itemview_propertysheet.h"
 #include "layout_propertysheet.h"
 
@@ -107,6 +106,4 @@
 #include <QtGui/QFileDialog>
 #include <QtGui/QHeaderView>
-#include <QtGui/QTreeView>
-#include <QtGui/QTableView>
 #include <QtGui/QWizardPage>
 #include <private/qlayoutengine_p.h>
@@ -1276,8 +1273,4 @@
     else if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), widget))
         w = saveWidget(widget, container, ui_parentWidget);
-    else if (QTreeView *treeView = qobject_cast<QTreeView*>(widget))
-        w = saveWidget(treeView, ui_parentWidget);
-    else if (QTableView *tableView = qobject_cast<QTableView*>(widget))
-        w = saveWidget(tableView, ui_parentWidget);
     else if (QWizardPage *wizardPage = qobject_cast<QWizardPage*>(widget))
         w = saveWidget(wizardPage, ui_parentWidget);
@@ -1549,58 +1542,4 @@
         attr->setElementNumber(int(area));
         ui_widget->setElementAttribute(ui_widget->elementAttribute() << attr);
-    }
-
-    return ui_widget;
-}
-
-DomWidget *QDesignerResource::saveWidget(QTreeView *treeView, DomWidget *ui_parentWidget)
-{
-    DomWidget *ui_widget = QAbstractFormBuilder::createDom(treeView, ui_parentWidget, true);
-
-    QDesignerPropertySheetExtension *sheet
-            = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), treeView);
-    ItemViewPropertySheet *itemViewSheet = static_cast<ItemViewPropertySheet*>(sheet);
-
-    if (itemViewSheet) {
-        QHash<QString,QString> nameMap = itemViewSheet->propertyNameMap();
-        foreach (const QString &fakeName, nameMap.keys()) {
-            int index = itemViewSheet->indexOf(fakeName);
-            if (sheet->isChanged(index)) {
-                DomProperty *domAttr = createProperty(treeView->header(), nameMap.value(fakeName),
-                                                      itemViewSheet->property(index));
-                domAttr->setAttributeName(fakeName);
-                ui_widget->setElementAttribute(ui_widget->elementAttribute() << domAttr);
-            }
-        }
-    }
-
-    return ui_widget;
-}
-
-DomWidget *QDesignerResource::saveWidget(QTableView *tableView, DomWidget *ui_parentWidget)
-{
-    DomWidget *ui_widget = QAbstractFormBuilder::createDom(tableView, ui_parentWidget, true);
-
-    QDesignerPropertySheetExtension *sheet
-            = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), tableView);
-    ItemViewPropertySheet *itemViewSheet = static_cast<ItemViewPropertySheet*>(sheet);
-
-    if (itemViewSheet) {
-        QHash<QString,QString> nameMap = itemViewSheet->propertyNameMap();
-        foreach (const QString &fakeName, nameMap.keys()) {
-            int index = itemViewSheet->indexOf(fakeName);
-            if (sheet->isChanged(index)) {
-                DomProperty *domAttr;
-                if (fakeName.startsWith(QLatin1String("horizontal"))) {
-                    domAttr = createProperty(tableView->horizontalHeader(), nameMap.value(fakeName),
-                                                      itemViewSheet->property(index));
-                } else {
-                    domAttr = createProperty(tableView->verticalHeader(), nameMap.value(fakeName),
-                                                      itemViewSheet->property(index));
-                }
-                domAttr->setAttributeName(fakeName);
-                ui_widget->setElementAttribute(ui_widget->elementAttribute() << domAttr);
-            }
-        }
     }
 
Index: trunk/tools/designer/src/components/formeditor/qdesigner_resource.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qdesigner_resource.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qdesigner_resource.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,6 +65,4 @@
 class QToolBox;
 class QToolBar;
-class QTreeView;
-class QTableView;
 class QDesignerDockWidget;
 class QLayoutWidget;
@@ -139,6 +137,4 @@
     DomWidget *saveWidget(QToolBar *toolBar, DomWidget *ui_parentWidget);
     DomWidget *saveWidget(QDesignerDockWidget *dockWidget, DomWidget *ui_parentWidget);
-    DomWidget *saveWidget(QTreeView *treeView, DomWidget *ui_parentWidget);
-    DomWidget *saveWidget(QTableView *tableView, DomWidget *ui_parentWidget);
     DomWidget *saveWidget(QWizardPage *wizardPage, DomWidget *ui_parentWidget);
 
Index: trunk/tools/designer/src/components/formeditor/qdesignerundostack.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qdesignerundostack.cpp	(revision 846)
+++ trunk/tools/designer/src/components/formeditor/qdesignerundostack.cpp	(revision 846)
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdesignerundostack.h"
+
+#include <QtGui/QUndoStack>
+#include <QtGui/QUndoCommand>
+
+QT_BEGIN_NAMESPACE
+
+namespace qdesigner_internal {
+
+QDesignerUndoStack::QDesignerUndoStack(QObject *parent) :
+    QObject(parent),
+    m_undoStack(new QUndoStack),
+    m_fakeDirty(false)
+{
+    connect(m_undoStack, SIGNAL(indexChanged(int)), this, SIGNAL(changed()));
+}
+
+QDesignerUndoStack::~QDesignerUndoStack()
+{ // QUndoStack is managed by the QUndoGroup
+}
+
+void QDesignerUndoStack::push(QUndoCommand * cmd)
+{
+    m_undoStack->push(cmd);
+}
+
+void QDesignerUndoStack::beginMacro(const QString &text)
+{
+    m_undoStack->beginMacro(text);
+}
+
+void QDesignerUndoStack::endMacro()
+{
+    m_undoStack->endMacro();
+}
+
+int  QDesignerUndoStack::index() const
+{
+    return m_undoStack->index();
+}
+
+const QUndoStack *QDesignerUndoStack::qundoStack() const
+{
+    return m_undoStack;
+}
+QUndoStack *QDesignerUndoStack::qundoStack()
+{
+    return m_undoStack;
+}
+
+bool QDesignerUndoStack::isDirty() const
+{
+    return m_fakeDirty || !m_undoStack->isClean();
+}
+
+void QDesignerUndoStack::setDirty(bool v)
+{
+    if (isDirty() == v)
+        return;
+    if (v) {
+        m_fakeDirty = true;
+        emit changed();
+    } else {
+        m_fakeDirty = false;
+        m_undoStack->setClean();
+    }
+}
+
+} // namespace qdesigner_internal
+
+QT_END_NAMESPACE
Index: trunk/tools/designer/src/components/formeditor/qdesignerundostack.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qdesignerundostack.h	(revision 846)
+++ trunk/tools/designer/src/components/formeditor/qdesignerundostack.h	(revision 846)
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDESIGNERUNDOSTACK_H
+#define QDESIGNERUNDOSTACK_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+class QUndoStack;
+class QUndoCommand;
+
+namespace qdesigner_internal {
+
+/* QDesignerUndoStack: A QUndoStack extended by a way of setting it to
+ * "dirty" indepently of commands (by modifications without commands
+ * such as resizing). Accomplished via bool m_fakeDirty flag. The
+ * lifecycle of the QUndoStack is managed by the QUndoGroup. */
+class QDesignerUndoStack : public QObject
+{
+    Q_DISABLE_COPY(QDesignerUndoStack)
+    Q_OBJECT
+public:
+    explicit QDesignerUndoStack(QObject *parent = 0);
+    virtual ~QDesignerUndoStack();
+
+    void push(QUndoCommand * cmd);
+    void beginMacro(const QString &text);
+    void endMacro();
+    int  index() const;
+
+    const QUndoStack *qundoStack() const;
+    QUndoStack *qundoStack();
+
+    bool isDirty() const;
+
+signals:
+    void changed();
+
+public slots:
+    void setDirty(bool);
+
+private:
+    QUndoStack *m_undoStack;
+    bool m_fakeDirty;
+};
+
+} // namespace qdesigner_internal
+
+QT_END_NAMESPACE
+
+#endif // QDESIGNERUNDOSTACK_H
Index: trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qlayoutwidget_propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qmainwindow_container.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qmainwindow_container.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qmainwindow_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qmainwindow_container.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qmainwindow_container.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qmainwindow_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qmdiarea_container.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qmdiarea_container.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qmdiarea_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -106,4 +106,5 @@
     const QSize areaSize = area->size();
     switch (QApplication::layoutDirection()) {
+    case Qt::LayoutDirectionAuto:
     case Qt::LeftToRight: {
         const QSize fullSize = QSize(areaSize.width() - pos.x(), areaSize.height() - pos.y());
Index: trunk/tools/designer/src/components/formeditor/qmdiarea_container.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qmdiarea_container.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qmdiarea_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qtbrushmanager.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qtbrushmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qtbrushmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qtbrushmanager.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qtbrushmanager.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qtbrushmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qwizard_container.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qwizard_container.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qwizard_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qwizard_container.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qwizard_container.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qwizard_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qworkspace_container.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/qworkspace_container.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qworkspace_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/qworkspace_container.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/qworkspace_container.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/qworkspace_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/spacer_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/spacer_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/spacer_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/spacer_propertysheet.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/spacer_propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/spacer_propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/templateoptionspage.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/templateoptionspage.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/templateoptionspage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/templateoptionspage.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/templateoptionspage.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/templateoptionspage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/tool_widgeteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/tool_widgeteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/tool_widgeteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/tool_widgeteditor.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/tool_widgeteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/tool_widgeteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/widgetselection.cpp
===================================================================
--- trunk/tools/designer/src/components/formeditor/widgetselection.cpp	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/widgetselection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/formeditor/widgetselection.h
===================================================================
--- trunk/tools/designer/src/components/formeditor/widgetselection.h	(revision 769)
+++ trunk/tools/designer/src/components/formeditor/widgetselection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/lib/lib.pro
===================================================================
--- trunk/tools/designer/src/components/lib/lib.pro	(revision 769)
+++ trunk/tools/designer/src/components/lib/lib.pro	(revision 846)
@@ -40,9 +40,9 @@
 
 INCLUDEPATH += . .. \
-    $$QT_SOURCE_TREE/tools/designer/src/lib/components \
-    $$QT_SOURCE_TREE/tools/designer/src/lib/sdk \
-    $$QT_SOURCE_TREE/tools/designer/src/lib/extension \
-    $$QT_SOURCE_TREE/tools/designer/src/lib/uilib \
-    $$QT_SOURCE_TREE/tools/designer/src/lib/shared
+    $$PWD/../../lib/components \
+    $$PWD/../../lib/sdk \
+    $$PWD/../../lib/extension \
+    $$PWD/../../lib/uilib \
+    $$PWD/../../lib/shared
 
 include(../propertyeditor/propertyeditor.pri)
Index: trunk/tools/designer/src/components/lib/lib_pch.h
===================================================================
--- trunk/tools/designer/src/components/lib/lib_pch.h	(revision 769)
+++ trunk/tools/designer/src/components/lib/lib_pch.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/lib/qdesigner_components.cpp
===================================================================
--- trunk/tools/designer/src/components/lib/qdesigner_components.cpp	(revision 769)
+++ trunk/tools/designer/src/components/lib/qdesigner_components.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/objectinspector/objectinspector.cpp
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspector.cpp	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspector.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/objectinspector/objectinspector.h
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspector.h	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspector.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/objectinspector/objectinspector.pri
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspector.pri	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspector.pri	(revision 846)
@@ -4,5 +4,5 @@
     INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/findwidget
 } else {
-    include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri)
+    include(../../../../shared/findwidget/findwidget.pri)
 }
 
Index: trunk/tools/designer/src/components/objectinspector/objectinspector_global.h
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspector_global.h	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspector_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspectormodel.cpp	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspectormodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/objectinspector/objectinspectormodel_p.h
===================================================================
--- trunk/tools/designer/src/components/objectinspector/objectinspectormodel_p.h	(revision 769)
+++ trunk/tools/designer/src/components/objectinspector/objectinspectormodel_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -120,9 +120,19 @@
 }
 
+
+typedef QMap<int, QIcon> EnumIndexIconMap;
+
+static void clearBrushIcons();
+Q_GLOBAL_STATIC_WITH_INITIALIZER(EnumIndexIconMap, brushIcons, qAddPostRoutine(clearBrushIcons))
+
+static void clearBrushIcons()
+{
+    brushIcons()->clear();
+}
+
 const BrushPropertyManager::EnumIndexIconMap &BrushPropertyManager::brushStyleIcons()
 {
     // Create a map of icons for the brush style editor
-    static EnumIndexIconMap rc;
-    if (rc.empty()) {
+    if (brushIcons()->empty()) {
         const int brushStyleCount = sizeof(brushStyles)/sizeof(const char *);
         QBrush brush(Qt::black);
@@ -131,8 +141,8 @@
             const Qt::BrushStyle style = brushStyleIndexToStyle(i);
             brush.setStyle(style);
-            rc.insert(i, QtPropertyBrowserUtils::brushValueIcon(brush));
+            brushIcons()->insert(i, QtPropertyBrowserUtils::brushValueIcon(brush));
         }
     }
-    return rc;
+    return *(brushIcons());
 }
 
Index: trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/brushpropertymanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/defs.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/defs.cpp	(revision 769)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "defs.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-
-int size_type_to_int( QSizePolicy::Policy t )
-{
-    if ( t == QSizePolicy::Fixed )
-	return 0;
-    if ( t == QSizePolicy::Minimum )
-	return 1;
-    if ( t == QSizePolicy::Maximum )
-	return 2;
-    if ( t == QSizePolicy::Preferred )
-	return 3;
-    if ( t == QSizePolicy::MinimumExpanding )
-	return 4;
-    if ( t == QSizePolicy::Expanding )
-	return 5;
-    if ( t == QSizePolicy::Ignored )
-	return 6;
-    return 0;
-}
-
-QString size_type_to_string( QSizePolicy::Policy t )
-{
-    if ( t == QSizePolicy::Fixed )
-	return QString::fromUtf8("Fixed");
-    if ( t == QSizePolicy::Minimum )
-	return QString::fromUtf8("Minimum");
-    if ( t == QSizePolicy::Maximum )
-	return QString::fromUtf8("Maximum");
-    if ( t == QSizePolicy::Preferred )
-	return QString::fromUtf8("Preferred");
-    if ( t == QSizePolicy::MinimumExpanding )
-	return QString::fromUtf8("MinimumExpanding");
-    if ( t == QSizePolicy::Expanding )
-	return QString::fromUtf8("Expanding");
-    if ( t == QSizePolicy::Ignored )
-	return QString::fromUtf8("Ignored");
-    return QString();
-}
-
-QSizePolicy::Policy int_to_size_type( int i )
-{
-    if ( i == 0 )
-	return QSizePolicy::Fixed;
-    if ( i == 1 )
-	return QSizePolicy::Minimum;
-    if ( i == 2 )
-	return QSizePolicy::Maximum;
-    if ( i == 3 )
-	return QSizePolicy::Preferred;
-    if ( i == 4 )
-	return QSizePolicy::MinimumExpanding;
-    if ( i == 5 )
-	return QSizePolicy::Expanding;
-    if ( i == 6 )
-	return QSizePolicy::Ignored;
-    return QSizePolicy::Preferred;
-}
-
-}  // namespace qdesigner_internal
-
-QT_END_NAMESPACE
Index: trunk/tools/designer/src/components/propertyeditor/defs.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/defs.h	(revision 769)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DEFS_H
-#define DEFS_H
-
-#include <QtGui/QSizePolicy>
-#include <QtCore/QString>
-
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-
-int size_type_to_int(QSizePolicy::Policy t);
-QString size_type_to_string(QSizePolicy::Policy t);
-QSizePolicy::Policy int_to_size_type(int i);
-
-}  // namespace qdesigner_internal
-
-QT_END_NAMESPACE
-
-#endif // DEFS_H
Index: trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/designerpropertymanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/fontmapping.xml
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/fontmapping.xml	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/fontmapping.xml	(revision 846)
@@ -3,5 +3,5 @@
 <!--************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/fontpropertymanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/newdynamicpropertydialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/paletteeditor.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/paletteeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/paletteeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/paletteeditor.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/paletteeditor.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/paletteeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/paletteeditor.ui
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/paletteeditor.ui	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/paletteeditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/paletteeditorbutton.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/previewframe.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/previewframe.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/previewframe.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/previewframe.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/previewframe.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/previewframe.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/previewwidget.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/previewwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/previewwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/previewwidget.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/previewwidget.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/previewwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/previewwidget.ui
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/previewwidget.ui	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/previewwidget.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/propertyeditor.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/propertyeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/propertyeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -80,4 +80,5 @@
 #include <QtGui/QActionGroup>
 #include <QtGui/QLabel>
+#include <QtGui/QPainter>
 
 #include <QtCore/QDebug>
@@ -99,4 +100,51 @@
 
 namespace qdesigner_internal {
+
+// ----------- ElidingLabel
+// QLabel does not support text eliding so we need a helper class
+
+class ElidingLabel : public QWidget
+{
+public:
+    ElidingLabel(const QString &text = QString(), QWidget *parent = 0)
+        : QWidget(parent),
+        m_text(text),
+        m_mode(Qt::ElideRight) {
+        setContentsMargins(3, 2, 3, 2);
+    }
+    QSize sizeHint() const;
+    void paintEvent(QPaintEvent *e);
+    void setText(const QString &text) {
+        m_text = text;
+        updateGeometry();
+    }
+    void setElidemode(Qt::TextElideMode mode) {
+        m_mode = mode;
+        updateGeometry();
+    }
+private:
+    QString m_text;
+    Qt::TextElideMode m_mode;
+};
+
+QSize ElidingLabel::sizeHint() const
+{
+    QSize size = fontMetrics().boundingRect(m_text).size();
+    size += QSize(contentsMargins().left() + contentsMargins().right(),
+                  contentsMargins().top() + contentsMargins().bottom());
+    return size;
+}
+
+void ElidingLabel::paintEvent(QPaintEvent *) {
+    QPainter painter(this);
+    painter.setPen(QColor(0, 0, 0, 60));
+    painter.setBrush(QColor(255, 255, 255, 40));
+    painter.drawRect(rect().adjusted(0, 0, -1, -1));
+    painter.setPen(palette().windowText().color());
+    painter.drawText(contentsRect(), Qt::AlignLeft,
+                     fontMetrics().elidedText(m_text, Qt::ElideRight, width(), 0));
+}
+
+
 // ----------- PropertyEditor::Strings
 
@@ -187,5 +235,5 @@
     m_treeAction(new QAction(tr("Tree View"), this)),
     m_buttonAction(new QAction(tr("Drop Down Button View"), this)),
-    m_classLabel(new QLabel),
+    m_classLabel(new ElidingLabel),
     m_sorting(false),
     m_coloring(false),
@@ -223,9 +271,4 @@
     actionGroup->addAction(m_buttonAction);
     connect(actionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewTriggered(QAction*)));
-
-    QWidget *classWidget = new QWidget;
-    QHBoxLayout *l = new QHBoxLayout(classWidget);
-    l->setContentsMargins(5, 0, 5, 0);
-    l->addWidget(m_classLabel);
 
     // Add actions
@@ -270,5 +313,4 @@
     // Assemble toolbar
     QToolBar *toolBar = new QToolBar;
-    toolBar->addWidget(classWidget);
     toolBar->addWidget(m_filterWidget);
     toolBar->addWidget(createDropDownButton(m_addDynamicAction));
@@ -293,4 +335,6 @@
     QVBoxLayout *layout = new QVBoxLayout(this);
     layout->addWidget(toolBar);
+    layout->addWidget(m_classLabel);
+    layout->addSpacerItem(new QSpacerItem(0,1));
     layout->addWidget(m_stackedWidget);
     layout->setMargin(0);
@@ -779,7 +823,12 @@
     }
 
-    QString classLabelText = objectName;
-    classLabelText += QLatin1Char('\n');
+    m_classLabel->setVisible(!objectName.isEmpty() || !className.isEmpty());
+    m_classLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+
+    QString classLabelText;
+    if (!objectName.isEmpty())
+        classLabelText += objectName + QLatin1String(" : ");
     classLabelText += className;
+
     m_classLabel->setText(classLabelText);
     m_classLabel->setToolTip(tr("Object: %1\nClass: %2").arg(objectName).arg(className));
@@ -1176,9 +1225,9 @@
         QVariant v;
         qVariantSetValue(v, e);
-        emit propertyValueChanged(property->propertyName(), v, true);
-        return;
-    }
-
-    emit propertyValueChanged(property->propertyName(), value, enableSubPropertyHandling);
+        emitPropertyValueChanged(property->propertyName(), v, true);
+        return;
+    }
+
+    emitPropertyValueChanged(property->propertyName(), value, enableSubPropertyHandling);
 }
 
Index: trunk/tools/designer/src/components/propertyeditor/propertyeditor.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/propertyeditor.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/propertyeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -63,7 +63,5 @@
 class QtVariantProperty;
 class QtBrowserItem;
-
 class QStackedWidget;
-class QLabel;
 
 namespace qdesigner_internal {
@@ -73,4 +71,5 @@
 class DesignerEditorFactory;
 class FilterWidget;
+class ElidingLabel;
 
 class QT_PROPERTYEDITOR_EXPORT PropertyEditor: public QDesignerPropertyEditor
@@ -187,5 +186,5 @@
     QAction *m_treeAction;
     QAction *m_buttonAction;
-    QLabel *m_classLabel;
+    ElidingLabel *m_classLabel;
 
     bool m_sorting;
Index: trunk/tools/designer/src/components/propertyeditor/propertyeditor.pri
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/propertyeditor.pri	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/propertyeditor.pri	(revision 846)
@@ -11,6 +11,6 @@
     INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/qtgradienteditor
 } else {
-    include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri)
-    include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtcolorbutton.pri)
+    include(../../../../shared/qtpropertybrowser/qtpropertybrowser.pri)
+    include(../../../../shared/qtgradienteditor/qtcolorbutton.pri)
 }
 
@@ -46,9 +46,7 @@
 HEADERS += \
     $$PWD/propertyeditor_global.h \
-    $$PWD/defs.h \
     $$PWD/qlonglongvalidator.h
 
-SOURCES += $$PWD/defs.cpp \
-    $$PWD/qlonglongvalidator.cpp
+SOURCES += $$PWD/qlonglongvalidator.cpp
 
 RESOURCES += $$PWD/propertyeditor.qrc
Index: trunk/tools/designer/src/components/propertyeditor/propertyeditor_global.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/propertyeditor_global.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/propertyeditor_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/qlonglongvalidator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/stringlisteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/stringlisteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/stringlisteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/stringlisteditor.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/stringlisteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/stringlisteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/stringlisteditor.ui
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/stringlisteditor.ui	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/stringlisteditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.h
===================================================================
--- trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.h	(revision 769)
+++ trunk/tools/designer/src/components/propertyeditor/stringlisteditorbutton.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/connectdialog.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/connectdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/connectdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/connectdialog_p.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/connectdialog_p.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/connectdialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalslot_utils_p.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalslot_utils_p.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalslot_utils_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_global.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_global.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_instance.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_instance.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_instance.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_p.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_p.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditor_tool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -64,4 +64,5 @@
 #include <QtGui/QButtonGroup>
 #include <QtGui/QMenu>
+#include <QtGui/QSortFilterProxyModel>
 #include <QtGui/QStandardItemModel>
 #include <QtGui/QComboBox>
@@ -713,7 +714,10 @@
     m_core(core),
     m_model(new ConnectionModel(this)),
+    m_proxy_model(new QSortFilterProxyModel(this)),
     m_handling_selection_change(false)
 {
-    m_view->setModel(m_model);
+    m_proxy_model->setSourceModel(m_model);
+    m_view->setModel(m_proxy_model);
+    m_view->setSortingEnabled(true);
     m_view->setItemDelegate(new ConnectionDelegate(this));
     m_view->setEditTriggers(QAbstractItemView::DoubleClicked
@@ -721,5 +725,5 @@
     m_view->setRootIsDecorated(false);
     m_view->setTextElideMode (Qt::ElideMiddle);
-    connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(updateUi()));
+    connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateUi()));
     connect(m_view->header(), SIGNAL(sectionDoubleClicked(int)), m_view, SLOT(resizeColumnToContents(int)));
 
@@ -791,5 +795,5 @@
         return;
 
-    QModelIndex index = m_model->connectionToIndex(con);
+    QModelIndex index = m_proxy_model->mapFromSource(m_model->connectionToIndex(con));
     if (index == m_view->currentIndex())
         return;
@@ -809,5 +813,5 @@
         return;
 
-    Connection *con = m_model->indexToConnection(index);
+    Connection *con = m_model->indexToConnection(m_proxy_model->mapToSource(index));
     if (m_editor->selected(con))
         return;
Index: trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h
===================================================================
--- trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h	(revision 769)
+++ trunk/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -51,4 +51,5 @@
 class QDesignerFormEditorInterface;
 class QModelIndex;
+class QSortFilterProxyModel;
 class QTreeView;
 class QToolButton;
@@ -85,4 +86,5 @@
     QDesignerFormEditorInterface *m_core;
     ConnectionModel *m_model;
+    QSortFilterProxyModel *m_proxy_model;
     bool m_handling_selection_change;
 };
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor.cpp
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor.h
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor.h	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_global.h
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_global.h	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_instance.cpp
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_instance.cpp	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_instance.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.h
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.h	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.h
===================================================================
--- trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.h	(revision 769)
+++ trunk/tools/designer/src/components/tabordereditor/tabordereditor_tool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/button_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/button_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/button_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/button_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/button_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/button_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/combobox_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/containerwidget_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/groupbox_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/inplace_editor.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/inplace_editor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/inplace_editor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/inplace_editor.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/inplace_editor.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/inplace_editor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/inplace_widget_helper.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/itemlisteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/itemlisteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/itemlisteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -115,18 +115,18 @@
 
 static const char * const itemFlagNames[] = {
-    "Selectable",
-    "Editable",
-    "DragEnabled",
-    "DropEnabled",
-    "UserCheckable",
-    "Enabled",
-    "Tristate",
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Selectable"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Editable"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "DragEnabled"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "DropEnabled"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "UserCheckable"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Enabled"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Tristate"),
     0
 };
 
 static const char * const checkStateNames[] = {
-    "Unchecked",
-    "PartiallyChecked",
-    "Checked",
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Unchecked"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "PartiallyChecked"),
+    QT_TRANSLATE_NOOP("AbstractItemEditor", "Checked"),
     0
 };
@@ -136,5 +136,5 @@
     QStringList out;
     for (int i = 0; in[i]; i++)
-        out << QLatin1String(in[i]);
+        out << AbstractItemEditor::tr(in[i]);
     return out;
 }
Index: trunk/tools/designer/src/components/taskmenu/itemlisteditor.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/itemlisteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/itemlisteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/itemlisteditor.ui
===================================================================
--- trunk/tools/designer/src/components/taskmenu/itemlisteditor.ui	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/itemlisteditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/label_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/label_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/label_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/label_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/label_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/label_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/layouttaskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/layouttaskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/layouttaskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/layouttaskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/layouttaskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/layouttaskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/lineedit_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/listwidget_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/listwidgeteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/listwidgeteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/listwidgeteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/listwidgeteditor.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/listwidgeteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/listwidgeteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/menutaskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/menutaskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/menutaskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/menutaskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/menutaskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/menutaskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/tablewidget_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.ui
===================================================================
--- trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.ui	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/tablewidgeteditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/taskmenu_component.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/taskmenu_component.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/taskmenu_component.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/taskmenu_component.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/taskmenu_component.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/taskmenu_component.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/taskmenu_global.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/taskmenu_global.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/taskmenu_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/textedit_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/toolbar_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/treewidget_taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
===================================================================
--- trunk/tools/designer/src/components/taskmenu/treewidgeteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/treewidgeteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/treewidgeteditor.h
===================================================================
--- trunk/tools/designer/src/components/taskmenu/treewidgeteditor.h	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/treewidgeteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/taskmenu/treewidgeteditor.ui
===================================================================
--- trunk/tools/designer/src/components/taskmenu/treewidgeteditor.ui	(revision 769)
+++ trunk/tools/designer/src/components/taskmenu/treewidgeteditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetbox.cpp
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox.cpp	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -75,5 +75,8 @@
     filterWidget->setRefuseFocus(true);
     connect(filterWidget, SIGNAL(filterChanged(QString)), m_view, SLOT(filter(QString)));
-    l->addWidget(filterWidget);
+
+    QToolBar *toolBar = new QToolBar(this);
+    toolBar->addWidget(filterWidget);
+    l->addWidget(toolBar);
 
     // View
Index: trunk/tools/designer/src/components/widgetbox/widgetbox.h
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox.h	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetbox.xml
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox.xml	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox.xml	(revision 846)
@@ -2,5 +2,5 @@
 <!--************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.h
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.h	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox_dnditem.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetbox_global.h
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetbox_global.h	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetbox_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -89,9 +89,13 @@
 struct WidgetBoxCategoryEntry {
     WidgetBoxCategoryEntry();
-    explicit WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable);
+    explicit WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &widget,
+                                    const QString &filter,
+                                    const QIcon &icon,
+                                    bool editable);
 
     QDesignerWidgetBoxInterface::Widget widget;
     QString toolTip;
     QString whatsThis;
+    QString filter;
     QIcon icon;
     bool editable;
@@ -104,6 +108,9 @@
 }
 
-WidgetBoxCategoryEntry::WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &w, const QIcon &i, bool e) :
+WidgetBoxCategoryEntry::WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface::Widget &w,
+                                               const QString &filterIn,
+                                               const QIcon &i, bool e) :
     widget(w),
+    filter(filterIn),
     icon(i),
     editable(e)
@@ -143,4 +150,5 @@
     typedef QList<WidgetBoxCategoryEntry> WidgetBoxCategoryEntrys;
 
+    QRegExp m_classNameRegExp;
     QDesignerFormEditorInterface *m_core;
     WidgetBoxCategoryEntrys m_items;
@@ -150,7 +158,9 @@
 WidgetBoxCategoryModel::WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent) :
     QAbstractListModel(parent),
+    m_classNameRegExp(QLatin1String("<widget +class *= *\"([^\"]+)\"")),
     m_core(core),
     m_viewMode(QListView::ListMode)
 {
+    Q_ASSERT(m_classNameRegExp.isValid());
 }
 
@@ -206,6 +216,12 @@
 void WidgetBoxCategoryModel::addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon,bool editable)
 {
-    // build item
-    WidgetBoxCategoryEntry item(widget, icon, editable);
+    // build item. Filter on name + class name if it is different and not a layout.
+    QString filter = widget.name();
+    if (!filter.contains(QLatin1String("Layout")) && m_classNameRegExp.indexIn(widget.domXml()) != -1) {
+        const QString className = m_classNameRegExp.cap(1);
+        if (!filter.contains(className))
+            filter += className;
+    }
+    WidgetBoxCategoryEntry item(widget, filter, icon, editable);
     const QDesignerWidgetDataBaseInterface *db = m_core->widgetDataBase();
     const int dbIndex = db->indexOfClassName(widget.name());
@@ -256,5 +272,5 @@
         return QVariant(item.whatsThis);
     case FilterRole:
-        return item.widget.name();
+        return item.filter;
     }
     return QVariant();
Index: trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.h
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.h	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetboxcategorylistview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.h
===================================================================
--- trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.h	(revision 769)
+++ trunk/tools/designer/src/components/widgetbox/widgetboxtreewidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/appfontdialog.cpp
===================================================================
--- trunk/tools/designer/src/designer/appfontdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/appfontdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/appfontdialog.h
===================================================================
--- trunk/tools/designer/src/designer/appfontdialog.h	(revision 769)
+++ trunk/tools/designer/src/designer/appfontdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/assistantclient.cpp
===================================================================
--- trunk/tools/designer/src/designer/assistantclient.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/assistantclient.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -102,5 +102,5 @@
     }
     QTextStream str(m_process);
-    str << cmd << QLatin1Char('\0') << endl;
+    str << cmd << QLatin1Char('\n') << endl;
     return true;
 }
Index: trunk/tools/designer/src/designer/assistantclient.h
===================================================================
--- trunk/tools/designer/src/designer/assistantclient.h	(revision 769)
+++ trunk/tools/designer/src/designer/assistantclient.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/designer.pro
===================================================================
--- trunk/tools/designer/src/designer/designer.pro	(revision 769)
+++ trunk/tools/designer/src/designer/designer.pro	(revision 846)
@@ -15,8 +15,6 @@
     extra
 
-LIBS += -L../../lib \
-    -L../../../../lib \
-    -lQtDesignerComponents \
-    -lQtDesigner
+QMAKE_LIBDIR += ../../lib ../../../../lib
+LIBS += -lQtDesignerComponents -lQtDesigner
 
 RESOURCES += designer.qrc
@@ -28,6 +26,6 @@
 TARGET = designer
 
-include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri)
-include($$QT_SOURCE_TREE/tools/shared/qttoolbardialog/qttoolbardialog.pri)
+include(../../../shared/fontpanel/fontpanel.pri)
+include(../../../shared/qttoolbardialog/qttoolbardialog.pri)
 
 HEADERS += \
@@ -95,5 +93,4 @@
 
 unix:!mac:LIBS += -lm
-TRANSLATIONS = designer_de.ts
 
 include(../../../../src/qt_targets.pri)
Index: trunk/tools/designer/src/designer/designer.rc
===================================================================
--- trunk/tools/designer/src/designer/designer.rc	(revision 769)
+++ trunk/tools/designer/src/designer/designer.rc	(revision 846)
@@ -19,5 +19,5 @@
             VALUE "FileDescription", "Qt Designer"
             VALUE "FileVersion", "1.0.0.0"
-            VALUE "LegalCopyright", "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+            VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
             VALUE "InternalName", "designer"
             VALUE "OriginalFilename", "designer.exe"
Index: trunk/tools/designer/src/designer/designer_enums.h
===================================================================
--- trunk/tools/designer/src/designer/designer_enums.h	(revision 769)
+++ trunk/tools/designer/src/designer/designer_enums.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/main.cpp
===================================================================
--- trunk/tools/designer/src/designer/main.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/mainwindow.cpp
===================================================================
--- trunk/tools/designer/src/designer/mainwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -76,5 +76,5 @@
     for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it) {
         QAction *action = *it;
-        if (!action->icon().isNull())
+        if (action->property(QDesignerActions::defaultToolbarPropertyName).toBool())
             t->addAction(action);
     }
@@ -114,4 +114,6 @@
 QList<QToolBar *>  MainWindowBase::createToolBars(const QDesignerActions *actions, bool singleToolBar)
 {
+    // Note that whenever you want to add a new tool bar here, you also have to update the default
+    // action groups added to the toolbar manager in the mainwindow constructor
     QList<QToolBar *> rc;
     if (singleToolBar) {
@@ -254,4 +256,20 @@
             m_manager->addAction(action, dockTitle);
     }
+
+    QString category(tr("File"));
+    foreach(QAction *action, actions->fileActions()->actions())
+        m_manager->addAction(action, category);
+
+    category = tr("Edit");
+    foreach(QAction *action, actions->editActions()->actions())
+        m_manager->addAction(action, category);
+
+    category = tr("Tools");
+    foreach(QAction *action, actions->toolActions()->actions())
+        m_manager->addAction(action, category);
+
+    category = tr("Form");
+    foreach(QAction *action, actions->formActions()->actions())
+        m_manager->addAction(action, category);
 
     m_manager->addAction(m_configureAction, tr("Toolbars"));
Index: trunk/tools/designer/src/designer/mainwindow.h
===================================================================
--- trunk/tools/designer/src/designer/mainwindow.h	(revision 769)
+++ trunk/tools/designer/src/designer/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/newform.cpp
===================================================================
--- trunk/tools/designer/src/designer/newform.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/newform.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/newform.h
===================================================================
--- trunk/tools/designer/src/designer/newform.h	(revision 769)
+++ trunk/tools/designer/src/designer/newform.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/preferencesdialog.cpp
===================================================================
--- trunk/tools/designer/src/designer/preferencesdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/preferencesdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/preferencesdialog.h
===================================================================
--- trunk/tools/designer/src/designer/preferencesdialog.h	(revision 769)
+++ trunk/tools/designer/src/designer/preferencesdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_actions.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_actions.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_actions.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -107,4 +107,6 @@
 
 using namespace qdesigner_internal;
+
+const char *QDesignerActions::defaultToolbarPropertyName = "__qt_defaultToolBarAction";
 
 //#ifdef Q_WS_MAC
@@ -201,7 +203,13 @@
       m_previewManager(0)
 {
+#ifdef Q_WS_X11
     m_newFormAction->setIcon(QIcon::fromTheme("document-new", m_newFormAction->icon()));
     m_openFormAction->setIcon(QIcon::fromTheme("document-open", m_openFormAction->icon()));
     m_saveFormAction->setIcon(QIcon::fromTheme("document-save", m_saveFormAction->icon()));
+    m_saveFormAsAction->setIcon(QIcon::fromTheme("document-save-as", m_saveFormAsAction->icon()));
+    m_printPreviewAction->setIcon(QIcon::fromTheme("document-print", m_printPreviewAction->icon()));
+    m_closeFormAction->setIcon(QIcon::fromTheme("window-close", m_closeFormAction->icon()));
+    m_quitAction->setIcon(QIcon::fromTheme("application-exit", m_quitAction->icon()));
+#endif
 
     Q_ASSERT(m_core != 0);
@@ -231,4 +239,8 @@
     m_helpActions = createHelpActions();
 
+    m_newFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    m_openFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    m_saveFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
     QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager();
     Q_ASSERT(formWindowManager != 0);
@@ -316,4 +328,7 @@
     m_editActions->addAction(formWindowManager->actionLower());
     m_editActions->addAction(formWindowManager->actionRaise());
+
+    formWindowManager->actionLower()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionRaise()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
 
 //
@@ -333,4 +348,5 @@
     m_editWidgetsAction->setChecked(true);
     m_editWidgetsAction->setEnabled(false);
+    m_editWidgetsAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
     m_toolActions->addAction(m_editWidgetsAction);
 
@@ -344,4 +360,5 @@
             if (QAction *action = formEditorPlugin->action()) {
                 m_toolActions->addAction(action);
+                action->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
                 action->setCheckable(true);
             }
@@ -371,4 +388,13 @@
     m_formActions->addAction(createSeparator(this));
 
+    formWindowManager->actionHorizontalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionVerticalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionSplitHorizontal()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionSplitVertical()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionGridLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionFormLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionBreakLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+    formWindowManager->actionAdjustSize()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
     m_previewFormAction->setShortcut(tr("CTRL+R"));
     m_formActions->addAction(m_previewFormAction);
@@ -491,5 +517,5 @@
     updateRecentFileActions();
     menu->addSeparator();
-    act = new QAction(tr("Clear &Menu"), this);
+    act = new QAction(QIcon::fromTheme("edit-clear"), tr("Clear &Menu"), this);
     act->setObjectName(QLatin1String("__qt_action_clear_menu_"));
     connect(act, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
@@ -497,5 +523,5 @@
     menu->addAction(act);
 
-    act = new QAction(tr("&Recent Forms"), this);
+    act = new QAction(QIcon::fromTheme("document-open-recent"), tr("&Recent Forms"), this);
     act->setMenu(menu);
     return act;
Index: trunk/tools/designer/src/designer/qdesigner_actions.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_actions.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_actions.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -113,4 +113,8 @@
 
     QString uiExtension() const;
+
+    // Boolean dynamic property set on actions to
+    // show them in the default toolbar layout
+    static const char *defaultToolbarPropertyName;
 
 public slots:
Index: trunk/tools/designer/src/designer/qdesigner_appearanceoptions.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_appearanceoptions.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_appearanceoptions.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_appearanceoptions.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_appearanceoptions.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_appearanceoptions.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_formwindow.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_formwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_formwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_formwindow.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_formwindow.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_formwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_pch.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_pch.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_pch.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_server.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_server.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_server.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_server.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_server.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_server.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_settings.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_settings.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_settings.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_settings.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_settings.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_settings.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_toolwindow.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_toolwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_toolwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_toolwindow.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_toolwindow.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_toolwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/qdesigner_workbench.cpp
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_workbench.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_workbench.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -420,4 +420,5 @@
     const QDesignerSettings settings(m_core);
     m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows);
+    m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true);
     m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal);
     connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*)));
Index: trunk/tools/designer/src/designer/qdesigner_workbench.h
===================================================================
--- trunk/tools/designer/src/designer/qdesigner_workbench.h	(revision 769)
+++ trunk/tools/designer/src/designer/qdesigner_workbench.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/saveformastemplate.cpp
===================================================================
--- trunk/tools/designer/src/designer/saveformastemplate.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/saveformastemplate.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/saveformastemplate.h
===================================================================
--- trunk/tools/designer/src/designer/saveformastemplate.h	(revision 769)
+++ trunk/tools/designer/src/designer/saveformastemplate.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/saveformastemplate.ui
===================================================================
--- trunk/tools/designer/src/designer/saveformastemplate.ui	(revision 769)
+++ trunk/tools/designer/src/designer/saveformastemplate.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/designer/versiondialog.cpp
===================================================================
--- trunk/tools/designer/src/designer/versiondialog.cpp	(revision 769)
+++ trunk/tools/designer/src/designer/versiondialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -173,5 +173,5 @@
 
     lbl->setText(tr("%1"
-                    "<br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+                    "<br/>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
                     ).arg(version));
 
Index: trunk/tools/designer/src/designer/versiondialog.h
===================================================================
--- trunk/tools/designer/src/designer/versiondialog.h	(revision 769)
+++ trunk/tools/designer/src/designer/versiondialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/components/qdesigner_components.h
===================================================================
--- trunk/tools/designer/src/lib/components/qdesigner_components.h	(revision 769)
+++ trunk/tools/designer/src/lib/components/qdesigner_components.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/components/qdesigner_components_global.h
===================================================================
--- trunk/tools/designer/src/lib/components/qdesigner_components_global.h	(revision 769)
+++ trunk/tools/designer/src/lib/components/qdesigner_components_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/default_extensionfactory.cpp
===================================================================
--- trunk/tools/designer/src/lib/extension/default_extensionfactory.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/extension/default_extensionfactory.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/default_extensionfactory.h
===================================================================
--- trunk/tools/designer/src/lib/extension/default_extensionfactory.h	(revision 769)
+++ trunk/tools/designer/src/lib/extension/default_extensionfactory.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/extension.cpp
===================================================================
--- trunk/tools/designer/src/lib/extension/extension.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/extension/extension.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/extension.h
===================================================================
--- trunk/tools/designer/src/lib/extension/extension.h	(revision 769)
+++ trunk/tools/designer/src/lib/extension/extension.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/extension_global.h
===================================================================
--- trunk/tools/designer/src/lib/extension/extension_global.h	(revision 769)
+++ trunk/tools/designer/src/lib/extension/extension_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/qextensionmanager.cpp
===================================================================
--- trunk/tools/designer/src/lib/extension/qextensionmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/extension/qextensionmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/extension/qextensionmanager.h
===================================================================
--- trunk/tools/designer/src/lib/extension/qextensionmanager.h	(revision 769)
+++ trunk/tools/designer/src/lib/extension/qextensionmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/lib_pch.h
===================================================================
--- trunk/tools/designer/src/lib/lib_pch.h	(revision 769)
+++ trunk/tools/designer/src/lib/lib_pch.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractactioneditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractactioneditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractactioneditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractactioneditor.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractactioneditor.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractactioneditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractbrushmanager.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractbrushmanager.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractbrushmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractdialoggui.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractdialoggui.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractdialoggui.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractdialoggui_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractdialoggui_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractdialoggui_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractdnditem.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractdnditem.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractdnditem.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractdnditem.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractdnditem.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractdnditem.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/abstractformeditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -72,5 +72,4 @@
     Q_INIT_RESOURCE(shared);
     Q_INIT_RESOURCE(ClamshellPhone);
-    Q_INIT_RESOURCE(PDAPhone);
     Q_INIT_RESOURCE(PortableMedia);
     Q_INIT_RESOURCE(S60_nHD_Touchscreen);
@@ -80,6 +79,4 @@
     Q_INIT_RESOURCE(SmartPhoneWithButtons);
     Q_INIT_RESOURCE(TouchscreenPhone);
-    Q_INIT_RESOURCE(Trolltech_Keypad);
-    Q_INIT_RESOURCE(Trolltech_Touchscreen);
 }
 
Index: trunk/tools/designer/src/lib/sdk/abstractformeditor.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformeditor.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformeditorplugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindow.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindow.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindow.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindow.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowcursor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowtool.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowtool.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowtool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractformwindowtool.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractformwindowtool.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractformwindowtool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstracticoncache.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstracticoncache.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstracticoncache.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstracticoncache.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstracticoncache.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstracticoncache.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/abstractintegration.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractintegration.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractintegration.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractintegration.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractintegration.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractintegration.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractintrospection.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractintrospection.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractintrospection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractintrospection_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractintrospection_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractintrospection_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractlanguage.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractlanguage.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractlanguage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractmetadatabase.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractmetadatabase.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractmetadatabase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractmetadatabase.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractmetadatabase.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractmetadatabase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractnewformwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractnewformwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractnewformwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractnewformwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractnewformwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractnewformwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractobjectinspector.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractobjectinspector.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractobjectinspector.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractobjectinspector.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractobjectinspector.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractobjectinspector.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractoptionspage_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractoptionspage_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractoptionspage_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractpromotioninterface.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractpropertyeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractresourcebrowser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractsettings_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractsettings_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractsettings_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetbox.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetbox.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetbox.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetbox.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetbox.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetdatabase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/abstractwidgetfactory.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/extrainfo.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/layoutdecoration.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/layoutdecoration.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/layoutdecoration.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/layoutdecoration.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/layoutdecoration.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/layoutdecoration.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/membersheet.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/membersheet.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/membersheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/membersheet.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/membersheet.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/membersheet.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/propertysheet.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/propertysheet.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/propertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/propertysheet.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/propertysheet.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/propertysheet.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/sdk/script.cpp
===================================================================
--- trunk/tools/designer/src/lib/sdk/script.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/script.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/script_p.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/script_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/script_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/sdk_global.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/sdk_global.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/sdk_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/taskmenu.h
===================================================================
--- trunk/tools/designer/src/lib/sdk/taskmenu.h	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/taskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/sdk/taskmenu.qdoc
===================================================================
--- trunk/tools/designer/src/lib/sdk/taskmenu.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/sdk/taskmenu.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/shared/actioneditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/actioneditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/actioneditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/actioneditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/actioneditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/actioneditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/actionprovider_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/actionprovider_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/actionprovider_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/actionrepository.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/actionrepository.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/actionrepository.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -416,7 +416,8 @@
 }
 
-void ActionTreeView::currentChanged(const QModelIndex &current, const QModelIndex &/*previous*/)
+void ActionTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
 {
     emit currentChanged(m_model->actionAt(current));
+    QTreeView::currentChanged(current, previous);
 }
 
@@ -505,7 +506,8 @@
 }
 
-void ActionListView::currentChanged(const QModelIndex &current, const QModelIndex & /*previous*/)
+void ActionListView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
 {
     emit currentChanged(m_model->actionAt(current));
+    QListView::currentChanged(current, previous);
 }
 
Index: trunk/tools/designer/src/lib/shared/actionrepository_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/actionrepository_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/actionrepository_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/codedialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/codedialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/codedialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/codedialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/codedialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/codedialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/connectionedit.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/connectionedit.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/connectionedit.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/connectionedit_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/connectionedit_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/connectionedit_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/csshighlighter.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/csshighlighter.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/csshighlighter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/csshighlighter_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/csshighlighter_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/csshighlighter_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/deviceprofile.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/deviceprofile.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/deviceprofile.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/deviceprofile_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/deviceprofile_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/deviceprofile_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/dialoggui.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/dialoggui.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/dialoggui.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/dialoggui_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/dialoggui_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/dialoggui_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/extensionfactory_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/extensionfactory_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/extensionfactory_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/filterwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/filterwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/filterwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,11 +45,15 @@
 #include <QtGui/QVBoxLayout>
 #include <QtGui/QHBoxLayout>
-#include <QtGui/QPushButton>
 #include <QtGui/QLineEdit>
 #include <QtGui/QFocusEvent>
 #include <QtGui/QPalette>
 #include <QtGui/QCursor>
+#include <QtGui/QToolButton>
+#include <QtGui/QPainter>
+#include <QtGui/QStyle>
+#include <QtGui/QStyleOption>
 
 #include <QtCore/QDebug>
+#include <QtCore/QPropertyAnimation>
 
 enum { debugFilter = 0 };
@@ -62,8 +66,43 @@
     QLineEdit(parent),
     m_defaultFocusPolicy(focusPolicy()),
-    m_hintColor(QColor(0xbbbbbb)),
-    m_refuseFocus(false),
-    m_showingHintText(false)
-{
+    m_refuseFocus(false)
+{
+}
+
+IconButton::IconButton(QWidget *parent)
+    : QToolButton(parent)
+{
+    setCursor(Qt::ArrowCursor);
+}
+
+void IconButton::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
+    // Note isDown should really use the active state but in most styles
+    // this has no proper feedback
+    QIcon::Mode state = QIcon::Disabled;
+    if (isEnabled())
+        state = isDown() ? QIcon::Selected : QIcon::Normal;
+    QPixmap iconpixmap = icon().pixmap(QSize(ICONBUTTON_SIZE, ICONBUTTON_SIZE),
+                                       state, QIcon::Off);
+    QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height());
+    pixmapRect.moveCenter(rect().center());
+    painter.setOpacity(m_fader);
+    painter.drawPixmap(pixmapRect, iconpixmap);
+}
+
+void IconButton::animateShow(bool visible)
+{
+    if (visible) {
+        QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
+        animation->setDuration(160);
+        animation->setEndValue(1.0);
+        animation->start(QAbstractAnimation::DeleteWhenStopped);
+    } else {
+        QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
+        animation->setDuration(160);
+        animation->setEndValue(0.0);
+        animation->start(QAbstractAnimation::DeleteWhenStopped);
+    }
 }
 
@@ -112,80 +151,36 @@
     }
 
-    hideHintText();
     QLineEdit::focusInEvent(e);
 }
-
-void HintLineEdit::focusOutEvent(QFocusEvent *e)
-{
-    if (debugFilter)
-        qDebug() << Q_FUNC_INFO;
-    // Focus out: Switch to displaying the hint text unless there is user input
-    showHintText();
-    QLineEdit::focusOutEvent(e);
-}
-
-QString HintLineEdit::hintText() const
-{
-    return m_hintText;
-}
-
-void HintLineEdit::setHintText(const QString &ht)
-{
-    if (ht == m_hintText)
-        return;
-    hideHintText();
-    m_hintText = ht;
-    if (!hasFocus() && !ht.isEmpty())
-        showHintText();
-}
-
-void HintLineEdit::showHintText(bool force)
-{
-    if (m_showingHintText || m_hintText.isEmpty())
-        return;
-    if (force || text().isEmpty()) {
-        m_showingHintText = true;
-        setText(m_hintText);
-        setTextColor(m_hintColor, &m_textColor);
-    }
-}
-void HintLineEdit::hideHintText()
-{
-    if (m_showingHintText && !m_hintText.isEmpty()) {
-        m_showingHintText = false;
-        setText(QString());
-        setTextColor(m_textColor);
-    }
-}
-
-bool  HintLineEdit::isShowingHintText() const
-{
-    return m_showingHintText;
-}
-
-QString  HintLineEdit::typedText() const
-{
-    return m_showingHintText ? QString() : text();
-}
-
-void HintLineEdit::setTextColor(const QColor &newColor, QColor *oldColor)
-{
-    QPalette pal = palette();
-    if (oldColor)
-        *oldColor = pal.color(QPalette::Text);
-    pal.setColor(QPalette::Text, newColor);
-    setPalette(pal);}
 
 // ------------------- FilterWidget
 FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm)  :
     QWidget(parent),
-    m_button(new QPushButton),
-    m_editor(new HintLineEdit)
-{
-    m_editor->setHintText(tr("<Filter>"));
+    m_editor(new HintLineEdit(this)),
+    m_button(new IconButton(m_editor)),
+    m_buttonwidth(0)
+{
+    m_editor->setPlaceholderText(tr("Filter"));
+
+    // Let the style determine minimum height for our widget
+    QSize size(ICONBUTTON_SIZE + 6, ICONBUTTON_SIZE + 2);
+
+    // Note KDE does not reserve space for the highlight color
+    if (style()->inherits("OxygenStyle")) {
+        size = size.expandedTo(QSize(24, 0));
+    }
+
+    // Make room for clear icon
+    QMargins margins = m_editor->textMargins();
+    if (layoutDirection() == Qt::LeftToRight)
+        margins.setRight(size.width());
+    else
+        margins.setLeft(size.width());
+
+    m_editor->setTextMargins(margins);
+
     QHBoxLayout *l = new QHBoxLayout(this);
     l->setMargin(0);
     l->setSpacing(0);
-
     if (lm == LayoutAlignRight)
         l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
@@ -193,9 +188,14 @@
     l->addWidget(m_editor);
 
-    m_button->setIcon(createIconSet(QLatin1String("resetproperty.png")));
-    m_button->setIconSize(QSize(8, 8));
-    m_button->setFlat(true);
-    l->addWidget(m_button);
-
+    // KDE has custom icons for this. Notice that icon namings are counter intuitive
+    // If these icons are not avaiable we use the freedesktop standard name before
+    // falling back to a bundled resource
+    QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
+                     QLatin1String("edit-clear-locationbar-rtl") :
+                     QLatin1String("edit-clear-locationbar-ltr"),
+                     QIcon::fromTheme("edit-clear", createIconSet(QLatin1String("cleartext.png"))));
+
+    m_button->setIcon(icon);
+    m_button->setToolTip(tr("Clear text"));
     connect(m_button, SIGNAL(clicked()), this, SLOT(reset()));
     connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString)));
@@ -205,10 +205,12 @@
 QString FilterWidget::text() const
 {
-    return m_editor->typedText();
-}
-
-void FilterWidget::checkButton(const QString &)
-{
-    m_button->setEnabled(!text().isEmpty());
+    return m_editor->text();
+}
+
+void FilterWidget::checkButton(const QString &text)
+{
+    if (m_oldText.isEmpty() || text.isEmpty())
+        m_button->animateShow(!m_editor->text().isEmpty());
+    m_oldText = text;
 }
 
@@ -217,11 +219,24 @@
     if (debugFilter)
         qDebug() << Q_FUNC_INFO;
-    if (!text().isEmpty()) {
+
+    if (!m_editor->text().isEmpty()) {
         // Editor has lost focus once this is pressed
-        m_editor->showHintText(true);
+        m_editor->clear();
         emit filterChanged(QString());
     }
 }
 
+void FilterWidget::resizeEvent(QResizeEvent *)
+{
+    QRect contentRect = m_editor->rect();
+    if (layoutDirection() == Qt::LeftToRight) {
+        const int iconoffset = m_editor->textMargins().right() + 4;
+        m_button->setGeometry(contentRect.adjusted(m_editor->width() - iconoffset, 0, 0, 0));
+    } else {
+        const int iconoffset = m_editor->textMargins().left() + 4;
+        m_button->setGeometry(contentRect.adjusted(0, 0, -m_editor->width() + iconoffset, 0));
+    }
+}
+
 bool FilterWidget::refuseFocus() const
 {
Index: trunk/tools/designer/src/lib/shared/filterwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/filterwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/filterwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -59,16 +59,13 @@
 #include <QtGui/QLineEdit>
 #include <QtGui/QColor>
+#include <QtGui/QToolButton>
 
 QT_BEGIN_NAMESPACE
 
-class QPushButton;
+class QToolButton;
 
 namespace qdesigner_internal {
 
-/* A line edit that displays a grayed hintText (like "Type Here to Filter")
- * when not focused and empty. When connecting to the changed signals and
- * querying text, one has to be aware that the text is set to that hint
- * text if isShowingHintText() returns true (that is, does not contain
- * valid user input). This widget should never have initial focus
+/* This widget should never have initial focus
  * (ie, be the first widget of a dialog, else, the hint cannot be displayed.
  * For situations, where it is the only focusable control (widget box),
@@ -77,4 +74,6 @@
  * is not sufficient for that as an ActivationFocus will occur). */
 
+#define ICONBUTTON_SIZE 16
+
 class QDESIGNER_SHARED_EXPORT HintLineEdit : public QLineEdit {
     Q_OBJECT
@@ -82,33 +81,31 @@
     explicit HintLineEdit(QWidget *parent = 0);
 
-    QString hintText() const;
-
-    bool isShowingHintText() const;
-
-    // Convenience for accessing the text that returns "" in case of isShowingHintText().
-    QString typedText() const;
-
     bool refuseFocus() const;
     void setRefuseFocus(bool v);
-
-public slots:
-    void setHintText(const QString &ht);
-    void showHintText(bool force = false);
-    void hideHintText();
 
 protected:
     virtual void mousePressEvent(QMouseEvent *event);
     virtual void focusInEvent(QFocusEvent *e);
-    virtual void focusOutEvent(QFocusEvent *e);
 
 private:
-    void setTextColor(const QColor &newColor, QColor *oldColor = 0);
+    const Qt::FocusPolicy m_defaultFocusPolicy;
+    bool m_refuseFocus;
+};
 
-    const Qt::FocusPolicy m_defaultFocusPolicy;
-    const QColor m_hintColor;
-    QColor m_textColor;
-    bool m_refuseFocus;
-    QString m_hintText;
-    bool m_showingHintText;
+// IconButton: This is a simple helper class that represents clickable icons
+
+class IconButton: public QToolButton
+{
+    Q_OBJECT
+    Q_PROPERTY(float fader READ fader WRITE setFader)
+public:
+    IconButton(QWidget *parent);
+    void paintEvent(QPaintEvent *event);
+    float fader() { return m_fader; }
+    void setFader(float value) { m_fader = value; update(); }
+    void animateShow(bool visible);
+
+private:
+    float m_fader;
 };
 
@@ -129,5 +126,5 @@
 
     QString text() const;
-
+    void resizeEvent(QResizeEvent *);
     bool refuseFocus() const; // see HintLineEdit
     void setRefuseFocus(bool v);
@@ -143,6 +140,8 @@
 
 private:
-    QPushButton *m_button;
     HintLineEdit *m_editor;
+    IconButton *m_button;
+    int m_buttonwidth;
+    QString m_oldText;
 };
 } // namespace qdesigner_internal
Index: trunk/tools/designer/src/lib/shared/formlayoutmenu.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/formlayoutmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/formlayoutmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/formlayoutmenu_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/formlayoutmenu_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/formlayoutmenu_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/formwindowbase.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/formwindowbase.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/formwindowbase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -73,4 +73,5 @@
 #include <QtGui/QMenu>
 #include <QtGui/QAction>
+#include <QtGui/QLabel>
 
 QT_BEGIN_NAMESPACE
@@ -182,5 +183,15 @@
         while (itIndex.hasNext()) {
             const int index = itIndex.next().key();
-            sheet->setProperty(index, sheet->property(index));
+            const QVariant newValue = sheet->property(index);
+            if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == QLatin1String("text")) {
+                const PropertySheetStringValue newString = qVariantValue<PropertySheetStringValue>(newValue);
+                // optimize a bit, reset only if the text value might contain a reference to qt resources
+                // (however reloading of icons other than taken from resources might not work here)
+                if (newString.value().contains(QLatin1String(":/"))) {
+                    const QVariant resetValue = qVariantFromValue(PropertySheetStringValue());
+                    sheet->setProperty(index, resetValue);
+                }
+            }
+            sheet->setProperty(index, newValue);
         }
         if (QTabWidget *tabWidget = qobject_cast<QTabWidget *>(sheet->object())) {
Index: trunk/tools/designer/src/lib/shared/formwindowbase_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/formwindowbase_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/formwindowbase_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/grid.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/grid.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/grid.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/grid_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/grid_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/grid_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/gridpanel.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/gridpanel.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/gridpanel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/gridpanel_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/gridpanel_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/gridpanel_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/htmlhighlighter.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/htmlhighlighter.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/htmlhighlighter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/htmlhighlighter_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/htmlhighlighter_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/htmlhighlighter_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/iconloader.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/iconloader.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/iconloader.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/iconloader_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/iconloader_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/iconloader_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/iconselector.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/iconselector.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/iconselector.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/iconselector_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/iconselector_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/iconselector_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/invisible_widget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/invisible_widget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/invisible_widget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/invisible_widget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/invisible_widget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/invisible_widget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/layout.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/layout.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/layout.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/layout_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/layout_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/layout_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/layoutinfo.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/layoutinfo.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/layoutinfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/layoutinfo_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/layoutinfo_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/layoutinfo_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/metadatabase.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/metadatabase.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/metadatabase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/metadatabase_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/metadatabase_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/metadatabase_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/morphmenu.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/morphmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/morphmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/morphmenu_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/morphmenu_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/morphmenu_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newactiondialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/newactiondialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newactiondialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newactiondialog.ui
===================================================================
--- trunk/tools/designer/src/lib/shared/newactiondialog.ui	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newactiondialog.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newactiondialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/newactiondialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newactiondialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newformwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/newformwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newformwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newformwidget.ui
===================================================================
--- trunk/tools/designer/src/lib/shared/newformwidget.ui	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newformwidget.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/newformwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/newformwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/newformwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/orderdialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/orderdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/orderdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/orderdialog.ui
===================================================================
--- trunk/tools/designer/src/lib/shared/orderdialog.ui	(revision 769)
+++ trunk/tools/designer/src/lib/shared/orderdialog.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/orderdialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/orderdialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/orderdialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/plaintexteditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/plaintexteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/plaintexteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/plaintexteditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/plaintexteditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/plaintexteditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/plugindialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/plugindialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/plugindialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -103,5 +103,5 @@
 
     if (!fileNames.isEmpty()) {
-        QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Loaded Plugins"));
+        QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Loaded Plugins"));
         QFont boldFont = topLevelItem->font(0);
 
@@ -126,5 +126,5 @@
     const QStringList notLoadedPlugins = pluginManager->failedPlugins();
     if (!notLoadedPlugins.isEmpty()) {
-        QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Failed Plugins"));
+        QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Failed Plugins"));
         const QFont boldFont = topLevelItem->font(0);
         foreach (const QString &plugin, notLoadedPlugins) {
Index: trunk/tools/designer/src/lib/shared/plugindialog.ui
===================================================================
--- trunk/tools/designer/src/lib/shared/plugindialog.ui	(revision 769)
+++ trunk/tools/designer/src/lib/shared/plugindialog.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/plugindialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/plugindialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/plugindialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/pluginmanager.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/pluginmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/pluginmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/pluginmanager_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/pluginmanager_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/pluginmanager_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/previewconfigurationwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/previewconfigurationwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/previewconfigurationwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -42,5 +42,5 @@
 /* It is possible to link the skins as resources into Designer by specifying:
  * QVFB_ROOT=$$QT_SOURCE_TREE/tools/qvfb
- * RESOURCES += $$QVFB_ROOT/ClamshellPhone.qrc  $$QVFB_ROOT/PDAPhone.qrc ...
+ * RESOURCES += $$QVFB_ROOT/ClamshellPhone.qrc  $$QVFB_ROOT/TouchScreenPhone.qrc ...
  * in lib/shared/shared.pri. However, this exceeds a limit of Visual Studio 6. */
 
Index: trunk/tools/designer/src/lib/shared/previewconfigurationwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/previewconfigurationwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/previewconfigurationwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/previewmanager.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/previewmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/previewmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/previewmanager_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/previewmanager_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/previewmanager_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/promotionmodel.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/promotionmodel.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/promotionmodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/promotionmodel_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/promotionmodel_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/promotionmodel_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/promotiontaskmenu.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/promotiontaskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/promotiontaskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/promotiontaskmenu_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/promotiontaskmenu_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/promotiontaskmenu_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/propertylineedit.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/propertylineedit.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/propertylineedit.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/propertylineedit_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/propertylineedit_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/propertylineedit_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_command.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_command.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_command.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_command2.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_command2.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_command2.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_command2_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_command2_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_command2_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_command_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_command_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_command_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_dnditem.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_dnditem.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_dnditem.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_dnditem_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_dnditem_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_dnditem_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_dockwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_dockwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_dockwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_dockwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_dockwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_dockwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formbuilder_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formeditorcommand_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -63,6 +63,8 @@
 
 // ---- QDesignerFormWindowCommand ----
-QDesignerFormWindowCommand::QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow)
-    : QUndoCommand(description),
+QDesignerFormWindowCommand::QDesignerFormWindowCommand(const QString &description,
+                                                       QDesignerFormWindowInterface *formWindow,
+                                                       QUndoCommand *parent)
+    : QUndoCommand(description, parent),
       m_formWindow(formWindow)
 {
Index: trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formwindowcommand_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -71,5 +71,7 @@
 
 public:
-    QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow);
+    QDesignerFormWindowCommand(const QString &description,
+                               QDesignerFormWindowInterface *formWindow,
+                               QUndoCommand *parent = 0);
 
     virtual void undo();
Index: trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_formwindowmanager_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_integration.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_integration.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_integration.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_integration_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_integration_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_integration_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_introspection.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_introspection.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_introspection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_introspection_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_introspection_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_introspection_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_membersheet.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_membersheet.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_membersheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_membersheet_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_membersheet_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_membersheet_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_menu.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_menu.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_menu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -78,4 +78,5 @@
 {
     switch (dir) {
+    case Qt::LayoutDirectionAuto: // Should never happen
     case Qt::LeftToRight:
         subMenuRect->setLeft(subMenuRect->left() - 20);
@@ -944,6 +945,6 @@
     if (ctrl)
         (void) swap(m_currentIndex, m_currentIndex - 1);
-
-    m_currentIndex = qMax(0, --m_currentIndex);
+    --m_currentIndex;
+    m_currentIndex = qMax(0, m_currentIndex);
     // Always re-select, swapping destroys order
     update();
@@ -960,5 +961,6 @@
         (void) swap(m_currentIndex + 1, m_currentIndex);
 
-    m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex);
+    ++m_currentIndex;
+    m_currentIndex = qMin(actions().count() - 1, m_currentIndex);
     update();
     if (!ctrl)
Index: trunk/tools/designer/src/lib/shared/qdesigner_menu_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_menu_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_menu_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_menubar.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_menubar.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_menubar.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_menubar_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_menubar_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_menubar_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_objectinspector.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_objectinspector.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_objectinspector.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_objectinspector_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_promotion.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_promotion.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_promotion.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_promotion_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_promotion_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_promotion_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -927,6 +927,7 @@
 
 // ---- PropertyListCommand
-PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow) :
-    QDesignerFormWindowCommand(QString(), formWindow)
+PropertyListCommand::PropertyListCommand(QDesignerFormWindowInterface *formWindow,
+                                         QUndoCommand *parent) :
+    QDesignerFormWindowCommand(QString(), formWindow, parent)
 {
 }
@@ -967,8 +968,15 @@
             return false;
     }
-    m_propertyHelperList.push_back(PropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
+
+    const PropertyHelperPtr ph(createPropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
+    m_propertyHelperList.push_back(ph);
     return true;
 }
 
+PropertyHelper *PropertyListCommand::createPropertyHelper(QObject *object, SpecialProperty sp,
+                                                          QDesignerPropertySheetExtension *sheet, int sheetIndex) const
+{
+    return new PropertyHelper(object, sp, sheet, sheetIndex);
+}
 
 // Init from a list and make sure referenceObject is added first to obtain the right property group
@@ -994,5 +1002,5 @@
 {
     Q_ASSERT(index < m_propertyHelperList.size());
-    return m_propertyHelperList[index].object();
+    return m_propertyHelperList.at(index)->object();
 }
 
@@ -1000,5 +1008,5 @@
 {
     Q_ASSERT(index < m_propertyHelperList.size());
-    return m_propertyHelperList[index].oldValue();
+    return m_propertyHelperList.at(index)->oldValue();
 }
 
@@ -1006,5 +1014,5 @@
 {
     Q_ASSERT(index < m_propertyHelperList.size());
-    m_propertyHelperList[index].setOldValue(oldValue);
+    m_propertyHelperList.at(index)->setOldValue(oldValue);
 }
 // ----- SetValueFunction: Set a new value when applied to a PropertyHelper.
@@ -1066,7 +1074,8 @@
 
     for (PropertyListIterator it = begin; it != end; ++it) {
-        if (QObject* object = it->object()) { // Might have been deleted in the meantime
-            const PropertyHelper::Value newValue = function(*it);
-            updateMask |= it->updateMask();
+        PropertyHelper *ph = it->data();
+        if (QObject* object = ph->object()) { // Might have been deleted in the meantime
+            const PropertyHelper::Value newValue = function( *ph );
+            updateMask |= ph->updateMask();
             // Update property editor if it is the current object
             if (!updatedPropertyEditor && propertyEditor && object == propertyEditor->object()) {
@@ -1085,7 +1094,9 @@
 {
     if(debugPropertyCommands)
-        qDebug() << "PropertyListCommand::setValue(" << value <<  changed << subPropertyMask << ')';
+        qDebug() << "PropertyListCommand::setValue(" << value
+                 << changed << subPropertyMask << ')';
     return changePropertyList(formWindow()->core(),
-                              m_propertyDescription.m_propertyName, m_propertyHelperList.begin(), m_propertyHelperList.end(),
+                              m_propertyDescription.m_propertyName,
+                              m_propertyHelperList.begin(), m_propertyHelperList.end(),
                               SetValueFunction(formWindow(), PropertyHelper::Value(value, changed), subPropertyMask));
 }
@@ -1147,5 +1158,5 @@
         return false;
     for (int i = 0; i < m_propertyHelperList.size(); i++) {
-        if (!m_propertyHelperList[i].canMerge(other[i]))
+        if (!m_propertyHelperList.at(i)->canMerge(*other.at(i)))
             return false;
     }
@@ -1154,6 +1165,7 @@
 
 // ---- SetPropertyCommand ----
-SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow)
-    :  PropertyListCommand(formWindow),
+SetPropertyCommand::SetPropertyCommand(QDesignerFormWindowInterface *formWindow,
+                                       QUndoCommand *parent)
+    :  PropertyListCommand(formWindow, parent),
        m_subPropertyMask(SubPropertyAll)
 {
@@ -1211,5 +1223,5 @@
 {
     if (propertyHelperList().size() == 1) {
-        setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
+        setText(QApplication::translate("Command", "Changed '%1' of '%2'").arg(propertyName()).arg(propertyHelperList().at(0)->object()->objectName()));
     } else {
         int count = propertyHelperList().size();
@@ -1230,4 +1242,9 @@
 {
     return 1976;
+}
+
+QVariant SetPropertyCommand::mergeValue(const QVariant &newValue)
+{
+    return newValue;
 }
 
@@ -1249,5 +1266,8 @@
         return false;
 
-    m_newValue = cmd->newValue();
+    const QVariant newValue = mergeValue(cmd->newValue());
+    if (!newValue.isValid())
+        return false;
+    m_newValue = newValue;
     m_subPropertyMask |= cmd->m_subPropertyMask;
     if(debugPropertyCommands)
@@ -1290,5 +1310,5 @@
 {
     if (propertyHelperList().size() == 1) {
-        setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList()[0].object()->objectName()));
+        setText(QApplication::translate("Command", "Reset '%1' of '%2'").arg(propertyName()).arg(propertyHelperList().at(0)->object()->objectName()));
     } else {
         int count = propertyHelperList().size();
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertycommand_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -59,4 +59,5 @@
 #include <QtCore/QList>
 #include <QtCore/QPair>
+#include <QtCore/QSharedPointer>
 
 QT_BEGIN_NAMESPACE
@@ -78,9 +79,10 @@
 enum SpecialProperty getSpecialProperty(const QString& propertyName);
 
-
 // A helper class for applying properties to objects.
 // Can be used for Set commands (setValue(), restoreOldValue()) or
 // Reset Commands     restoreDefaultValue(), restoreOldValue()).
-class PropertyHelper {
+//
+class QDESIGNER_SHARED_EXPORT PropertyHelper {
+    Q_DISABLE_COPY(PropertyHelper)
 public:
     // A pair of Value and changed flag
@@ -93,9 +95,11 @@
                    QDesignerPropertySheetExtension *sheet,
                    int index);
+    virtual ~PropertyHelper() {}
 
     QObject *object() const { return m_object; }
     SpecialProperty specialProperty() const { return m_specialProperty; }
-    // set a new value
-    Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
+    // set a new value. Can be overwritten to perform a transformation (see
+    // handling of Arrow key move in FormWindow class).
+    virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
 
     // restore old value
@@ -148,5 +152,5 @@
     typedef QList<QObject *> ObjectList;
 
-    explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow);
+    explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
 
     QObject* object(int index = 0) const;
@@ -160,6 +164,6 @@
 
 protected:
-    typedef QList<PropertyHelper> PropertyHelperList;
-
+    typedef QSharedPointer<PropertyHelper> PropertyHelperPtr;
+    typedef QList<PropertyHelperPtr> PropertyHelperList;
 
     // add an object
@@ -205,4 +209,8 @@
     const PropertyDescription &propertyDescription() const { return  m_propertyDescription; }
 
+protected:
+    virtual PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
+                                                 QDesignerPropertySheetExtension *sheet, int sheetIndex) const;
+
 private:
     PropertyDescription m_propertyDescription;
@@ -216,5 +224,5 @@
     typedef QList<QObject *> ObjectList;
 
-    explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow);
+    explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
 
     bool init(QObject *object, const QString &propertyName, const QVariant &newValue);
@@ -233,4 +241,8 @@
 
     virtual void redo();
+
+protected:
+    virtual QVariant mergeValue(const QVariant &newValue);
+
 private:
     unsigned subPropertyMask(const QVariant &newValue, QObject *referenceObject);
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -93,5 +93,6 @@
 
 QDesignerPropertyEditor::QDesignerPropertyEditor(QWidget *parent, Qt::WindowFlags flags) :
-    QDesignerPropertyEditorInterface(parent, flags)
+    QDesignerPropertyEditorInterface(parent, flags),
+    m_propertyChangedForwardingBlocked(false)
 {
     // Make old signal work for  compatibility
@@ -148,7 +149,18 @@
 }
 
+void QDesignerPropertyEditor::emitPropertyValueChanged(const QString &name, const QVariant &value, bool enableSubPropertyHandling)
+{
+    // Avoid duplicate signal emission - see below
+    m_propertyChangedForwardingBlocked = true;
+    emit propertyValueChanged(name, value, enableSubPropertyHandling);
+    emit propertyChanged(name, value);
+    m_propertyChangedForwardingBlocked = false;
+}
+
 void QDesignerPropertyEditor::slotPropertyChanged(const QString &name, const QVariant &value)
 {
-    emit propertyValueChanged(name, value, true);
+    // Forward signal from Integration using the old interfaces.
+    if (!m_propertyChangedForwardingBlocked)
+        emit propertyValueChanged(name, value, true);
 }
 
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertyeditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -80,5 +80,4 @@
                 const QObject *object, const QString &propertyName, bool isMainContainer);
 
-
 Q_SIGNALS:
     void propertyValueChanged(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
@@ -98,4 +97,11 @@
 private Q_SLOTS:
     void slotPropertyChanged(const QString &name, const QVariant &value);
+
+protected:
+    void emitPropertyValueChanged(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
+
+private:
+    bool m_propertyChangedForwardingBlocked;
+
 };
 
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -272,4 +272,5 @@
     return isResourceProperty(index)
            || propertyType(index) == QDesignerPropertySheet::PropertyStyleSheet
+           || propertyType(index) == QDesignerPropertySheet::PropertyText
            || q->property(index).type() == QVariant::Url;
 }
@@ -550,4 +551,5 @@
         propertyTypeHash.insert(QLatin1String("windowModified"),          PropertyWindowModified);
         propertyTypeHash.insert(QLatin1String("styleSheet"),              PropertyStyleSheet);
+        propertyTypeHash.insert(QLatin1String("text"),                    PropertyText);
     }
     return propertyTypeHash.value(name, PropertyNone);
@@ -611,6 +613,7 @@
         createFakeProperty(QLatin1String("acceptDrops"));
         createFakeProperty(QLatin1String("dragEnabled"));
-        // windowModality is visible only for the main container, in which case the form windows enables it on loading
+        // windowModality/Opacity is visible only for the main container, in which case the form windows enables it on loading
         setVisible(createFakeProperty(QLatin1String("windowModality")), false);
+        setVisible(createFakeProperty(QLatin1String("windowOpacity"), double(1.0)), false);
         if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
             createFakeProperty(QLatin1String("floatable"), QVariant(true));
@@ -691,4 +694,8 @@
 bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) const
 {
+    // used internally
+    if (propName == QLatin1String("database") ||
+        propName == QLatin1String("buttonGroupId"))
+        return false;
     const int index = d->m_meta->indexOfProperty(propName);
     if (index != -1)
@@ -720,8 +727,9 @@
         v = qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue());
     else if (value.type() == QVariant::String)
-        v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
-    else if (value.type() == QVariant::KeySequence)
-        v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue());
-
+        v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
+    else if (value.type() == QVariant::KeySequence) {
+        const QKeySequence keySequence = qVariantValue<QKeySequence>(value);
+        v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+    }
 
     if (d->m_addIndex.contains(propName)) {
@@ -1128,5 +1136,5 @@
         }
 
-        if (isDynamicProperty(index)) {
+        if (isDynamicProperty(index) || isDefaultDynamicProperty(index)) {
             if (d->isResourceProperty(index))
                 d->setResourceProperty(index, value);
@@ -1198,8 +1206,15 @@
         const QString propName = propertyName(index);
         const QVariant oldValue = d->m_addProperties.value(index);
-        const QVariant newValue = d->m_info.value(index).defaultValue;
+        const QVariant defaultValue = d->m_info.value(index).defaultValue;
+        QVariant newValue = defaultValue;
+        if (d->isStringProperty(index)) {
+            newValue = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString()));
+        } else if (d->isKeySequenceProperty(index)) {
+            const QKeySequence keySequence = qVariantValue<QKeySequence>(newValue);
+            newValue = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+        }
         if (oldValue == newValue)
             return true;
-        d->m_object->setProperty(propName.toUtf8(), newValue);
+        d->m_object->setProperty(propName.toUtf8(), defaultValue);
         d->m_addProperties[index] = newValue;
         return true;
@@ -1452,6 +1467,11 @@
 
     if (isFakeProperty(index)) {
-        if (type == PropertyWindowModality) // Hidden for child widgets
+        switch (type) {
+        case PropertyWindowModality: // Hidden for child widgets
+        case PropertyWindowOpacity:
             return d->m_info.value(index).visible;
+        default:
+            break;
+        }
         return true;
     }
Index: trunk/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -177,5 +177,6 @@
                         PropertyWindowModality,
                         PropertyWindowModified,
-                        PropertyStyleSheet
+                        PropertyStyleSheet,
+                        PropertyText
     };
 
Index: trunk/tools/designer/src/lib/shared/qdesigner_qsettings.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_qsettings.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_qsettings.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_qsettings_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_qsettings_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_qsettings_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_stackedbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_stackedbox_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_stackedbox_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_stackedbox_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_tabwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_tabwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_tabwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_taskmenu_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_taskmenu_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_taskmenu_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_toolbar.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_toolbar.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -476,4 +476,5 @@
     case Qt::Horizontal:
         switch (tb->layoutDirection()) {
+        case Qt::LayoutDirectionAuto: // Should never happen
         case Qt::LeftToRight:
             rc.setX(exclusionRectangle.right() + 1);
Index: trunk/tools/designer/src/lib/shared/qdesigner_toolbar_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_toolbar_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_toolbar_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_toolbox.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_toolbox.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_toolbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_toolbox_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_toolbox_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_toolbox_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_utils.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_utils.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_utils.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_utils_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_utils_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_utils_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widgetbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widgetbox_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widgetitem.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widgetitem.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widgetitem.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qdesigner_widgetitem_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qdesigner_widgetitem_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qdesigner_widgetitem_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qlayout_widget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qlayout_widget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qlayout_widget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qlayout_widget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qlayout_widget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qlayout_widget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qscripthighlighter.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qscripthighlighter.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qscripthighlighter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qscripthighlighter_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qscripthighlighter_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qscripthighlighter_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qsimpleresource.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qsimpleresource.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qsimpleresource.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qsimpleresource_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qsimpleresource_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qsimpleresource_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qtresourceeditordialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourceeditordialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourceeditordialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qtresourceeditordialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourceeditordialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourceeditordialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qtresourcemodel.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourcemodel.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourcemodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -429,8 +429,8 @@
 void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable)
 {
-    m_fileWatcher->removePath(path);
-
-    if (!enable)
-        return;
+    if (!enable) {
+        m_fileWatcher->removePath(path);
+        return;
+    }
 
     QFileInfo fi(path);
Index: trunk/tools/designer/src/lib/shared/qtresourcemodel_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourcemodel_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourcemodel_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/qtresourceview.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourceview.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourceview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -382,5 +382,6 @@
         return;
 
-    const QString root(QLatin1Char(':'));
+    // Resource root up until 4.6 was ':', changed to ":/" as of 4.7
+    const QString root(QLatin1String(":/"));
 
     QMap<QString, QString> contents = m_resourceModel->contents();
@@ -425,5 +426,5 @@
 
     const bool matchAll = m_filterPattern.isEmpty();
-    const QString root(QLatin1Char(':'));
+    const QString root(QLatin1String(":/"));
 
     QQueue<QString> pathQueue;
@@ -669,4 +670,6 @@
 void QtResourceView::selectResource(const QString &resource)
 {
+    if (resource.isEmpty())
+        return;
     QFileInfo fi(resource);
     QDir dir = fi.absoluteDir();
Index: trunk/tools/designer/src/lib/shared/qtresourceview_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/qtresourceview_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/qtresourceview_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/richtexteditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/richtexteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/richtexteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/richtexteditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/richtexteditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/richtexteditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scriptcommand.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/scriptcommand.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scriptcommand.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scriptcommand_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/scriptcommand_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scriptcommand_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scriptdialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/scriptdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scriptdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scriptdialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/scriptdialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scriptdialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scripterrordialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/scripterrordialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scripterrordialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/scripterrordialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/scripterrordialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/scripterrordialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/shared.pri
===================================================================
--- trunk/tools/designer/src/lib/shared/shared.pri	(revision 769)
+++ trunk/tools/designer/src/lib/shared/shared.pri	(revision 846)
@@ -3,9 +3,9 @@
 contains(QT_CONFIG, script): QT += script
 
-include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri)
-include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri)
-include($$QT_SOURCE_TREE/src/tools/rcc/rcc.pri)
-include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri)
-include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtgradienteditor.pri)
+include(../../../../shared/qtpropertybrowser/qtpropertybrowser.pri)
+include(../../../../shared/deviceskin/deviceskin.pri)
+include(../../../../../src/tools/rcc/rcc.pri)
+include(../../../../shared/findwidget/findwidget.pri)
+include(../../../../shared/qtgradienteditor/qtgradienteditor.pri)
 
 # Input
Index: trunk/tools/designer/src/lib/shared/shared_enums_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/shared_enums_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/shared_enums_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/shared_global_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/shared_global_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/shared_global_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/shared_settings.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/shared_settings.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/shared_settings.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/shared_settings_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/shared_settings_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/shared_settings_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/sheet_delegate.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/sheet_delegate.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/sheet_delegate.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/sheet_delegate_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/sheet_delegate_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/sheet_delegate_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/signalslotdialog.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/signalslotdialog.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/signalslotdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/signalslotdialog_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/signalslotdialog_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/signalslotdialog_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/spacer_widget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/spacer_widget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/spacer_widget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/spacer_widget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/spacer_widget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/spacer_widget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/stylesheeteditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/stylesheeteditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/stylesheeteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -80,4 +80,5 @@
 {
     setTabStopWidth(fontMetrics().width(QLatin1Char(' '))*4);
+    setAcceptRichText(false);
     new CssHighlighter(document());
 }
Index: trunk/tools/designer/src/lib/shared/stylesheeteditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/stylesheeteditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/stylesheeteditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/textpropertyeditor.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/textpropertyeditor.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/textpropertyeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/textpropertyeditor_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/textpropertyeditor_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/textpropertyeditor_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/widgetdatabase.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/widgetdatabase.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/widgetdatabase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/widgetdatabase_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/widgetdatabase_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/widgetdatabase_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/widgetfactory.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/widgetfactory.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/widgetfactory.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/widgetfactory_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/widgetfactory_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/widgetfactory_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/zoomwidget.cpp
===================================================================
--- trunk/tools/designer/src/lib/shared/zoomwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/shared/zoomwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/shared/zoomwidget_p.h
===================================================================
--- trunk/tools/designer/src/lib/shared/zoomwidget_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/shared/zoomwidget_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/abstractformbuilder.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/abstractformbuilder.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/abstractformbuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -2126,4 +2126,19 @@
 }
 
+// Return the buttongroups assigned to a button except the internal one
+// (with empty object name) used by Q3ButtonGroup.
+static inline const QButtonGroup *formButtonGroup(const QAbstractButton *widget)
+{
+    const QButtonGroup *buttonGroup = widget->group();
+    if (!buttonGroup)
+        return 0;
+    if (buttonGroup->objectName().isEmpty()) {
+        if (const QWidget *parent = widget->parentWidget())
+            if (!qstrcmp(parent->metaObject()->className(), "Q3ButtonGroup"))
+                return 0;
+    }
+    return buttonGroup;
+}
+
 /*!
     \internal
@@ -2134,5 +2149,5 @@
 {
     typedef QList<DomProperty*> DomPropertyList;
-    if (const QButtonGroup *buttonGroup = widget->group()) {
+    if (const QButtonGroup *buttonGroup = formButtonGroup(widget)) {
         DomPropertyList attributes = ui_widget->elementAttribute();
         DomString *domString = new DomString();
Index: trunk/tools/designer/src/lib/uilib/abstractformbuilder.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/abstractformbuilder.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/abstractformbuilder.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/container.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/container.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/container.qdoc
===================================================================
--- trunk/tools/designer/src/lib/uilib/container.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/container.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/uilib/customwidget.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/customwidget.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/customwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/customwidget.qdoc
===================================================================
--- trunk/tools/designer/src/lib/uilib/customwidget.qdoc	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/customwidget.qdoc	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -7,30 +7,16 @@
 ** This file is part of the documentation of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:FDL$
 ** Commercial Usage
 ** Licensees holding valid Qt Commercial licenses may use this file in
 ** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
 **
 ** If you have questions regarding the use of this file, please contact
Index: trunk/tools/designer/src/lib/uilib/formbuilder.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/formbuilder.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formbuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/formbuilder.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/formbuilder.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formbuilder.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/formbuilderextra.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/formbuilderextra.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formbuilderextra.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/formbuilderextra_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/formbuilderextra_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formbuilderextra_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/formscriptrunner.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/formscriptrunner.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formscriptrunner.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/formscriptrunner_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/formscriptrunner_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/formscriptrunner_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/properties.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/properties.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/properties.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -656,14 +656,19 @@
         dom_prop->setElementBrush(afb->saveBrush(qvariant_cast<QBrush>(v)));
         break;
-    default:
+    default: {
+        const bool hadAttributeStdset = dom_prop->hasAttributeStdset();
+        const bool attributeStdset = dom_prop->attributeStdset();
         delete dom_prop;
         if (afb->resourceBuilder()->isResourceType(v)) {
             dom_prop = afb->resourceBuilder()->saveResource(afb->workingDirectory(), v);
-            if (dom_prop)
+            if (dom_prop) {
                 dom_prop->setAttributeName(pname);
+                if (hadAttributeStdset)
+                    dom_prop->setAttributeStdset(attributeStdset);
+            }
             break;
         }
         uiLibWarning(msgCannotWriteProperty(pname, v));
-        return 0;
+    } return 0;
     }
     return dom_prop;
Index: trunk/tools/designer/src/lib/uilib/properties_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/properties_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/properties_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/qdesignerexportwidget.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/qdesignerexportwidget.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/qdesignerexportwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/resourcebuilder.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/resourcebuilder.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/resourcebuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/resourcebuilder_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/resourcebuilder_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/resourcebuilder_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/textbuilder.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/textbuilder.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/textbuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/textbuilder_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/textbuilder_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/textbuilder_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/ui4.cpp
===================================================================
--- trunk/tools/designer/src/lib/uilib/ui4.cpp	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/ui4.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/ui4_p.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/ui4_p.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/ui4_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/lib/uilib/uilib_global.h
===================================================================
--- trunk/tools/designer/src/lib/uilib/uilib_global.h	(revision 769)
+++ trunk/tools/designer/src/lib/uilib/uilib_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetextrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.h
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetplugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.h
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.h	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qaxwidgettaskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.cpp
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h
===================================================================
--- trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h	(revision 769)
+++ trunk/tools/designer/src/plugins/activeqt/qdesigneraxwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/phononcollection.cpp
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/phononcollection.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/phononcollection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -67,10 +67,10 @@
 QString SeekSliderPlugin::toolTip() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
 QString SeekSliderPlugin::whatsThis() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
Index: trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/seeksliderplugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -73,10 +73,10 @@
 QString VideoPlayerPlugin::toolTip() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
 QString VideoPlayerPlugin::whatsThis() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
Index: trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/videoplayerplugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/videoplayertaskmenu.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -67,10 +67,10 @@
 QString VolumeSliderPlugin::toolTip() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
 QString VolumeSliderPlugin::whatsThis() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
Index: trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h
===================================================================
--- trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/phononwidgets/volumesliderplugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/plugins.pro
===================================================================
--- trunk/tools/designer/src/plugins/plugins.pro	(revision 769)
+++ trunk/tools/designer/src/plugins/plugins.pro	(revision 846)
@@ -4,6 +4,7 @@
 REQUIRES = !CONFIG(static,shared|static)
 contains(QT_CONFIG, qt3support): SUBDIRS += widgets
-win32:!contains(QT_EDITION, OpenSource):SUBDIRS += activeqt
+win32: SUBDIRS += activeqt
 # contains(QT_CONFIG, opengl): SUBDIRS += tools/view3d
 contains(QT_CONFIG, webkit): SUBDIRS += qwebview
 contains(QT_CONFIG, phonon): SUBDIRS += phononwidgets
+contains(QT_CONFIG, declarative): SUBDIRS += qdeclarativeview
Index: trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro
===================================================================
--- trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro	(revision 846)
+++ trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro	(revision 846)
@@ -0,0 +1,13 @@
+TEMPLATE    = lib
+TARGET      = qdeclarativeview
+CONFIG     += qt warn_on plugin designer
+QT         += declarative
+
+include(../plugins.pri)
+build_all:!build_pass {
+    CONFIG -= build_all
+    CONFIG += release
+}
+
+SOURCES += qdeclarativeview_plugin.cpp
+HEADERS += qdeclarativeview_plugin.h
Index: trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp	(revision 846)
+++ trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp	(revision 846)
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarativeview_plugin.h"
+
+#include <QtDesigner/QExtensionFactory>
+#include <QtDesigner/QExtensionManager>
+
+#include <QtCore/qplugin.h>
+#include <QtDeclarative/QDeclarativeView>
+
+static const char toolTipC[] = "QtDeclarative view widget";
+
+QT_BEGIN_NAMESPACE
+
+QDeclarativeViewPlugin::QDeclarativeViewPlugin(QObject *parent) :
+    QObject(parent),
+    m_initialized(false)
+{
+}
+
+QString QDeclarativeViewPlugin::name() const
+{
+    return QLatin1String("QDeclarativeView");
+}
+
+QString QDeclarativeViewPlugin::group() const
+{
+    return QLatin1String("Display Widgets");
+}
+
+QString QDeclarativeViewPlugin::toolTip() const
+{
+    return tr(toolTipC);
+}
+
+QString QDeclarativeViewPlugin::whatsThis() const
+{
+    return tr(toolTipC);
+}
+
+QString QDeclarativeViewPlugin::includeFile() const
+{
+    return QLatin1String("QtDeclarative/QDeclarativeView");
+}
+
+QIcon QDeclarativeViewPlugin::icon() const
+{
+    return QIcon();
+}
+
+bool QDeclarativeViewPlugin::isContainer() const
+{
+    return false;
+}
+
+QWidget *QDeclarativeViewPlugin::createWidget(QWidget *parent)
+{
+    return new QDeclarativeView(parent);
+}
+
+bool QDeclarativeViewPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void QDeclarativeViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
+{
+    if (m_initialized)
+        return;
+
+    m_initialized = true;
+}
+
+QString QDeclarativeViewPlugin::domXml() const
+{
+    return QLatin1String("\
+    <ui language=\"c++\">\
+        <widget class=\"QDeclarativeView\" name=\"declarativeView\">\
+            <property name=\"geometry\">\
+                <rect>\
+                    <x>0</x>\
+                    <y>0</y>\
+                    <width>300</width>\
+                    <height>200</height>\
+                </rect>\
+            </property>\
+        </widget>\
+    </ui>");
+}
+
+Q_EXPORT_PLUGIN2(customwidgetplugin, QDeclarativeViewPlugin)
+
+QT_END_NAMESPACE
Index: trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h	(revision 846)
+++ trunk/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h	(revision 846)
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVEVIEW_PLUGIN_H
+#define QDECLARATIVEVIEW_PLUGIN_H
+
+#include <QtDesigner/QDesignerCustomWidgetInterface>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeViewPlugin: public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+public:
+    QDeclarativeViewPlugin(QObject *parent = 0);
+
+    virtual QString name() const;
+    virtual QString group() const;
+    virtual QString toolTip() const;
+    virtual QString whatsThis() const;
+    virtual QString includeFile() const;
+    virtual QIcon icon() const;
+    virtual bool isContainer() const;
+    virtual QWidget *createWidget(QWidget *parent);
+    virtual bool isInitialized() const;
+    virtual void initialize(QDesignerFormEditorInterface *core);
+    virtual QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEVIEW_PLUGIN_H
Index: trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -70,10 +70,10 @@
 QString QWebViewPlugin::toolTip() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
 QString QWebViewPlugin::whatsThis() const
 {
-    return QString(QLatin1String(toolTipC));
+    return tr(toolTipC);
 }
 
Index: trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/qwebview/qwebview_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d.cpp
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d.h
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d.h	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d_global.h
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d_global.h	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.cpp
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.h
===================================================================
--- trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.h	(revision 769)
+++ trunk/tools/designer/src/plugins/tools/view3d/view3d_tool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h
===================================================================
--- trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp
===================================================================
--- trunk/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp	(revision 769)
+++ trunk/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/uitools/quiloader.cpp
===================================================================
--- trunk/tools/designer/src/uitools/quiloader.cpp	(revision 769)
+++ trunk/tools/designer/src/uitools/quiloader.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/uitools/quiloader.h
===================================================================
--- trunk/tools/designer/src/uitools/quiloader.h	(revision 769)
+++ trunk/tools/designer/src/uitools/quiloader.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/designer/src/uitools/quiloader_p.h
===================================================================
--- trunk/tools/designer/src/uitools/quiloader_p.h	(revision 769)
+++ trunk/tools/designer/src/uitools/quiloader_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/doxygen/config/phonon.doxyfile
===================================================================
--- trunk/tools/doxygen/config/phonon.doxyfile	(revision 769)
+++ trunk/tools/doxygen/config/phonon.doxyfile	(revision 846)
@@ -6,5 +6,5 @@
 #---------------------------------------------------------------------------
 PROJECT_NAME           = Qt
-PROJECT_NUMBER         = 4.6.3
+PROJECT_NUMBER         = 4.7.2
 OUTPUT_DIRECTORY       = doc
 CREATE_SUBDIRS         = NO
Index: trunk/tools/kmap2qmap/main.cpp
===================================================================
--- trunk/tools/kmap2qmap/main.cpp	(revision 769)
+++ trunk/tools/kmap2qmap/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/lconvert/main.cpp
===================================================================
--- trunk/tools/linguist/lconvert/main.cpp	(revision 769)
+++ trunk/tools/linguist/lconvert/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -46,6 +46,14 @@
 #include <QtCore/QString>
 #include <QtCore/QStringList>
+#include <QtCore/QTranslator>
+#include <QtCore/QLibraryInfo>
 
 #include <iostream>
+
+QT_USE_NAMESPACE
+
+class LC {
+    Q_DECLARE_TR_FUNCTIONS(LConvert)
+};
 
 static int usage(const QStringList &args)
@@ -58,5 +66,5 @@
         loaders += line.arg(format.extension, -5).arg(format.description);
 
-    std::cerr << qPrintable(QString(QLatin1String("\nUsage:\n"
+    std::cerr << qPrintable(LC::tr("\nUsage:\n"
         "    lconvert [options] <infile> [<infile>...]\n\n"
         "lconvert is part of Qt's Linguist tool chain. It can be used as a\n"
@@ -120,5 +128,5 @@
         "    1 on command line parse failures\n"
         "    2 on read failures\n"
-        "    3 on write failures\n")).arg(loaders));
+        "    3 on write failures\n").arg(loaders));
     return 1;
 }
@@ -133,6 +141,17 @@
 {
     QCoreApplication app(argc, argv);
+#ifndef Q_OS_WIN32
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+    }
+#endif // Q_OS_WIN32
+
     QStringList args = app.arguments();
-
     QList<File> inFiles;
     QString inFormat(QLatin1String("auto"));
@@ -239,5 +258,5 @@
 
     if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) {
-        qWarning() << qPrintable(cd.error());
+        std::cerr << qPrintable(cd.error());
         return 2;
     }
@@ -247,5 +266,5 @@
         Translator tr2;
         if (!tr2.load(inFiles[i].name, cd, inFiles[i].format)) {
-            qWarning() << qPrintable(cd.error());
+            std::cerr << qPrintable(cd.error());
             return 2;
         }
@@ -272,9 +291,9 @@
     tr.normalizeTranslations(cd);
     if (!cd.errors().isEmpty()) {
-        qWarning("%s", qPrintable(cd.error()));
+        std::cerr << qPrintable(cd.error());
         cd.clearErrors();
     }
     if (!tr.save(outFileName, cd, outFormat)) {
-        qWarning("%s", qPrintable(cd.error()));
+        std::cerr << qPrintable(cd.error());
         return 3;
     }
Index: trunk/tools/linguist/linguist.pro
===================================================================
--- trunk/tools/linguist/linguist.pro	(revision 769)
+++ trunk/tools/linguist/linguist.pro	(revision 846)
@@ -1,6 +1,6 @@
 TEMPLATE = subdirs
 SUBDIRS  = \
-    linguist \
     lrelease \
     lupdate \
     lconvert
+!no-png:!contains(QT_CONFIG, no-gui):SUBDIRS += linguist
Index: trunk/tools/linguist/linguist/batchtranslation.ui
===================================================================
--- trunk/tools/linguist/linguist/batchtranslation.ui	(revision 769)
+++ trunk/tools/linguist/linguist/batchtranslation.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/batchtranslationdialog.cpp
===================================================================
--- trunk/tools/linguist/linguist/batchtranslationdialog.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/batchtranslationdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/batchtranslationdialog.h
===================================================================
--- trunk/tools/linguist/linguist/batchtranslationdialog.h	(revision 769)
+++ trunk/tools/linguist/linguist/batchtranslationdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/errorsview.cpp
===================================================================
--- trunk/tools/linguist/linguist/errorsview.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/errorsview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/errorsview.h
===================================================================
--- trunk/tools/linguist/linguist/errorsview.h	(revision 769)
+++ trunk/tools/linguist/linguist/errorsview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/finddialog.cpp
===================================================================
--- trunk/tools/linguist/linguist/finddialog.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/finddialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/finddialog.h
===================================================================
--- trunk/tools/linguist/linguist/finddialog.h	(revision 769)
+++ trunk/tools/linguist/linguist/finddialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/finddialog.ui
===================================================================
--- trunk/tools/linguist/linguist/finddialog.ui	(revision 769)
+++ trunk/tools/linguist/linguist/finddialog.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/formpreviewview.cpp
===================================================================
--- trunk/tools/linguist/linguist/formpreviewview.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/formpreviewview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/formpreviewview.h
===================================================================
--- trunk/tools/linguist/linguist/formpreviewview.h	(revision 769)
+++ trunk/tools/linguist/linguist/formpreviewview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/globals.cpp
===================================================================
--- trunk/tools/linguist/linguist/globals.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/globals.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/globals.h
===================================================================
--- trunk/tools/linguist/linguist/globals.h	(revision 769)
+++ trunk/tools/linguist/linguist/globals.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/linguist.pro
===================================================================
--- trunk/tools/linguist/linguist/linguist.pro	(revision 769)
+++ trunk/tools/linguist/linguist/linguist.pro	(revision 846)
@@ -10,5 +10,5 @@
 
 DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
-build_all:!build_pass { 
+build_all:!build_pass {
     CONFIG -= build_all
     CONFIG += release
@@ -43,5 +43,5 @@
     translatedialog.cpp \
     translationsettingsdialog.cpp \
-    ../shared/simtexth.cpp 
+    ../shared/simtexth.cpp
 
 HEADERS += \
@@ -73,5 +73,5 @@
 win32:RC_FILE = linguist.rc
 os2:RC_FILE = linguist_os2.rc
-mac { 
+mac {
     static:CONFIG -= global_init_link_order
     ICON = linguist.icns
@@ -97,14 +97,3 @@
 RESOURCES += linguist.qrc
 
-TR_DIR = $$PWD/../../../translations
-TRANSLATIONS = \
-    $$TR_DIR/linguist_cs.ts \
-    $$TR_DIR/linguist_de.ts \
-    $$TR_DIR/linguist_fr.ts \
-    $$TR_DIR/linguist_ja.ts \
-    $$TR_DIR/linguist_pl.ts \
-    $$TR_DIR/linguist_ru.ts \
-    $$TR_DIR/linguist_zh_CN.ts \
-    $$TR_DIR/linguist_zh_TW.ts
-
 include(../../../src/qt_targets.pri)
Index: trunk/tools/linguist/linguist/linguist.rc
===================================================================
--- trunk/tools/linguist/linguist/linguist.rc	(revision 769)
+++ trunk/tools/linguist/linguist/linguist.rc	(revision 846)
@@ -19,5 +19,5 @@
             VALUE "FileDescription", "Qt Linguist"
             VALUE "FileVersion", "1.0.0.0"
-            VALUE "LegalCopyright", "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+            VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
             VALUE "InternalName", "linguist"
             VALUE "OriginalFilename", "linguist.exe"
Index: trunk/tools/linguist/linguist/main.cpp
===================================================================
--- trunk/tools/linguist/linguist/main.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/mainwindow.cpp
===================================================================
--- trunk/tools/linguist/linguist/mainwindow.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -143,8 +143,11 @@
     case 0x2049: // exclamation question mark
     case 0x2762: // heavy exclamation mark ornament
+    case 0xff01: // full width exclamation mark
+    case 0xff1f: // full width question mark
         return End_Interrobang;
     case 0x003b: // greek 'compatibility' questionmark
         return lang == QLocale::Greek ? End_Interrobang : End_None;
     case 0x003a: // colon
+    case 0xff1a: // full width colon
         return End_Colon;
     case 0x2026: // horizontal ellipsis
@@ -1036,4 +1039,6 @@
                         if (searchItem(m->extraComment()))
                             break;
+                        if (searchItem(m->translatorComment()))
+                            break;
                         m_foundWhere = DataModel::NoLocation;
                         // did not find the search string in this message
@@ -1358,5 +1363,5 @@
         << (QT_VERSION & 0xFF)
         << QLatin1String("/qdoc/linguist-manual.html")
-        << QLatin1Char('\0') << endl;
+        << QLatin1Char('\n') << endl;
 }
 
@@ -1371,5 +1376,5 @@
                     "<p>Qt Linguist is a tool for adding translations to Qt "
                     "applications.</p>"
-                    "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+                    "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
                    ).arg(version));
 
@@ -1528,5 +1533,5 @@
             m_phraseView->setSourceText(-1, QString());
         }
-        if (m) {
+        if (m && !m->fileName().isEmpty()) {
             if (hasFormPreview(m->fileName())) {
                 m_sourceAndFormView->setCurrentWidget(m_formPreviewView);
@@ -1583,5 +1588,5 @@
 
     m->setTranslations(translations);
-    if (hasFormPreview(m->fileName()))
+    if (!m->fileName().isEmpty() && hasFormPreview(m->fileName()))
         m_formPreviewView->setSourceContext(m_currentIndex.model(), m);
     updateDanger(m_currentIndex, true);
@@ -1821,16 +1826,42 @@
 }
 
+static inline void setThemeIcon(QAction *action, const char *name, const char *fallback)
+{
+    const QIcon fallbackIcon(MainWindow::resourcePrefix() + QLatin1String(fallback));
+#ifdef Q_WS_X11
+    action->setIcon(QIcon::fromTheme(QLatin1String(name), fallbackIcon));
+#else
+    Q_UNUSED(name)
+    action->setIcon(fallbackIcon);
+#endif
+}
+
 void MainWindow::setupMenuBar()
 {
+    // There are no fallback icons for these
+#ifdef Q_WS_X11
+    m_ui.menuRecentlyOpenedFiles->setIcon(QIcon::fromTheme(QLatin1String("document-open-recent")));
+    m_ui.actionCloseAll->setIcon(QIcon::fromTheme(QLatin1String("window-close")));
+    m_ui.actionExit->setIcon(QIcon::fromTheme(QLatin1String("application-exit")));
+    m_ui.actionSelectAll->setIcon(QIcon::fromTheme(QLatin1String("edit-select-all")));
+#endif
+
+    // Prefer theme icons when available for these actions
+    setThemeIcon(m_ui.actionOpen, "document-open", "/fileopen.png");
+    setThemeIcon(m_ui.actionOpenAux, "document-open", "/fileopen.png");
+    setThemeIcon(m_ui.actionSave, "document-save", "/filesave.png");
+    setThemeIcon(m_ui.actionSaveAll, "document-save", "/filesave.png");
+    setThemeIcon(m_ui.actionPrint, "document-print", "/print.png");
+    setThemeIcon(m_ui.actionRedo, "edit-redo", "/redo.png");
+    setThemeIcon(m_ui.actionUndo, "edit-undo", "/undo.png");
+    setThemeIcon(m_ui.actionCut, "edit-cut", "/editcut.png");
+    setThemeIcon(m_ui.actionCopy, "edit-copy", "/editcopy.png");
+    setThemeIcon(m_ui.actionPaste, "edit-paste", "/editpaste.png");
+    setThemeIcon(m_ui.actionFind, "edit-find", "/searchfind.png");
+
+    // No well defined theme icons for these actions
     m_ui.actionAccelerators->setIcon(QIcon(resourcePrefix() + QLatin1String("/accelerator.png")));
     m_ui.actionOpenPhraseBook->setIcon(QIcon(resourcePrefix() + QLatin1String("/book.png")));
     m_ui.actionDoneAndNext->setIcon(QIcon(resourcePrefix() + QLatin1String("/doneandnext.png")));
-    m_ui.actionCopy->setIcon(QIcon(resourcePrefix() + QLatin1String("/editcopy.png")));
-    m_ui.actionCut->setIcon(QIcon(resourcePrefix() + QLatin1String("/editcut.png")));
-    m_ui.actionPaste->setIcon(QIcon(resourcePrefix() + QLatin1String("/editpaste.png")));
-    m_ui.actionOpen->setIcon(QIcon(resourcePrefix() + QLatin1String("/fileopen.png")));
-    m_ui.actionOpenAux->setIcon(QIcon(resourcePrefix() + QLatin1String("/fileopen.png")));
-    m_ui.actionSaveAll->setIcon(QIcon(resourcePrefix() + QLatin1String("/filesave.png")));
-    m_ui.actionSave->setIcon(QIcon(resourcePrefix() + QLatin1String("/filesave.png")));
     m_ui.actionNext->setIcon(QIcon(resourcePrefix() + QLatin1String("/next.png")));
     m_ui.actionNextUnfinished->setIcon(QIcon(resourcePrefix() + QLatin1String("/nextunfinished.png")));
@@ -1839,8 +1870,4 @@
     m_ui.actionPrev->setIcon(QIcon(resourcePrefix() + QLatin1String("/prev.png")));
     m_ui.actionPrevUnfinished->setIcon(QIcon(resourcePrefix() + QLatin1String("/prevunfinished.png")));
-    m_ui.actionPrint->setIcon(QIcon(resourcePrefix() + QLatin1String("/print.png")));
-    m_ui.actionRedo->setIcon(QIcon(resourcePrefix() + QLatin1String("/redo.png")));
-    m_ui.actionFind->setIcon(QIcon(resourcePrefix() + QLatin1String("/searchfind.png")));
-    m_ui.actionUndo->setIcon(QIcon(resourcePrefix() + QLatin1String("/undo.png")));
     m_ui.actionPlaceMarkerMatches->setIcon(QIcon(resourcePrefix() + QLatin1String("/validateplacemarkers.png")));
     m_ui.actionWhatsThis->setIcon(QIcon(resourcePrefix() + QLatin1String("/whatsthis.png")));
@@ -1980,5 +2007,5 @@
         if (m_currentIndex.isValid()) {
             if (MessageItem *item = m_dataModel->messageItem(m_currentIndex)) {
-                if (hasFormPreview(item->fileName()))
+                if (!item->fileName().isEmpty() && hasFormPreview(item->fileName()))
                     m_formPreviewView->setSourceContext(model, item);
                 if (enableRw && !item->isObsolete())
@@ -2381,5 +2408,5 @@
             if (c != '&' && c != ' ' && QChar(c).isPrint()) {
                 const ushort *pp = p;
-                for (; *p < 256 && ::isalpha(*p); p++) ;
+                for (; *p < 256 && isalpha(*p); p++) ;
                 if (pp == p || *p != ';')
                     return true;
@@ -2482,6 +2509,6 @@
 
             if (m_ui.actionPlaceMarkerMatches->isChecked()) {
-                // Stores the occurence count of the place markers in the map placeMarkerIndexes.
-                // i.e. the occurence count of %1 is stored at placeMarkerIndexes[1],
+                // Stores the occurrence count of the place markers in the map placeMarkerIndexes.
+                // i.e. the occurrence count of %1 is stored at placeMarkerIndexes[1],
                 // count of %2 is stored at placeMarkerIndexes[2] etc.
                 // In the first pass, it counts all place markers in the sourcetext.
Index: trunk/tools/linguist/linguist/mainwindow.h
===================================================================
--- trunk/tools/linguist/linguist/mainwindow.h	(revision 769)
+++ trunk/tools/linguist/linguist/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/mainwindow.ui
===================================================================
--- trunk/tools/linguist/linguist/mainwindow.ui	(revision 769)
+++ trunk/tools/linguist/linguist/mainwindow.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -680,5 +680,5 @@
    </property>
    <property name="whatsThis">
-    <string>Display information about the Qt toolkit by Trolltech.</string>
+    <string>Display information about the Qt toolkit by Nokia.</string>
    </property>
    <property name="menuRole">
Index: trunk/tools/linguist/linguist/messageeditor.cpp
===================================================================
--- trunk/tools/linguist/linguist/messageeditor.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/messageeditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messageeditor.h
===================================================================
--- trunk/tools/linguist/linguist/messageeditor.h	(revision 769)
+++ trunk/tools/linguist/linguist/messageeditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messageeditorwidgets.cpp
===================================================================
--- trunk/tools/linguist/linguist/messageeditorwidgets.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/messageeditorwidgets.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messageeditorwidgets.h
===================================================================
--- trunk/tools/linguist/linguist/messageeditorwidgets.h	(revision 769)
+++ trunk/tools/linguist/linguist/messageeditorwidgets.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messagehighlighter.cpp
===================================================================
--- trunk/tools/linguist/linguist/messagehighlighter.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/messagehighlighter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messagehighlighter.h
===================================================================
--- trunk/tools/linguist/linguist/messagehighlighter.h	(revision 769)
+++ trunk/tools/linguist/linguist/messagehighlighter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/messagemodel.cpp
===================================================================
--- trunk/tools/linguist/linguist/messagemodel.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/messagemodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -210,4 +210,11 @@
     }
 
+    if (!tor.messageCount()) {
+        QMessageBox::warning(parent, QObject::tr("Qt Linguist"),
+                             tr("The translation file '%1' will not be loaded because it is empty.")
+                             .arg(Qt::escape(fileName)));
+        return false;
+    }
+
     Translator::Duplicates dupes = tor.resolveDuplicates();
     if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) {
@@ -403,5 +410,5 @@
         lang = QLocale::English;
     QByteArray rules;
-    bool ok = getNumerusInfo(lang, country, &rules, &m_numerusForms);
+    bool ok = getNumerusInfo(lang, country, &rules, &m_numerusForms, 0);
     m_localizedLanguage = QCoreApplication::translate("MessageEditor", QLocale::languageToString(lang).toAscii());
     m_countRefNeeds.clear();
Index: trunk/tools/linguist/linguist/messagemodel.h
===================================================================
--- trunk/tools/linguist/linguist/messagemodel.h	(revision 769)
+++ trunk/tools/linguist/linguist/messagemodel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrase.cpp
===================================================================
--- trunk/tools/linguist/linguist/phrase.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/phrase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -189,8 +189,7 @@
 {
     if (ferrorCount++ == 0) {
-        QString msg;
-        msg.sprintf("Parse error at line %d, column %d (%s).",
-            exception.lineNumber(), exception.columnNumber(),
-            exception.message().toLatin1().constData());
+        QString msg = PhraseBook::tr("Parse error at line %1, column %2 (%3).")
+            .arg(exception.lineNumber()).arg(exception.columnNumber())
+            .arg(exception.message());
         QMessageBox::information(0,
             QObject::tr("Qt Linguist"), msg);
Index: trunk/tools/linguist/linguist/phrase.h
===================================================================
--- trunk/tools/linguist/linguist/phrase.h	(revision 769)
+++ trunk/tools/linguist/linguist/phrase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrasebookbox.cpp
===================================================================
--- trunk/tools/linguist/linguist/phrasebookbox.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/phrasebookbox.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrasebookbox.h
===================================================================
--- trunk/tools/linguist/linguist/phrasebookbox.h	(revision 769)
+++ trunk/tools/linguist/linguist/phrasebookbox.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrasebookbox.ui
===================================================================
--- trunk/tools/linguist/linguist/phrasebookbox.ui	(revision 769)
+++ trunk/tools/linguist/linguist/phrasebookbox.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrasemodel.cpp
===================================================================
--- trunk/tools/linguist/linguist/phrasemodel.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/phrasemodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phrasemodel.h
===================================================================
--- trunk/tools/linguist/linguist/phrasemodel.h	(revision 769)
+++ trunk/tools/linguist/linguist/phrasemodel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phraseview.cpp
===================================================================
--- trunk/tools/linguist/linguist/phraseview.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/phraseview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/phraseview.h
===================================================================
--- trunk/tools/linguist/linguist/phraseview.h	(revision 769)
+++ trunk/tools/linguist/linguist/phraseview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/printout.cpp
===================================================================
--- trunk/tools/linguist/linguist/printout.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/printout.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -133,5 +133,5 @@
 }
 
-// use init if inital vsize should be calculated (first breakPage call)
+// use init if initial vsize should be calculated (first breakPage call)
 void PrintOut::breakPage(bool init)
 {
Index: trunk/tools/linguist/linguist/printout.h
===================================================================
--- trunk/tools/linguist/linguist/printout.h	(revision 769)
+++ trunk/tools/linguist/linguist/printout.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/recentfiles.cpp
===================================================================
--- trunk/tools/linguist/linguist/recentfiles.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/recentfiles.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/recentfiles.h
===================================================================
--- trunk/tools/linguist/linguist/recentfiles.h	(revision 769)
+++ trunk/tools/linguist/linguist/recentfiles.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/sourcecodeview.cpp
===================================================================
--- trunk/tools/linguist/linguist/sourcecodeview.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/sourcecodeview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,5 +65,5 @@
     setToolTip(fileName);
 
-    if (fileName.isNull()) {
+    if (fileName.isEmpty()) {
         clear();
         m_currentFileName.clear();
Index: trunk/tools/linguist/linguist/sourcecodeview.h
===================================================================
--- trunk/tools/linguist/linguist/sourcecodeview.h	(revision 769)
+++ trunk/tools/linguist/linguist/sourcecodeview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/statistics.cpp
===================================================================
--- trunk/tools/linguist/linguist/statistics.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/statistics.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/statistics.h
===================================================================
--- trunk/tools/linguist/linguist/statistics.h	(revision 769)
+++ trunk/tools/linguist/linguist/statistics.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/statistics.ui
===================================================================
--- trunk/tools/linguist/linguist/statistics.ui	(revision 769)
+++ trunk/tools/linguist/linguist/statistics.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/translatedialog.cpp
===================================================================
--- trunk/tools/linguist/linguist/translatedialog.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/translatedialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/translatedialog.h
===================================================================
--- trunk/tools/linguist/linguist/translatedialog.h	(revision 769)
+++ trunk/tools/linguist/linguist/translatedialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/translatedialog.ui
===================================================================
--- trunk/tools/linguist/linguist/translatedialog.ui	(revision 769)
+++ trunk/tools/linguist/linguist/translatedialog.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/translationsettingsdialog.cpp
===================================================================
--- trunk/tools/linguist/linguist/translationsettingsdialog.cpp	(revision 769)
+++ trunk/tools/linguist/linguist/translationsettingsdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/linguist/translationsettingsdialog.h
===================================================================
--- trunk/tools/linguist/linguist/translationsettingsdialog.h	(revision 769)
+++ trunk/tools/linguist/linguist/translationsettingsdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/lrelease/lrelease.pro
===================================================================
--- trunk/tools/linguist/lrelease/lrelease.pro	(revision 769)
+++ trunk/tools/linguist/lrelease/lrelease.pro	(revision 846)
@@ -17,4 +17,5 @@
 include(../shared/formats.pri)
 include(../shared/proparser.pri)
+include(../../shared/symbian/epocroot.pri)
 
 win32:LIBS += -ladvapi32   # for qsettings_win.cpp
Index: trunk/tools/linguist/lrelease/main.cpp
===================================================================
--- trunk/tools/linguist/lrelease/main.cpp	(revision 769)
+++ trunk/tools/linguist/lrelease/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,4 +56,6 @@
 #include <QtCore/QTextStream>
 
+#include <iostream>
+
 QT_USE_NAMESPACE
 
@@ -64,4 +66,15 @@
 #endif
         );
+
+struct LR {
+    static inline QString tr(const char *sourceText, const char *comment = 0)
+    {
+        return QCoreApplication::translate("LRelease", sourceText, comment);
+    }
+};
+#else
+class LR {
+    Q_DECLARE_TR_FUNCTIONS(LRelease)
+};
 #endif
 
@@ -74,5 +87,5 @@
 static void printUsage()
 {
-    printOut(QCoreApplication::tr(
+    printOut(LR::tr(
         "Usage:\n"
         "    lrelease [options] project-file\n"
@@ -107,5 +120,5 @@
     bool ok = tor.load(tsFileName, cd, QLatin1String("auto"));
     if (!ok) {
-        qWarning("lrelease error: %s\n", qPrintable(cd.error()));
+        std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error()));
     } else {
         if (!cd.errors().isEmpty())
@@ -122,8 +135,8 @@
 
     if (cd.isVerbose())
-        printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName));
+        printOut(LR::tr("Updating '%1'...\n").arg(qmFileName));
     if (removeIdentical) {
         if (cd.isVerbose())
-            printOut(QCoreApplication::tr( "Removing translations equal to source text in '%1'...\n").arg(qmFileName));
+            printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName));
         tor.stripIdenticalSourceTranslations();
     }
@@ -131,6 +144,6 @@
     QFile file(qmFileName);
     if (!file.open(QIODevice::WriteOnly)) {
-        qWarning("lrelease error: cannot create '%s': %s\n",
-                 qPrintable(qmFileName), qPrintable(file.errorString()));
+        std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n")
+                                .arg(qmFileName, file.errorString()));
         return false;
     }
@@ -141,6 +154,6 @@
 
     if (!ok) {
-        qWarning("lrelease error: cannot save '%s': %s\n",
-                 qPrintable(qmFileName), qPrintable(cd.error()));
+        std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2")
+                                .arg(qmFileName, cd.error()));
     } else if (!cd.errors().isEmpty()) {
         printOut(cd.error());
@@ -179,8 +192,16 @@
 #else
     QCoreApplication app(argc, argv);
+#ifndef Q_OS_WIN32
     QTranslator translator;
-    if (translator.load(QLatin1String("lrelease_") + QLocale::system().name()))
+    QTranslator qtTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
         app.installTranslator(&translator);
-#endif
+        app.installTranslator(&qtTranslator);
+    }
+#endif // Q_OS_WIN32
+#endif // QT_BOOTSTRAPPED
 
     ConversionData cd;
@@ -220,5 +241,5 @@
             continue;
         } else if (!strcmp(argv[i], "-version")) {
-            printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) );
+            printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)));
             return 0;
         } else if (!strcmp(argv[i], "-qm")) {
@@ -254,9 +275,13 @@
 
             if (!visitor.queryProFile(&pro)) {
-                qWarning("lrelease error: cannot read project file '%s'.", qPrintable(inputFile));
+                std::cerr << qPrintable(LR::tr(
+                          "lrelease error: cannot read project file '%1'.\n")
+                          .arg(inputFile));
                 continue;
             }
             if (!visitor.accept(&pro)) {
-                qWarning("lrelease error: cannot process project file '%s'.", qPrintable(inputFile));
+                std::cerr << qPrintable(LR::tr(
+                          "lrelease error: cannot process project file '%1'.\n")
+                          .arg(inputFile));
                 continue;
             }
@@ -264,7 +289,7 @@
             QStringList translations = visitor.values(QLatin1String("TRANSLATIONS"));
             if (translations.isEmpty()) {
-                qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in"
-                         " project file '%s'\n",
-                         qPrintable(inputFile));
+                std::cerr << qPrintable(LR::tr(
+                          "lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n")
+                          .arg(inputFile));
             } else {
                 QDir proDir(fi.absolutePath());
Index: trunk/tools/linguist/lupdate/cpp.cpp
===================================================================
--- trunk/tools/linguist/lupdate/cpp.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/cpp.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -51,8 +51,15 @@
 #include <QtCore/QTextCodec>
 #include <QtCore/QTextStream>
+#include <QtCore/QCoreApplication>
+
+#include <iostream>
 
 #include <ctype.h>              // for isXXX()
 
 QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 /* qmake ignore Q_OBJECT */
@@ -226,4 +233,6 @@
         int elseLine;
     };
+
+    std::ostream &yyMsg(int line = 0);
 
     uint getChar();
@@ -353,4 +362,10 @@
 }
 
+
+std::ostream &CppParser::yyMsg(int line)
+{
+    return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": ";
+}
+
 void CppParser::setInput(const QString &in)
 {
@@ -475,4 +490,5 @@
 STRING(friend);
 STRING(namespace);
+STRING(operator);
 STRING(qtTrId);
 STRING(return);
@@ -614,7 +630,7 @@
                                 || yyBraceDepth != is.braceDepth1st
                                 || yyParenDepth != is.parenDepth1st)
-                                qWarning("%s:%d: Parenthesis/bracket/brace mismatch between "
-                                         "#if and #else branches; using #if branch\n",
-                                         qPrintable(yyFileName), is.elseLine);
+                                yyMsg(is.elseLine)
+                                    << qPrintable(LU::tr("Parenthesis/bracket/brace mismatch between "
+                                                         "#if and #else branches; using #if branch\n"));
                         } else {
                             is.bracketDepth1st = yyBracketDepth;
@@ -637,7 +653,7 @@
                                 || yyBraceDepth != is.braceDepth1st
                                 || yyParenDepth != is.parenDepth1st)
-                                qWarning("%s:%d: Parenthesis/brace mismatch between "
-                                         "#if and #else branches; using #if branch\n",
-                                         qPrintable(yyFileName), is.elseLine);
+                                yyMsg(is.elseLine)
+                                    << qPrintable(LU::tr("Parenthesis/brace mismatch between "
+                                                         "#if and #else branches; using #if branch\n"));
                             yyBracketDepth = is.bracketDepth1st;
                             yyBraceDepth = is.braceDepth1st;
@@ -665,6 +681,5 @@
                             yyCh = getChar();
                             if (yyCh == EOF) {
-                                qWarning("%s:%d: Unterminated C++ comment\n",
-                                         qPrintable(yyFileName), yyLineNo);
+                                yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n"));
                                 break;
                             }
@@ -740,4 +755,18 @@
                     return Tok_namespace;
                 break;
+            case 'o':
+                if (yyWord == stroperator) {
+                    // Operator overload declaration/definition.
+                    // We need to prevent those characters from confusing the followup
+                    // parsing. Actually using them does not add value, so just eat them.
+                    while (isspace(yyCh))
+                       yyCh = getChar();
+                    while (yyCh == '+' || yyCh == '-' || yyCh == '*' || yyCh == '/' || yyCh == '%'
+                           || yyCh == '=' || yyCh == '<' || yyCh == '>' || yyCh == '!'
+                           || yyCh == '&' || yyCh == '|' || yyCh == '~' || yyCh == '^'
+                           || yyCh == '[' || yyCh == ']')
+                        yyCh = getChar();
+                }
+                break;
             case 'q':
                 if (yyWord == strqtTrId)
@@ -796,6 +825,5 @@
                         yyCh = getChar();
                         if (yyCh == EOF) {
-                            qWarning("%s:%d: Unterminated C++ comment\n",
-                                     qPrintable(yyFileName), yyLineNo);
+                            yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n"));
                             break;
                         }
@@ -830,6 +858,5 @@
 
                 if (yyCh != '"')
-                    qWarning("%s:%d: Unterminated C++ string\n",
-                              qPrintable(yyFileName), yyLineNo);
+                    yyMsg() << qPrintable(LU::tr("Unterminated C++ string\n"));
                 else
                     yyCh = getChar();
@@ -868,6 +895,5 @@
                 forever {
                     if (yyCh == EOF || yyCh == '\n') {
-                        qWarning("%s:%d: Unterminated C++ character\n",
-                                  qPrintable(yyFileName), yyLineNo);
+                        yyMsg() << "Unterminated C++ character\n";
                         break;
                     }
@@ -888,7 +914,7 @@
                 if (yyBraceDepth == yyMinBraceDepth) {
                     if (!inDefine)
-                        qWarning("%s:%d: Excess closing brace in C++ code"
-                                  " (or abuse of the C++ preprocessor)\n",
-                                  qPrintable(yyFileName), yyCurLineNo);
+                        yyMsg(yyCurLineNo)
+                            << qPrintable(LU::tr("Excess closing brace in C++ code"
+                                                 " (or abuse of the C++ preprocessor)\n"));
                     // Avoid things getting messed up even more
                     yyCh = getChar();
@@ -906,7 +932,7 @@
             case ')':
                 if (yyParenDepth == 0)
-                    qWarning("%s:%d: Excess closing parenthesis in C++ code"
-                             " (or abuse of the C++ preprocessor)\n",
-                             qPrintable(yyFileName), yyCurLineNo);
+                    yyMsg(yyCurLineNo)
+                        << qPrintable(LU::tr("Excess closing parenthesis in C++ code"
+                                             " (or abuse of the C++ preprocessor)\n"));
                 else
                     yyParenDepth--;
@@ -921,7 +947,7 @@
             case ']':
                 if (yyBracketDepth == 0)
-                    qWarning("%s:%d: Excess closing bracket in C++ code"
-                             " (or abuse of the C++ preprocessor)\n",
-                             qPrintable(yyFileName), yyCurLineNo);
+                    yyMsg(yyCurLineNo)
+                        << qPrintable(LU::tr("Excess closing bracket in C++ code"
+                                             " (or abuse of the C++ preprocessor)\n"));
                 else
                     yyBracketDepth--;
@@ -1291,6 +1317,5 @@
 
     if (inclusions.contains(cleanFile)) {
-        qWarning("%s:%d: circular inclusion of %s\n",
-                 qPrintable(yyFileName), yyLineNo, qPrintable(cleanFile));
+        yyMsg() << qPrintable(LU::tr("circular inclusion of %1\n").arg(cleanFile));
         return;
     }
@@ -1316,7 +1341,5 @@
     QFile f(cleanFile);
     if (!f.open(QIODevice::ReadOnly)) {
-        qWarning("%s:%d: Cannot open %s: %s\n",
-                 qPrintable(yyFileName), yyLineNo,
-                 qPrintable(cleanFile), qPrintable(f.errorString()));
+        yyMsg() << qPrintable(LU::tr("Cannot open %1: %2\n").arg(cleanFile, f.errorString()));
         return;
     }
@@ -1657,6 +1680,5 @@
                     NamespaceList nsl;
                     if (!fullyQualify(namespaces, quali, true, &nsl, 0)) {
-                        qWarning("%s:%d: Ignoring definition of undeclared qualified class\n",
-                                 qPrintable(yyFileName), yyLineNo);
+                        yyMsg() << "Ignoring definition of undeclared qualified class\n";
                         break;
                     }
@@ -1672,4 +1694,6 @@
                 prospectiveContext.clear();
                 pendingContext.clear();
+
+                yyTok = getToken();
             }
             break;
@@ -1685,4 +1709,9 @@
                     namespaceDepths.push(namespaces.count());
                     enterNamespace(&namespaces, ns);
+
+                    functionContext = namespaces;
+                    functionContextUnresolved.clear();
+                    prospectiveContext.clear();
+                    pendingContext.clear();
                     yyTok = getToken();
                 } else if (yyTok == Tok_Equals) {
@@ -1758,6 +1787,5 @@
                 goto case_default;
             if (!sourcetext.isEmpty())
-                qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n",
-                         qPrintable(yyFileName), yyLineNo);
+                yyMsg() << qPrintable(LU::tr("//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"));
             utf8 = (yyTok == Tok_trUtf8);
             line = yyLineNo;
@@ -1780,8 +1808,6 @@
                     if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) {
                         functionContextUnresolved = unresolved.join(strColons);
-                        qWarning("%s:%d: Qualifying with unknown namespace/class %s::%s\n",
-                                 qPrintable(yyFileName), yyLineNo,
-                                 qPrintable(stringifyNamespace(functionContext)),
-                                 qPrintable(unresolved.first()));
+                        yyMsg() << qPrintable(LU::tr("Qualifying with unknown namespace/class %1::%2\n")
+                                              .arg(stringifyNamespace(functionContext)).arg(unresolved.first()));
                     }
                     pendingContext.clear();
@@ -1791,6 +1817,5 @@
                         int idx = functionContext.length();
                         if (idx < 2) {
-                            qWarning("%s:%d: tr() cannot be called without context\n",
-                                     qPrintable(yyFileName), yyLineNo);
+                            yyMsg() << qPrintable(LU::tr("tr() cannot be called without context\n"));
                             break;
                         }
@@ -1801,7 +1826,6 @@
                                 fctx = findNamespace(functionContext)->classDef;
                                 if (!fctx->complained) {
-                                    qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n",
-                                             qPrintable(yyFileName), yyLineNo,
-                                             qPrintable(context));
+                                    yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n")
+                                                         .arg(context));
                                     fctx->complained = true;
                                 }
@@ -1831,7 +1855,6 @@
                     QString className = prefix.mid(last == -1 ? 0 : last + 2);
                     if (!className.isEmpty() && className == functionName) {
-                        qWarning("%s::%d: It is not recommended to call tr() from within a constructor '%s::%s' ",
-                                  qPrintable(yyFileName), yyLineNo,
-                                  className.constData(), functionName.constData());
+                        yyMsg() << qPrintable(LU::tr("It is not recommended to call tr() from within a constructor '%1::%2'\n")
+                                .arg(className).arg(functionName));
                     }
 #endif
@@ -1848,7 +1871,5 @@
                         }
                         if (!fctx->hasTrFunctions && !fctx->complained) {
-                            qWarning("%s:%d: Class '%s' lacks Q_OBJECT macro\n",
-                                     qPrintable(yyFileName), yyLineNo,
-                                     qPrintable(context));
+                            yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n").arg(context));
                             fctx->complained = true;
                         }
@@ -1862,4 +1883,5 @@
                 recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
             }
+            sourcetext.clear(); // Will have warned about that already
             extracomment.clear();
             msgid.clear();
@@ -1871,6 +1893,5 @@
                 goto case_default;
             if (!sourcetext.isEmpty())
-                qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n",
-                         qPrintable(yyFileName), yyLineNo);
+                yyMsg() << qPrintable(LU::tr("//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"));
             utf8 = (yyTok == Tok_translateUtf8);
             line = yyLineNo;
@@ -1918,4 +1939,5 @@
                 recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural);
             }
+            sourcetext.clear(); // Will have warned about that already
             extracomment.clear();
             msgid.clear();
@@ -1926,6 +1948,5 @@
                 goto case_default;
             if (!msgid.isEmpty())
-                qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n",
-                         qPrintable(yyFileName), yyLineNo);
+                yyMsg() << qPrintable(LU::tr("//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n"));
             //utf8 = false; // Maybe use //%% or something like that
             line = yyLineNo;
@@ -1994,6 +2015,5 @@
                         continue;
                     if (c != '"') {
-                        qWarning("%s:%d: Unexpected character in meta string\n",
-                                 qPrintable(yyFileName), yyLineNo);
+                        yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
                         break;
                     }
@@ -2001,6 +2021,5 @@
                         if (p >= yyWord.length()) {
                           whoops:
-                            qWarning("%s:%d: Unterminated meta string\n",
-                                     qPrintable(yyFileName), yyLineNo);
+                            yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
                             break;
                         }
@@ -2055,6 +2074,5 @@
             yyTok = getToken();
             if (yyTok == Tok_tr || yyTok == Tok_trUtf8)
-                qWarning("%s:%d: Cannot invoke tr() like this\n",
-                          qPrintable(yyFileName), yyLineNo);
+                yyMsg() << qPrintable(LU::tr("Cannot invoke tr() like this\n"));
             break;
         case Tok_ColonColon:
@@ -2088,7 +2106,11 @@
             prospectiveContext.clear();
             prefix.clear();
-            extracomment.clear();
-            msgid.clear();
-            extra.clear();
+            if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
+                yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
+                sourcetext.clear();
+                extracomment.clear();
+                msgid.clear();
+                extra.clear();
+            }
             yyTokColonSeen = false;
             yyTok = getToken();
@@ -2124,15 +2146,15 @@
 
     if (yyBraceDepth != 0)
-        qWarning("%s:%d: Unbalanced opening brace in C++ code"
-                  " (or abuse of the C++ preprocessor)\n",
-                  qPrintable(yyFileName), yyBraceLineNo);
+        yyMsg(yyBraceLineNo)
+            << qPrintable(LU::tr("Unbalanced opening brace in C++ code"
+                                 " (or abuse of the C++ preprocessor)\n"));
     else if (yyParenDepth != 0)
-        qWarning("%s:%d: Unbalanced opening parenthesis in C++ code"
-                 " (or abuse of the C++ preprocessor)\n",
-                 qPrintable(yyFileName), yyParenLineNo);
+        yyMsg(yyParenLineNo)
+            << qPrintable(LU::tr("Unbalanced opening parenthesis in C++ code"
+                                 " (or abuse of the C++ preprocessor)\n"));
     else if (yyBracketDepth != 0)
-        qWarning("%s:%d: Unbalanced opening bracket in C++ code"
-                 " (or abuse of the C++ preprocessor)\n",
-                 qPrintable(yyFileName), yyBracketLineNo);
+        yyMsg(yyBracketLineNo)
+            << qPrintable(LU::tr("Unbalanced opening bracket in C++ code"
+                                 " (or abuse of the C++ preprocessor)\n"));
 }
 
@@ -2195,6 +2217,5 @@
         QFile file(filename);
         if (!file.open(QIODevice::ReadOnly)) {
-            cd.appendError(QString::fromLatin1("Cannot open %1: %2")
-                .arg(filename, file.errorString()));
+            cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
             continue;
         }
Index: trunk/tools/linguist/lupdate/java.cpp
===================================================================
--- trunk/tools/linguist/lupdate/java.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/java.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -51,8 +51,15 @@
 #include <QtCore/QString>
 #include <QtCore/QTextCodec>
+#include <QtCore/QCoreApplication>
+
+#include <iostream>
 
 #include <ctype.h>
 
 QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 enum { Tok_Eof, Tok_class, Tok_return, Tok_tr,
@@ -107,4 +114,9 @@
 static QStack<Scope*> yyScope;
 static QString yyDefaultContext;
+
+std::ostream &yyMsg(int line = 0)
+{
+    return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": ";
+}
 
 static QChar getChar()
@@ -190,8 +202,5 @@
                         yyCh = getChar();
                         if ( yyCh == EOF ) {
-                            qFatal( "%s: Unterminated Java comment starting at"
-                                    " line %d\n",
-                                    qPrintable(yyFileName), yyLineNo );
-
+                            yyMsg() << qPrintable(LU::tr("Unterminated Java comment.\n"));
                             return Tok_Comment;
                         }
@@ -229,6 +238,6 @@
                                     int sub(yyCh.toLower().toAscii() - 87);
                                     if( sub > 15 || sub < 10) {
-                                        qFatal( "%s:%d: Invalid Unicode",
-                                            qPrintable(yyFileName), yyLineNo );
+                                        yyMsg() << qPrintable(LU::tr("Invalid Unicode value.\n"));
+                                        break;
                                     }
                                     unicode += sub;
@@ -252,6 +261,5 @@
 
                 if ( yyCh != QLatin1Char('"') )
-                    qFatal( "%s:%d: Unterminated string",
-                        qPrintable(yyFileName), yyLineNo );
+                    yyMsg() << qPrintable(LU::tr("Unterminated string.\n"));
 
                 yyCh = getChar();
@@ -366,7 +374,7 @@
             s += yyString;
         else {
-            qWarning( "%s:%d: String used in translation can only contain strings"
-                " concatenated with other strings, not expressions or numbers.",
-                qPrintable(yyFileName), yyLineNo );
+            yyMsg() << qPrintable(LU::tr(
+                "String used in translation can contain only literals"
+                " concatenated with other literals, not expressions or numbers.\n"));
             return false;
         }
@@ -476,6 +484,6 @@
             }
             else {
-                qFatal( "%s:%d: Class must be followed by a classname",
-                                          qPrintable(yyFileName), yyLineNo );
+                yyMsg() << qPrintable(LU::tr("'class' must be followed by a class name.\n"));
+                break;
             }
             while (!match(Tok_LeftBrace)) {
@@ -548,6 +556,5 @@
         case Tok_RightBrace:
             if ( yyScope.isEmpty() ) {
-                qFatal( "%s:%d: Unbalanced right brace in Java code\n",
-                        qPrintable(yyFileName), yyLineNo );
+                yyMsg() << qPrintable(LU::tr("Excess closing brace.\n"));
             }
             else
@@ -578,6 +585,5 @@
                         break;
                     default:
-                         qFatal( "%s:%d: Package keyword should be followed by com.package.name;",
-                                          qPrintable(yyFileName), yyLineNo );
+                         yyMsg() << qPrintable(LU::tr("'package' must be followed by package name.\n"));
                          break;
                 }
@@ -592,9 +598,7 @@
 
     if ( !yyScope.isEmpty() )
-        qFatal( "%s:%d: Unbalanced braces in Java code\n",
-                 qPrintable(yyFileName), yyScope.top()->line );
+        yyMsg(yyScope.top()->line) << qPrintable(LU::tr("Unbalanced opening brace.\n"));
     else if ( yyParenDepth != 0 )
-        qFatal( "%s:%d: Unbalanced parentheses in Java code\n",
-                 qPrintable(yyFileName), yyParenLineNo );
+        yyMsg(yyParenLineNo) << qPrintable(LU::tr("Unbalanced opening parenthesis.\n"));
 }
 
@@ -604,6 +608,5 @@
     QFile file(filename);
     if (!file.open(QIODevice::ReadOnly)) {
-        cd.appendError(QString::fromLatin1("Cannot open %1: %2")
-            .arg(filename, file.errorString()));
+        cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
         return false;
     }
Index: trunk/tools/linguist/lupdate/lupdate.h
===================================================================
--- trunk/tools/linguist/lupdate/lupdate.h	(revision 769)
+++ trunk/tools/linguist/lupdate/lupdate.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -80,4 +80,5 @@
 bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd);
 bool loadUI(Translator &translator, const QString &filename, ConversionData &cd);
+bool loadQml(Translator &translator, const QString &filename, ConversionData &cd);
 
 QT_END_NAMESPACE
Index: trunk/tools/linguist/lupdate/lupdate.pro
===================================================================
--- trunk/tools/linguist/lupdate/lupdate.pro	(revision 769)
+++ trunk/tools/linguist/lupdate/lupdate.pro	(revision 846)
@@ -16,4 +16,7 @@
 include(../shared/proparser.pri)
 
+include($$QT_SOURCE_TREE/src/declarative/qml/parser/parser.pri)
+INCLUDEPATH += $$QT_SOURCE_TREE/src/declarative/qml $$QT_BUILD_TREE/include/QtDeclarative
+
 SOURCES += \
     main.cpp \
@@ -24,4 +27,5 @@
     java.cpp \
     qscript.cpp \
+    qdeclarative.cpp \
     ui.cpp
 
Index: trunk/tools/linguist/lupdate/main.cpp
===================================================================
--- trunk/tools/linguist/lupdate/main.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -53,4 +53,6 @@
 #include <QtCore/QStringList>
 #include <QtCore/QTextCodec>
+#include <QtCore/QTranslator>
+#include <QtCore/QLibraryInfo>
 
 #include <iostream>
@@ -58,13 +60,12 @@
 static QString m_defaultExtensions;
 
-static void printErr(const QString & out)
-{
-    qWarning("%s", qPrintable(out));
-}
-
 static void printOut(const QString & out)
 {
     std::cerr << qPrintable(out);
 }
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 static void recursiveFileInfoList(const QDir &dir,
@@ -81,8 +82,8 @@
 static void printUsage()
 {
-    printOut(QObject::tr(
+    printOut(LU::tr(
         "Usage:\n"
         "    lupdate [options] [project-file]...\n"
-        "    lupdate [options] [source-file|path]... -ts ts-files\n\n"
+        "    lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file\n\n"
         "lupdate is part of Qt's Linguist tool chain. It extracts translatable\n"
         "messages from Qt UI files, C++, Java and JavaScript/QtScript source code.\n"
@@ -133,4 +134,6 @@
         "    -version\n"
         "           Display the version of lupdate and exit.\n"
+        "    @lst-file\n"
+        "           Read additional file names (one per line) from lst-file.\n"
     ).arg(m_defaultExtensions));
 }
@@ -149,5 +152,5 @@
         if (QFile(fileName).exists()) {
             if (!tor.load(fileName, cd, QLatin1String("auto"))) {
-                printErr(cd.error());
+                printOut(cd.error());
                 *fail = true;
                 continue;
@@ -156,15 +159,16 @@
             cd.clearErrors();
             if (setCodec && fetchedTor.codec() != tor.codec())
-                qWarning("lupdate warning: Codec for tr() '%s' disagrees with "
-                         "existing file's codec '%s'. Expect trouble.",
-                         fetchedTor.codecName().constData(), tor.codecName().constData());
+                printOut(LU::tr("lupdate warning: Codec for tr() '%1' disagrees with"
+                                " existing file's codec '%2'. Expect trouble.\n")
+                         .arg(QString::fromLatin1(fetchedTor.codecName()),
+                              QString::fromLatin1(tor.codecName())));
             if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode())
-                qWarning("lupdate warning: Specified target language '%s' disagrees with "
-                         "existing file's language '%s'. Ignoring.",
-                         qPrintable(targetLanguage), qPrintable(tor.languageCode()));
+                printOut(LU::tr("lupdate warning: Specified target language '%1' disagrees with"
+                                " existing file's language '%2'. Ignoring.\n")
+                         .arg(targetLanguage, tor.languageCode()));
             if (!sourceLanguage.isEmpty() && sourceLanguage != tor.sourceLanguageCode())
-                qWarning("lupdate warning: Specified source language '%s' disagrees with "
-                         "existing file's language '%s'. Ignoring.",
-                         qPrintable(sourceLanguage), qPrintable(tor.sourceLanguageCode()));
+                printOut(LU::tr("lupdate warning: Specified source language '%1' disagrees with"
+                                " existing file's language '%2'. Ignoring.\n")
+                         .arg(sourceLanguage, tor.sourceLanguageCode()));
         } else {
             if (setCodec)
@@ -185,5 +189,5 @@
             tor.setLocationsType(Translator::AbsoluteLocations);
         if (options & Verbose)
-            printOut(QObject::tr("Updating '%1'...\n").arg(fn));
+            printOut(LU::tr("Updating '%1'...\n").arg(fn));
 
         UpdateOptions theseOptions = options;
@@ -200,5 +204,5 @@
         if (options & PluralOnly) {
             if (options & Verbose)
-                printOut(QObject::tr("Stripping non plural forms in '%1'...\n").arg(fn));
+                printOut(LU::tr("Stripping non plural forms in '%1'...\n").arg(fn));
             out.stripNonPluralForms();
         }
@@ -209,9 +213,9 @@
         out.normalizeTranslations(cd);
         if (!cd.errors().isEmpty()) {
-            printErr(cd.error());
+            printOut(cd.error());
             cd.clearErrors();
         }
         if (!out.save(fileName, cd, QLatin1String("auto"))) {
-            printErr(cd.error());
+            printOut(cd.error());
             *fail = true;
         }
@@ -268,4 +272,6 @@
                  || it->endsWith(QLatin1String(".qs"), Qt::CaseInsensitive))
             loadQScript(fetchedTor, *it, cd);
+        else if (it->endsWith(QLatin1String(".qml"), Qt::CaseInsensitive))
+            loadQml(fetchedTor, *it, cd);
         else
             sourceFilesCpp << *it;
@@ -293,6 +299,7 @@
         codecForSource = tmp.last().toLatin1();
         if (!QTextCodec::codecForName(codecForSource)) {
-            qWarning("lupdate warning: Codec for source '%s' is invalid. "
-                     "Falling back to codec for tr().", codecForSource.constData());
+            printOut(LU::tr("lupdate warning: Codec for source '%1' is invalid."
+                            " Falling back to codec for tr().\n")
+                     .arg(QString::fromLatin1(codecForSource)));
             codecForSource.clear();
         }
@@ -344,4 +351,8 @@
         visitor.setVerbose(options & Verbose);
 
+        QHash<QString, QStringList> lupdateConfig;
+        lupdateConfig.insert(QLatin1String("CONFIG"), QStringList(QLatin1String("lupdate_run")));
+        visitor.addVariables(lupdateConfig);
+
         QFileInfo pfi(proFile);
         ProFile pro(pfi.absoluteFilePath());
@@ -355,10 +366,10 @@
             if (parentTor) {
                 if (topLevel) {
-                    std::cerr << "lupdate warning: TS files from command line "
-                            "will override TRANSLATIONS in " << qPrintable(proFile) << ".\n";
+                    std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line "
+                                                   "will override TRANSLATIONS in %1.\n").arg(proFile));
                     goto noTrans;
                 } else if (nestComplain) {
-                    std::cerr << "lupdate warning: TS files from command line "
-                            "prevent recursing into " << qPrintable(proFile) << ".\n";
+                    std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line "
+                                                   "prevent recursing into %1.\n").arg(proFile));
                     continue;
                 }
@@ -391,6 +402,6 @@
         if (!parentTor) {
             if (topLevel)
-                std::cerr << "lupdate warning: no TS files specified. Only diagnostics "
-                        "will be produced for '" << qPrintable(proFile) << "'.\n";
+                std::cerr << qPrintable(LU::tr("lupdate warning: no TS files specified. Only diagnostics "
+                                               "will be produced for '%1'.\n").arg(proFile));
             Translator tor;
             processProject(nestComplain, pfi, visitor, options, codecForSource,
@@ -406,5 +417,17 @@
 {
     QCoreApplication app(argc, argv);
-    m_defaultExtensions = QLatin1String("ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx");
+#ifndef Q_OS_WIN32
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+    }
+#endif // Q_OS_WIN32
+
+    m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml");
 
     QStringList args = app.arguments();
@@ -449,5 +472,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The option -target-language requires a parameter.");
+                printOut(LU::tr("The option -target-language requires a parameter.\n"));
                 return 1;
             }
@@ -457,5 +480,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The option -source-language requires a parameter.");
+                printOut(LU::tr("The option -source-language requires a parameter.\n"));
                 return 1;
             }
@@ -465,5 +488,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The option -disable-heuristic requires a parameter.");
+                printOut(LU::tr("The option -disable-heuristic requires a parameter.\n"));
                 return 1;
             }
@@ -476,5 +499,5 @@
                 options &= ~HeuristicNumber;
             } else {
-                qWarning("Invalid heuristic name passed to -disable-heuristic.");
+                printOut(LU::tr("Invalid heuristic name passed to -disable-heuristic.\n"));
                 return 1;
             }
@@ -483,5 +506,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The option -locations requires a parameter.");
+                printOut(LU::tr("The option -locations requires a parameter.\n"));
                 return 1;
             }
@@ -493,5 +516,5 @@
                 options |= AbsoluteLocations;
             } else {
-                qWarning("Invalid parameter passed to -locations.");
+                printOut(LU::tr("Invalid parameter passed to -locations.\n"));
                 return 1;
             }
@@ -519,5 +542,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The -codecfortr option should be followed by a codec name.");
+                printOut(LU::tr("The -codecfortr option should be followed by a codec name.\n"));
                 return 1;
             }
@@ -530,5 +553,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The -extensions option should be followed by an extension list.");
+                printOut(LU::tr("The -extensions option should be followed by an extension list.\n"));
                 return 1;
             }
@@ -538,5 +561,5 @@
             ++i;
             if (i == argc) {
-                qWarning("The -pro option should be followed by a filename of .pro file.");
+                printOut(LU::tr("The -pro option should be followed by a filename of .pro file.\n"));
                 return 1;
             }
@@ -548,5 +571,5 @@
                 ++i;
                 if (i == argc) {
-                    qWarning("The -I option should be followed by a path.");
+                    printOut(LU::tr("The -I option should be followed by a path.\n"));
                     return 1;
                 }
@@ -557,75 +580,96 @@
             continue;
         } else if (arg.startsWith(QLatin1String("-")) && arg != QLatin1String("-")) {
-            qWarning("Unrecognized option '%s'", qPrintable(arg));
+            printOut(LU::tr("Unrecognized option '%1'.\n").arg(arg));
             return 1;
         }
 
+        QStringList files;
+        if (arg.startsWith(QLatin1String("@"))) {
+            QFile lstFile(arg.mid(1));
+            if (!lstFile.open(QIODevice::ReadOnly)) {
+                printOut(LU::tr("lupdate error: List file '%1' is not readable.\n")
+                         .arg(lstFile.fileName()));
+                return 1;
+            }
+            while (!lstFile.atEnd())
+                files << QString::fromLocal8Bit(lstFile.readLine().trimmed());
+        } else {
+            files << arg;
+        }
         if (metTsFlag) {
-            bool found = false;
-            foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) {
-                if (arg.endsWith(QLatin1Char('.') + fmt.extension, Qt::CaseInsensitive)) {
-                    QFileInfo fi(arg);
-                    if (!fi.exists() || fi.isWritable()) {
-                        tsFileNames.append(QFileInfo(arg).absoluteFilePath());
-                    } else {
-                        qWarning("lupdate warning: For some reason, '%s' is not writable.\n",
-                                qPrintable(arg));
+            foreach (const QString &file, files) {
+                bool found = false;
+                foreach (const Translator::FileFormat &fmt, Translator::registeredFileFormats()) {
+                    if (file.endsWith(QLatin1Char('.') + fmt.extension, Qt::CaseInsensitive)) {
+                        QFileInfo fi(file);
+                        if (!fi.exists() || fi.isWritable()) {
+                            tsFileNames.append(QFileInfo(file).absoluteFilePath());
+                        } else {
+                            printOut(LU::tr("lupdate warning: For some reason, '%1' is not writable.\n")
+                                     .arg(file));
+                        }
+                        found = true;
+                        break;
                     }
-                    found = true;
-                    break;
                 }
-            }
-            if (!found) {
-                qWarning("lupdate error: File '%s' has no recognized extension\n",
-                         qPrintable(arg));
-                return 1;
-            }
-        } else if (arg.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive)
-                || arg.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) {
-            proFiles << arg;
+                if (!found) {
+                    printOut(LU::tr("lupdate error: File '%1' has no recognized extension.\n")
+                             .arg(file));
+                    return 1;
+                }
+            }
             numFiles++;
         } else {
-            QFileInfo fi(arg);
-            if (!fi.exists()) {
-                qWarning("lupdate error: File '%s' does not exists\n", qPrintable(arg));
-                return 1;
-            } else if (fi.isDir()) {
-                if (options & Verbose)
-                    printOut(QObject::tr("Scanning directory '%1'...").arg(arg));
-                QDir dir = QDir(fi.filePath());
-                projectRoots.insert(dir.absolutePath() + QLatin1Char('/'));
-                if (extensionsNameFilters.isEmpty()) {
-                    foreach (QString ext, extensions.split(QLatin1Char(','))) {
-                        ext = ext.trimmed();
-                        if (ext.startsWith(QLatin1Char('.')))
-                            ext.remove(0, 1);
-                        extensionsNameFilters.insert(ext);
+            foreach (const QString &file, files) {
+                QFileInfo fi(file);
+                if (!fi.exists()) {
+                    printOut(LU::tr("lupdate error: File '%1' does not exist.\n").arg(file));
+                    return 1;
+                }
+                if (file.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive)
+                    || file.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) {
+                    proFiles << file;
+                } else if (fi.isDir()) {
+                    if (options & Verbose)
+                        printOut(LU::tr("Scanning directory '%1'...\n").arg(file));
+                    QDir dir = QDir(fi.filePath());
+                    projectRoots.insert(dir.absolutePath() + QLatin1Char('/'));
+                    if (extensionsNameFilters.isEmpty()) {
+                        foreach (QString ext, extensions.split(QLatin1Char(','))) {
+                            ext = ext.trimmed();
+                            if (ext.startsWith(QLatin1Char('.')))
+                                ext.remove(0, 1);
+                            extensionsNameFilters.insert(ext);
+                        }
                     }
+                    QDir::Filters filters = QDir::Files | QDir::NoSymLinks;
+                    if (recursiveScan)
+                        filters |= QDir::AllDirs | QDir::NoDotAndDotDot;
+                    QFileInfoList fileinfolist;
+                    recursiveFileInfoList(dir, extensionsNameFilters, filters, &fileinfolist);
+                    int scanRootLen = dir.absolutePath().length();
+                    foreach (const QFileInfo &fi, fileinfolist) {
+                        QString fn = QDir::cleanPath(fi.absoluteFilePath());
+                        sourceFiles << fn;
+
+                        if (!fn.endsWith(QLatin1String(".java"))
+                            && !fn.endsWith(QLatin1String(".jui"))
+                            && !fn.endsWith(QLatin1String(".ui"))
+                            && !fn.endsWith(QLatin1String(".js"))
+                            && !fn.endsWith(QLatin1String(".qs"))
+                            && !fn.endsWith(QLatin1String(".qml"))) {
+                            int offset = 0;
+                            int depth = 0;
+                            do {
+                                offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1);
+                                QString ffn = fn.mid(offset + 1);
+                                allCSources.insert(ffn, fn);
+                            } while (++depth < 3 && offset > scanRootLen);
+                        }
+                    }
+                } else {
+                    sourceFiles << QDir::cleanPath(fi.absoluteFilePath());;
+                    projectRoots.insert(fi.absolutePath() + QLatin1Char('/'));
                 }
-                QDir::Filters filters = QDir::Files | QDir::NoSymLinks;
-                if (recursiveScan)
-                    filters |= QDir::AllDirs | QDir::NoDotAndDotDot;
-                QFileInfoList fileinfolist;
-                recursiveFileInfoList(dir, extensionsNameFilters, filters, &fileinfolist);
-                int scanRootLen = dir.absolutePath().length();
-                foreach (const QFileInfo &fi, fileinfolist) {
-                    QString fn = QDir::cleanPath(fi.absoluteFilePath());
-                    sourceFiles << fn;
-
-                    if (!fn.endsWith(QLatin1String(".java"))
-                        && !fn.endsWith(QLatin1String(".ui"))
-                        && !fn.endsWith(QLatin1String(".js"))
-                        && !fn.endsWith(QLatin1String(".qs"))) {
-                        int offset = 0;
-                        int depth = 0;
-                        do {
-                            offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1);
-                            QString ffn = fn.mid(offset + 1);
-                            allCSources.insert(ffn, fn);
-                        } while (++depth < 3 && offset > scanRootLen);
-                    }
-                }
-            } else {
-                sourceFiles << QDir::cleanPath(fi.absoluteFilePath());;
             }
             numFiles++;
@@ -639,14 +683,14 @@
 
     if (!targetLanguage.isEmpty() && tsFileNames.count() != 1)
-        std::cerr << "lupdate warning: -target-language usually only "
-                     "makes sense with exactly one TS file.\n";
+        printOut(LU::tr("lupdate warning: -target-language usually only"
+                        " makes sense with exactly one TS file.\n"));
     if (!codecForTr.isEmpty() && tsFileNames.isEmpty())
-        std::cerr << "lupdate warning: -codecfortr has no effect without -ts.\n";
+        printOut(LU::tr("lupdate warning: -codecfortr has no effect without -ts.\n"));
 
     bool fail = false;
     if (proFiles.isEmpty()) {
         if (tsFileNames.isEmpty())
-            std::cerr << "lupdate warning: no TS files specified. "
-                         "Only diagnostics will be produced.\n";
+            printOut(LU::tr("lupdate warning:"
+                            " no TS files specified. Only diagnostics will be produced.\n"));
 
         Translator fetchedTor;
@@ -662,5 +706,6 @@
     } else {
         if (!sourceFiles.isEmpty() || !includePath.isEmpty()) {
-            qWarning("lupdate error: Both project and source files / include paths specified.\n");
+            printOut(LU::tr("lupdate error:"
+                            " Both project and source files / include paths specified.\n"));
             return 1;
         }
Index: trunk/tools/linguist/lupdate/merge.cpp
===================================================================
--- trunk/tools/linguist/lupdate/merge.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/merge.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,4 +45,5 @@
 #include "translator.h"
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QDebug>
 #include <QtCore/QMap>
@@ -51,6 +52,9 @@
 #include <QtCore/QVector>
 
-
 QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 static bool isDigitFriendly(QChar c)
@@ -486,22 +490,22 @@
     if (options & Verbose) {
         int totalFound = neww + known;
-        err += QObject::tr("    Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known);
+        err += LU::tr("    Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known);
 
         if (obsoleted) {
             if (options & NoObsolete) {
-                err += QObject::tr("    Removed %n obsolete entries\n", 0, obsoleted);
+                err += LU::tr("    Removed %n obsolete entries\n", 0, obsoleted);
             } else {
-                err += QObject::tr("    Kept %n obsolete entries\n", 0, obsoleted);
+                err += LU::tr("    Kept %n obsolete entries\n", 0, obsoleted);
             }
         }
 
         if (sameNumberHeuristicCount)
-            err += QObject::tr("    Number heuristic provided %n translation(s)\n",
+            err += LU::tr("    Number heuristic provided %n translation(s)\n",
                       0, sameNumberHeuristicCount);
         if (sameTextHeuristicCount)
-            err += QObject::tr("    Same-text heuristic provided %n translation(s)\n",
+            err += LU::tr("    Same-text heuristic provided %n translation(s)\n",
                       0, sameTextHeuristicCount);
         if (similarTextHeuristicCount)
-            err += QObject::tr("    Similar-text heuristic provided %n translation(s)\n",
+            err += LU::tr("    Similar-text heuristic provided %n translation(s)\n",
                       0, similarTextHeuristicCount);
     }
Index: trunk/tools/linguist/lupdate/qdeclarative.cpp
===================================================================
--- trunk/tools/linguist/lupdate/qdeclarative.cpp	(revision 846)
+++ trunk/tools/linguist/lupdate/qdeclarative.cpp	(revision 846)
@@ -0,0 +1,432 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Linguist of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "lupdate.h"
+
+#include <translator.h>
+
+#include <QtCore/QDebug>
+#include <QtCore/QFile>
+#include <QtCore/QString>
+
+#include "parser/qdeclarativejsengine_p.h"
+#include "parser/qdeclarativejsparser_p.h"
+#include "parser/qdeclarativejslexer_p.h"
+#include "parser/qdeclarativejsnodepool_p.h"
+#include "parser/qdeclarativejsastvisitor_p.h"
+#include "parser/qdeclarativejsast_p.h"
+
+#include <QCoreApplication>
+#include <QFile>
+#include <QFileInfo>
+#include <QtDebug>
+#include <QStringList>
+
+#include <iostream>
+#include <cstdlib>
+
+QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
+using namespace QDeclarativeJS;
+
+class Comment
+{
+public:
+    Comment() : lastLine(-1) {}
+    QString extracomment;
+    QString msgid;
+    TranslatorMessage::ExtraData extra;
+    QString sourcetext;
+    int lastLine;
+
+    bool isValid() const
+    { return !extracomment.isEmpty() || !msgid.isEmpty() || !sourcetext.isEmpty() || !extra.isEmpty(); }
+};
+
+class FindTrCalls: protected AST::Visitor
+{
+public:
+    void operator()(Translator *translator, const QString &fileName, AST::Node *node)
+    {
+        m_translator = translator;
+        m_fileName = fileName;
+        m_component = QFileInfo(fileName).baseName();   //matches qsTr usage in QScriptEngine
+        accept(node);
+    }
+
+    QList<Comment> comments;
+
+protected:
+    using AST::Visitor::visit;
+    using AST::Visitor::endVisit;
+
+    void accept(AST::Node *node)
+    { AST::Node::acceptChild(node, this); }
+
+    virtual void endVisit(AST::CallExpression *node)
+    {
+        m_bSource.clear();
+        if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(node->base)) {
+            if (idExpr->name->asString() == QLatin1String("qsTr") ||
+                idExpr->name->asString() == QLatin1String("QT_TR_NOOP")) {
+                if (!node->arguments)
+                    return;
+                AST::BinaryExpression *binary = AST::cast<AST::BinaryExpression *>(node->arguments->expression);
+                if (binary) {
+                    if (!createString(binary))
+                        m_bSource.clear();
+                }
+                AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression);
+                if (literal || !m_bSource.isEmpty()) {
+                    const QString source = literal ? literal->value->asString() : m_bSource;
+
+                    QString comment;
+                    bool plural = false;
+                    AST::ArgumentList *commentNode = node->arguments->next;
+                    if (commentNode && AST::cast<AST::StringLiteral *>(commentNode->expression)) {
+                        literal = AST::cast<AST::StringLiteral *>(commentNode->expression);
+                        comment = literal->value->asString();
+
+                        AST::ArgumentList *nNode = commentNode->next;
+                        if (nNode)
+                            plural = true;
+                    }
+
+                    QString id;
+                    QString extracomment;
+                    TranslatorMessage::ExtraData extra;
+                    Comment scomment = findComment(node->firstSourceLocation().startLine);
+                    if (scomment.isValid()) {
+                        extracomment = scomment.extracomment;
+                        extra = scomment.extra;
+                        id = scomment.msgid;
+                    }
+
+                    TranslatorMessage msg(m_component, source,
+                        comment, QString(), m_fileName,
+                        node->firstSourceLocation().startLine, QStringList(),
+                        TranslatorMessage::Unfinished, plural);
+                    msg.setExtraComment(extracomment.simplified());
+                    msg.setId(id);
+                    msg.setExtras(extra);
+                    m_translator->extend(msg);
+                }
+            } else if (idExpr->name->asString() == QLatin1String("qsTranslate") ||
+                       idExpr->name->asString() == QLatin1String("QT_TRANSLATE_NOOP")) {
+                if (node->arguments && AST::cast<AST::StringLiteral *>(node->arguments->expression)) {
+                    AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression);
+                    const QString context = literal->value->asString();
+
+                    QString source;
+                    QString comment;
+                    bool plural = false;
+                    AST::ArgumentList *sourceNode = node->arguments->next;
+                    if (!sourceNode)
+                        return;
+                    literal = AST::cast<AST::StringLiteral *>(sourceNode->expression);
+                    AST::BinaryExpression *binary = AST::cast<AST::BinaryExpression *>(sourceNode->expression);
+                    if (binary) {
+                        if (!createString(binary))
+                            m_bSource.clear();
+                    }
+                    if (!literal && m_bSource.isEmpty())
+                        return;
+
+                    QString id;
+                    QString extracomment;
+                    TranslatorMessage::ExtraData extra;
+                    Comment scomment = findComment(node->firstSourceLocation().startLine);
+                    if (scomment.isValid()) {
+                        extracomment = scomment.extracomment;
+                        extra = scomment.extra;
+                        id = scomment.msgid;
+                    }
+
+                    source = literal ? literal->value->asString() : m_bSource;
+                    AST::ArgumentList *commentNode = sourceNode->next;
+                    if (commentNode && AST::cast<AST::StringLiteral *>(commentNode->expression)) {
+                        literal = AST::cast<AST::StringLiteral *>(commentNode->expression);
+                        comment = literal->value->asString();
+
+                        AST::ArgumentList *nNode = commentNode->next;
+                        if (nNode)
+                            plural = true;
+                    }
+
+                    TranslatorMessage msg(context, source,
+                        comment, QString(), m_fileName,
+                        node->firstSourceLocation().startLine, QStringList(),
+                        TranslatorMessage::Unfinished, plural);
+                    msg.setExtraComment(extracomment.simplified());
+                    msg.setId(id);
+                    msg.setExtras(extra);
+                    m_translator->extend(msg);
+                }
+            } else if (idExpr->name->asString() == QLatin1String("qsTrId") ||
+                       idExpr->name->asString() == QLatin1String("QT_TRID_NOOP")) {
+                if (!node->arguments)
+                    return;
+
+                AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression);
+                if (literal) {
+
+                    QString extracomment;
+                    QString sourcetext;
+                    TranslatorMessage::ExtraData extra;
+                    Comment comment = findComment(node->firstSourceLocation().startLine);
+                    if (comment.isValid()) {
+                        extracomment = comment.extracomment;
+                        sourcetext = comment.sourcetext;
+                        extra = comment.extra;
+                    }
+
+                    const QString id = literal->value->asString();
+                    bool plural = node->arguments->next;
+
+                    TranslatorMessage msg(QString(), sourcetext,
+                        QString(), QString(), m_fileName,
+                        node->firstSourceLocation().startLine, QStringList(),
+                        TranslatorMessage::Unfinished, plural);
+                    msg.setExtraComment(extracomment.simplified());
+                    msg.setId(id);
+                    msg.setExtras(extra);
+                    m_translator->extend(msg);
+                }
+            }
+        }
+    }
+
+private:
+    bool createString(AST::BinaryExpression *b)
+    {
+        if (!b || b->op != 0)
+            return false;
+        AST::BinaryExpression *l = AST::cast<AST::BinaryExpression *>(b->left);
+        AST::BinaryExpression *r = AST::cast<AST::BinaryExpression *>(b->right);
+        AST::StringLiteral *ls = AST::cast<AST::StringLiteral *>(b->left);
+        AST::StringLiteral *rs = AST::cast<AST::StringLiteral *>(b->right);
+        if ((!l && !ls) || (!r && !rs))
+            return false;
+        if (l) {
+            if (!createString(l))
+                return false;
+        } else
+            m_bSource.prepend(ls->value->asString());
+
+        if (r) {
+            if (!createString(r))
+                return false;
+        } else
+            m_bSource.append(rs->value->asString());
+
+        return true;
+    }
+
+    Comment findComment(int loc)
+    {
+        if (comments.isEmpty())
+            return Comment();
+
+        int i = 0;
+        int commentLoc = comments.at(i).lastLine;
+        while (commentLoc <= loc) {
+            if (commentLoc == loc)
+                return comments.at(i);
+            if (i == comments.count()-1)
+                break;
+            commentLoc = comments.at(++i).lastLine;
+        }
+        return Comment();
+    }
+
+    Translator *m_translator;
+    QString m_fileName;
+    QString m_component;
+    QString m_bSource;
+};
+
+QString createErrorString(const QString &filename, const QString &code, Parser &parser)
+{
+    // print out error
+    QStringList lines = code.split(QLatin1Char('\n'));
+    lines.append(QLatin1String("\n")); // sentinel.
+    QString errorString;
+
+    foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) {
+
+        if (m.isWarning())
+            continue;
+
+        QString error = filename + QLatin1Char(':') + QString::number(m.loc.startLine)
+                        + QLatin1Char(':') + QString::number(m.loc.startColumn) + QLatin1String(": error: ")
+                        + m.message + QLatin1Char('\n');
+
+        int line = 0;
+        if (m.loc.startLine > 0)
+            line = m.loc.startLine - 1;
+
+        const QString textLine = lines.at(line);
+
+        error += textLine + QLatin1Char('\n');
+
+        int column = m.loc.startColumn - 1;
+        if (column < 0)
+            column = 0;
+
+        column = qMin(column, textLine.length());
+
+        for (int i = 0; i < column; ++i) {
+            const QChar ch = textLine.at(i);
+            if (ch.isSpace())
+                error += ch.unicode();
+            else
+                error += QLatin1Char(' ');
+        }
+        error += QLatin1String("^\n");
+        errorString += error;
+    }
+    return errorString;
+}
+
+bool processComment(const QChar *chars, int length, Comment &comment)
+{
+    // Try to match the logic of the QtScript parser.
+    if (!length)
+        return comment.isValid();
+    if (*chars == QLatin1Char(':') && chars[1].isSpace()) {
+        comment.extracomment += QString(chars+1, length-1);
+    } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) {
+        comment.msgid = QString(chars+2, length-2).simplified();
+    } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) {
+        QString text = QString(chars+2, length-2).trimmed();
+        int k = text.indexOf(QLatin1Char(' '));
+        if (k > -1)
+            comment.extra.insert(text.left(k), text.mid(k + 1).trimmed());
+    } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) {
+        comment.sourcetext.reserve(comment.sourcetext.length() + length-2);
+        ushort *ptr = (ushort *)comment.sourcetext.data() + comment.sourcetext.length();
+        int p = 2, c;
+        forever {
+            if (p >= length)
+                break;
+            c = chars[p++].unicode();
+            if (isspace(c))
+                continue;
+            if (c != '"')
+                break;
+            forever {
+                if (p >= length)
+                    break;
+                c = chars[p++].unicode();
+                if (c == '"')
+                    break;
+                if (c == '\\') {
+                    if (p >= length)
+                        break;
+                    c = chars[p++].unicode();
+                    if (c == '\n')
+                        break;
+                    *ptr++ = '\\';
+                }
+                *ptr++ = c;
+            }
+        }
+        comment.sourcetext.resize(ptr - (ushort *)comment.sourcetext.data());
+    }
+    return comment.isValid();
+}
+
+bool loadQml(Translator &translator, const QString &filename, ConversionData &cd)
+{
+    cd.m_sourceFileName = filename;
+    QFile file(filename);
+    if (!file.open(QIODevice::ReadOnly)) {
+        cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
+        return false;
+    }
+
+    const QString code = QTextStream(&file).readAll();
+
+    Engine driver;
+    Parser parser(&driver);
+
+    NodePool nodePool(filename, &driver);
+    driver.setNodePool(&nodePool);
+
+    Lexer lexer(&driver);
+    lexer.setCode(code, /*line = */ 1);
+    driver.setLexer(&lexer);
+
+    if (parser.parse()) {
+        FindTrCalls trCalls;
+
+        // build up a list of comments that contain translation information.
+        for (int i = 0; i < driver.comments().size(); ++i) {
+            AST::SourceLocation loc = driver.comments().at(i);
+            QString commentStr = code.mid(loc.offset, loc.length);
+
+            if (trCalls.comments.isEmpty() || trCalls.comments.last().lastLine != int(loc.startLine)) {
+                Comment comment;
+                comment.lastLine = loc.startLine+1;
+                if (processComment(commentStr.constData(), commentStr.length(), comment))
+                    trCalls.comments.append(comment);
+            } else {
+                Comment &lastComment = trCalls.comments.last();
+                lastComment.lastLine += 1;
+                processComment(commentStr.constData(), commentStr.length(), lastComment);
+            }
+        }
+
+        //find all tr calls in the code
+        trCalls(&translator, filename, parser.ast());
+    } else {
+        QString error = createErrorString(filename, code, parser);
+        cd.appendError(error);
+        return false;
+    }
+    return true;
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/linguist/lupdate/qscript.cpp
===================================================================
--- trunk/tools/linguist/lupdate/qscript.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/qscript.cpp	(revision 846)
@@ -2,5 +2,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,4 +40,31 @@
 **
 ****************************************************************************/
+
+
+#define Q_SCRIPT_REGEXPLITERAL_RULE1 7
+
+#define Q_SCRIPT_REGEXPLITERAL_RULE2 8
+
+#include <translator.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/qdebug.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qtextcodec.h>
+#include <QtCore/qvariant.h>
+
+#include <iostream>
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 class QScriptGrammar
@@ -174,5 +201,4 @@
   }
 };
-
 
 const char *const QScriptGrammar::spell [] = {
@@ -748,27 +774,8 @@
   -1, -1};
 
-
-#define Q_SCRIPT_REGEXPLITERAL_RULE1 7
-
-#define Q_SCRIPT_REGEXPLITERAL_RULE2 8
-
-#include <translator.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qtextcodec.h>
-#include <QtCore/qvariant.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
 static void recordMessage(
     Translator *tor, const QString &context, const QString &text, const QString &comment,
-    const QString &extracomment, bool plural, const QString &fileName, int lineNo)
+    const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+    bool plural, const QString &fileName, int lineNo)
 {
     TranslatorMessage msg(
@@ -777,4 +784,6 @@
         TranslatorMessage::Unfinished, plural);
     msg.setExtraComment(extracomment.simplified());
+    msg.setId(msgid);
+    msg.setExtras(extra);
     tor->extend(msg);
 }
@@ -784,13 +793,21 @@
 {
 
+class CommentProcessor
+{
+public:
+    virtual ~CommentProcessor() {}
+    virtual void processComment(const QChar *chars, int length) = 0;
+};
+
 class Lexer
 {
 public:
-    Lexer();
+    Lexer(CommentProcessor *);
     ~Lexer();
 
-    void setCode(const QString &c, int lineno);
+    void setCode(const QString &c, const QString &fileName, int lineno);
     int lex();
 
+    QString fileName() const { return yyfilename; }
     int currentLineNo() const { return yylineno; }
     int currentColumnNo() const { return yycolumn; }
@@ -872,4 +889,5 @@
 
 private:
+    QString yyfilename;
     int yylineno;
     bool done;
@@ -925,4 +943,6 @@
     void syncProhibitAutomaticSemicolon();
 
+    void processComment(const QChar *, int);
+
     const QChar *code;
     uint length;
@@ -951,4 +971,6 @@
     int parenthesesCount;
     bool prohibitAutomaticSemicolon;
+
+    CommentProcessor *commentProcessor;
 };
 
@@ -1027,5 +1049,5 @@
 } // namespace QScript
 
-QScript::Lexer::Lexer()
+QScript::Lexer::Lexer(QScript::CommentProcessor *proc)
     :
       yylineno(0),
@@ -1038,5 +1060,6 @@
       check_reserved(true),
       parenthesesState(IgnoreParentheses),
-      prohibitAutomaticSemicolon(false)
+      prohibitAutomaticSemicolon(false),
+      commentProcessor(proc)
 {
     // allocate space for read buffers
@@ -1053,7 +1076,8 @@
 }
 
-void QScript::Lexer::setCode(const QString &c, int lineno)
+void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno)
 {
     errmsg = QString();
+    yyfilename = fileName;
     yylineno = lineno;
     yycolumn = 1;
@@ -1404,8 +1428,10 @@
                 recordStartPos();
                 shift(1);
+                Q_ASSERT(pos16 == 0);
                 state = InSingleLineComment;
             } else if (current == '/' && next1 == '*') {
                 recordStartPos();
                 shift(1);
+                Q_ASSERT(pos16 == 0);
                 state = InMultiLineComment;
             } else if (current == 0) {
@@ -1466,5 +1492,5 @@
                     setDone(Bad);
                     err = IllegalCharacter;
-                    errmsg = QLatin1String("Illegal character");
+                    errmsg = LU::tr("Illegal character");
                 }
             }
@@ -1477,5 +1503,5 @@
                 setDone(Bad);
                 err = UnclosedStringLiteral;
-                errmsg = QLatin1String("Unclosed string at end of line");
+                errmsg = LU::tr("Unclosed string at end of line");
             } else if (current == '\\') {
                 state = InEscapeSequence;
@@ -1503,5 +1529,5 @@
                     setDone(Bad);
                     err = IllegalEscapeSequence;
-                    errmsg = QLatin1String("Illegal escape squence");
+                    errmsg = LU::tr("Illegal escape squence");
                 }
             } else if (current == 'x')
@@ -1542,12 +1568,15 @@
                 setDone(Bad);
                 err = IllegalUnicodeEscapeSequence;
-                errmsg = QLatin1String("Illegal unicode escape sequence");
+                errmsg = LU::tr("Illegal unicode escape sequence");
             }
             break;
         case InSingleLineComment:
             if (isLineTerminator()) {
+                record16(current); // include newline
+                processComment(buffer16, pos16);
                 shiftWindowsLineBreak();
                 yylineno++;
                 yycolumn = 0;
+                pos16 = 0;
                 terminator = true;
                 bol = true;
@@ -1559,4 +1588,6 @@
             } else if (current == 0) {
                 setDone(Eof);
+            } else {
+                record16(current);
             }
             break;
@@ -1565,11 +1596,15 @@
                 setDone(Bad);
                 err = UnclosedComment;
-                errmsg = QLatin1String("Unclosed comment at end of file");
+                errmsg = LU::tr("Unclosed comment at end of file");
             } else if (isLineTerminator()) {
                 shiftWindowsLineBreak();
                 yylineno++;
             } else if (current == '*' && next1 == '/') {
+                processComment(buffer16, pos16);
+                pos16 = 0;
                 state = Start;
                 shift(1);
+            } else {
+                record16(current);
             }
             break;
@@ -1649,5 +1684,5 @@
                 setDone(Bad);
                 err = IllegalExponentIndicator;
-                errmsg = QLatin1String("Illegal syntax for exponential number");
+                errmsg = LU::tr("Illegal syntax for exponential number");
             }
             break;
@@ -1675,5 +1710,5 @@
         state = Bad;
         err = IllegalIdentifier;
-        errmsg = QLatin1String("Identifier cannot start with numeric literal");
+        errmsg = LU::tr("Identifier cannot start with numeric literal");
     }
 
@@ -1994,5 +2029,5 @@
     while (1) {
         if (isLineTerminator() || current == 0) {
-            errmsg = QLatin1String("Unterminated regular expression literal");
+            errmsg = LU::tr("Unterminated regular expression literal");
             return false;
         }
@@ -2033,8 +2068,13 @@
 }
 
+void QScript::Lexer::processComment(const QChar *chars, int length)
+{
+    commentProcessor->processComment(chars, length);
+}
+
 
 class Translator;
 
-class QScriptParser: protected QScriptGrammar
+class QScriptParser: protected QScriptGrammar, public QScript::CommentProcessor
 {
 public:
@@ -2052,8 +2092,10 @@
     ~QScriptParser();
 
-    bool parse(QScript::Lexer *lexer,
-               const QString &fileName,
-               Translator *translator);
-
+    void setLexer(QScript::Lexer *);
+
+    bool parse(Translator *translator);
+
+    QString fileName() const
+    { return lexer->fileName(); }
     inline QString errorMessage() const
     { return error_message; }
@@ -2071,4 +2113,8 @@
     inline Location &loc(int index)
     { return location_stack [tos + index - 2]; }
+
+    std::ostream &yyMsg(int line = 0);
+
+    virtual void processComment(const QChar *, int);
 
 protected:
@@ -2081,4 +2127,11 @@
     int error_lineno;
     int error_column;
+
+private:
+    QScript::Lexer *lexer;
+    QString extracomment;
+    QString msgid;
+    QString sourcetext;
+    TranslatorMessage::ExtraData extra;
 };
 
@@ -2107,5 +2160,6 @@
     sym_stack(0),
     state_stack(0),
-    location_stack(0)
+    location_stack(0),
+    lexer(0)
 {
 }
@@ -2129,8 +2183,12 @@
 }
 
-bool QScriptParser::parse(QScript::Lexer *lexer,
-                    const QString &fileName,
-     	            Translator *translator)
-{
+void QScriptParser::setLexer(QScript::Lexer *lex)
+{
+    lexer = lex;
+}
+
+bool QScriptParser::parse(Translator *translator)
+{
+  Q_ASSERT(lexer != 0);
   const int INITIAL_STATE = 0;
 
@@ -2214,42 +2272,68 @@
     QString name = sym(1).toString();
     if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
+        if (!sourcetext.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
         QVariantList args = sym(2).toList();
         if (args.size() < 2) {
-            qWarning("%s:%d: %s() requires at least two arguments",
-                     qPrintable(fileName), identLineNo, qPrintable(name));
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name));
         } else {
             if ((args.at(0).type() != QVariant::String)
                 || (args.at(1).type() != QVariant::String)) {
-                qWarning("%s:%d: %s(): both arguments must be literal strings",
-                         qPrintable(fileName), identLineNo, qPrintable(name));
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name));
             } else {
                 QString context = args.at(0).toString();
                 QString text = args.at(1).toString();
                 QString comment = args.value(2).toString();
-                QString extracomment;
                 bool plural = (args.size() > 4);
                 recordMessage(translator, context, text, comment, extracomment,
-                              plural, fileName, identLineNo);
+                              msgid, extra, plural, fileName(), identLineNo);
             }
         }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
     } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
+        if (!sourcetext.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
         QVariantList args = sym(2).toList();
         if (args.size() < 1) {
-            qWarning("%s:%d: %s() requires at least one argument",
-                     qPrintable(fileName), identLineNo, qPrintable(name));
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
         } else {
             if (args.at(0).type() != QVariant::String) {
-                qWarning("%s:%d: %s(): text to translate must be a literal string",
-                         qPrintable(fileName), identLineNo, qPrintable(name));
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name));
             } else {
-                QString context = QFileInfo(fileName).baseName();
+                QString context = QFileInfo(fileName()).baseName();
                 QString text = args.at(0).toString();
                 QString comment = args.value(1).toString();
-                QString extracomment;
                 bool plural = (args.size() > 2);
                 recordMessage(translator, context, text, comment, extracomment,
-                              plural, fileName, identLineNo);
+                              msgid, extra, plural, fileName(), identLineNo);
             }
         }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
+    } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+        if (!msgid.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name));
+        QVariantList args = sym(2).toList();
+        if (args.size() < 1) {
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
+        } else {
+            if (args.at(0).type() != QVariant::String) {
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name));
+            } else {
+                msgid = args.at(0).toString();
+                bool plural = (args.size() > 1);
+                recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+                              msgid, extra, plural, fileName(), identLineNo);
+            }
+        }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
     }
 } break;
@@ -2277,4 +2361,42 @@
         sym(1) = QVariant();
 } break;
+
+    case 171:
+
+    case 172:
+
+    case 173:
+
+    case 174:
+
+    case 175:
+
+    case 176:
+
+    case 177:
+
+    case 178:
+
+    case 179:
+
+    case 180:
+
+    case 181:
+
+    case 182:
+
+    case 183:
+
+    case 184:
+
+    case 185:
+    if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
+        yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
+    }
+    break;
 
           } // switch
@@ -2332,5 +2454,7 @@
                 {
                   if (first)
-                    error_message += QLatin1String ("Expected ");
+                    //: Beginning of the string that contains
+                    //: comma-separated list of expected tokens
+                    error_message += LU::tr("Expected ");
                   else
                     error_message += QLatin1String (", ");
@@ -2356,4 +2480,61 @@
 }
 
+std::ostream &QScriptParser::yyMsg(int line)
+{
+    return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": ";
+}
+
+void QScriptParser::processComment(const QChar *chars, int length)
+{
+    if (!length)
+        return;
+    // Try to match the logic of the C++ parser.
+    if (*chars == QLatin1Char(':') && chars[1].isSpace()) {
+        extracomment += QString(chars+2, length-2);
+    } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) {
+        msgid = QString(chars+2, length-2).simplified();
+    } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) {
+        QString text = QString(chars+2, length-2).trimmed();
+        int k = text.indexOf(QLatin1Char(' '));
+        if (k > -1)
+            extra.insert(text.left(k), text.mid(k + 1).trimmed());
+    } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) {
+        sourcetext.reserve(sourcetext.length() + length-2);
+        ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length();
+        int p = 2, c;
+        forever {
+            if (p >= length)
+                break;
+            c = chars[p++].unicode();
+            if (isspace(c))
+                continue;
+            if (c != '"') {
+                yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
+                break;
+            }
+            forever {
+                if (p >= length) {
+                  whoops:
+                    yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
+                    break;
+                }
+                c = chars[p++].unicode();
+                if (c == '"')
+                    break;
+                if (c == '\\') {
+                    if (p >= length)
+                        goto whoops;
+                    c = chars[p++].unicode();
+                    if (c == '\n')
+                        goto whoops;
+                    *ptr++ = '\\';
+                }
+                *ptr++ = c;
+            }
+        }
+        sourcetext.resize(ptr - (ushort *)sourcetext.data());
+    }
+}
+
 
 bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd)
@@ -2361,6 +2542,5 @@
     QFile file(filename);
     if (!file.open(QIODevice::ReadOnly)) {
-        cd.appendError(QString::fromLatin1("Cannot open %1: %2")
-            .arg(filename, file.errorString()));
+        cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
         return false;
     }
@@ -2375,10 +2555,11 @@
 
     QString code = ts.readAll();
-    QScript::Lexer lexer;
-    lexer.setCode(code, /*lineNumber=*/1);
     QScriptParser parser;
-    if (!parser.parse(&lexer, filename, &translator)) {
-        qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(),
-                 qPrintable(parser.errorMessage()));
+    QScript::Lexer lexer(&parser);
+    lexer.setCode(code, filename, /*lineNumber=*/1);
+    parser.setLexer(&lexer);
+    if (!parser.parse(&translator)) {
+        std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": "
+                  << qPrintable(parser.errorMessage()) << std::endl;
         return false;
     }
Index: trunk/tools/linguist/lupdate/qscript.g
===================================================================
--- trunk/tools/linguist/lupdate/qscript.g	(revision 769)
+++ trunk/tools/linguist/lupdate/qscript.g	(revision 846)
@@ -1,5 +1,5 @@
 ----------------------------------------------------------------------------
 --
--- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+-- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 -- All rights reserved.
 -- Contact: Nokia Corporation (qt-info@nokia.com)
@@ -85,4 +85,5 @@
 #include <translator.h>
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/qdebug.h>
 #include <QtCore/qnumeric.h>
@@ -91,4 +92,6 @@
 #include <QtCore/qvariant.h>
 
+#include <iostream>
+
 #include <ctype.h>
 #include <stdlib.h>
@@ -98,7 +101,12 @@
 QT_BEGIN_NAMESPACE
 
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
 static void recordMessage(
     Translator *tor, const QString &context, const QString &text, const QString &comment,
-    const QString &extracomment, bool plural, const QString &fileName, int lineNo)
+    const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra,
+    bool plural, const QString &fileName, int lineNo)
 {
     TranslatorMessage msg(
@@ -107,5 +115,7 @@
         TranslatorMessage::Unfinished, plural);
     msg.setExtraComment(extracomment.simplified());
-    tor->replace(msg);
+    msg.setId(msgid);
+    msg.setExtras(extra);
+    tor->extend(msg);
 }
 
@@ -114,13 +124,21 @@
 {
 
+class CommentProcessor
+{
+public:
+    virtual ~CommentProcessor() {}
+    virtual void processComment(const QChar *chars, int length) = 0;
+};
+
 class Lexer
 {
 public:
-    Lexer();
+    Lexer(CommentProcessor *);
     ~Lexer();
 
-    void setCode(const QString &c, int lineno);
+    void setCode(const QString &c, const QString &fileName, int lineno);
     int lex();
 
+    QString fileName() const { return yyfilename; }
     int currentLineNo() const { return yylineno; }
     int currentColumnNo() const { return yycolumn; }
@@ -202,4 +220,5 @@
 
 private:
+    QString yyfilename;
     int yylineno;
     bool done;
@@ -255,4 +274,6 @@
     void syncProhibitAutomaticSemicolon();
 
+    void processComment(const QChar *, int);
+
     const QChar *code;
     uint length;
@@ -281,4 +302,6 @@
     int parenthesesCount;
     bool prohibitAutomaticSemicolon;
+
+    CommentProcessor *commentProcessor;
 };
 
@@ -357,5 +380,5 @@
 } // namespace QScript
 
-QScript::Lexer::Lexer()
+QScript::Lexer::Lexer(QScript::CommentProcessor *proc)
     :
       yylineno(0),
@@ -368,5 +391,6 @@
       check_reserved(true),
       parenthesesState(IgnoreParentheses),
-      prohibitAutomaticSemicolon(false)
+      prohibitAutomaticSemicolon(false),
+      commentProcessor(proc)
 {
     // allocate space for read buffers
@@ -383,7 +407,8 @@
 }
 
-void QScript::Lexer::setCode(const QString &c, int lineno)
+void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno)
 {
     errmsg = QString();
+    yyfilename = fileName;
     yylineno = lineno;
     yycolumn = 1;
@@ -734,8 +759,10 @@
                 recordStartPos();
                 shift(1);
+                Q_ASSERT(pos16 == 0);
                 state = InSingleLineComment;
             } else if (current == '/' && next1 == '*') {
                 recordStartPos();
                 shift(1);
+                Q_ASSERT(pos16 == 0);
                 state = InMultiLineComment;
             } else if (current == 0) {
@@ -796,5 +823,5 @@
                     setDone(Bad);
                     err = IllegalCharacter;
-                    errmsg = QLatin1String("Illegal character");
+                    errmsg = LU::tr("Illegal character");
                 }
             }
@@ -807,5 +834,5 @@
                 setDone(Bad);
                 err = UnclosedStringLiteral;
-                errmsg = QLatin1String("Unclosed string at end of line");
+                errmsg = LU::tr("Unclosed string at end of line");
             } else if (current == '\\') {
                 state = InEscapeSequence;
@@ -833,5 +860,5 @@
                     setDone(Bad);
                     err = IllegalEscapeSequence;
-                    errmsg = QLatin1String("Illegal escape squence");
+                    errmsg = LU::tr("Illegal escape squence");
                 }
             } else if (current == 'x')
@@ -872,12 +899,15 @@
                 setDone(Bad);
                 err = IllegalUnicodeEscapeSequence;
-                errmsg = QLatin1String("Illegal unicode escape sequence");
+                errmsg = LU::tr("Illegal unicode escape sequence");
             }
             break;
         case InSingleLineComment:
             if (isLineTerminator()) {
+                record16(current); // include newline
+                processComment(buffer16, pos16);
                 shiftWindowsLineBreak();
                 yylineno++;
                 yycolumn = 0;
+                pos16 = 0;
                 terminator = true;
                 bol = true;
@@ -889,4 +919,6 @@
             } else if (current == 0) {
                 setDone(Eof);
+            } else {
+                record16(current);
             }
             break;
@@ -895,11 +927,15 @@
                 setDone(Bad);
                 err = UnclosedComment;
-                errmsg = QLatin1String("Unclosed comment at end of file");
+                errmsg = LU::tr("Unclosed comment at end of file");
             } else if (isLineTerminator()) {
                 shiftWindowsLineBreak();
                 yylineno++;
             } else if (current == '*' && next1 == '/') {
+                processComment(buffer16, pos16);
+                pos16 = 0;
                 state = Start;
                 shift(1);
+            } else {
+                record16(current);
             }
             break;
@@ -979,5 +1015,5 @@
                 setDone(Bad);
                 err = IllegalExponentIndicator;
-                errmsg = QLatin1String("Illegal syntax for exponential number");
+                errmsg = LU::tr("Illegal syntax for exponential number");
             }
             break;
@@ -1005,5 +1041,5 @@
         state = Bad;
         err = IllegalIdentifier;
-        errmsg = QLatin1String("Identifier cannot start with numeric literal");
+        errmsg = LU::tr("Identifier cannot start with numeric literal");
     }
 
@@ -1324,5 +1360,5 @@
     while (1) {
         if (isLineTerminator() || current == 0) {
-            errmsg = QLatin1String("Unterminated regular expression literal");
+            errmsg = LU::tr("Unterminated regular expression literal");
             return false;
         }
@@ -1363,8 +1399,13 @@
 }
 
+void QScript::Lexer::processComment(const QChar *chars, int length)
+{
+    commentProcessor->processComment(chars, length);
+}
+
 
 class Translator;
 
-class QScriptParser: protected $table
+class QScriptParser: protected $table, public QScript::CommentProcessor
 {
 public:
@@ -1382,8 +1423,10 @@
     ~QScriptParser();
 
-    bool parse(QScript::Lexer *lexer,
-               const QString &fileName,
-               Translator *translator);
-
+    void setLexer(QScript::Lexer *);
+
+    bool parse(Translator *translator);
+
+    QString fileName() const
+    { return lexer->fileName(); }
     inline QString errorMessage() const
     { return error_message; }
@@ -1401,4 +1444,8 @@
     inline Location &loc(int index)
     { return location_stack [tos + index - 2]; }
+
+    std::ostream &yyMsg(int line = 0);
+
+    virtual void processComment(const QChar *, int);
 
 protected:
@@ -1411,4 +1458,11 @@
     int error_lineno;
     int error_column;
+
+private:
+    QScript::Lexer *lexer;
+    QString extracomment;
+    QString msgid;
+    QString sourcetext;
+    TranslatorMessage::ExtraData extra;
 };
 
@@ -1437,5 +1491,6 @@
     sym_stack(0),
     state_stack(0),
-    location_stack(0)
+    location_stack(0),
+    lexer(0)
 {
 }
@@ -1459,8 +1514,12 @@
 }
 
-bool QScriptParser::parse(QScript::Lexer *lexer,
-                    const QString &fileName,
-     	            Translator *translator)
-{
+void QScriptParser::setLexer(QScript::Lexer *lex)
+{
+    lexer = lex;
+}
+
+bool QScriptParser::parse(Translator *translator)
+{
+  Q_ASSERT(lexer != 0);
   const int INITIAL_STATE = 0;
 
@@ -1629,42 +1688,68 @@
     QString name = sym(1).toString();
     if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) {
+        if (!sourcetext.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
         QVariantList args = sym(2).toList();
         if (args.size() < 2) {
-            qWarning("%s:%d: %s() requires at least two arguments",
-                     qPrintable(fileName), identLineNo, qPrintable(name));
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name));
         } else {
             if ((args.at(0).type() != QVariant::String)
                 || (args.at(1).type() != QVariant::String)) {
-                qWarning("%s:%d: %s(): both arguments must be literal strings",
-                         qPrintable(fileName), identLineNo, qPrintable(name));
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name));
             } else {
                 QString context = args.at(0).toString();
                 QString text = args.at(1).toString();
                 QString comment = args.value(2).toString();
-                QString extracomment;
                 bool plural = (args.size() > 4);
                 recordMessage(translator, context, text, comment, extracomment,
-                              plural, fileName, identLineNo);
-            }
-        }
+                              msgid, extra, plural, fileName(), identLineNo);
+            }
+        }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
     } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) {
+        if (!sourcetext.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name));
         QVariantList args = sym(2).toList();
         if (args.size() < 1) {
-            qWarning("%s:%d: %s() requires at least one argument",
-                     qPrintable(fileName), identLineNo, qPrintable(name));
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
         } else {
             if (args.at(0).type() != QVariant::String) {
-                qWarning("%s:%d: %s(): text to translate must be a literal string",
-                         qPrintable(fileName), identLineNo, qPrintable(name));
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name));
             } else {
-                QString context = QFileInfo(fileName).baseName();
+                QString context = QFileInfo(fileName()).baseName();
                 QString text = args.at(0).toString();
                 QString comment = args.value(1).toString();
-                QString extracomment;
                 bool plural = (args.size() > 2);
                 recordMessage(translator, context, text, comment, extracomment,
-                              plural, fileName, identLineNo);
-            }
-        }
+                              msgid, extra, plural, fileName(), identLineNo);
+            }
+        }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
+    } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) {
+        if (!msgid.isEmpty())
+            yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name));
+        QVariantList args = sym(2).toList();
+        if (args.size() < 1) {
+            yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
+        } else {
+            if (args.at(0).type() != QVariant::String) {
+                yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name));
+            } else {
+                msgid = args.at(0).toString();
+                bool plural = (args.size() > 1);
+                recordMessage(translator, QString(), sourcetext, QString(), extracomment,
+                              msgid, extra, plural, fileName(), identLineNo);
+            }
+        }
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
     }
 } break;
@@ -1812,18 +1897,71 @@
 
 Statement: Block ;
+/.
+    case $rule_number:
+./
 Statement: VariableStatement ;
+/.
+    case $rule_number:
+./
 Statement: EmptyStatement ;
+/.
+    case $rule_number:
+./
 Statement: ExpressionStatement ;
+/.
+    case $rule_number:
+./
 Statement: IfStatement ;
+/.
+    case $rule_number:
+./
 Statement: IterationStatement ;
+/.
+    case $rule_number:
+./
 Statement: ContinueStatement ;
+/.
+    case $rule_number:
+./
 Statement: BreakStatement ;
+/.
+    case $rule_number:
+./
 Statement: ReturnStatement ;
+/.
+    case $rule_number:
+./
 Statement: WithStatement ;
+/.
+    case $rule_number:
+./
 Statement: LabelledStatement ;
+/.
+    case $rule_number:
+./
 Statement: SwitchStatement ;
+/.
+    case $rule_number:
+./
 Statement: ThrowStatement ;
+/.
+    case $rule_number:
+./
 Statement: TryStatement ;
+/.
+    case $rule_number:
+./
 Statement: DebuggerStatement ;
+/.
+    case $rule_number:
+    if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) {
+        yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n"));
+        sourcetext.clear();
+        extracomment.clear();
+        msgid.clear();
+        extra.clear();
+    }
+    break;
+./
 
 Block: T_LBRACE StatementListOpt T_RBRACE ;
@@ -1964,4 +2102,7 @@
                   if (first)
                     error_message += QLatin1String ("Expected ");
+                    //: Beginning of the string that contains
+                    //: comma-separated list of expected tokens
+                    error_message += LU::tr("Expected ");
                   else
                     error_message += QLatin1String (", ");
@@ -1987,4 +2128,61 @@
 }
 
+std::ostream &QScriptParser::yyMsg(int line)
+{
+    return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": ";
+}
+
+void QScriptParser::processComment(const QChar *chars, int length)
+{
+    if (!length)
+        return;
+    // Try to match the logic of the C++ parser.
+    if (*chars == QLatin1Char(':') && chars[1].isSpace()) {
+        extracomment += QString(chars+2, length-2);
+    } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) {
+        msgid = QString(chars+2, length-2).simplified();
+    } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) {
+        QString text = QString(chars+2, length-2).trimmed();
+        int k = text.indexOf(QLatin1Char(' '));
+        if (k > -1)
+            extra.insert(text.left(k), text.mid(k + 1).trimmed());
+    } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) {
+        sourcetext.reserve(sourcetext.length() + length-2);
+        ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length();
+        int p = 2, c;
+        forever {
+            if (p >= length)
+                break;
+            c = chars[p++].unicode();
+            if (isspace(c))
+                continue;
+            if (c != '"') {
+                yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n"));
+                break;
+            }
+            forever {
+                if (p >= length) {
+                  whoops:
+                    yyMsg() << qPrintable(LU::tr("Unterminated meta string\n"));
+                    break;
+                }
+                c = chars[p++].unicode();
+                if (c == '"')
+                    break;
+                if (c == '\\') {
+                    if (p >= length)
+                        goto whoops;
+                    c = chars[p++].unicode();
+                    if (c == '\n')
+                        goto whoops;
+                    *ptr++ = '\\';
+                }
+                *ptr++ = c;
+            }
+        }
+        sourcetext.resize(ptr - (ushort *)sourcetext.data());
+    }
+}
+
 
 bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd)
@@ -1992,6 +2190,5 @@
     QFile file(filename);
     if (!file.open(QIODevice::ReadOnly)) {
-        cd.appendError(QString::fromLatin1("Cannot open %1: %2")
-            .arg(filename, file.errorString()));
+        cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
         return false;
     }
@@ -2006,10 +2203,11 @@
 
     QString code = ts.readAll();
-    QScript::Lexer lexer;
-    lexer.setCode(code, /*lineNumber=*/1);
     QScriptParser parser;
-    if (!parser.parse(&lexer, filename, &translator)) {
-        qWarning("%s:%d: %s", qPrintable(filename), parser.errorLineNumber(),
-                 qPrintable(parser.errorMessage()));
+    QScript::Lexer lexer(&parser);
+    lexer.setCode(code, filename, /*lineNumber=*/1);
+    parser.setLexer(&lexer);
+    if (!parser.parse(&translator)) {
+        std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": "
+                  << qPrintable(parser.errorMessage()) << std::endl;
         return false;
     }
Index: trunk/tools/linguist/lupdate/ui.cpp
===================================================================
--- trunk/tools/linguist/lupdate/ui.cpp	(revision 769)
+++ trunk/tools/linguist/lupdate/ui.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,5 @@
 #include <translator.h>
 
+#include <QtCore/QCoreApplication>
 #include <QtCore/QDebug>
 #include <QtCore/QFile>
@@ -55,4 +56,8 @@
 
 QT_BEGIN_NAMESPACE
+
+class LU {
+    Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
 
 class UiReader : public QXmlDefaultHandler
@@ -153,9 +158,8 @@
 bool UiReader::fatalError(const QXmlParseException &exception)
 {
-    QString msg;
-    msg.sprintf("XML error: Parse error at line %d, column %d (%s).",
-                 exception.lineNumber(), exception.columnNumber(),
-                 exception.message().toLatin1().data());
-    m_cd.appendError(msg); 
+    QString msg = LU::tr("XML error: Parse error at line %1, column %2 (%3).")
+        .arg(exception.lineNumber()).arg(exception.columnNumber())
+        .arg(exception.message());
+    m_cd.appendError(msg);
     return false;
 }
@@ -182,6 +186,5 @@
     QFile file(filename);
     if (!file.open(QIODevice::ReadOnly)) {
-        cd.appendError(QString::fromLatin1("Cannot open %1: %2")
-            .arg(filename, file.errorString()));
+        cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString()));
         return false;
     }
@@ -197,5 +200,5 @@
     bool result = reader.parse(in);
     if (!result)
-        cd.appendError(QLatin1String("Parse error in UI file"));
+        cd.appendError(LU::tr("Parse error in UI file"));
     reader.setContentHandler(0);
     reader.setErrorHandler(0);
Index: trunk/tools/linguist/phrasebooks/french.qph
===================================================================
--- trunk/tools/linguist/phrasebooks/french.qph	(revision 769)
+++ trunk/tools/linguist/phrasebooks/french.qph	(revision 846)
@@ -802,5 +802,5 @@
 <phrase>
     <source>Redo</source>
-    <target>Annuler Annuler</target>
+    <target>RÃ©tablir</target>
 </phrase>
 <phrase>
@@ -1112,8 +1112,4 @@
 </phrase>
 <phrase>
-    <source>&amp;Redo</source>
-    <target>Re&amp;faire</target>
-</phrase>
-<phrase>
     <source>debugger</source>
     <target>dÃ©bogueur</target>
@@ -1439,3 +1435,59 @@
     <target>&amp;DÃ©boguer</target>
 </phrase>
+<phrase>
+    <source>Slider</source>
+    <target>Barre de dÃ©filement</target>
+</phrase>
+<phrase>
+    <source>&amp;Restore</source>
+    <target>&amp;Restaurer</target>
+</phrase>
+<phrase>
+    <source>&amp;Move</source>
+    <target>&amp;DÃ©placer</target>
+</phrase>
+<phrase>
+    <source>New</source>
+    <target>CrÃ©er</target>
+</phrase>
+<phrase>
+    <source>Play</source>
+    <target>Lecture</target>
+</phrase>
+<phrase>
+    <source>Slider</source>
+    <target>Barre de dÃ©filement</target>
+</phrase>
+<phrase>
+    <source>&amp;Restore</source>
+    <target>&amp;Restaurer</target>
+</phrase>
+<phrase>
+    <source>&amp;Move</source>
+    <target>&amp;DÃ©placer</target>
+</phrase>
+<phrase>
+    <source>New</source>
+    <target>CrÃ©er</target>
+</phrase>
+<phrase>
+    <source>Play</source>
+    <target>Lecture</target>
+</phrase>
+<phrase>
+    <source>&amp;Redo</source>
+    <target>&amp;Refaire</target>
+</phrase>
+<phrase>
+    <source>Raised</source>
+    <target>BombÃ©</target>
+</phrase>
+<phrase>
+    <source>Sunken</source>
+    <target>EnfoncÃ©</target>
+</phrase>
+<phrase>
+    <source>Run:</source>
+    <target>ExÃ©cution :</target>
+</phrase>
 </QPH>
Index: trunk/tools/linguist/phrasebooks/hungarian.qph
===================================================================
--- trunk/tools/linguist/phrasebooks/hungarian.qph	(revision 846)
+++ trunk/tools/linguist/phrasebooks/hungarian.qph	(revision 846)
@@ -0,0 +1,752 @@
+<!DOCTYPE QPH>
+<QPH language="hu_HU">
+<phrase>
+    <source>OK</source>
+    <target>OK</target>
+</phrase>
+<phrase>
+    <source>Bookmarks</source>
+    <target>KÃ¶nyvjelzÅk</target>
+</phrase>
+<phrase>
+    <source>Remove</source>
+    <target>TÃ¶rlÃ©s</target>
+</phrase>
+<phrase>
+    <source>New Folder</source>
+    <target>Ãj kÃ¶nyvtÃ¡r</target>
+</phrase>
+<phrase>
+    <source>Add</source>
+    <target>HozzÃ¡adÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Previous</source>
+    <target>ElÅzÅ</target>
+</phrase>
+<phrase>
+    <source>Font</source>
+    <target>BetÅ±tÃ­pus</target>
+</phrase>
+<phrase>
+    <source>Help</source>
+    <target>SegÃ­tsÃ©g</target>
+</phrase>
+<phrase>
+    <source>Done</source>
+    <target>KÃ©sz</target>
+</phrase>
+<phrase>
+    <source>Install</source>
+    <target>TelepÃ­tÃ©s</target>
+</phrase>
+<phrase>
+    <source>Cancel</source>
+    <target>MÃ©gsem</target>
+</phrase>
+<phrase>
+    <source>Installation Path:</source>
+    <target>TelepÃ­tÃ©si Ãºtvonal:</target>
+</phrase>
+<phrase>
+    <source>Index</source>
+    <target>Index</target>
+</phrase>
+<phrase>
+    <source>Contents</source>
+    <target>Tartalom</target>
+</phrase>
+<phrase>
+    <source>Search</source>
+    <target>KeresÃ©s</target>
+</phrase>
+<phrase>
+    <source>Print Preview...</source>
+    <target>NyomtatÃ¡si kÃ©p...</target>
+</phrase>
+<phrase>
+    <source>About...</source>
+    <target>NÃ©vjegy...</target>
+</phrase>
+<phrase>
+    <source>Toolbars</source>
+    <target>EszkÃ¶ztÃ¡rak</target>
+</phrase>
+<phrase>
+    <source>Address:</source>
+    <target>CÃ­m:</target>
+</phrase>
+<phrase>
+    <source>Open Source Edition</source>
+    <target>NyÃ­ltforrÃ¡sÃº kiadÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Yes</source>
+    <target>Igen</target>
+</phrase>
+<phrase>
+    <source>No</source>
+    <target>Nem</target>
+</phrase>
+<phrase>
+    <source>Apply</source>
+    <target>Alkalmaz</target>
+</phrase>
+<phrase>
+    <source>Ignore</source>
+    <target>KihagyÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Abort</source>
+    <target>MegszakÃ­tÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Play</source>
+    <target>LejÃ¡tszÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Pause</source>
+    <target>SzÃŒnet</target>
+</phrase>
+<phrase>
+    <source>File</source>
+    <target>FÃ¡jl</target>
+    <definition>menu</definition>
+</phrase>
+<phrase>
+    <source>file</source>
+    <target>fÃ¡jl</target>
+</phrase>
+<phrase>
+    <source>directory</source>
+    <target>kÃ¶nyvtÃ¡r</target>
+</phrase>
+<phrase>
+    <source>Symlink</source>
+    <target>Szimbolikus link</target>
+</phrase>
+<phrase>
+    <source>Delete</source>
+    <target>TÃ¶rlÃ©s</target>
+</phrase>
+<phrase>
+    <source>Rename</source>
+    <target>ÃtnevezÃ©s</target>
+</phrase>
+<phrase>
+    <source>Back</source>
+    <target>Vissza</target>
+</phrase>
+<phrase>
+    <source>Forward</source>
+    <target>ElÅre</target>
+</phrase>
+<phrase>
+    <source>Finish</source>
+    <target>BefejezÃ©s</target>
+</phrase>
+<phrase>
+    <source>Quit</source>
+    <target>KilÃ©pÃ©s</target>
+</phrase>
+<phrase>
+    <source>Exit</source>
+    <target>KilÃ©pÃ©s</target>
+</phrase>
+<phrase>
+    <source>Close</source>
+    <target>BezÃ¡rÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Close All</source>
+    <target>Mindent bezÃ¡r</target>
+</phrase>
+<phrase>
+    <source>Error</source>
+    <target>Hiba</target>
+</phrase>
+<phrase>
+    <source>Warning</source>
+    <target>FigyelmeztetÃ©s</target>
+</phrase>
+<phrase>
+    <source>Information</source>
+    <target>InformÃ¡ciÃ³</target>
+</phrase>
+<phrase>
+    <source>Question</source>
+    <target>KÃ©rdÃ©s</target>
+</phrase>
+<phrase>
+    <source>document</source>
+    <target>dokumentum</target>
+</phrase>
+<phrase>
+    <source>author</source>
+    <target>szerzÅ</target>
+</phrase>
+<phrase>
+    <source>subsidiary(-ies)</source>
+    <target>leÃ¡nyvÃ¡llalata(i)</target>
+</phrase>
+<phrase>
+    <source>Help</source>
+    <target>SÃºgÃ³</target>
+</phrase>
+<phrase>
+    <source>Undo</source>
+    <target>VisszavonÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Redo</source>
+    <target>Ãjra</target>
+</phrase>
+<phrase>
+    <source>Open</source>
+    <target>MegnyitÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Save</source>
+    <target>MentÃ©s</target>
+</phrase>
+<phrase>
+    <source>Save all</source>
+    <target>Mindet menti</target>
+</phrase>
+<phrase>
+    <source>click</source>
+    <target>kattintÃ¡s</target>
+    <definition>noun</definition>
+</phrase>
+<phrase>
+    <source>click</source>
+    <target>kattintson</target>
+    <definition>ask</definition>
+</phrase>
+<phrase>
+    <source>Recent</source>
+    <target>ElÅzÅ</target>
+    <definition>Recent files/ElÅzÅ fÃ¡jlok</definition>
+</phrase>
+<phrase>
+    <source>Window</source>
+    <target>Ablak</target>
+</phrase>
+<phrase>
+    <source>Cascade</source>
+    <target>LÃ©pcsÅzetes</target>
+</phrase>
+<phrase>
+    <source>Tile</source>
+    <target>MozaikszerÅ±</target>
+</phrase>
+<phrase>
+    <source>Game</source>
+    <target>JÃ¡tÃ©k</target>
+</phrase>
+<phrase>
+    <source>New Game</source>
+    <target>Ãj jÃ¡tÃ©k</target>
+</phrase>
+<phrase>
+    <source>Untitled</source>
+    <target>NÃ©vtelen</target>
+</phrase>
+<phrase>
+    <source>Unknown error</source>
+    <target>Ismeretlen hiba</target>
+</phrase>
+<phrase>
+    <source>New Folder</source>
+    <target>Ãj mappa</target>
+</phrase>
+<phrase>
+    <source>folder</source>
+    <target>mappa</target>
+</phrase>
+<phrase>
+    <source>New Directory</source>
+    <target>Ãj kÃ¶nyvtÃ¡r</target>
+</phrase>
+<phrase>
+    <source>unknown</source>
+    <target>ismeretlen</target>
+</phrase>
+<phrase>
+    <source>Copy</source>
+    <target>MÃ¡solÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Cut</source>
+    <target>KivÃ¡gÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Paste</source>
+    <target>BeillesztÃ©s</target>
+</phrase>
+<phrase>
+    <source>Paste special</source>
+    <target>SpeciÃ¡lis beillesztÃ©s</target>
+</phrase>
+<phrase>
+    <source>Insert</source>
+    <target>BeszÃºrÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Copy here</source>
+    <target>MÃ¡solÃ¡s ide</target>
+</phrase>
+<phrase>
+    <source>Minimize</source>
+    <target>MinimalizÃ¡lÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Zoom</source>
+    <target>NagyÃ­tÃ¡s</target>
+</phrase>
+<phrase>
+    <source>&amp;Edit</source>
+    <target>S&amp;zerkesztÃ©s</target>
+</phrase>
+<phrase>
+    <source>&amp;View</source>
+    <target>&amp;NÃ©zet</target>
+</phrase>
+<phrase>
+    <source>Application</source>
+    <target>AlkalmazÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Documentation</source>
+    <target>DokumentÃ¡ciÃ³</target>
+</phrase>
+<phrase>
+    <source>Network</source>
+    <target>HÃ¡lÃ³zat</target>
+</phrase>
+<phrase>
+    <source>Current Page</source>
+    <target>AktuÃ¡lis oldal</target>
+</phrase>
+<phrase>
+    <source>Find</source>
+    <target>KeresÃ©s</target>
+</phrase>
+<phrase>
+    <source>Locale</source>
+    <target>Nyelv</target>
+</phrase>
+<phrase>
+    <source>Cannot open &apos;%1&apos;.</source>
+    <target>&apos;%1&apos; nem nyithatÃ³ meg.</target>
+</phrase>
+<phrase>
+    <source>Cannot find the string &apos;%1&apos;.</source>
+    <target>A szÃ¶veg nem talÃ¡lhatÃ³: &apos;%1&apos;.</target>
+</phrase>
+<phrase>
+    <source>A file called &apos;%1&apos; already exists.  Please choose another name.</source>
+    <target>&apos;%1&apos; nevÅ± fÃ¡jl mÃ¡r lÃ©tezik. VÃ¡lasszon egy mÃ¡sik nevet.</target>
+</phrase>
+<phrase>
+    <source>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</source>
+    <target>Ez a program abban a remÃ©nyben kerÃŒlt kÃ¶zreadÃ¡sra, hogy hasznos lesz, de minden egyÃ©b GARANCIA NÃLKÃL, az ELADHATÃSÃGRA vagy VALAMELY CÃLRA VALÃ ALKALMAZHATÃSÃGRA valÃ³ szÃ¡rmaztatott garanciÃ¡t is beleÃ©rtve.</target>
+    <definition>License text in most Qt programs</definition>
+</phrase>
+<phrase>
+    <source>Open Link</source>
+    <target>Link megnyitÃ¡sa</target>
+</phrase>
+<phrase>
+    <source>Next</source>
+    <target>KÃ¶vetkezÅ</target>
+</phrase>
+<phrase>
+    <source>Case Sensitive</source>
+    <target>Kis/nagybetÅ± Ã©rzÃ©keny</target>
+</phrase>
+<phrase>
+    <source>Whole words</source>
+    <target>Teljes szÃ³</target>
+</phrase>
+<phrase>
+    <source>Open Link in New Tab</source>
+    <target>Link megnyitÃ¡sa Ãºj lapon</target>
+</phrase>
+<phrase>
+    <source>Download canceled.</source>
+    <target>LetÃ¶ltÃ©s megszakÃ­tva.</target>
+</phrase>
+<phrase>
+    <source>The file %1 already exists. Do you want to overwrite it?</source>
+    <target>A(z) &apos;%1&apos; nevÅ± fÃ¡jl mÃ¡r lÃ©tezik. FelÃŒlÃ­rja?</target>
+</phrase>
+<phrase>
+    <source>Qt Assistant</source>
+    <target>Qt Asszisztens</target>
+</phrase>
+<phrase>
+    <source>Preferences...</source>
+    <target>BeÃ¡llÃ­tÃ¡sok...</target>
+</phrase>
+<phrase>
+    <source>&amp;File</source>
+    <target>&amp;FÃ¡jl</target>
+</phrase>
+<phrase>
+    <source>Browser</source>
+    <target>BÃ¶ngÃ©szÅ</target>
+</phrase>
+<phrase>
+    <source>Filters</source>
+    <target>SzÅ±rÅk</target>
+</phrase>
+<phrase>
+    <source>Delete Folder</source>
+    <target>Mappa tÃ¶rlÃ©se</target>
+</phrase>
+<phrase>
+    <source>Rename Folder</source>
+    <target>Mappa Ã¡tnevezÃ©se</target>
+</phrase>
+<phrase>
+    <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see &lt;a href=&quot;http://www.trolltech.com/company/model.html&quot;&gt;www.trolltech.com/company/model.html&lt;/a&gt; for an overview of Qt licensing.</source>
+    <target>Amennyiben zÃ¡rt forrÃ¡sÃº alkalmazÃ¡s fejlesztÃ©sÃ©hez kÃ­vÃ¡nja a Qt-t felhasznÃ¡lni, szÃŒksÃ©ge lesz a Qt kereskedelmi verziÃ³jÃ¡ra. KÃ©rem tekintse meg az &lt;tt&gt;http://www.trolltech.com/company/model.html&lt;/tt&gt; oldalt a Qt licenszelÃ©sÃ©nek Ã¡ttekintÃ©sÃ©hez.</target>
+</phrase>
+<phrase>
+    <source>New Tab</source>
+    <target>Ãj fÃŒl</target>
+</phrase>
+<phrase>
+    <source>Close Tab</source>
+    <target>FÃŒl bezÃ¡rÃ¡sa</target>
+</phrase>
+<phrase>
+    <source>Close Other Tabs</source>
+    <target>A tÃ¶bbi fÃŒl bezÃ¡rÃ¡sa</target>
+</phrase>
+<phrase>
+    <source>True</source>
+    <target>Igaz</target>
+</phrase>
+<phrase>
+    <source>False</source>
+    <target>Hamis</target>
+</phrase>
+<phrase>
+    <source>Update</source>
+    <target>FrissÃ­tÃ©s</target>
+</phrase>
+<phrase>
+    <source>Normal</source>
+    <target>NormÃ¡l</target>
+</phrase>
+<phrase>
+    <source>Bold</source>
+    <target>FÃ©lkÃ¶vÃ©r</target>
+</phrase>
+<phrase>
+    <source>Italic</source>
+    <target>DÅlt</target>
+</phrase>
+<phrase>
+    <source>Greek</source>
+    <target>GÃ¶rÃ¶g</target>
+</phrase>
+<phrase>
+    <source>Cyrillic</source>
+    <target>Cirill</target>
+</phrase>
+<phrase>
+    <source>Armenian</source>
+    <target>ÃrmÃ©ny</target>
+</phrase>
+<phrase>
+    <source>Hebrew</source>
+    <target>HÃ©ber</target>
+</phrase>
+<phrase>
+    <source>Arabic</source>
+    <target>Arab</target>
+</phrase>
+<phrase>
+    <source>Syriac</source>
+    <target>SzÃ­r</target>
+</phrase>
+<phrase>
+    <source>Permission denied</source>
+    <target>HozzÃ¡fÃ©rÃ©s megtagadva</target>
+</phrase>
+<phrase>
+    <source>Too many open files</source>
+    <target>TÃºl sok fÃ¡jl van nyitva</target>
+</phrase>
+<phrase>
+    <source>No such file or directory</source>
+    <target>Nincs ilyen fÃ¡jl vagy kÃ¶nyvtÃ¡r</target>
+</phrase>
+<phrase>
+    <source>No space left on device</source>
+    <target>Nincs tÃ¶bb hely az eszkÃ¶zÃ¶n</target>
+</phrase>
+<phrase>
+    <source>Width:</source>
+    <target>SzÃ©lessÃ©g:</target>
+</phrase>
+<phrase>
+    <source>Height:</source>
+    <target>MagassÃ¡g:</target>
+</phrase>
+<phrase>
+    <source>Margins</source>
+    <target>MargÃ³k</target>
+</phrase>
+<phrase>
+    <source>top margin</source>
+    <target>felsÅ margÃ³</target>
+</phrase>
+<phrase>
+    <source>left margin</source>
+    <target>bal margÃ³</target>
+</phrase>
+<phrase>
+    <source>right margin</source>
+    <target>jobb margÃ³</target>
+</phrase>
+<phrase>
+    <source>bottom margin</source>
+    <target>alsÃ³ margÃ³</target>
+</phrase>
+<phrase>
+    <source>Next page</source>
+    <target>KÃ¶vetkezÅ oldal</target>
+</phrase>
+<phrase>
+    <source>Previous page</source>
+    <target>ElÅzÅ oldal</target>
+</phrase>
+<phrase>
+    <source>First page</source>
+    <target>ElsÅ oldal</target>
+</phrase>
+<phrase>
+    <source>Last page</source>
+    <target>UtolsÃ³ oldal</target>
+</phrase>
+<phrase>
+    <source>Fit width</source>
+    <target>SzÃ©lessÃ©g igazÃ­tÃ¡sa</target>
+</phrase>
+<phrase>
+    <source>Fit page</source>
+    <target>Oldal igazÃ­tÃ¡sa</target>
+</phrase>
+<phrase>
+    <source>Zoom in</source>
+    <target>NagyÃ­tÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Zoom out</source>
+    <target>KicsinyÃ­tÃ©s</target>
+</phrase>
+<phrase>
+    <source>Portrait</source>
+    <target>ÃllÃ³</target>
+</phrase>
+<phrase>
+    <source>Landscape</source>
+    <target>FekvÅ</target>
+</phrase>
+<phrase>
+    <source>Print</source>
+    <target>NyomtatÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Page setup</source>
+    <target>OldalbeÃ¡llÃ­tÃ¡s</target>
+</phrase>
+<phrase>
+    <source>Color</source>
+    <target>SzÃ­n</target>
+</phrase>
+<phrase>
+    <source>Grayscale</source>
+    <target>SzÃŒrkeÃ¡rnyalatos</target>
+</phrase>
+<phrase>
+    <source>None</source>
+    <target>Nincs</target>
+</phrase>
+<phrase>
+    <source>...</source>
+    <target>...</target>
+</phrase>
+<phrase>
+    <source>Menu</source>
+    <target>MenÃŒ</target>
+</phrase>
+<phrase>
+    <source>Keep</source>
+    <target>Meghagy</target>
+</phrase>
+<phrase>
+    <source>Pause</source>
+    <target>MegÃ¡llÃ­t</target>
+</phrase>
+<phrase>
+    <source>Log</source>
+    <target>NaplÃ³</target>
+</phrase>
+<phrase>
+    <source>Mi&amp;nimize</source>
+    <target>&amp;Kis mÃ©ret</target>
+</phrase>
+<phrase>
+    <source>Press</source>
+    <target>Nyomja meg</target>
+</phrase>
+<phrase>
+    <source>Submit</source>
+    <target>KÃŒldÃ©s</target>
+</phrase>
+<phrase>
+    <source>Underline</source>
+    <target>AlÃ¡hÃºzott</target>
+</phrase>
+<phrase>
+    <source>Outline</source>
+    <target>ÃthÃºzott</target>
+</phrase>
+<phrase>
+    <source>Direction</source>
+    <target>IrÃ¡ny</target>
+</phrase>
+<phrase>
+    <source>Configuration</source>
+    <target>KonfigurÃ¡ciÃ³</target>
+</phrase>
+<phrase>
+    <source>None</source>
+    <target>Semmi</target>
+</phrase>
+<phrase>
+    <source>Save As...</source>
+    <target>MentÃ©s mÃ¡skÃ©nt...</target>
+</phrase>
+<phrase>
+    <source>Context</source>
+    <target>KÃ¶rnyezet</target>
+</phrase>
+<phrase>
+    <source>Edit</source>
+    <target>SzerkesztÃ©s</target>
+</phrase>
+<phrase>
+    <source>Toolbar</source>
+    <target>EszkÃ¶ztÃ¡r</target>
+</phrase>
+<phrase>
+    <source>&amp;Print...</source>
+    <target>&amp;NyomtatÃ¡s...</target>
+</phrase>
+<phrase>
+    <source>E&amp;xit</source>
+    <target>&amp;KilÃ©pÃ©s</target>
+</phrase>
+<phrase>
+    <source>Sidebar</source>
+    <target>OldalsÃ¡v</target>
+</phrase>
+<phrase>
+    <source>Bookmark</source>
+    <target>KÃ¶nyvjelzÅ</target>
+</phrase>
+<phrase>
+    <source>Save As</source>
+    <target>MentÃ©s mÃ¡skÃ©nt</target>
+</phrase>
+<phrase>
+    <source>Select All</source>
+    <target>Ãsszes kijelÃ¶lÃ©se</target>
+</phrase>
+<phrase>
+    <source>Name</source>
+    <target>NÃ©v</target>
+</phrase>
+<phrase>
+    <source>Type</source>
+    <target>TÃ­pus</target>
+</phrase>
+<phrase>
+    <source>Date</source>
+    <target>DÃ¡tum</target>
+</phrase>
+<phrase>
+    <source>Name</source>
+    <target>NÃ©v</target>
+</phrase>
+<phrase>
+    <source>Unknown</source>
+    <target>Ismeretlen</target>
+</phrase>
+<phrase>
+    <source>Value</source>
+    <target>ÃrtÃ©k</target>
+</phrase>
+<phrase>
+    <source>Default</source>
+    <target>AlapÃ©rtelmezett</target>
+</phrase>
+<phrase>
+    <source>New</source>
+    <target>Ãj</target>
+</phrase>
+<phrase>
+    <source>Level</source>
+    <target>Szint</target>
+</phrase>
+<phrase>
+    <source>Location</source>
+    <target>Hely</target>
+</phrase>
+<phrase>
+    <source>Reload</source>
+    <target>ÃjratÃ¶ltÃ©s</target>
+</phrase>
+<phrase>
+    <source>Pictures</source>
+    <target>KÃ©pek</target>
+</phrase>
+<phrase>
+    <source>Battery</source>
+    <target>Elem</target>
+</phrase>
+<phrase>
+    <source>No error</source>
+    <target>Nincs hiba</target>
+</phrase>
+<phrase>
+    <source>Whole words</source>
+    <target>Teljes szÃ³</target>
+</phrase>
+<phrase>
+    <source>(Ãj bejegyzÃ©s)</source>
+    <target></target>
+</phrase>
+<phrase>
+    <source>Horizontal</source>
+    <target>VÃ­zszintes</target>
+</phrase>
+<phrase>
+    <source>Enabled</source>
+    <target>EngedÃ©lyezve</target>
+</phrase>
+<phrase>
+    <source>Up</source>
+    <target>Fel</target>
+</phrase>
+<phrase>
+    <source>Down</source>
+    <target>Le</target>
+</phrase>
+</QPH>
Index: trunk/tools/linguist/phrasebooks/russian.qph
===================================================================
--- trunk/tools/linguist/phrasebooks/russian.qph	(revision 769)
+++ trunk/tools/linguist/phrasebooks/russian.qph	(revision 846)
@@ -504,5 +504,5 @@
 <phrase>
     <source>Next</source>
-    <target>Ð¡Ð»ÐµÐŽÑÑÑÐžÐ¹</target>
+    <target>ÐÐ°Ð»ÐµÐµ</target>
 </phrase>
 <phrase>
@@ -837,5 +837,5 @@
 <phrase>
     <source>slider</source>
-    <target>Ð¿ÐŸÐ»Ð·ÑÐœÐŸÐº</target>
+    <target>ÑÐµÐ³ÑÐ»ÑÑÐŸÑ</target>
 </phrase>
 <phrase>
@@ -1081,5 +1081,5 @@
 <phrase>
     <source>Next</source>
-    <target>ÐÐ°Ð»ÐµÐµ</target>
+    <target>Ð¡Ð»ÐµÐŽÑÑÑÐžÐ¹</target>
 </phrase>
 <phrase>
@@ -1216,3 +1216,15 @@
     <target>ÐÐŸÑÑÑÐ¿ Ð·Ð°Ð¿ÑÐµÑÑÐœ</target>
 </phrase>
+<phrase>
+    <source>Previous</source>
+    <target>ÐÑÐµÐŽÑÐŽÑÑÐžÐ¹</target>
+</phrase>
+<phrase>
+    <source>Next</source>
+    <target>Ð¡Ð»ÐµÐŽÑÑÑÐµÐµ</target>
+</phrase>
+<phrase>
+    <source>Previous</source>
+    <target>ÐÑÐµÐŽÑÐŽÑÑÐµÐµ</target>
+</phrase>
 </QPH>
Index: trunk/tools/linguist/shared/abstractproitemvisitor.h
===================================================================
--- trunk/tools/linguist/shared/abstractproitemvisitor.h	(revision 769)
+++ trunk/tools/linguist/shared/abstractproitemvisitor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/numerus.cpp
===================================================================
--- trunk/tools/linguist/shared/numerus.cpp	(revision 769)
+++ trunk/tools/linguist/shared/numerus.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,5 +65,5 @@
     { Q_EQ, 1, Q_NEWRULE,
       Q_EQ, 2 };
-static const uchar slovakRules[] =
+static const uchar slovakStyleRules[] =
     { Q_EQ, 1, Q_NEWRULE,
       Q_BETWEEN, 2, 4 };
@@ -101,5 +101,5 @@
       Q_EQ, 2, Q_NEWRULE,
       Q_MOD_100 | Q_BETWEEN, 3, 10, Q_NEWRULE,
-      Q_MOD_100 | Q_NOT | Q_BETWEEN, 0, 2 };
+      Q_MOD_100 | Q_GEQ, 11 };
 static const uchar tagalogRules[] =
     { Q_LEQ, 1, Q_NEWRULE,
@@ -115,5 +115,5 @@
 static const char * const latvianForms[] = { "Singular", "Plural", "Nullar", 0 };
 static const char * const irishStyleForms[] = { "Singular", "Dual", "Plural", 0 };
-static const char * const slovakForms[] = { "Singular", "Paucal", "Plural", 0 };
+static const char * const slovakStyleForms[] = { "Singular", "Paucal", "Plural", 0 };
 static const char * const macedonianForms[] = { "Singular", "Dual", "Plural", 0 };
 static const char * const lithuanianForms[] = { "Singular", "Paucal", "Plural", 0 };
@@ -280,5 +280,5 @@
     EOL
 };
-static const QLocale::Language slovakLanguages[] = { QLocale::Slovak, QLocale::Czech, EOL };
+static const QLocale::Language slovakStyleLanguages[] = { QLocale::Slovak, QLocale::Czech, EOL };
 static const QLocale::Language macedonianLanguage[] = { QLocale::Macedonian, EOL };
 static const QLocale::Language lithuanianLanguage[] = { QLocale::Lithuanian, EOL };
@@ -319,26 +319,43 @@
     const QLocale::Language *languages;
     const QLocale::Country *countries;
+    const char * const gettextRules;
 };
 
 static const NumerusTableEntry numerusTable[] = {
-    { 0, 0, japaneseStyleForms, japaneseStyleLanguages, 0 },
-    { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0 },
+    { 0, 0, japaneseStyleForms, japaneseStyleLanguages, 0, "nplurals=1; plural=0;" },
+    { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0,
+      "nplurals=2; plural=(n != 1);" },
     { frenchStyleRules, sizeof(frenchStyleRules), frenchStyleForms, frenchStyleLanguages,
-      frenchStyleCountries },
-    { latvianRules, sizeof(latvianRules), latvianForms, latvianLanguage, 0 },
-    { icelandicRules, sizeof(icelandicRules), icelandicForms, icelandicLanguage, 0 },
-    { irishStyleRules, sizeof(irishStyleRules), irishStyleForms, irishStyleLanguages, 0 },
-    { slovakRules, sizeof(slovakRules), slovakForms, slovakLanguages, 0 },
-    { macedonianRules, sizeof(macedonianRules), macedonianForms, macedonianLanguage, 0 },
-    { lithuanianRules, sizeof(lithuanianRules), lithuanianForms, lithuanianLanguage, 0 },
-    { russianStyleRules, sizeof(russianStyleRules), russianStyleForms, russianStyleLanguages, 0 },
-    { polishRules, sizeof(polishRules), polishForms, polishLanguage, 0 },
-    { romanianRules, sizeof(romanianRules), romanianForms, romanianLanguages, 0 },
-    { slovenianRules, sizeof(slovenianRules), slovenianForms, slovenianLanguage, 0 },
-    { malteseRules, sizeof(malteseRules), malteseForms, malteseLanguage, 0 },
-    { welshRules, sizeof(welshRules), welshForms, welshLanguage, 0 },
-    { arabicRules, sizeof(arabicRules), arabicForms, arabicLanguage, 0 },
-    { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0 },
-    { catalanRules, sizeof(catalanRules), catalanForms, catalanLanguage, 0 }
+      frenchStyleCountries, "nplurals=2; plural=(n > 1);" },
+    { latvianRules, sizeof(latvianRules), latvianForms, latvianLanguage, 0,
+      "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);" },
+    { icelandicRules, sizeof(icelandicRules), icelandicForms, icelandicLanguage, 0,
+      "nplurals=2; plural=(n%10==1 && n%100!=11 ? 0 : 1);" },
+    { irishStyleRules, sizeof(irishStyleRules), irishStyleForms, irishStyleLanguages, 0,
+      "nplurals=3; plural=(n==1 ? 0 : n==2 ? 1 : 2);" },
+    { slovakStyleRules, sizeof(slovakStyleRules), slovakStyleForms, slovakStyleLanguages, 0,
+      "nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);" },
+    { macedonianRules, sizeof(macedonianRules), macedonianForms, macedonianLanguage, 0,
+      "nplurals=3; plural=(n%100==1 ? 0 : n%100==2 ? 1 : 2);" },
+    { lithuanianRules, sizeof(lithuanianRules), lithuanianForms, lithuanianLanguage, 0,
+      "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);" },
+    { russianStyleRules, sizeof(russianStyleRules), russianStyleForms, russianStyleLanguages, 0,
+      "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" },
+    { polishRules, sizeof(polishRules), polishForms, polishLanguage, 0,
+      "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" },
+    { romanianRules, sizeof(romanianRules), romanianForms, romanianLanguages, 0,
+      "nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);" },
+    { slovenianRules, sizeof(slovenianRules), slovenianForms, slovenianLanguage, 0,
+      "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);" },
+    { malteseRules, sizeof(malteseRules), malteseForms, malteseLanguage, 0,
+      "nplurals=4; plural=(n==1 ? 0 : (n==0 || (n%100>=1 && n%100<=10)) ? 1 : (n%100>=11 && n%100<=19) ? 2 : 3);" },
+    { welshRules, sizeof(welshRules), welshForms, welshLanguage, 0,
+      "nplurals=5; plural=(n==0 ? 0 : n==1 ? 1 : (n>=2 && n<=5) ? 2 : n==6 ? 3 : 4);" },
+    { arabicRules, sizeof(arabicRules), arabicForms, arabicLanguage, 0,
+      "nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : (n%100>=3 && n%100<=10) ? 3 : n%100>=11 ? 4 : 5);" },
+    { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0,
+      "nplurals=3; plural=(n==1 ? 0 : (n%10==4 || n%10==6 || n%10== 9) ? 1 : 2);" },
+    { catalanRules, sizeof(catalanRules), catalanForms, catalanLanguage, 0,
+      "nplurals=3; plural=(n==1 ? 0 : (n==11 || n/1000==11 || n/1000000==11 || n/1000000000==11) ? 1 : 2);" },
 };
 
@@ -353,5 +370,5 @@
 
 bool getNumerusInfo(QLocale::Language language, QLocale::Country country,
-                           QByteArray *rules, QStringList *forms)
+                    QByteArray *rules, QStringList *forms, const char **gettextRules)
 {
     while (true) {
@@ -366,4 +383,6 @@
                                                     entry.rulesSize);
                     }
+                    if (gettextRules)
+                        *gettextRules = entry.gettextRules;
                     if (forms) {
                         forms->clear();
Index: trunk/tools/linguist/shared/po.cpp
===================================================================
--- trunk/tools/linguist/shared/po.cpp	(revision 769)
+++ trunk/tools/linguist/shared/po.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -46,9 +46,8 @@
 #include <QtCore/QHash>
 #include <QtCore/QString>
+#include <QtCore/QTextCodec>
 #include <QtCore/QTextStream>
 
 #include <ctype.h>
-
-#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries"
 
 // Uncomment if you wish to hard wrap long lines in .po files. Note that this
@@ -202,16 +201,16 @@
 
 public:
-    QString id;
-    QString context;
-    QString tscomment;
-    QString oldTscomment;
-    QString lineNumber;
-    QString fileName;
-    QString references;
-    QString translatorComments;
-    QString automaticComments;
-    QString msgId;
-    QString oldMsgId;
-    QStringList msgStr;
+    QByteArray id;
+    QByteArray context;
+    QByteArray tscomment;
+    QByteArray oldTscomment;
+    QByteArray lineNumber;
+    QByteArray fileName;
+    QByteArray references;
+    QByteArray translatorComments;
+    QByteArray automaticComments;
+    QByteArray msgId;
+    QByteArray oldMsgId;
+    QList<QByteArray> msgStr;
     bool isPlural;
     bool isFuzzy;
@@ -220,23 +219,22 @@
 
 
-static bool isTranslationLine(const QString &line)
-{
-    return line.startsWith(QLatin1String("#~ msgstr"))
-           || line.startsWith(QLatin1String("msgstr"));
-}
-
-static QString slurpEscapedString(const QStringList &lines, int & l,
-        int offset, const QString &prefix, ConversionData &cd)
-{
-    QString msg;
+static bool isTranslationLine(const QByteArray &line)
+{
+    return line.startsWith("#~ msgstr") || line.startsWith("msgstr");
+}
+
+static QByteArray slurpEscapedString(const QList<QByteArray> &lines, int &l,
+        int offset, const QByteArray &prefix, ConversionData &cd)
+{
+    QByteArray msg;
     int stoff;
 
     for (; l < lines.size(); ++l) {
-        const QString &line = lines.at(l);
+        const QByteArray &line = lines.at(l);
         if (line.isEmpty() || !line.startsWith(prefix))
             break;
-        while (line[offset].isSpace()) // No length check, as string has no trailing spaces.
+        while (isspace(line[offset])) // No length check, as string has no trailing spaces.
             offset++;
-        if (line[offset].unicode() != '"')
+        if (line[offset] != '"')
             break;
         offset++;
@@ -244,11 +242,11 @@
             if (offset == line.length())
                 goto premature_eol;
-            ushort c = line[offset++].unicode();
+            uchar c = line[offset++];
             if (c == '"') {
                 if (offset == line.length())
                     break;
-                while (line[offset].isSpace())
+                while (isspace(line[offset]))
                     offset++;
-                if (line[offset++].unicode() != '"') {
+                if (line[offset++] != '"') {
                     cd.appendError(QString::fromLatin1(
                             "PO parsing error: extra characters on line %1.")
@@ -261,32 +259,32 @@
                 if (offset == line.length())
                     goto premature_eol;
-                c = line[offset++].unicode();
+                c = line[offset++];
                 switch (c) {
                 case 'r':
-                    msg += QLatin1Char('\r'); // Maybe just throw it away?
+                    msg += '\r'; // Maybe just throw it away?
                     break;
                 case 'n':
-                    msg += QLatin1Char('\n');
+                    msg += '\n';
                     break;
                 case 't':
-                    msg += QLatin1Char('\t');
+                    msg += '\t';
                     break;
                 case 'v':
-                    msg += QLatin1Char('\v');
+                    msg += '\v';
                     break;
                 case 'a':
-                    msg += QLatin1Char('\a');
+                    msg += '\a';
                     break;
                 case 'b':
-                    msg += QLatin1Char('\b');
+                    msg += '\b';
                     break;
                 case 'f':
-                    msg += QLatin1Char('\f');
+                    msg += '\f';
                     break;
                 case '"':
-                    msg += QLatin1Char('"');
+                    msg += '"';
                     break;
                 case '\\':
-                    msg += QLatin1Char('\\');
+                    msg += '\\';
                     break;
                 case '0':
@@ -299,26 +297,26 @@
                 case '7':
                     stoff = offset - 1;
-                    while ((c = line[offset].unicode()) >= '0' && c <= '7')
+                    while ((c = line[offset]) >= '0' && c <= '7')
                         if (++offset == line.length())
                             goto premature_eol;
-                    msg += QChar(line.mid(stoff, offset - stoff).toUInt(0, 8));
+                    msg += line.mid(stoff, offset - stoff).toUInt(0, 8);
                     break;
                 case 'x':
                     stoff = offset;
-                    while (isxdigit(line[offset].unicode()))
+                    while (isxdigit(line[offset]))
                         if (++offset == line.length())
                             goto premature_eol;
-                    msg += QChar(line.mid(stoff, offset - stoff).toUInt(0, 16));
+                    msg += line.mid(stoff, offset - stoff).toUInt(0, 16);
                     break;
                 default:
                     cd.appendError(QString::fromLatin1(
                             "PO parsing error: invalid escape '\\%1' (line %2).")
-                            .arg(QChar(c)).arg(l + 1));
-                    msg += QLatin1Char('\\');
-                    msg += QChar(c);
+                            .arg(QChar((uint)c)).arg(l + 1));
+                    msg += '\\';
+                    msg += c;
                     break;
                 }
             } else {
-                msg += QChar(c);
+                msg += c;
             }
         }
@@ -331,13 +329,12 @@
     cd.appendError(QString::fromLatin1(
             "PO parsing error: premature end of line %1.").arg(l + 1));
-    return QString();
-}
-
-static void slurpComment(QString &msg, const QStringList &lines, int & l)
-{
-    const QChar newline = QLatin1Char('\n');
-    QString prefix = lines.at(l);
+    return QByteArray();
+}
+
+static void slurpComment(QByteArray &msg, const QList<QByteArray> &lines, int & l)
+{
+    QByteArray prefix = lines.at(l);
     for (int i = 1; ; i++) {
-        if (prefix.at(i).unicode() != ' ') {
+        if (prefix.at(i) != ' ') {
             prefix.truncate(i);
             break;
@@ -345,20 +342,69 @@
     }
     for (; l < lines.size(); ++l) {
-        const QString &line = lines.at(l);
+        const QByteArray &line = lines.at(l);
         if (line.startsWith(prefix))
             msg += line.mid(prefix.size());
-        else if (line != QLatin1String("#"))
-            break;
-        msg += newline;
+        else if (line != "#")
+            break;
+        msg += '\n';
     }
     --l;
 }
 
+static void splitContext(QByteArray *comment, QByteArray *context)
+{
+    char *data = comment->data();
+    int len = comment->size();
+    int sep = -1, j = 0;
+
+    for (int i = 0; i < len; i++, j++) {
+        if (data[i] == '~' && i + 1 < len)
+            i++;
+        else if (data[i] == '|')
+            sep = j;
+        data[j] = data[i];
+    }
+    if (sep >= 0) {
+        QByteArray tmp = comment->mid(sep + 1, j - sep - 1);
+        comment->truncate(sep);
+        *context = *comment;
+        *comment = tmp;
+    } else {
+        comment->truncate(j);
+    }
+}
+
+static QString makePoHeader(const QString &str)
+{
+    return QLatin1String("po-header-") + str.toLower().replace(QLatin1Char('-'), QLatin1Char('_'));
+}
+
+static QByteArray QByteArrayList_join(const QList<QByteArray> &that, char sep)
+{
+    int totalLength = 0;
+    const int size = that.size();
+
+    for (int i = 0; i < size; ++i)
+        totalLength += that.at(i).size();
+
+    if (size > 0)
+        totalLength += size - 1;
+
+    QByteArray res;
+    if (totalLength == 0)
+        return res;
+    res.reserve(totalLength);
+    for (int i = 0; i < that.size(); ++i) {
+        if (i)
+            res += sep;
+        res += that.at(i);
+    }
+    return res;
+}
+
 bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd)
 {
-    const QChar quote = QLatin1Char('"');
-    const QChar newline = QLatin1Char('\n');
-    QTextStream in(&dev);
-    in.setCodec(cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource);
+    QTextCodec *codec = QTextCodec::codecForName(
+            cd.m_codecForSource.isEmpty() ? QByteArray("UTF-8") : cd.m_codecForSource);
     bool error = false;
 
@@ -381,74 +427,171 @@
 
     // we need line based lookahead below.
-    QStringList lines;
-    while (!in.atEnd())
-        lines.append(in.readLine().trimmed());
-    lines.append(QString());
-
-    int l = 0;
+    QList<QByteArray> lines;
+    while (!dev.atEnd())
+        lines.append(dev.readLine().trimmed());
+    lines.append(QByteArray());
+
+    int l = 0, lastCmtLine = -1;
+    bool qtContexts = false;
     PoItem item;
     for (; l != lines.size(); ++l) {
-        QString line = lines.at(l);
+        QByteArray line = lines.at(l);
         if (line.isEmpty())
            continue;
         if (isTranslationLine(line)) {
-            bool isObsolete = line.startsWith(QLatin1String("#~ msgstr"));
-            const QString prefix = QLatin1String(isObsolete ? "#~ " : "");
+            bool isObsolete = line.startsWith("#~ msgstr");
+            const QByteArray prefix = isObsolete ? "#~ " : "";
             while (true) {
-                int idx = line.indexOf(QLatin1Char(' '), prefix.length());
-                QString str = slurpEscapedString(lines, l, idx, prefix, cd);
+                int idx = line.indexOf(' ', prefix.length());
+                QByteArray str = slurpEscapedString(lines, l, idx, prefix, cd);
+                item.msgStr.append(str);
+                if (l + 1 >= lines.size() || !isTranslationLine(lines.at(l + 1)))
+                    break;
+                ++l;
+                line = lines.at(l);
+            }
+            if (item.msgId.isEmpty()) {
+                QHash<QString, QByteArray> extras;
+                QList<QByteArray> hdrOrder;
+                QByteArray pluralForms;
+                foreach (const QByteArray &hdr, item.msgStr.first().split('\n')) {
+                    if (hdr.isEmpty())
+                        continue;
+                    int idx = hdr.indexOf(':');
+                    if (idx < 0) {
+                        cd.appendError(QString::fromLatin1("Unexpected PO header format '%1'")
+                            .arg(QString::fromLatin1(hdr)));
+                        error = true;
+                        break;
+                    }
+                    QByteArray hdrName = hdr.left(idx).trimmed();
+                    QByteArray hdrValue = hdr.mid(idx + 1).trimmed();
+                    hdrOrder << hdrName;
+                    if (hdrName == "X-Language") {
+                        translator.setLanguageCode(QString::fromLatin1(hdrValue));
+                    } else if (hdrName == "X-Source-Language") {
+                        translator.setSourceLanguageCode(QString::fromLatin1(hdrValue));
+                    } else if (hdrName == "X-Qt-Contexts") {
+                        qtContexts = (hdrValue == "true");
+                    } else if (hdrName == "Plural-Forms") {
+                        pluralForms  = hdrValue;
+                    } else if (hdrName == "MIME-Version") {
+                        // just assume it is 1.0
+                    } else if (hdrName == "Content-Type") {
+                        if (cd.m_codecForSource.isEmpty()) {
+                            if (!hdrValue.startsWith("text/plain; charset=")) {
+                                cd.appendError(QString::fromLatin1("Unexpected Content-Type header '%1'")
+                                    .arg(QString::fromLatin1(hdrValue)));
+                                error = true;
+                                // This will avoid a flood of conversion errors.
+                                codec = QTextCodec::codecForName("latin1");
+                            } else {
+                                QByteArray cod = hdrValue.mid(20);
+                                QTextCodec *cdc = QTextCodec::codecForName(cod);
+                                if (!cdc) {
+                                    cd.appendError(QString::fromLatin1("Unsupported codec '%1'")
+                                            .arg(QString::fromLatin1(cod)));
+                                    error = true;
+                                    // This will avoid a flood of conversion errors.
+                                    codec = QTextCodec::codecForName("latin1");
+                                } else {
+                                    codec = cdc;
+                                }
+                            }
+                        }
+                    } else if (hdrName == "Content-Transfer-Encoding") {
+                        if (hdrValue != "8bit") {
+                            cd.appendError(QString::fromLatin1("Unexpected Content-Transfer-Encoding '%1'")
+                                .arg(QString::fromLatin1(hdrValue)));
+                            return false;
+                        }
+                    } else if (hdrName == "X-Virgin-Header") {
+                        // legacy
+                    } else {
+                        extras[makePoHeader(QString::fromLatin1(hdrName))] = hdrValue;
+                    }
+                }
+                if (!pluralForms.isEmpty()) {
+                    if (translator.languageCode().isEmpty()) {
+                        extras[makePoHeader(QLatin1String("Plural-Forms"))] = pluralForms;
+                    } else {
+                         // FIXME: have fun with making a consistency check ...
+                    }
+                }
+                // Eliminate the field if only headers we added are present in standard order.
+                // Keep in sync with savePO
+                static const char * const dfltHdrs[] = {
+                    "MIME-Version", "Content-Type", "Content-Transfer-Encoding",
+                    "Plural-Forms", "X-Language", "X-Source-Language", "X-Qt-Contexts"
+                };
+                uint cdh = 0;
+                for (int cho = 0; cho < hdrOrder.length(); cho++) {
+                    for (;; cdh++) {
+                        if (cdh == sizeof(dfltHdrs)/sizeof(dfltHdrs[0])) {
+                            extras[QLatin1String("po-headers")] =
+                                    QByteArrayList_join(hdrOrder, ',');
+                            goto doneho;
+                        }
+                        if (hdrOrder.at(cho) == dfltHdrs[cdh]) {
+                            cdh++;
+                            break;
+                        }
+                    }
+                }
+              doneho:
+                if (lastCmtLine != -1)
+                    extras[QLatin1String("po-header_comment")] =
+                            QByteArrayList_join(lines.mid(0, lastCmtLine + 1), '\n');
+                for (QHash<QString, QByteArray>::ConstIterator it = extras.constBegin(),
+                                                               end = extras.constEnd();
+                     it != end; ++it)
+                    translator.setExtra(it.key(), codec->toUnicode(it.value()));
+                item = PoItem();
+                continue;
+            }
+            // build translator message
+            TranslatorMessage msg;
+            msg.setContext(codec->toUnicode(item.context));
+            if (!item.references.isEmpty()) {
+                QString xrefs;
+                foreach (const QString &ref,
+                         codec->toUnicode(item.references).split(
+                                 QRegExp(QLatin1String("\\s")), QString::SkipEmptyParts)) {
+                    int pos = ref.indexOf(QLatin1Char(':'));
+                    int lpos = ref.lastIndexOf(QLatin1Char(':'));
+                    if (pos != -1 && pos == lpos) {
+                        bool ok;
+                        int lno = ref.mid(pos + 1).toInt(&ok);
+                        if (ok) {
+                            msg.addReference(ref.left(pos), lno);
+                            continue;
+                        }
+                    }
+                    if (!xrefs.isEmpty())
+                        xrefs += QLatin1Char(' ');
+                    xrefs += ref;
+                }
+                if (!xrefs.isEmpty())
+                    item.extra[QLatin1String("po-references")] = xrefs;
+            }
+            msg.setId(codec->toUnicode(item.id));
+            msg.setSourceText(codec->toUnicode(item.msgId));
+            msg.setOldSourceText(codec->toUnicode(item.oldMsgId));
+            msg.setComment(codec->toUnicode(item.tscomment));
+            msg.setOldComment(codec->toUnicode(item.oldTscomment));
+            msg.setExtraComment(codec->toUnicode(item.automaticComments));
+            msg.setTranslatorComment(codec->toUnicode(item.translatorComments));
+            msg.setPlural(item.isPlural || item.msgStr.size() > 1);
+            QStringList translations;
+            foreach (const QByteArray &bstr, item.msgStr) {
+                QString str = codec->toUnicode(bstr);
                 str.replace(QChar(Translator::TextVariantSeparator),
                             QChar(Translator::BinaryVariantSeparator));
-                item.msgStr.append(str);
-                if (l + 1 >= lines.size() || !isTranslationLine(lines.at(l + 1)))
-                    break;
-                ++l;
-                line = lines.at(l);
-            }
-            if (item.msgId.isEmpty()) {
-                QRegExp rx(QLatin1String("\\bX-Language: ([^\n]*)\n"));
-                int idx = rx.indexIn(item.msgStr.first());
-                if (idx >= 0) {
-                    translator.setLanguageCode(rx.cap(1));
-                    item.msgStr.first().remove(idx, rx.matchedLength());
-                }
-                QRegExp rx2(QLatin1String("\\bX-Source-Language: ([^\n]*)\n"));
-                int idx2 = rx2.indexIn(item.msgStr.first());
-                if (idx2 >= 0) {
-                    translator.setSourceLanguageCode(rx2.cap(1));
-                    item.msgStr.first().remove(idx2, rx2.matchedLength());
-                }
-                if (item.msgStr.first().indexOf(
-                        QRegExp(QLatin1String("\\bX-Virgin-Header:[^\n]*\n"))) >= 0) {
-                    item = PoItem();
-                    continue;
-                }
-            }
-            // build translator message
-            TranslatorMessage msg;
-            msg.setContext(item.context);
-            if (!item.references.isEmpty()) {
-                foreach (const QString &ref,
-                         item.references.split(QRegExp(QLatin1String("\\s")),
-                                               QString::SkipEmptyParts)) {
-                    int pos = ref.lastIndexOf(QLatin1Char(':'));
-                    if (pos != -1)
-                        msg.addReference(ref.left(pos), ref.mid(pos + 1).toInt());
-                }
-            } else if (isObsolete) {
-                msg.setFileName(QLatin1String(MAGIC_OBSOLETE_REFERENCE));
-            }
-            msg.setId(item.id);
-            msg.setSourceText(item.msgId);
-            msg.setOldSourceText(item.oldMsgId);
-            msg.setComment(item.tscomment);
-            msg.setOldComment(item.oldTscomment);
-            msg.setExtraComment(item.automaticComments);
-            msg.setTranslatorComment(item.translatorComments);
-            msg.setPlural(item.isPlural || item.msgStr.size() > 1);
-            msg.setTranslations(item.msgStr);
+                translations << str;
+            }
+            msg.setTranslations(translations);
             if (isObsolete)
                 msg.setType(TranslatorMessage::Obsolete);
-            else if (item.isFuzzy)
+            else if (item.isFuzzy || (!msg.sourceText().isEmpty() && !msg.isTranslated()))
                 msg.setType(TranslatorMessage::Unfinished);
             else
@@ -461,16 +604,17 @@
             translator.append(msg);
             item = PoItem();
-        } else if (line.startsWith(QLatin1Char('#'))) {
-            switch(line.size() < 2 ? 0 : line.at(1).unicode()) {
+        } else if (line.startsWith('#')) {
+            switch (line.size() < 2 ? 0 : line.at(1)) {
                 case ':':
                     item.references += line.mid(3);
-                    item.references += newline;
+                    item.references += '\n';
                     break;
                 case ',': {
                     QStringList flags =
-                            line.mid(2).split(QRegExp(QLatin1String("[, ]")),
-                                              QString::SkipEmptyParts);
+                            QString::fromLatin1(line.mid(2)).split(
+                                    QRegExp(QLatin1String("[, ]")), QString::SkipEmptyParts);
                     if (flags.removeOne(QLatin1String("fuzzy")))
                         item.isFuzzy = true;
+                    flags.removeOne(QLatin1String("qt-format"));
                     TranslatorMessage::ExtraData::const_iterator it =
                             item.extra.find(QLatin1String("po-flags"));
@@ -482,5 +626,5 @@
                 }
                 case 0:
-                    item.translatorComments += newline;
+                    item.translatorComments += '\n';
                     break;
                 case ' ':
@@ -488,62 +632,71 @@
                     break;
                 case '.':
-                    if (line.startsWith(QLatin1String("#. ts-context "))) {
+                    if (line.startsWith("#. ts-context ")) { // legacy
                         item.context = line.mid(14);
-                    } else if (line.startsWith(QLatin1String("#. ts-id "))) {
+                    } else if (line.startsWith("#. ts-id ")) {
                         item.id = line.mid(9);
                     } else {
                         item.automaticComments += line.mid(3);
-                        item.automaticComments += newline;
+                        item.automaticComments += '\n';
                     }
                     break;
                 case '|':
-                    if (line.startsWith(QLatin1String("#| msgid "))) {
-                        item.oldMsgId = slurpEscapedString(lines, l, 9, QLatin1String("#| "), cd);
-                    } else if (line.startsWith(QLatin1String("#| msgid_plural "))) {
-                        QString extra = slurpEscapedString(lines, l, 16, QLatin1String("#| "), cd);
+                    if (line.startsWith("#| msgid ")) {
+                        item.oldMsgId = slurpEscapedString(lines, l, 9, "#| ", cd);
+                    } else if (line.startsWith("#| msgid_plural ")) {
+                        QByteArray extra = slurpEscapedString(lines, l, 16, "#| ", cd);
                         if (extra != item.oldMsgId)
-                            item.extra[QLatin1String("po-old_msgid_plural")] = extra;
-                    } else if (line.startsWith(QLatin1String("#| msgctxt "))) {
-                        item.oldTscomment = slurpEscapedString(lines, l, 11, QLatin1String("#| "), cd);
+                            item.extra[QLatin1String("po-old_msgid_plural")] =
+                                    codec->toUnicode(extra);
+                    } else if (line.startsWith("#| msgctxt ")) {
+                        item.oldTscomment = slurpEscapedString(lines, l, 11, "#| ", cd);
+                        if (qtContexts)
+                            splitContext(&item.oldTscomment, &item.context);
                     } else {
-                        cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
-                            .arg(l + 1).arg(lines[l]));
+                        cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
+                            .arg(l + 1).arg(codec->toUnicode(lines[l])));
                         error = true;
                     }
                     break;
                 case '~':
-                    if (line.startsWith(QLatin1String("#~ msgid "))) {
-                        item.msgId = slurpEscapedString(lines, l, 9, QLatin1String("#~ "), cd);
-                    } else if (line.startsWith(QLatin1String("#~ msgid_plural "))) {
-                        QString extra = slurpEscapedString(lines, l, 16, QLatin1String("#~ "), cd);
+                    if (line.startsWith("#~ msgid ")) {
+                        item.msgId = slurpEscapedString(lines, l, 9, "#~ ", cd);
+                    } else if (line.startsWith("#~ msgid_plural ")) {
+                        QByteArray extra = slurpEscapedString(lines, l, 16, "#~ ", cd);
                         if (extra != item.msgId)
-                            item.extra[QLatin1String("po-msgid_plural")] = extra;
+                            item.extra[QLatin1String("po-msgid_plural")] =
+                                    codec->toUnicode(extra);
                         item.isPlural = true;
-                    } else if (line.startsWith(QLatin1String("#~ msgctxt "))) {
-                        item.tscomment = slurpEscapedString(lines, l, 11, QLatin1String("#~ "), cd);
+                    } else if (line.startsWith("#~ msgctxt ")) {
+                        item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd);
+                        if (qtContexts)
+                            splitContext(&item.tscomment, &item.context);
                     } else {
-                        cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
-                            .arg(l + 1).arg(lines[l]));
+                        cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
+                            .arg(l + 1).arg(codec->toUnicode(lines[l])));
                         error = true;
                     }
                     break;
                 default:
-                    cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'\n"))
-                        .arg(l + 1).arg(lines[l]));
+                    cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'"))
+                        .arg(l + 1).arg(codec->toUnicode(lines[l])));
                     error = true;
                     break;
             }
-        } else if (line.startsWith(QLatin1String("msgctxt "))) {
-            item.tscomment = slurpEscapedString(lines, l, 8, QString(), cd);
-        } else if (line.startsWith(QLatin1String("msgid "))) {
-            item.msgId = slurpEscapedString(lines, l, 6, QString(), cd);
-        } else if (line.startsWith(QLatin1String("msgid_plural "))) {
-            QString extra = slurpEscapedString(lines, l, 13, QString(), cd);
+            lastCmtLine = l;
+        } else if (line.startsWith("msgctxt ")) {
+            item.tscomment = slurpEscapedString(lines, l, 8, QByteArray(), cd);
+            if (qtContexts)
+                splitContext(&item.tscomment, &item.context);
+        } else if (line.startsWith("msgid ")) {
+            item.msgId = slurpEscapedString(lines, l, 6, QByteArray(), cd);
+        } else if (line.startsWith("msgid_plural ")) {
+            QByteArray extra = slurpEscapedString(lines, l, 13, QByteArray(), cd);
             if (extra != item.msgId)
-                item.extra[QLatin1String("po-msgid_plural")] = extra;
+                item.extra[QLatin1String("po-msgid_plural")] = codec->toUnicode(extra);
             item.isPlural = true;
         } else {
-            cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'\n"))
-                .arg(l + 1).arg(lines[l]));
+            cd.appendError(QString(QLatin1String("PO-format error in line %1: '%2'"))
+                .arg(l + 1).arg(codec->toUnicode(lines[l])));
             error = true;
         }
@@ -552,31 +705,74 @@
 }
 
+static void addPoHeader(Translator::ExtraData &headers, QStringList &hdrOrder,
+                        const char *name, const QString &value)
+{
+    QString qName = QLatin1String(name);
+    if (!hdrOrder.contains(qName))
+        hdrOrder << qName;
+    headers[makePoHeader(qName)] = value;
+}
+
+static QString escapeComment(const QString &in, bool escape)
+{
+    QString out = in;
+    if (escape) {
+        out.replace(QLatin1Char('~'), QLatin1String("~~"));
+        out.replace(QLatin1Char('|'), QLatin1String("~|"));
+    }
+    return out;
+}
+
 bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd)
 {
+    QString str_format = QLatin1String("-format");
+
     bool ok = true;
     QTextStream out(&dev);
     out.setCodec(cd.m_outputCodec.isEmpty() ? QByteArray("UTF-8") : cd.m_outputCodec);
 
-    bool first = true;
-    if (translator.messages().isEmpty() || !translator.messages().first().sourceText().isEmpty()) {
-        out <<
-            "# SOME DESCRIPTIVE TITLE.\n"
-            "# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n"
-            "# This file is distributed under the same license as the PACKAGE package.\n"
-            "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n"
-            "#\n"
-            "#, fuzzy\n"
-            "msgid \"\"\n"
-            "msgstr \"\"\n"
-            "\"X-Virgin-Header: remove this line if you change anything in the header.\\n\"\n";
-        if (!translator.languageCode().isEmpty())
-            out << "\"X-Language: " << translator.languageCode() << "\\n\"\n";
-        if (!translator.sourceLanguageCode().isEmpty())
-            out << "\"X-Source-Language: " << translator.sourceLanguageCode() << "\\n\"\n";
-        first = false;
-    }
+    bool qtContexts = false;
+    foreach (const TranslatorMessage &msg, translator.messages())
+        if (!msg.context().isEmpty()) {
+            qtContexts = true;
+            break;
+        }
+
+    QString cmt = translator.extra(QLatin1String("po-header_comment"));
+    if (!cmt.isEmpty())
+        out << cmt << '\n';
+    out << "msgid \"\"\n";
+    Translator::ExtraData headers = translator.extras();
+    QStringList hdrOrder = translator.extra(QLatin1String("po-headers")).split(
+            QLatin1Char(','), QString::SkipEmptyParts);
+    // Keep in sync with loadPO
+    addPoHeader(headers, hdrOrder, "MIME-Version", QLatin1String("1.0"));
+    addPoHeader(headers, hdrOrder, "Content-Type",
+                QLatin1String("text/plain; charset=" + out.codec()->name()));
+    addPoHeader(headers, hdrOrder, "Content-Transfer-Encoding", QLatin1String("8bit"));
+    if (!translator.languageCode().isEmpty()) {
+        QLocale::Language l;
+        QLocale::Country c;
+        Translator::languageAndCountry(translator.languageCode(), &l, &c);
+        const char *gettextRules;
+        if (getNumerusInfo(l, c, 0, 0, &gettextRules))
+            addPoHeader(headers, hdrOrder, "Plural-Forms", QLatin1String(gettextRules));
+        addPoHeader(headers, hdrOrder, "X-Language", translator.languageCode());
+    }
+    if (!translator.sourceLanguageCode().isEmpty())
+        addPoHeader(headers, hdrOrder, "X-Source-Language", translator.sourceLanguageCode());
+    if (qtContexts)
+        addPoHeader(headers, hdrOrder, "X-Qt-Contexts", QLatin1String("true"));
+    QString hdrStr;
+    foreach (const QString &hdr, hdrOrder) {
+        hdrStr += hdr;
+        hdrStr += QLatin1String(": ");
+        hdrStr += headers.value(makePoHeader(hdr));
+        hdrStr += QLatin1Char('\n');
+    }
+    out << poEscapedString(QString(), QString::fromLatin1("msgstr"), true, hdrStr);
+
     foreach (const TranslatorMessage &msg, translator.messages()) {
-        if (!first)
-            out << endl;
+        out << endl;
 
         if (!msg.translatorComment().isEmpty())
@@ -586,28 +782,49 @@
             out << poEscapedLines(QLatin1String("#."), true, msg.extraComment());
 
-        if (!msg.context().isEmpty())
-            out << QLatin1String("#. ts-context ") << msg.context() << '\n';
         if (!msg.id().isEmpty())
             out << QLatin1String("#. ts-id ") << msg.id() << '\n';
 
-        if (!msg.fileName().isEmpty() && msg.fileName() != QLatin1String(MAGIC_OBSOLETE_REFERENCE)) {
+        QString xrefs = msg.extra(QLatin1String("po-references"));
+        if (!msg.fileName().isEmpty() || !xrefs.isEmpty()) {
             QStringList refs;
             foreach (const TranslatorMessage::Reference &ref, msg.allReferences())
                 refs.append(QString(QLatin1String("%2:%1"))
                                     .arg(ref.lineNumber()).arg(ref.fileName()));
+            if (!xrefs.isEmpty())
+                refs << xrefs;
             out << poWrappedEscapedLines(QLatin1String("#:"), true, refs.join(QLatin1String(" ")));
         }
 
         bool noWrap = false;
+        bool skipFormat = false;
         QStringList flags;
-        if (msg.type() == TranslatorMessage::Unfinished)
+        if (msg.type() == TranslatorMessage::Unfinished && msg.isTranslated())
             flags.append(QLatin1String("fuzzy"));
         TranslatorMessage::ExtraData::const_iterator itr =
                 msg.extras().find(QLatin1String("po-flags"));
         if (itr != msg.extras().end()) {
-            if (itr->split(QLatin1String(", ")).contains(QLatin1String("no-wrap")))
+            QStringList atoms = itr->split(QLatin1String(", "));
+            foreach (const QString &atom, atoms)
+                if (atom.endsWith(str_format)) {
+                    skipFormat = true;
+                    break;
+                }
+            if (atoms.contains(QLatin1String("no-wrap")))
                 noWrap = true;
             flags.append(*itr);
         }
+        if (!skipFormat) {
+            QString source = msg.sourceText();
+            // This is fuzzy logic, as we don't know whether the string is
+            // actually used with QString::arg().
+            for (int off = 0; (off = source.indexOf(QLatin1Char('%'), off)) >= 0; ) {
+                if (++off >= source.length())
+                    break;
+                if (source.at(off) == QLatin1Char('n') || source.at(off).isDigit()) {
+                    flags.append(QLatin1String("qt-format"));
+                    break;
+                }
+            }
+        }
         if (!flags.isEmpty())
             out << "#, " << flags.join(QLatin1String(", ")) << '\n';
@@ -615,5 +832,6 @@
         QString prefix = QLatin1String("#| ");
         if (!msg.oldComment().isEmpty())
-            out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.oldComment());
+            out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap,
+                                   escapeComment(msg.oldComment(), qtContexts));
         if (!msg.oldSourceText().isEmpty())
             out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.oldSourceText());
@@ -622,14 +840,16 @@
             out << poEscapedString(prefix, QLatin1String("msgid_plural"), noWrap, plural);
         prefix = QLatin1String((msg.type() == TranslatorMessage::Obsolete) ? "#~ " : "");
-        if (!msg.comment().isEmpty())
-            out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap, msg.comment());
+        if (!msg.context().isEmpty())
+            out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap,
+                                   escapeComment(msg.context(), true) + QLatin1Char('|')
+                                   + escapeComment(msg.comment(), true));
+        else if (!msg.comment().isEmpty())
+            out << poEscapedString(prefix, QLatin1String("msgctxt"), noWrap,
+                                   escapeComment(msg.comment(), qtContexts));
         out << poEscapedString(prefix, QLatin1String("msgid"), noWrap, msg.sourceText());
         if (!msg.isPlural()) {
             QString transl = msg.translation();
-            if (first) {
-                transl.remove(QRegExp(QLatin1String("\\bX-Language:[^\n]*\n")));
-                if (!translator.languageCode().isEmpty())
-                    transl += QLatin1String("X-Language: ") + translator.languageCode() + QLatin1Char('\n');
-            }
+            transl.replace(QChar(Translator::BinaryVariantSeparator),
+                           QChar(Translator::TextVariantSeparator));
             out << poEscapedString(prefix, QLatin1String("msgstr"), noWrap, transl);
         } else {
@@ -647,7 +867,13 @@
             }
         }
-        first = false;
     }
     return ok;
+}
+
+static bool savePOT(const Translator &translator, QIODevice &dev, ConversionData &cd)
+{
+    Translator ttor = translator;
+    ttor.dropTranslations();
+    return savePO(ttor, dev, cd);
 }
 
@@ -662,4 +888,11 @@
     format.priority = 1;
     Translator::registerFileFormat(format);
+    format.extension = QLatin1String("pot");
+    format.description = QObject::tr("GNU Gettext localization template files");
+    format.loader = &loadPO;
+    format.saver = &savePOT;
+    format.fileType = Translator::FileFormat::TranslationSource;
+    format.priority = -1;
+    Translator::registerFileFormat(format);
     return 1;
 }
Index: trunk/tools/linguist/shared/profileevaluator.cpp
===================================================================
--- trunk/tools/linguist/shared/profileevaluator.cpp	(revision 769)
+++ trunk/tools/linguist/shared/profileevaluator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -2608,5 +2608,5 @@
 {
     if (d->m_verbose && !d->m_skipLevel)
-        qWarning("%s", qPrintable(message));
+        fprintf(stderr, "%s\n", qPrintable(message));
 }
 
@@ -2614,5 +2614,5 @@
 {
     if (!d->m_skipLevel)
-        qWarning("%s", qPrintable(message));
+        fprintf(stderr, "%s\n", qPrintable(message));
 }
 
@@ -2620,5 +2620,5 @@
 {
     if (!d->m_skipLevel)
-        qWarning("%s", qPrintable(message));
+        fprintf(stderr, "%s\n", qPrintable(message));
 }
 
Index: trunk/tools/linguist/shared/profileevaluator.h
===================================================================
--- trunk/tools/linguist/shared/profileevaluator.h	(revision 769)
+++ trunk/tools/linguist/shared/profileevaluator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/proitems.cpp
===================================================================
--- trunk/tools/linguist/shared/proitems.cpp	(revision 769)
+++ trunk/tools/linguist/shared/proitems.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/proitems.h
===================================================================
--- trunk/tools/linguist/shared/proitems.h	(revision 769)
+++ trunk/tools/linguist/shared/proitems.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/proparserutils.h
===================================================================
--- trunk/tools/linguist/shared/proparserutils.h	(revision 769)
+++ trunk/tools/linguist/shared/proparserutils.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/qm.cpp
===================================================================
--- trunk/tools/linguist/shared/qm.cpp	(revision 769)
+++ trunk/tools/linguist/shared/qm.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -565,5 +565,5 @@
     QStringList numerusForms;
     bool guessPlurals = true;
-    if (getNumerusInfo(l, c, 0, &numerusForms))
+    if (getNumerusInfo(l, c, 0, &numerusForms, 0))
         guessPlurals = (numerusForms.count() == 1);
 
@@ -705,5 +705,5 @@
     Translator::languageAndCountry(translator.languageCode(), &l, &c);
     QByteArray rules;
-    if (getNumerusInfo(l, c, &rules, 0))
+    if (getNumerusInfo(l, c, &rules, 0, 0))
         releaser.setNumerusRules(rules);
     releaser.setCodecName(translator.codecName());
@@ -774,9 +774,9 @@
         int generatedCount = finished + unfinished;
         cd.appendError(QCoreApplication::translate("LRelease",
-            "    Generated %n translation(s) (%1 finished and %2 unfinished)\n", 0,
+            "    Generated %n translation(s) (%1 finished and %2 unfinished)", 0,
             QCoreApplication::CodecForTr, generatedCount).arg(finished).arg(unfinished));
         if (untranslated)
             cd.appendError(QCoreApplication::translate("LRelease",
-                "    Ignored %n untranslated source text(s)\n", 0,
+                "    Ignored %n untranslated source text(s)", 0,
                 QCoreApplication::CodecForTr, untranslated));
     }
Index: trunk/tools/linguist/shared/qph.cpp
===================================================================
--- trunk/tools/linguist/shared/qph.cpp	(revision 769)
+++ trunk/tools/linguist/shared/qph.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/simtexth.cpp
===================================================================
--- trunk/tools/linguist/shared/simtexth.cpp	(revision 769)
+++ trunk/tools/linguist/shared/simtexth.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/simtexth.h
===================================================================
--- trunk/tools/linguist/shared/simtexth.h	(revision 769)
+++ trunk/tools/linguist/shared/simtexth.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/translator.cpp
===================================================================
--- trunk/tools/linguist/shared/translator.cpp	(revision 769)
+++ trunk/tools/linguist/shared/translator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,8 +44,15 @@
 #include "simtexth.h"
 
+#include <iostream>
+
 #include <stdio.h>
 #ifdef Q_OS_WIN
-#include <io.h> // required for _setmode, to avoid _O_TEXT streams...
-#include <fcntl.h> // for _O_BINARY
+// required for _setmode, to avoid _O_TEXT streams...
+# ifdef Q_OS_WINCE
+#  include <stdlib.h>
+# else
+#  include <io.h> // for _setmode
+#  include <fcntl.h> // for _O_BINARY
+# endif
 #endif
 
@@ -214,5 +221,9 @@
 #ifdef Q_OS_WIN
         // QFile is broken for text files
+# ifdef Q_OS_WINCE
+        ::_setmode(stdin, _O_BINARY);
+# else
         ::_setmode(0, _O_BINARY);
+# endif
 #endif
         if (!file.open(stdin, QIODevice::ReadOnly)) {
@@ -254,5 +265,9 @@
 #ifdef Q_OS_WIN
         // QFile is broken for text files
+# ifdef Q_OS_WINCE
+        ::_setmode(stdout, _O_BINARY);
+# else
         ::_setmode(1, _O_BINARY);
+# endif
 #endif
         if (!file.open(stdout, QIODevice::WriteOnly)) {
@@ -574,20 +589,19 @@
 {
     if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) {
+        std::cerr << "Warning: dropping duplicate messages in '" << qPrintable(fileName);
         if (!verbose) {
-            qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).",
-                     qPrintable(fileName));
+            std::cerr << "'\n(try -verbose for more info).\n";
         } else {
-            qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName));
+            std::cerr << "':\n";
             foreach (int i, dupes.byId)
-                qWarning("\n* ID: %s", qPrintable(message(i).id()));
+                std::cerr << "\n* ID: " << qPrintable(message(i).id()) << std::endl;
             foreach (int j, dupes.byContents) {
                 const TranslatorMessage &msg = message(j);
-                qWarning("\n* Context: %s\n* Source: %s",
-                        qPrintable(msg.context()),
-                        qPrintable(msg.sourceText()));
+                std::cerr << "\n* Context: " << qPrintable(msg.context())
+                          << "\n* Source: " << qPrintable(msg.sourceText()) << std::endl;
                 if (!msg.comment().isEmpty())
-                    qWarning("* Comment: %s", qPrintable(msg.comment()));
+                    std::cerr << "* Comment: " << qPrintable(msg.comment()) << std::endl;
             }
-            qWarning();
+            std::cerr << std::endl;
         }
     }
@@ -653,5 +667,5 @@
     if (l != QLocale::C) {
         QStringList forms;
-        if (getNumerusInfo(l, c, 0, &forms))
+        if (getNumerusInfo(l, c, 0, &forms, 0))
             numPlurals = forms.count(); // includes singular
     }
@@ -676,5 +690,5 @@
             "Removed plural forms as the target language has less "
             "forms.\nIf this sounds wrong, possibly the target language is "
-            "not set or recognized.\n"));
+            "not set or recognized."));
 }
 
@@ -725,5 +739,5 @@
     if (!codec) {
         if (!name.isEmpty())
-            qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData());
+            std::cerr << "No QTextCodec for " << name.constData() << " available. Using Latin1.\n";
         m_codec = QTextCodec::codecForName("ISO-8859-1");
     } else {
Index: trunk/tools/linguist/shared/translator.h
===================================================================
--- trunk/tools/linguist/shared/translator.h	(revision 769)
+++ trunk/tools/linguist/shared/translator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -93,5 +93,5 @@
 
     void appendError(const QString &error) { m_errors.append(error); }
-    QString error() const { return  m_errors.join(QLatin1String("\n")); }
+    QString error() const { return m_errors.isEmpty() ? QString() : m_errors.join(QLatin1String("\n")) + QLatin1Char('\n'); }
     QStringList errors() const { return  m_errors; }
     void clearErrors() { m_errors.clear(); }
@@ -124,6 +124,6 @@
     Translator();
 
-    bool load(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/);
-    bool save(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/) const;
+    bool load(const QString &filename, ConversionData &err, const QString &format /* = "auto" */);
+    bool save(const QString &filename, ConversionData &err, const QString &format /* = "auto" */) const;
     bool release(QFile *iod, ConversionData &cd) const;
 
@@ -234,5 +234,5 @@
 
 bool getNumerusInfo(QLocale::Language language, QLocale::Country country,
-                           QByteArray *rules, QStringList *forms);
+                    QByteArray *rules, QStringList *forms, const char **gettextRules);
 
 /*
Index: trunk/tools/linguist/shared/translatormessage.cpp
===================================================================
--- trunk/tools/linguist/shared/translatormessage.cpp	(revision 769)
+++ trunk/tools/linguist/shared/translatormessage.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/translatormessage.h
===================================================================
--- trunk/tools/linguist/shared/translatormessage.h	(revision 769)
+++ trunk/tools/linguist/shared/translatormessage.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/ts.cpp
===================================================================
--- trunk/tools/linguist/shared/ts.cpp	(revision 769)
+++ trunk/tools/linguist/shared/ts.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/linguist/shared/ts.dtd
===================================================================
--- trunk/tools/linguist/shared/ts.dtd	(revision 769)
+++ trunk/tools/linguist/shared/ts.dtd	(revision 846)
@@ -5,6 +5,4 @@
  ! The location element is set as optional since it was introduced first in Qt 4.2.
  ! The userdata element is set as optional since it was introduced first in Qt 4.4.
- ! The source and translation elements are optional starting with version 3.0
- ! (Qt 4.6) to support S60 blank messages.
  !
   -->
@@ -37,11 +35,8 @@
 <!-- The encoding to use in the QM file by default. Default is ISO-8859-1. -->
 <!ELEMENT defaultcodec (#PCDATA) >
-<!ELEMENT context (name?, comment?, (context|message)+) >
+<!ELEMENT context (name, comment?, (context|message)+) >
 <!ATTLIST context
           encoding CDATA #IMPLIED>
 <!ELEMENT name %evilstring; >
-<!-- If "no", then the context nesting is for informational puposes only -->
-<!ATTLIST name
-          nest (yes|no) "yes">
 <!-- This is "disambiguation" in the (new) API, or "msgctxt" in gettext speak -->
 <!ELEMENT comment %evilstring; >
@@ -54,10 +49,11 @@
 <!ELEMENT message (location*, source?, oldsource?, comment?, oldcomment?, extracomment?, translatorcomment?, translation?, userdata?, extra-**) >
 <!--
- ! If utf8 is true, the defaultcodec is overridden and the message is encoded
- ! in UTF-8 in the QM file.
+ ! If utf8 is "true", the defaultcodec is overridden and the message is encoded
+ ! in UTF-8 in the QM file. If it is "both", both source encodings are stored
+ ! in the QM file.
   -->
 <!ATTLIST message
           id CDATA #IMPLIED
-          utf8 (true|false) "false"
+          utf8 (true|false|both) "false"
           numerus (yes|no) "no">
 <!ELEMENT location EMPTY>
@@ -101,13 +97,4 @@
 <!ELEMENT numerusform (#PCDATA|byte|lengthvariant)* >
 <!ATTLIST numerusform
-          plurality (nullar|singular|dual|trial|paucal|greaterpaucal|plural|greaterplural) #IMPLIED>
           variants (yes|no) "no">
 <!ELEMENT lengthvariant %evilstring; >
-<!--
- ! The translation variants have a priority between 1 ("highest") and 9 ("lowest")
- ! Typically longer translations get a higher priority.
- ! If omitted, the order of appearance of the variants in the TS files is used.
-  -->
-<!ATTLIST lengthvariant
-          priority (1|2|3|4|5|6|7|8|9) #IMPLIED>
-         
Index: trunk/tools/linguist/shared/xliff.cpp
===================================================================
--- trunk/tools/linguist/shared/xliff.cpp	(revision 769)
+++ trunk/tools/linguist/shared/xliff.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,4 +54,9 @@
 
 
+// The string value is historical and reflects the main purpose: Keeping
+// obsolete entries separate from the magic file message (which both have
+// no location information, but typically reside at opposite ends of the file).
+#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries"
+
 QT_BEGIN_NAMESPACE
 
@@ -504,4 +509,6 @@
         m_sourceLanguage = atts.value(QLatin1String("source-language"));
         m_sourceLanguage.replace(QLatin1Char('-'), QLatin1Char('_'));
+        if (m_sourceLanguage == QLatin1String("en"))
+            m_sourceLanguage.clear();
     } else if (localName == QLatin1String("group")) {
         if (atts.value(QLatin1String("restype")) == QLatin1String(restypeContext)) {
@@ -691,4 +698,7 @@
         return false;
     }
+    if (m_type == TranslatorMessage::Obsolete && m_refs.size() == 1
+        && m_refs.at(0).fileName() == QLatin1String(MAGIC_OBSOLETE_REFERENCE))
+        m_refs.clear();
     TranslatorMessage msg(m_context, m_sources[0],
                           m_comment, QString(), QString(), -1,
@@ -760,10 +770,13 @@
     QList<QString> fileOrder;
     foreach (const TranslatorMessage &msg, translator.messages()) {
-        QHash<QString, QList<TranslatorMessage> > &file = messageOrder[msg.fileName()];
+        QString fn = msg.fileName();
+        if (fn.isEmpty() && msg.type() == TranslatorMessage::Obsolete)
+            fn = QLatin1String(MAGIC_OBSOLETE_REFERENCE);
+        QHash<QString, QList<TranslatorMessage> > &file = messageOrder[fn];
         if (file.isEmpty())
-            fileOrder.append(msg.fileName());
+            fileOrder.append(fn);
         QList<TranslatorMessage> &context = file[msg.context()];
         if (context.isEmpty())
-            contextOrder[msg.fileName()].append(msg.context());
+            contextOrder[fn].append(msg.context());
         context.append(msg);
     }
Index: trunk/tools/macdeployqt/macchangeqt/main.cpp
===================================================================
--- trunk/tools/macdeployqt/macchangeqt/main.cpp	(revision 769)
+++ trunk/tools/macdeployqt/macchangeqt/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/macdeployqt/macdeployqt/main.cpp
===================================================================
--- trunk/tools/macdeployqt/macdeployqt/main.cpp	(revision 769)
+++ trunk/tools/macdeployqt/macdeployqt/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/macdeployqt/shared/shared.cpp
===================================================================
--- trunk/tools/macdeployqt/shared/shared.cpp	(revision 769)
+++ trunk/tools/macdeployqt/shared/shared.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -389,5 +389,5 @@
             changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath);
 
-            // Deploy framework if neccesary.
+            // Deploy framework if necessary.
             if (copiedFrameworks.contains(dependency.frameworkName) == false && frameworks.contains(dependency) == false) {
                 frameworks.append(dependency);
Index: trunk/tools/macdeployqt/shared/shared.h
===================================================================
--- trunk/tools/macdeployqt/shared/shared.h	(revision 769)
+++ trunk/tools/macdeployqt/shared/shared.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/macdeployqt/tests/tst_deployment_mac.cpp
===================================================================
--- trunk/tools/macdeployqt/tests/tst_deployment_mac.cpp	(revision 769)
+++ trunk/tools/macdeployqt/tests/tst_deployment_mac.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/makeqpf/main.cpp
===================================================================
--- trunk/tools/makeqpf/main.cpp	(revision 769)
+++ trunk/tools/makeqpf/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/makeqpf/mainwindow.cpp
===================================================================
--- trunk/tools/makeqpf/mainwindow.cpp	(revision 769)
+++ trunk/tools/makeqpf/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/makeqpf/mainwindow.h
===================================================================
--- trunk/tools/makeqpf/mainwindow.h	(revision 769)
+++ trunk/tools/makeqpf/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/makeqpf/qpf2.cpp
===================================================================
--- trunk/tools/makeqpf/qpf2.cpp	(revision 769)
+++ trunk/tools/makeqpf/qpf2.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -544,5 +544,5 @@
                 }
 
-                qMemCopy(data, img.bits(), img.byteCount());
+                memcpy(data, img.bits(), img.byteCount());
             }
         }
Index: trunk/tools/makeqpf/qpf2.h
===================================================================
--- trunk/tools/makeqpf/qpf2.h	(revision 769)
+++ trunk/tools/makeqpf/qpf2.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/pixeltool/main.cpp
===================================================================
--- trunk/tools/pixeltool/main.cpp	(revision 769)
+++ trunk/tools/pixeltool/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/pixeltool/qpixeltool.cpp
===================================================================
--- trunk/tools/pixeltool/qpixeltool.cpp	(revision 769)
+++ trunk/tools/pixeltool/qpixeltool.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -357,5 +357,5 @@
     freeze.setChecked(tmpFreeze);
     freeze.setShortcut(QKeySequence(Qt::Key_Space));
-    QAction autoUpdate(QLatin1String("Continous update"), &menu);
+    QAction autoUpdate(QLatin1String("Continuous update"), &menu);
     autoUpdate.setCheckable(true);
     autoUpdate.setChecked(m_autoUpdate);
Index: trunk/tools/pixeltool/qpixeltool.h
===================================================================
--- trunk/tools/pixeltool/qpixeltool.h	(revision 769)
+++ trunk/tools/pixeltool/qpixeltool.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/ast.cpp
===================================================================
--- trunk/tools/porting/src/ast.cpp	(revision 769)
+++ trunk/tools/porting/src/ast.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/ast.h
===================================================================
--- trunk/tools/porting/src/ast.h	(revision 769)
+++ trunk/tools/porting/src/ast.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/codemodel.cpp
===================================================================
--- trunk/tools/porting/src/codemodel.cpp	(revision 769)
+++ trunk/tools/porting/src/codemodel.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/codemodel.h
===================================================================
--- trunk/tools/porting/src/codemodel.h	(revision 769)
+++ trunk/tools/porting/src/codemodel.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -97,5 +97,5 @@
 public:
      void add(CollectedType *collectedItem)
-    { insert(collectedItem->name(), collectedItem); }
+    { this->insert(collectedItem->name(), collectedItem); }
 };
 
Index: trunk/tools/porting/src/codemodelattributes.cpp
===================================================================
--- trunk/tools/porting/src/codemodelattributes.cpp	(revision 769)
+++ trunk/tools/porting/src/codemodelattributes.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/codemodelattributes.h
===================================================================
--- trunk/tools/porting/src/codemodelattributes.h	(revision 769)
+++ trunk/tools/porting/src/codemodelattributes.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/codemodelwalker.cpp
===================================================================
--- trunk/tools/porting/src/codemodelwalker.cpp	(revision 769)
+++ trunk/tools/porting/src/codemodelwalker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/codemodelwalker.h
===================================================================
--- trunk/tools/porting/src/codemodelwalker.h	(revision 769)
+++ trunk/tools/porting/src/codemodelwalker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/cpplexer.cpp
===================================================================
--- trunk/tools/porting/src/cpplexer.cpp	(revision 769)
+++ trunk/tools/porting/src/cpplexer.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/cpplexer.h
===================================================================
--- trunk/tools/porting/src/cpplexer.h	(revision 769)
+++ trunk/tools/porting/src/cpplexer.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/errors.cpp
===================================================================
--- trunk/tools/porting/src/errors.cpp	(revision 769)
+++ trunk/tools/porting/src/errors.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,7 +45,7 @@
 QT_BEGIN_NAMESPACE
 
-QT_STATIC_CONST_IMPL Error& Errors::InternalError = Error( 1, -1, QLatin1String("Internal Error") );
-QT_STATIC_CONST_IMPL Error& Errors::SyntaxError = Error( 2, -1, QLatin1String("Syntax Error before '%1'") );
-QT_STATIC_CONST_IMPL Error& Errors::ParseError = Error( 3, -1, QLatin1String("Parse Error before '%1'") );
+QT_STATIC_CONST_IMPL Error Errors::InternalError = Error( 1, -1, QLatin1String("Internal Error") );
+QT_STATIC_CONST_IMPL Error Errors::SyntaxError = Error( 2, -1, QLatin1String("Syntax Error before '%1'") );
+QT_STATIC_CONST_IMPL Error Errors::ParseError = Error( 3, -1, QLatin1String("Parse Error before '%1'") );
 
 QT_END_NAMESPACE
Index: trunk/tools/porting/src/errors.h
===================================================================
--- trunk/tools/porting/src/errors.h	(revision 769)
+++ trunk/tools/porting/src/errors.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -62,7 +62,7 @@
 {
 public:
-    QT_STATIC_CONST Error& InternalError;
-    QT_STATIC_CONST Error& SyntaxError;
-    QT_STATIC_CONST Error& ParseError;
+    QT_STATIC_CONST Error InternalError;
+    QT_STATIC_CONST Error SyntaxError;
+    QT_STATIC_CONST Error ParseError;
 };
 
Index: trunk/tools/porting/src/fileporter.cpp
===================================================================
--- trunk/tools/porting/src/fileporter.cpp	(revision 769)
+++ trunk/tools/porting/src/fileporter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/fileporter.h
===================================================================
--- trunk/tools/porting/src/fileporter.h	(revision 769)
+++ trunk/tools/porting/src/fileporter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/filewriter.cpp
===================================================================
--- trunk/tools/porting/src/filewriter.cpp	(revision 769)
+++ trunk/tools/porting/src/filewriter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/filewriter.h
===================================================================
--- trunk/tools/porting/src/filewriter.h	(revision 769)
+++ trunk/tools/porting/src/filewriter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/list.h
===================================================================
--- trunk/tools/porting/src/list.h	(revision 769)
+++ trunk/tools/porting/src/list.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/logger.cpp
===================================================================
--- trunk/tools/porting/src/logger.cpp	(revision 769)
+++ trunk/tools/porting/src/logger.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/logger.h
===================================================================
--- trunk/tools/porting/src/logger.h	(revision 769)
+++ trunk/tools/porting/src/logger.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/parser.cpp
===================================================================
--- trunk/tools/porting/src/parser.cpp	(revision 769)
+++ trunk/tools/porting/src/parser.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/parser.h
===================================================================
--- trunk/tools/porting/src/parser.h	(revision 769)
+++ trunk/tools/porting/src/parser.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/port.cpp
===================================================================
--- trunk/tools/porting/src/port.cpp	(revision 769)
+++ trunk/tools/porting/src/port.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/portingrules.cpp
===================================================================
--- trunk/tools/porting/src/portingrules.cpp	(revision 769)
+++ trunk/tools/porting/src/portingrules.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/portingrules.h
===================================================================
--- trunk/tools/porting/src/portingrules.h	(revision 769)
+++ trunk/tools/porting/src/portingrules.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/preprocessorcontrol.cpp
===================================================================
--- trunk/tools/porting/src/preprocessorcontrol.cpp	(revision 769)
+++ trunk/tools/porting/src/preprocessorcontrol.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -155,5 +155,5 @@
     if (receivers(SIGNAL(readFile(QByteArray&,QString))) > 0) {
         QByteArray array;
-        // Workaround for "not beeing able to emit from const function"
+        // Workaround for "not being able to emit from const function"
         PreprocessorCache *cache = const_cast<PreprocessorCache *>(this);
         emit cache->readFile(array, filename);
Index: trunk/tools/porting/src/preprocessorcontrol.h
===================================================================
--- trunk/tools/porting/src/preprocessorcontrol.h	(revision 769)
+++ trunk/tools/porting/src/preprocessorcontrol.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/projectporter.cpp
===================================================================
--- trunk/tools/porting/src/projectporter.cpp	(revision 769)
+++ trunk/tools/porting/src/projectporter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/projectporter.h
===================================================================
--- trunk/tools/porting/src/projectporter.h	(revision 769)
+++ trunk/tools/porting/src/projectporter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/proparser.cpp
===================================================================
--- trunk/tools/porting/src/proparser.cpp	(revision 769)
+++ trunk/tools/porting/src/proparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/proparser.h
===================================================================
--- trunk/tools/porting/src/proparser.h	(revision 769)
+++ trunk/tools/porting/src/proparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/q3porting.xml
===================================================================
--- trunk/tools/porting/src/q3porting.xml	(revision 769)
+++ trunk/tools/porting/src/q3porting.xml	(revision 846)
@@ -2,5 +2,5 @@
 <!--************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -1625,8 +1625,4 @@
         <Library>Qt3Support</Library>
         <Name>Q3Wizard</Name>
-    </item>
-    <item Type="Qt4Class" >
-        <Library>QtAssistant</Library>
-        <Name>QAssistantClient</Name>
     </item>
     <item Type="Qt4Class" >
Index: trunk/tools/porting/src/qtsimplexml.cpp
===================================================================
--- trunk/tools/porting/src/qtsimplexml.cpp	(revision 769)
+++ trunk/tools/porting/src/qtsimplexml.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/qtsimplexml.h
===================================================================
--- trunk/tools/porting/src/qtsimplexml.h	(revision 769)
+++ trunk/tools/porting/src/qtsimplexml.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/replacetoken.cpp
===================================================================
--- trunk/tools/porting/src/replacetoken.cpp	(revision 769)
+++ trunk/tools/porting/src/replacetoken.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/replacetoken.h
===================================================================
--- trunk/tools/porting/src/replacetoken.h	(revision 769)
+++ trunk/tools/porting/src/replacetoken.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpp.cpp
===================================================================
--- trunk/tools/porting/src/rpp.cpp	(revision 769)
+++ trunk/tools/porting/src/rpp.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -61,5 +61,5 @@
 {
     m_memoryPool = memoryPool;
-    Source *m_source = createNode<Source>(m_memoryPool); //node whith no parent
+    Source *m_source = createNode<Source>(m_memoryPool); //node with no parent
     m_tokenContainer = tokenContainer;
     m_tokenTypeList = tokenTypeList;
@@ -539,5 +539,5 @@
 /*
     Reads a preprocessor line from the source by advancing lexerTokenIndex and
-    returing a TokenSection containg the read line. Text lines separated by
+    returning a TokenSection containing the read line. Text lines separated by
     an escaped newline are joined.
 */
Index: trunk/tools/porting/src/rpp.h
===================================================================
--- trunk/tools/porting/src/rpp.h	(revision 769)
+++ trunk/tools/porting/src/rpp.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rppexpressionbuilder.cpp
===================================================================
--- trunk/tools/porting/src/rppexpressionbuilder.cpp	(revision 769)
+++ trunk/tools/porting/src/rppexpressionbuilder.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rppexpressionbuilder.h
===================================================================
--- trunk/tools/porting/src/rppexpressionbuilder.h	(revision 769)
+++ trunk/tools/porting/src/rppexpressionbuilder.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpplexer.cpp
===================================================================
--- trunk/tools/porting/src/rpplexer.cpp	(revision 769)
+++ trunk/tools/porting/src/rpplexer.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpplexer.h
===================================================================
--- trunk/tools/porting/src/rpplexer.h	(revision 769)
+++ trunk/tools/porting/src/rpplexer.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpptreeevaluator.cpp
===================================================================
--- trunk/tools/porting/src/rpptreeevaluator.cpp	(revision 769)
+++ trunk/tools/porting/src/rpptreeevaluator.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpptreeevaluator.h
===================================================================
--- trunk/tools/porting/src/rpptreeevaluator.h	(revision 769)
+++ trunk/tools/porting/src/rpptreeevaluator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpptreewalker.cpp
===================================================================
--- trunk/tools/porting/src/rpptreewalker.cpp	(revision 769)
+++ trunk/tools/porting/src/rpptreewalker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/rpptreewalker.h
===================================================================
--- trunk/tools/porting/src/rpptreewalker.h	(revision 769)
+++ trunk/tools/porting/src/rpptreewalker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/semantic.cpp
===================================================================
--- trunk/tools/porting/src/semantic.cpp	(revision 769)
+++ trunk/tools/porting/src/semantic.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -769,5 +769,5 @@
 {
     // If this is a classSpecifier or a EnumSpecifier we skip the name lookup,
-    // becuase looking up the name "E" in a class definition like
+    // because looking up the name "E" in a class definition like
     // "class E { ..." makes no sense. (There might be a variable named E
     // already declared, but that variable is now shadowed by the class type.)
@@ -807,8 +807,8 @@
 
 /*
-    looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList()
-    returns a non-emty list, the C++ qualified name lookup rules are used. Otherwise the
+    Looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList()
+    returns a non-empty list, the C++ qualified name lookup rules are used. Otherwise the
     unquialified name lookup rules are used.  Returns the a list of members that was found,
-    In most cases this list will contain zero or one element, exept in the case of overloaded functions.
+    In most cases this list will contain zero or one element, except in the case of overloaded functions.
     TODO: Argument-dependent name lookup
 */
@@ -976,5 +976,5 @@
 FunctionMember *Semantic::selectFunction(QList<CodeModel::Member*> candidatateList, const DeclaratorAST *functionDeclarator)
 {
-    // get arguments for funciton we are looking for
+    // get arguments for function we are looking for
     FunctionMember testFunction;
     parseFunctionArguments(functionDeclarator, &testFunction);
Index: trunk/tools/porting/src/semantic.h
===================================================================
--- trunk/tools/porting/src/semantic.h	(revision 769)
+++ trunk/tools/porting/src/semantic.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/smallobject.cpp
===================================================================
--- trunk/tools/porting/src/smallobject.cpp	(revision 769)
+++ trunk/tools/porting/src/smallobject.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/smallobject.h
===================================================================
--- trunk/tools/porting/src/smallobject.h	(revision 769)
+++ trunk/tools/porting/src/smallobject.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/textreplacement.cpp
===================================================================
--- trunk/tools/porting/src/textreplacement.cpp	(revision 769)
+++ trunk/tools/porting/src/textreplacement.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/textreplacement.h
===================================================================
--- trunk/tools/porting/src/textreplacement.h	(revision 769)
+++ trunk/tools/porting/src/textreplacement.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,5 +54,5 @@
     QByteArray newText;
     int insertPosition;
-    int currentLenght;    //lenght of the text that is going to be replaced.
+    int currentLenght;    //length of the text that is going to be replaced.
     bool operator<(const TextReplacement &other) const
     {
@@ -71,5 +71,5 @@
         insert maintains the TextReplacement list in sorted order.
 
-        Returns true if the insert was successfull, false otherwise;
+        Returns true if the insert was successful, false otherwise;
     */
     bool insert(QByteArray newText, int insertPosition, int currentLenght);
Index: trunk/tools/porting/src/tokenengine.cpp
===================================================================
--- trunk/tools/porting/src/tokenengine.cpp	(revision 769)
+++ trunk/tools/porting/src/tokenengine.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/tokenengine.h
===================================================================
--- trunk/tools/porting/src/tokenengine.h	(revision 769)
+++ trunk/tools/porting/src/tokenengine.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,5 +56,5 @@
 class TokenContainer;
 /*
-    A token is defined as a start-postion and a lenght. Since the actual text
+    A token is defined as a start-position and a length. Since the actual text
     storage is not reffered to here, Token needs to be used together with
     a TokenContainer in order to be useful.
Index: trunk/tools/porting/src/tokenizer.cpp
===================================================================
--- trunk/tools/porting/src/tokenizer.cpp	(revision 769)
+++ trunk/tools/porting/src/tokenizer.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/tokenizer.h
===================================================================
--- trunk/tools/porting/src/tokenizer.h	(revision 769)
+++ trunk/tools/porting/src/tokenizer.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/tokenreplacements.cpp
===================================================================
--- trunk/tools/porting/src/tokenreplacements.cpp	(revision 769)
+++ trunk/tools/porting/src/tokenreplacements.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -127,5 +127,5 @@
     int tokenIndex = currentIndex;
     QByteArray tokenText;
-    //loop until we get a token containg text or we pass the beginning/end of the source
+    //loop until we get a token containing text or we pass the beginning/end of the source
     tokenIndex += direction;
     while(tokenText.isEmpty() && isValidIndex(tokenIndex)) {
@@ -147,5 +147,5 @@
         return -1;
     QByteArray tokenText;
-   //loop until we get a token containg text or we pass the start of the source
+   //loop until we get a token containing text or we pass the start of the source
     tokenIndex += direction;
     while(tokenText.isEmpty() && isValidIndex(tokenIndex)) {
@@ -267,5 +267,5 @@
         return false;
     // If nameUse is set we test if the nameUse refers to the correct declaration.
-    // This is done by checking the parentScope attriute, wich returns the scope
+    // This is done by checking the parentScope attribute, which returns the scope
     // for the declaration associated with this name use.
     const bool haveNameUseInfo = !attributes->attribute(sourceIndex, "nameUse").isEmpty();
@@ -315,5 +315,5 @@
 
     // If we have no name use info and the source and old scopes don't match,
-    // we generally dont't do a replace, unless the old scope is Qt and
+    // we generally don't do a replace, unless the old scope is Qt and
     // the source scope inherits Qt. For example, QWidget::ButtonState should
     // be renamed to Qt::ButtonState.
Index: trunk/tools/porting/src/tokenreplacements.h
===================================================================
--- trunk/tools/porting/src/tokenreplacements.h	(revision 769)
+++ trunk/tools/porting/src/tokenreplacements.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/tokens.h
===================================================================
--- trunk/tools/porting/src/tokens.h	(revision 769)
+++ trunk/tools/porting/src/tokens.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/tokenstreamadapter.h
===================================================================
--- trunk/tools/porting/src/tokenstreamadapter.h	(revision 769)
+++ trunk/tools/porting/src/tokenstreamadapter.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/translationunit.cpp
===================================================================
--- trunk/tools/porting/src/translationunit.cpp	(revision 769)
+++ trunk/tools/porting/src/translationunit.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/translationunit.h
===================================================================
--- trunk/tools/porting/src/translationunit.h	(revision 769)
+++ trunk/tools/porting/src/translationunit.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/treewalker.cpp
===================================================================
--- trunk/tools/porting/src/treewalker.cpp	(revision 769)
+++ trunk/tools/porting/src/treewalker.cpp	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/porting/src/treewalker.h
===================================================================
--- trunk/tools/porting/src/treewalker.h	(revision 769)
+++ trunk/tools/porting/src/treewalker.h	(revision 846)
@@ -2,5 +2,5 @@
 **
 ** Copyright (C) 2001-2004 Roberto Raggi
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/feature.cpp
===================================================================
--- trunk/tools/qconfig/feature.cpp	(revision 769)
+++ trunk/tools/qconfig/feature.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/feature.h
===================================================================
--- trunk/tools/qconfig/feature.h	(revision 769)
+++ trunk/tools/qconfig/feature.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/featuretreemodel.cpp
===================================================================
--- trunk/tools/qconfig/featuretreemodel.cpp	(revision 769)
+++ trunk/tools/qconfig/featuretreemodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/featuretreemodel.h
===================================================================
--- trunk/tools/qconfig/featuretreemodel.h	(revision 769)
+++ trunk/tools/qconfig/featuretreemodel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/graphics.h
===================================================================
--- trunk/tools/qconfig/graphics.h	(revision 769)
+++ trunk/tools/qconfig/graphics.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qconfig/main.cpp
===================================================================
--- trunk/tools/qconfig/main.cpp	(revision 769)
+++ trunk/tools/qconfig/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -506,5 +506,5 @@
 	"<p></p>"
 	"<p>Version 2.0</p>"
-	"<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>"
+	"<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>"
 	"<p></p>"
     );
Index: trunk/tools/qconfig/qconfig.pro
===================================================================
--- trunk/tools/qconfig/qconfig.pro	(revision 769)
+++ trunk/tools/qconfig/qconfig.pro	(revision 846)
@@ -7,4 +7,3 @@
 HEADERS		= feature.h featuretreemodel.h graphics.h
 SOURCES		= main.cpp feature.cpp featuretreemodel.cpp
-INTERFACES	=
 TARGET		= qconfig
Index: trunk/tools/qdbus/qdbus.pro
===================================================================
--- trunk/tools/qdbus/qdbus.pro	(revision 769)
+++ trunk/tools/qdbus/qdbus.pro	(revision 846)
@@ -1,2 +1,3 @@
 TEMPLATE = subdirs
-SUBDIRS = qdbus qdbusxml2cpp qdbuscpp2xml qdbusviewer
+SUBDIRS = qdbus qdbusxml2cpp qdbuscpp2xml
+!contains(QT_CONFIG, no-gui): SUBDIRS += qdbusviewer
Index: trunk/tools/qdbus/qdbus/qdbus.cpp
===================================================================
--- trunk/tools/qdbus/qdbus/qdbus.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbus/qdbus.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -249,6 +249,6 @@
 }
 
-static void placeCall(const QString &service, const QString &path, const QString &interface,
-               const QString &member, QStringList args)
+static int placeCall(const QString &service, const QString &path, const QString &interface,
+               const QString &member, const QStringList& arguments, bool try_prop=true)
 {
     QDBusInterface iface(service, path, interface, connection);
@@ -257,4 +257,7 @@
     // activate the service if possible.
 
+    QList<int> knownIds;
+    bool matchFound = false;
+    QStringList args = arguments;
     QVariantList params;
     if (!args.isEmpty()) {
@@ -263,101 +266,128 @@
         match += '(';
 
-        int midx = -1;
         for (int i = mo->methodOffset(); i < mo->methodCount(); ++i) {
             QMetaMethod mm = mo->method(i);
             QByteArray signature = mm.signature();
-            if (signature.startsWith(match)) {
-                midx = i;
-                break;
+            if (signature.startsWith(match))
+                knownIds += i;
+         }
+
+
+        while (!matchFound) {
+            args = arguments; // reset
+            params.clear();
+            if (knownIds.isEmpty()) {
+                // Failed to set property after falling back?
+                // Bail out without displaying an error
+                if (!try_prop)
+                    return 1;
+                if (try_prop && args.size() == 1) {
+                    QStringList proparg;
+                    proparg += interface;
+                    proparg += member;
+                    proparg += args.first();
+                    if (!placeCall(service, path, "org.freedesktop.DBus.Properties", "Set", proparg, false))
+                        return 0;
+                }
+                fprintf(stderr, "Cannot find '%s.%s' in object %s at %s\n",
+                        qPrintable(interface), qPrintable(member), qPrintable(path),
+                        qPrintable(service));
+                return 1;
             }
-         }
-
-        if (midx == -1) {
-            fprintf(stderr, "Cannot find '%s.%s' in object %s at %s\n",
-                    qPrintable(interface), qPrintable(member), qPrintable(path),
-                    qPrintable(service));
-            exit(1);
-        }
-
-        QMetaMethod mm = mo->method(midx);
-        QList<QByteArray> types = mm.parameterTypes();
-        for (int i = 0; i < types.count(); ++i) {
-            if (types.at(i).endsWith('&')) {
-                // reference (and not a reference to const): output argument
-                // we're done with the inputs
-                while (types.count() > i)
-                    types.removeLast();
-                break;
+
+            QMetaMethod mm = mo->method(knownIds.takeFirst());
+            QList<QByteArray> types = mm.parameterTypes();
+            for (int i = 0; i < types.count(); ++i) {
+                if (types.at(i).endsWith('&')) {
+                    // reference (and not a reference to const): output argument
+                    // we're done with the inputs
+                    while (types.count() > i)
+                        types.removeLast();
+                    break;
+                }
             }
-        }
-
-        for (int i = 0; !args.isEmpty() && i < types.count(); ++i) {
-            int id = QVariant::nameToType(types.at(i));
-            if (id == QVariant::UserType)
-                id = QMetaType::type(types.at(i));
-            Q_ASSERT(id);
-
-            QVariant p;
-            QString argument;
-            if ((id == QVariant::List || id == QVariant::StringList)
-                 && args.at(0) == QLatin1String("("))
-                p = readList(args);
-            else
-                p = argument = args.takeFirst();
-
-            if (id == int(QMetaType::UChar)) {
-                // special case: QVariant::convert doesn't convert to/from
-                // UChar because it can't decide if it's a character or a number
-                p = qVariantFromValue<uchar>(p.toUInt());
-            } else if (id < int(QMetaType::User) && id != int(QVariant::Map)) {
-                p.convert(QVariant::Type(id));
-                if (p.type() == QVariant::Invalid) {
-                    fprintf(stderr, "Could not convert '%s' to type '%s'.\n",
-                            qPrintable(argument), types.at(i).constData());
-                    exit(1);
+
+            for (int i = 0; !args.isEmpty() && i < types.count(); ++i) {
+                int id = QVariant::nameToType(types.at(i));
+                if (id == QVariant::UserType)
+                    id = QMetaType::type(types.at(i));
+                Q_ASSERT(id);
+
+                QVariant p;
+                QString argument;
+                if ((id == QVariant::List || id == QVariant::StringList)
+                     && args.at(0) == QLatin1String("("))
+                    p = readList(args);
+                else
+                    p = argument = args.takeFirst();
+
+                if (id == int(QMetaType::UChar)) {
+                    // special case: QVariant::convert doesn't convert to/from
+                    // UChar because it can't decide if it's a character or a number
+                    p = qVariantFromValue<uchar>(p.toUInt());
+                } else if (id < int(QMetaType::User) && id != int(QVariant::Map)) {
+                    p.convert(QVariant::Type(id));
+                    if (p.type() == QVariant::Invalid) {
+                        fprintf(stderr, "Could not convert '%s' to type '%s'.\n",
+                                qPrintable(argument), types.at(i).constData());
+                        return 1 ;
+                    }
+                } else if (id == qMetaTypeId<QDBusVariant>()) {
+                    QDBusVariant tmp(p);
+                    p = qVariantFromValue(tmp);
+                } else if (id == qMetaTypeId<QDBusObjectPath>()) {
+                    QDBusObjectPath path(argument);
+                    if (path.path().isNull()) {
+                        fprintf(stderr, "Cannot pass argument '%s' because it is not a valid object path.\n",
+                                qPrintable(argument));
+                        return 1;
+                    }
+                    p = qVariantFromValue(path);
+                } else if (id == qMetaTypeId<QDBusSignature>()) {
+                    QDBusSignature sig(argument);
+                    if (sig.signature().isNull()) {
+                        fprintf(stderr, "Cannot pass argument '%s' because it is not a valid signature.\n",
+                                qPrintable(argument));
+                        return 1;
+                    }
+                    p = qVariantFromValue(sig);
+                } else {
+                    fprintf(stderr, "Sorry, can't pass arg of type '%s'.\n",
+                            types.at(i).constData());
+                    return 1;
                 }
-            } else if (id == qMetaTypeId<QDBusVariant>()) {
-                QDBusVariant tmp(p);
-                p = qVariantFromValue(tmp);
-            } else if (id == qMetaTypeId<QDBusObjectPath>()) {
-                QDBusObjectPath path(argument);
-                if (path.path().isNull()) {
-                    fprintf(stderr, "Cannot pass argument '%s' because it is not a valid object path.\n",
-                            qPrintable(argument));
-                    exit(1);
-                }
-                p = qVariantFromValue(path);
-            } else if (id == qMetaTypeId<QDBusSignature>()) {
-                QDBusSignature sig(argument);
-                if (sig.signature().isNull()) {
-                    fprintf(stderr, "Cannot pass argument '%s' because it is not a valid signature.\n",
-                            qPrintable(argument));
-                    exit(1);
-                }
-                p = qVariantFromValue(sig);
-            } else {
-                fprintf(stderr, "Sorry, can't pass arg of type '%s'.\n",
-                        types.at(i).constData());
-                exit(1);
+                params += p;
             }
-            params += p;
-        }
-        if (params.count() != types.count() || !args.isEmpty()) {
-            fprintf(stderr, "Invalid number of parameters\n");
-            exit(1);
-        }
-    }
+            if (params.count() == types.count() && args.isEmpty())
+                matchFound = true;
+            else if (knownIds.isEmpty()) {
+                fprintf(stderr, "Invalid number of parameters\n");
+                return 1;
+            }
+        } // while (!matchFound)
+    } // if (!args.isEmpty()
 
     QDBusMessage reply = iface.callWithArgumentList(QDBus::Block, member, params);
     if (reply.type() == QDBusMessage::ErrorMessage) {
         QDBusError err = reply;
+        // Failed to retrieve property after falling back?
+        // Bail out without displaying an error
+        if (!try_prop)
+            return 1;
+        if (err.type() == QDBusError::UnknownMethod && try_prop) {
+            QStringList proparg;
+            proparg += interface;
+            proparg += member;
+            if (!placeCall(service, path, "org.freedesktop.DBus.Properties", "Get", proparg, false))
+                return 0;
+        }
         if (err.type() == QDBusError::ServiceUnknown)
             fprintf(stderr, "Service '%s' does not exist.\n", qPrintable(service));
         else
             printf("Error: %s\n%s\n", qPrintable(err.name()), qPrintable(err.message()));
-        exit(2);
+        return 2;
     } else if (reply.type() != QDBusMessage::ReplyMessage) {
         fprintf(stderr, "Invalid reply type %d\n", int(reply.type()));
-        exit(1);
+        return 1;
     }
 
@@ -365,5 +395,5 @@
         printArg(v);
 
-    exit(0);
+    return 0;
 }
 
@@ -484,5 +514,6 @@
     }
 
-    placeCall(service, path, interface, member, args);
-}
-
+    int ret = placeCall(service, path, interface, member, args);
+    exit(ret);
+}
+
Index: trunk/tools/qdbus/qdbuscpp2xml/qdbuscpp2xml.cpp
===================================================================
--- trunk/tools/qdbus/qdbuscpp2xml/qdbuscpp2xml.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbuscpp2xml/qdbuscpp2xml.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,5 +65,5 @@
 // in qdbusxmlgenerator.cpp
 QT_BEGIN_NAMESPACE
-extern QDBUS_EXPORT QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo,
+extern Q_DBUS_EXPORT QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo,
                                                        const QMetaObject *base, int flags);
 QT_END_NAMESPACE
@@ -71,5 +71,5 @@
 #define PROGRAMNAME     "qdbuscpp2xml"
 #define PROGRAMVERSION  "0.1"
-#define PROGRAMCOPYRIGHT "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+#define PROGRAMCOPYRIGHT "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
 
 static QString outputFile;
Index: trunk/tools/qdbus/qdbusviewer/main.cpp
===================================================================
--- trunk/tools/qdbus/qdbusviewer/main.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdbus/qdbusviewer/propertydialog.cpp
===================================================================
--- trunk/tools/qdbus/qdbusviewer/propertydialog.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/propertydialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdbus/qdbusviewer/propertydialog.h
===================================================================
--- trunk/tools/qdbus/qdbusviewer/propertydialog.h	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/propertydialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdbus/qdbusviewer/qdbusmodel.cpp
===================================================================
--- trunk/tools/qdbus/qdbusviewer/qdbusmodel.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/qdbusmodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -76,4 +76,5 @@
     QString name;
     QString caption;
+    QString typeSignature;
 };
 
@@ -119,4 +120,11 @@
                     child.attribute(QLatin1String("name")), parent);
             item->caption = QLatin1String("Method: ") + item->name;
+            //get "type" from <arg> where "direction" is "in"
+            QDomElement n = child.firstChildElement();
+            while (!n.isNull()) {
+                if (n.attribute(QLatin1String("direction")) == QLatin1String("in"))
+                    item->typeSignature += n.attribute(QLatin1String("type"));
+                n = n.nextSiblingElement();
+            }
         } else if (child.tagName() == QLatin1String("signal")) {
             item = new QDBusItem(QDBusModel::SignalItem,
@@ -299,4 +307,10 @@
 }
 
+QString QDBusModel::dBusTypeSignature(const QModelIndex &index) const
+{
+    QDBusItem *item = static_cast<QDBusItem *>(index.internalPointer());
+    return item ? item->typeSignature : QString();
+}
+
 QModelIndex QDBusModel::findObject(const QDBusObjectPath &objectPath)
 {
Index: trunk/tools/qdbus/qdbusviewer/qdbusmodel.h
===================================================================
--- trunk/tools/qdbus/qdbusviewer/qdbusmodel.h	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/qdbusmodel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -73,4 +73,5 @@
     QString dBusInterface(const QModelIndex &index) const;
     QString dBusMethodName(const QModelIndex &index) const;
+    QString dBusTypeSignature(const QModelIndex &index) const;
 
     void refresh(const QModelIndex &index = QModelIndex());
Index: trunk/tools/qdbus/qdbusviewer/qdbusviewer.cpp
===================================================================
--- trunk/tools/qdbus/qdbusviewer/qdbusviewer.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/qdbusviewer.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -70,7 +70,14 @@
     objectPathRegExp(QLatin1String("\\[ObjectPath: (.*)\\]"))
 {
-    services = new QTreeWidget;
-    services->setRootIsDecorated(false);
-    services->setHeaderLabels(QStringList(QLatin1String("Services")));
+    servicesModel = new QStringListModel(this);
+    servicesFilterModel = new QSortFilterProxyModel(this);
+    servicesFilterModel->setSourceModel(servicesModel);
+    servicesFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+    serviceFilterLine = new QLineEdit(this);
+    serviceFilterLine->setPlaceholderText(tr("Search..."));
+    servicesView = new QListView(this);
+    servicesView->setModel(servicesFilterModel);
+
+    connect(serviceFilterLine, SIGNAL(textChanged(QString)), servicesFilterModel, SLOT(setFilterFixedString(QString)));
 
     tree = new QTreeView;
@@ -87,17 +94,26 @@
     connect(refreshShortcut, SIGNAL(activated()), this, SLOT(refreshChildren()));
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    QSplitter *topSplitter = new QSplitter(Qt::Vertical, this);
+    layout->addWidget(topSplitter);
+
     log = new QTextBrowser;
     connect(log, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
 
-    QHBoxLayout *layout = new QHBoxLayout;
-    layout->addWidget(services, 1);
-    layout->addWidget(tree, 2);
-
-    topLayout->addLayout(layout);
-    topLayout->addWidget(log);
-
-    connect(services, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
-            this, SLOT(serviceChanged(QTreeWidgetItem*)));
+    QSplitter *splitter = new QSplitter(topSplitter);
+    splitter->addWidget(servicesView);
+
+    QWidget *servicesWidget = new QWidget;
+    QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
+    servicesLayout->addWidget(serviceFilterLine);
+    servicesLayout->addWidget(servicesView);
+    splitter->addWidget(servicesWidget);
+    splitter->addWidget(tree);
+
+    topSplitter->addWidget(splitter);
+    topSplitter->addWidget(log);
+
+    connect(servicesView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
+            this, SLOT(serviceChanged(QModelIndex)));
     connect(tree, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(showContextMenu(QPoint)));
@@ -134,10 +150,9 @@
 void QDBusViewer::refresh()
 {
-    services->clear();
+    servicesModel->removeRows(0, servicesModel->rowCount());
 
     if (c.isConnected()) {
         const QStringList serviceNames = c.interface()->registeredServiceNames();
-        foreach (QString service, serviceNames)
-            new QTreeWidgetItem(services, QStringList(service));
+        servicesModel->setStringList(serviceNames);
     }
 }
@@ -155,4 +170,5 @@
     sig.mInterface = model->dBusInterface(item);
     sig.mName = model->dBusMethodName(item);
+    sig.mTypeSig = model->dBusTypeSignature(item);
 
     switch (model->itemType(item)) {
@@ -208,4 +224,15 @@
 }
 
+static QString getDbusSignature(const QMetaMethod& method)
+{
+    // create a D-Bus type signature from QMetaMethod's parameters
+    QString sig;
+    for (int i = 0; i < method.parameterTypes().count(); ++i) {
+        QVariant::Type type = QVariant::nameToType(method.parameterTypes().at(i));
+        sig.append(QString::fromLatin1(QDBusMetaType::typeToSignature(type)));
+    }
+    return sig;
+}
+
 void QDBusViewer::callMethod(const BusSignature &sig)
 {
@@ -218,5 +245,6 @@
         const QString signature = QString::fromLatin1(mo->method(i).signature());
         if (signature.startsWith(sig.mName) && signature.at(sig.mName.length()) == QLatin1Char('('))
-            method = mo->method(i);
+            if (getDbusSignature(mo->method(i)) == sig.mTypeSig)
+                method = mo->method(i);
     }
     if (!method.signature()) {
@@ -278,4 +306,5 @@
     sig.mInterface = model->dBusInterface(item);
     sig.mName = model->dBusMethodName(item);
+    sig.mTypeSig = model->dBusTypeSignature(item);
 
     QMenu menu;
@@ -380,12 +409,12 @@
 }
 
-void QDBusViewer::serviceChanged(QTreeWidgetItem *item)
+void QDBusViewer::serviceChanged(const QModelIndex &index)
 {
     delete tree->model();
 
     currentService.clear();
-    if (!item)
-        return;
-    currentService = item->text(0);
+    if (!index.isValid())
+        return;
+    currentService = index.data().toString();
 
     tree->setModel(new QDBusViewModel(currentService, c));
@@ -398,19 +427,23 @@
         return;
 
-    new QTreeWidgetItem(services, QStringList(service));
-}
-
-static QTreeWidgetItem *findItem(const QTreeWidget *services, const QString &name)
-{
-    for (int i = 0; i < services->topLevelItemCount(); ++i) {
-        if (services->topLevelItem(i)->text(0) == name)
-            return services->topLevelItem(i);
-    }
-    return 0;
+    servicesModel->insertRows(0, 1);
+    servicesModel->setData(servicesModel->index(0, 0), service);
+}
+
+static QModelIndex findItem(QStringListModel *servicesModel, const QString &name)
+{
+    QModelIndexList hits = servicesModel->match(servicesModel->index(0, 0), Qt::DisplayRole, name);
+    if (hits.isEmpty())
+        return QModelIndex();
+
+    return hits.first();
 }
 
 void QDBusViewer::serviceUnregistered(const QString &name)
 {
-    delete findItem(services, name);
+    QModelIndex hit = findItem(servicesModel, name);
+    if (!hit.isValid())
+        return;
+    servicesModel->removeRows(hit.row(), 1);
 }
 
@@ -418,12 +451,12 @@
                                       const QString &newOwner)
 {
-    QTreeWidgetItem *item = findItem(services, name);
-
-    if (!item && oldOwner.isEmpty() && !newOwner.isEmpty())
+    QModelIndex hit = findItem(servicesModel, name);
+
+    if (!hit.isValid() && oldOwner.isEmpty() && !newOwner.isEmpty())
         serviceRegistered(name);
-    else if (item && !oldOwner.isEmpty() && newOwner.isEmpty())
-        delete item;
-    else if (item && !oldOwner.isEmpty() && !newOwner.isEmpty()) {
-        delete item;
+    else if (hit.isValid() && !oldOwner.isEmpty() && newOwner.isEmpty())
+        servicesModel->removeRows(hit.row(), 1);
+    else if (hit.isValid() && !oldOwner.isEmpty() && !newOwner.isEmpty()) {
+        servicesModel->removeRows(hit.row(), 1);
         serviceRegistered(name);
     }
@@ -445,5 +478,5 @@
                 "<h3>%1</h3>"
                 "<p>Version %2</p></center>"
-                "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>")
+                "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>")
             .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR)));
     box.setWindowTitle(tr("D-Bus Viewer"));
Index: trunk/tools/qdbus/qdbusviewer/qdbusviewer.h
===================================================================
--- trunk/tools/qdbus/qdbusviewer/qdbusviewer.h	(revision 769)
+++ trunk/tools/qdbus/qdbusviewer/qdbusviewer.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -53,4 +53,5 @@
 {
     QString mService, mPath, mInterface, mName;
+    QString mTypeSig;
 };
 
@@ -66,5 +67,5 @@
 
 private slots:
-    void serviceChanged(QTreeWidgetItem *item);
+    void serviceChanged(const QModelIndex &index);
     void showContextMenu(const QPoint &);
     void connectionRequested(const BusSignature &sig);
@@ -92,4 +93,8 @@
     QAction *refreshAction;
     QTreeWidget *services;
+    QStringListModel *servicesModel;
+    QSortFilterProxyModel *servicesFilterModel;
+    QLineEdit *serviceFilterLine;
+    QListView *servicesView;
     QTextBrowser *log;
     QRegExp objectPathRegExp;
Index: trunk/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
===================================================================
--- trunk/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp	(revision 769)
+++ trunk/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,15 +54,10 @@
 #include "private/qdbusintrospection_p.h"
 
-#include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef Q_WS_WIN
-#include <process.h>
-#endif
-
 #define PROGRAMNAME     "qdbusxml2cpp"
 #define PROGRAMVERSION  "0.7"
-#define PROGRAMCOPYRIGHT "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
+#define PROGRAMCOPYRIGHT "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
 
 #define ANNOTATION_NO_WAIT      "org.freedesktop.DBus.Method.NoReply"
@@ -1136,9 +1131,9 @@
     objects or implement said interfaces.
 
-    \c qdbusxml2dcpp has two modes of operation, that correspond to the two possible outputs it can
+    \c qdbusxml2cpp has two modes of operation, that correspond to the two possible outputs it can
     produce: the interface (proxy) class or the adaptor class. The latter consists of both a C++
     header and a source file, which are meant to be edited and adapted to your needs.
 
-    The \c qdbusxml2dcpp tool is not meant to be run every time you compile your
+    The \c qdbusxml2cpp tool is not meant to be run every time you compile your
     application. Instead, it's meant to be used when developing the code or when the interface
     changes.
Index: trunk/tools/qdoc3/apigenerator.cpp
===================================================================
--- trunk/tools/qdoc3/apigenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/apigenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/apigenerator.h
===================================================================
--- trunk/tools/qdoc3/apigenerator.h	(revision 769)
+++ trunk/tools/qdoc3/apigenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/archiveextractor.cpp
===================================================================
--- trunk/tools/qdoc3/archiveextractor.cpp	(revision 769)
+++ trunk/tools/qdoc3/archiveextractor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/archiveextractor.h
===================================================================
--- trunk/tools/qdoc3/archiveextractor.h	(revision 769)
+++ trunk/tools/qdoc3/archiveextractor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/atom.cpp
===================================================================
--- trunk/tools/qdoc3/atom.cpp	(revision 769)
+++ trunk/tools/qdoc3/atom.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/atom.h
===================================================================
--- trunk/tools/qdoc3/atom.h	(revision 769)
+++ trunk/tools/qdoc3/atom.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/bookgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/bookgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/bookgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/bookgenerator.h
===================================================================
--- trunk/tools/qdoc3/bookgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/bookgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/ccodeparser.cpp
===================================================================
--- trunk/tools/qdoc3/ccodeparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/ccodeparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/ccodeparser.h
===================================================================
--- trunk/tools/qdoc3/ccodeparser.h	(revision 769)
+++ trunk/tools/qdoc3/ccodeparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/codechunk.cpp
===================================================================
--- trunk/tools/qdoc3/codechunk.cpp	(revision 769)
+++ trunk/tools/qdoc3/codechunk.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/codechunk.h
===================================================================
--- trunk/tools/qdoc3/codechunk.h	(revision 769)
+++ trunk/tools/qdoc3/codechunk.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,5 +56,5 @@
   The CodeChunk class represents a tiny piece of C++ code.
 
-  The class provides convertion between a list of lexemes and a string.  It adds
+  The class provides conversion between a list of lexemes and a string.  It adds
   spaces at the right place for consistent style.  The tiny pieces of code it
   represents are data types, enum values, and default parameter values.
Index: trunk/tools/qdoc3/codemarker.cpp
===================================================================
--- trunk/tools/qdoc3/codemarker.cpp	(revision 769)
+++ trunk/tools/qdoc3/codemarker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -178,5 +178,5 @@
 {
     if (sizeof(const Node *) == sizeof(ulong)) {
-        return QString::number(reinterpret_cast<ulong>(node));
+        return QString::number(reinterpret_cast<quintptr>(node));
     }
     else {
@@ -258,4 +258,5 @@
 {
     QString tag;
+    QString name = node->name();
 
     switch (node->type()) {
@@ -278,9 +279,18 @@
         tag = QLatin1String("@property");
         break;
+#ifdef QDOC_QML
+    case Node::Fake:
+        if (node->subType() == Node::QmlClass) {
+            if (node->name().startsWith(QLatin1String("QML:")))
+                name = name.mid(4);                 // remove the "QML:" prefix
+        }
+        tag = QLatin1String("@property");
+        break;
+#endif
     default:
         tag = QLatin1String("@unknown");
         break;
     }
-    return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name())
+    return QLatin1Char('<') + tag + QLatin1Char('>') + protect(name)
         + QLatin1String("</") + tag + QLatin1Char('>');
 }
@@ -458,5 +468,5 @@
 {
     if (!fs.isEmpty()) {
-	Section section(fs.name,fs.singularMember,fs.pluralMember);
+	Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember);
 	section.members = fs.memberMap.values();
         section.reimpMembers = fs.reimpMemberMap.values();
@@ -615,5 +625,7 @@
   the specified QmlClassNode.
  */
-QList<Section> CodeMarker::qmlSections(const QmlClassNode* , SynopsisStyle )
+QList<Section> CodeMarker::qmlSections(const QmlClassNode* ,
+                                       SynopsisStyle ,
+                                       const Tree* )
 {
     return QList<Section>();
@@ -621,3 +633,11 @@
 #endif
 
+const Node* CodeMarker::resolveTarget(const QString& , 
+                                      const Tree* ,
+		                      const Node* ,
+                                      const Node* )
+{
+    return 0;
+}
+
 QT_END_NAMESPACE
Index: trunk/tools/qdoc3/codemarker.h
===================================================================
--- trunk/tools/qdoc3/codemarker.h	(revision 769)
+++ trunk/tools/qdoc3/codemarker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -59,4 +59,5 @@
 {
     QString name;
+    QString divClass;
     QString singularMember;
     QString pluralMember;
@@ -67,7 +68,9 @@
     Section() { }
     Section(const QString& name0, 
+            const QString& divClass0,
             const QString& singularMember0, 
             const QString& pluralMember0) 
-        : name(name0), 
+        : name(name0),
+          divClass(divClass0),
           singularMember(singularMember0),
 	  pluralMember(pluralMember0) { }
@@ -80,4 +83,5 @@
     const InnerNode *innerNode;
     QString name;
+    QString divClass;
     QString singularMember;
     QString pluralMember;
@@ -87,17 +91,27 @@
 
     FastSection(const InnerNode *innerNode0, 
-                const QString& name0 = "",
-                const QString& singularMember0 = "member",
-                const QString& pluralMember0 = "members")
+                const QString& name0,
+                const QString& divClass0,
+                const QString& singularMember0,
+                const QString& pluralMember0)
 	: innerNode(innerNode0), 
           name(name0), 
+          divClass(divClass0),
           singularMember(singularMember0),
 	  pluralMember(pluralMember0) { }
     bool isEmpty() const { 
-        return (memberMap.isEmpty() && inherited.isEmpty() && 
+        return (memberMap.isEmpty() && 
+                inherited.isEmpty() && 
                 reimpMemberMap.isEmpty()); 
     }
 
 };
+
+#if 0
+                const QString& name0 = "",
+                const QString& divClass0 = "",
+                const QString& singularMember0 = "member",
+                const QString& pluralMember0 = "members")
+#endif
 
 class CodeMarker
@@ -140,10 +154,12 @@
 #ifdef QDOC_QML
     virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode,
-                                       SynopsisStyle style);
-#endif
-    virtual const Node *resolveTarget(const QString& target, 
-                                      const Tree *tree,
-		                      const Node *relative) = 0;
-    virtual QStringList macRefsForNode(const Node *node);
+                                       SynopsisStyle style,
+                                       const Tree* tree);
+#endif
+    virtual const Node* resolveTarget(const QString& target, 
+                                      const Tree* tree,
+		                      const Node* relative,
+                                      const Node* self = 0);
+    virtual QStringList macRefsForNode(const Node* node);
 
     static void initialize(const Config& config);
Index: trunk/tools/qdoc3/codeparser.cpp
===================================================================
--- trunk/tools/qdoc3/codeparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/codeparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,9 +44,9 @@
 */
 
-#include <QtCore>
 #include "codeparser.h"
 #include "node.h"
 #include "tree.h"
 #include "config.h"
+#include <QDebug>
 
 QT_BEGIN_NAMESPACE
@@ -60,4 +60,5 @@
 #define COMMAND_NONREENTRANT            Doc::alias(QLatin1String("nonreentrant"))
 #define COMMAND_OBSOLETE                Doc::alias(QLatin1String("obsolete"))
+#define COMMAND_PAGEKEYWORDS            Doc::alias(QLatin1String("pagekeywords"))
 #define COMMAND_PRELIMINARY             Doc::alias(QLatin1String("preliminary"))
 #define COMMAND_INPUBLICGROUP           Doc::alias(QLatin1String("inpublicgroup"))
@@ -70,4 +71,5 @@
 QList<CodeParser *> CodeParser::parsers;
 bool CodeParser::showInternal = false;
+QMap<QString,QString> CodeParser::nameToTitle;
 
 /*!
@@ -171,4 +173,5 @@
                            << COMMAND_NONREENTRANT
                            << COMMAND_OBSOLETE
+                           << COMMAND_PAGEKEYWORDS
                            << COMMAND_PRELIMINARY
                            << COMMAND_INPUBLICGROUP
@@ -231,4 +234,7 @@
         node->setSince(arg);
     }
+    else if (command == COMMAND_PAGEKEYWORDS) {
+        node->addPageKeywords(arg);
+    }
     else if (command == COMMAND_SUBTITLE) {
 	if (node->type() == Node::Fake) {
@@ -246,4 +252,5 @@
 	    FakeNode *fake = static_cast<FakeNode *>(node);
             fake->setTitle(arg);
+            nameToTitle.insert(fake->name(),arg);
         }
         else
@@ -252,3 +259,12 @@
 }
 
+/*!
+  Find the page title given the page \a name and return it.
+ */
+const QString CodeParser::titleFromName(const QString& name)
+{
+    const QString t = nameToTitle.value(name);
+    return t;
+}
+
 QT_END_NAMESPACE
Index: trunk/tools/qdoc3/codeparser.h
===================================================================
--- trunk/tools/qdoc3/codeparser.h	(revision 769)
+++ trunk/tools/qdoc3/codeparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -79,4 +79,5 @@
     static void terminate();
     static CodeParser *parserForLanguage(const QString& language);
+    static const QString titleFromName(const QString& name);
 
  protected:
@@ -89,4 +90,5 @@
     static QList<CodeParser *> parsers;
     static bool showInternal;
+    static QMap<QString,QString> nameToTitle;
 };
 
Index: trunk/tools/qdoc3/command.cpp
===================================================================
--- trunk/tools/qdoc3/command.cpp	(revision 769)
+++ trunk/tools/qdoc3/command.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -48,4 +48,6 @@
 #include "command.h"
 
+#include <stdlib.h>
+
 QT_BEGIN_NAMESPACE
 
@@ -70,4 +72,10 @@
 	toolName.truncate(space);
 
+#ifdef QT_BOOTSTRAPPED
+    int status = system(qPrintable(actualCommand));
+    int exitCode = WEXITSTATUS(status);
+    if (status == -1 || exitCode != EXIT_SUCCESS)
+        location.fatal(QString("Error executing '$1': $2").arg(toolName).arg(exitCode));
+#else
     QProcess process;
     process.start(QLatin1String("sh"),
@@ -90,4 +98,5 @@
                           "It emitted these errors:\n%2")
                        .arg(actualCommand).arg(errors));
+#endif
 }
 
Index: trunk/tools/qdoc3/command.h
===================================================================
--- trunk/tools/qdoc3/command.h	(revision 769)
+++ trunk/tools/qdoc3/command.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/config.cpp
===================================================================
--- trunk/tools/qdoc3/config.cpp	(revision 769)
+++ trunk/tools/qdoc3/config.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,5 +44,9 @@
 */
 
-#include <QtCore>
+#include <QDir>
+#include <QVariant>
+#include <QFile>
+#include <QTemporaryFile>
+#include <QTextStream>
 
 #include "archiveextractor.h"
@@ -525,6 +529,9 @@
     QStringList::ConstIterator e = fileExtensions.begin();
     while (e != fileExtensions.end()) {
-	QString filePath = findFile(location, files, dirs, fileBase + "." + *e,
-				     userFriendlyFilePath);
+	QString filePath = findFile(location,
+                                    files,
+                                    dirs,
+                                    fileBase + "." + *e,
+                                    userFriendlyFilePath);
 	if (!filePath.isEmpty())
 	    return filePath;
@@ -672,5 +679,7 @@
     }
 
-    QString text = fin.readAll();
+    QTextStream stream(&fin);
+    stream.setCodec("UTF-8");
+    QString text = stream.readAll();
     text += QLatin1String("\n\n");
     text += QChar('\0');
Index: trunk/tools/qdoc3/config.h
===================================================================
--- trunk/tools/qdoc3/config.h	(revision 769)
+++ trunk/tools/qdoc3/config.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -120,4 +120,5 @@
 
 #define CONFIG_ALIAS                    "alias"
+#define CONFIG_APPLICATION		"application"
 #define CONFIG_BASE                     "base"      // ### don't document for now
 #define CONFIG_CODEINDENT               "codeindent"
@@ -141,6 +142,9 @@
 #define CONFIG_LANGUAGE                 "language"
 #define CONFIG_MACRO                    "macro"
+#define CONFIG_NATURALLANGUAGE          "naturallanguage"
 #define CONFIG_OBSOLETELINKS            "obsoletelinks"
+#define CONFIG_APPLICATION              "application"
 #define CONFIG_OUTPUTDIR                "outputdir"
+#define CONFIG_OUTPUTENCODING           "outputencoding"
 #define CONFIG_OUTPUTLANGUAGE           "outputlanguage"
 #define CONFIG_OUTPUTFORMATS            "outputformats"
@@ -148,9 +152,14 @@
 #define CONFIG_QHP                      "qhp"
 #define CONFIG_QUOTINGINFORMATION       "quotinginformation"
+#define CONFIG_SCRIPTDIRS               "scriptdirs"
+#define CONFIG_SCRIPTS                  "scripts"
 #define CONFIG_SLOW                     "slow"
 #define CONFIG_SHOWINTERNAL             "showinternal"
 #define CONFIG_SOURCEDIRS               "sourcedirs"
+#define CONFIG_SOURCEENCODING           "sourceencoding"
 #define CONFIG_SOURCES                  "sources"
 #define CONFIG_SPURIOUS                 "spurious"
+#define CONFIG_STYLEDIRS                "styledirs"
+#define CONFIG_STYLES                   "styles"
 #define CONFIG_STYLESHEETS              "stylesheets"
 #define CONFIG_TABSIZE                  "tabsize"
Index: trunk/tools/qdoc3/cppcodemarker.cpp
===================================================================
--- trunk/tools/qdoc3/cppcodemarker.cpp	(revision 769)
+++ trunk/tools/qdoc3/cppcodemarker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -146,5 +146,5 @@
     else {
 	QString fullName;
-	for (;;) {
+	while (node) {
 	    fullName.prepend(plainName(node));
 	    if (node->parent() == relative || node->parent()->name().isEmpty())
@@ -483,53 +483,64 @@
 	    FastSection privateFunctions(classe,
                                          "Private Functions",
+                                         "",
                                          "private function",
 				         "private functions");
-	    FastSection privateSlots(classe, "Private Slots", "private slot", "private slots");
-	    FastSection privateTypes(classe, "Private Types", "private type", "private types");
+	    FastSection privateSlots(classe, "Private Slots", "", "private slot", "private slots");
+	    FastSection privateTypes(classe, "Private Types", "", "private type", "private types");
 	    FastSection protectedFunctions(classe,
                                            "Protected Functions",
+                                           "",
                                            "protected function",
 				           "protected functions");
 	    FastSection protectedSlots(classe,
                                        "Protected Slots",
+                                       "",
                                        "protected slot",
                                        "protected slots");
 	    FastSection protectedTypes(classe,
                                        "Protected Types",
+                                       "",
                                        "protected type",
                                        "protected types");
 	    FastSection protectedVariables(classe,
                                            "Protected Variables",
+                                           "",
                                            "protected type",
                                            "protected variables");
 	    FastSection publicFunctions(classe,
                                         "Public Functions",
+                                        "",
                                         "public function",
                                         "public functions");
-	    FastSection publicSignals(classe, "Signals", "signal", "signals");
-	    FastSection publicSlots(classe, "Public Slots", "public slot", "public slots");
-	    FastSection publicTypes(classe, "Public Types", "public type", "public types");
+	    FastSection publicSignals(classe, "Signals", "", "signal", "signals");
+	    FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots");
+	    FastSection publicTypes(classe, "Public Types", "", "public type", "public types");
 	    FastSection publicVariables(classe,
                                         "Public Variables",
-                                        "public type",
+                                        "",
+                                        "public variable",
                                         "public variables");
-	    FastSection properties(classe, "Properties", "property", "properties");
+	    FastSection properties(classe, "Properties", "", "property", "properties");
 	    FastSection relatedNonMembers(classe,
                                           "Related Non-Members",
+                                          "",
                                           "related non-member",
                                           "related non-members");
 	    FastSection staticPrivateMembers(classe,
                                              "Static Private Members",
+                                             "",
                                              "static private member",
 					     "static private members");
 	    FastSection staticProtectedMembers(classe,
                                                "Static Protected Members",
+                                               "",
 					       "static protected member",
                                                "static protected members");
 	    FastSection staticPublicMembers(classe,
                                             "Static Public Members",
+                                            "",
                                             "static public member",
 					    "static public members");
-            FastSection macros(inner, "Macros", "macro", "macros");
+            FastSection macros(inner, "Macros", "", "macro", "macros");
 
 	    NodeList::ConstIterator r = classe->relatedNodes().begin();
@@ -667,10 +678,10 @@
         }
         else if (style == Detailed) {
-	    FastSection memberFunctions(classe,"Member Function Documentation");
-	    FastSection memberTypes(classe,"Member Type Documentation");
-	    FastSection memberVariables(classe,"Member Variable Documentation");
-	    FastSection properties(classe,"Property Documentation");
-	    FastSection relatedNonMembers(classe,"Related Non-Members");
-	    FastSection macros(classe,"Macro Documentation");
+	    FastSection memberFunctions(classe,"Member Function Documentation","func","member","members");
+	    FastSection memberTypes(classe,"Member Type Documentation","types","member","members");
+	    FastSection memberVariables(classe,"Member Variable Documentation","vars","member","members");
+	    FastSection properties(classe,"Property Documentation","prop","member","members");
+	    FastSection relatedNonMembers(classe,"Related Non-Members","relnonmem","member","members");
+	    FastSection macros(classe,"Macro Documentation","macros","member","members");
 
 	    NodeList::ConstIterator r = classe->relatedNodes().begin();
@@ -718,5 +729,5 @@
         }
         else {
-	    FastSection all(classe);
+	    FastSection all(classe,"","","member","members");
 
 	    QStack<const ClassNode *> stack;
@@ -748,13 +759,15 @@
 	    FastSection namespaces(inner,
                                    "Namespaces",
+                                   style == Detailed ? "nmspace" : "",
                                    "namespace",
                                    "namespaces");
             FastSection classes(inner,
                                 "Classes",
+                                style == Detailed ? "classes" : "",
                                 "class",
                                 "classes");
             FastSection types(inner,
-                              style == Summary ?
-                              "Types" : "Type Documentation",
+                              style == Summary ? "Types" : "Type Documentation",
+                              style == Detailed ? "types" : "",
                               "type",
 			      "types");
@@ -762,4 +775,5 @@
                                   style == Summary ?
                                   "Functions" : "Function Documentation",
+                                  style == Detailed ? "func" : "",
 			          "function",
                                   "functions");
@@ -767,4 +781,5 @@
                                style == Summary ?
                                "Macros" : "Macro Documentation",
+                               style == Detailed ? "macros" : "",
                                "macro",
                                "macros");
@@ -811,7 +826,8 @@
 }
 
-const Node *CppCodeMarker::resolveTarget(const QString &target,
-                                         const Tree *tree,
-                                         const Node *relative)
+const Node *CppCodeMarker::resolveTarget(const QString& target,
+                                         const Tree* tree,
+                                         const Node* relative,
+                                         const Node* self)
 {
     if (target.endsWith("()")) {
@@ -855,9 +871,11 @@
         QStringList path = target.split("::");
         const Node *node;
+        int flags = Tree::SearchBaseClasses |
+            Tree::SearchEnumValues |
+            Tree::NonFunction;
         if ((node = tree->findNode(path,
                                    relative,
-                                   Tree::SearchBaseClasses |
-                                   Tree::SearchEnumValues |
-                                   Tree::NonFunction)))
+                                   flags,
+                                   self)))
             return node;
     }
@@ -882,5 +900,5 @@
     static QRegExp multiLineComment("/(?:( )?\\*(?:[^*]+|\\*(?! /))*\\*\\1/)");
     multiLineComment.setMinimal(true);
-    static QRegExp singleLineComment("//(?!!)[^!\n]*");
+    static QRegExp singleLineComment("[^:]//(?!!)[^!\\n]*");
     static QRegExp preprocessor("(?:^|\n)(#[ \t]*(?:include|if|elif|endif|error|pragma|define"
                                 "|warning)(?:(?:\\\\\n|\\n#)[^\n]*)*)");
@@ -1068,11 +1086,11 @@
         }
         else if (mlpos == -1) {
-            pos = slpos;
-            len = singleLineComment.matchedLength();
+            pos = slpos + 1;
+            len = singleLineComment.matchedLength() - 1;
         }
         else {
             if (slpos < mlpos) {
-                pos = slpos;
-                len = singleLineComment.matchedLength();
+                pos = slpos + 1;
+                len = singleLineComment.matchedLength() - 1;
             }
             else {
@@ -1110,5 +1128,6 @@
  */
 QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
-                                          SynopsisStyle style)
+                                          SynopsisStyle style,
+                                          const Tree* tree)
 {
     QList<Section> sections;
@@ -1117,24 +1136,30 @@
 	    FastSection qmlproperties(qmlClassNode,
                                       "Properties",
+                                      "",
                                       "property",
                                       "properties");
 	    FastSection qmlattachedproperties(qmlClassNode,
                                               "Attached Properties",
+                                              "",
                                               "property",
                                               "properties");
 	    FastSection qmlsignals(qmlClassNode,
-                                "Signals",
-                                "signal",
-                                "signals");
+                                   "Signals",
+                                   "",
+                                   "signal",
+                                   "signals");
 	    FastSection qmlattachedsignals(qmlClassNode,
-                                           "QML Attached Signals",
+                                           "Attached Signals",
+                                           "",
                                            "signal",
                                            "signals");
 	    FastSection qmlmethods(qmlClassNode,
                                    "Methods",
+                                   "",
                                    "method",
                                    "methods");
 	    FastSection qmlattachedmethods(qmlClassNode,
-                                           "QML Attached Methods",
+                                           "Attached Methods",
+                                           "",
                                            "method",
                                            "methods");
@@ -1180,10 +1205,13 @@
         }
         else if (style == Detailed) {
-            FastSection qmlproperties(qmlClassNode, "Property Documentation");
-	    FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation");
-            FastSection qmlsignals(qmlClassNode,"Signal Documentation");
-	    FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation");
-            FastSection qmlmethods(qmlClassNode,"Method Documentation");
-	    FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation");
+            FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members");
+	    FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop",
+                                              "member","members");
+            FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members");
+	    FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig",
+                                           "member","members");
+            FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members");
+	    FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth",
+                                           "member","members");
 	    NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
 	    while (c != qmlClassNode->childNodes().end()) {
@@ -1218,4 +1246,46 @@
 	    append(sections,qmlattachedmethods);
         }
+        else {
+	    FastSection all(qmlClassNode,"","","member","members");
+
+	    QStack<const QmlClassNode*> stack;
+	    stack.push(qmlClassNode);
+
+	    while (!stack.isEmpty()) {
+	        const QmlClassNode* ancestorClass = stack.pop();
+
+	        NodeList::ConstIterator c = ancestorClass->childNodes().begin();
+	        while (c != ancestorClass->childNodes().end()) {
+                    //		    if ((*c)->access() != Node::Private)
+                    if ((*c)->subType() == Node::QmlPropertyGroup) {
+                        const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c);
+                        NodeList::ConstIterator p = qpgn->childNodes().begin();
+                        while (p != qpgn->childNodes().end()) {
+                            if ((*p)->type() == Node::QmlProperty) {
+                                insert(all,*p,style,Okay);
+                            }
+                            ++p;
+                        }
+                    }
+                    else
+                        insert(all,*c,style,Okay);
+                    ++c;
+                }
+
+                if (!ancestorClass->links().empty()) {
+                    if (ancestorClass->links().contains(Node::InheritsLink)) {
+                        QPair<QString,QString> linkPair;
+                        linkPair = ancestorClass->links()[Node::InheritsLink];
+                        QStringList strList(linkPair.first);
+                        const Node* n = tree->findNode(strList,Node::Fake);
+                        if (n && n->subType() == Node::QmlClass) {
+                            const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
+                            stack.prepend(qcn);
+                        }
+                    }
+                }
+	    }
+	    append(sections, all);
+        }
     }
 
Index: trunk/tools/qdoc3/cppcodemarker.h
===================================================================
--- trunk/tools/qdoc3/cppcodemarker.h	(revision 769)
+++ trunk/tools/qdoc3/cppcodemarker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -81,8 +81,10 @@
                             Status status);
     QList<Section> qmlSections(const QmlClassNode* qmlClassNode,
-                               SynopsisStyle style);
-    const Node *resolveTarget(const QString& target, 
-                              const Tree *tree, 
-                              const Node *relative);
+                               SynopsisStyle style,
+                               const Tree* tree);
+    const Node* resolveTarget(const QString& target, 
+                              const Tree* tree, 
+                              const Node* relative,
+                              const Node* self = 0);
 
 private:
Index: trunk/tools/qdoc3/cppcodeparser.cpp
===================================================================
--- trunk/tools/qdoc3/cppcodeparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/cppcodeparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,9 +44,9 @@
 */
 
-#include <QtCore>
 #include <qfile.h>
 
 #include <stdio.h>
 #include <errno.h>
+#include <qdebug.h>
 
 #include "codechunk.h"
@@ -96,4 +96,5 @@
 #define COMMAND_QMLATTACHEDMETHOD       Doc::alias("qmlattachedmethod")
 #define COMMAND_QMLDEFAULT              Doc::alias("default")
+#define COMMAND_QMLBASICTYPE            Doc::alias("qmlbasictype")
 #endif
 
@@ -281,6 +282,6 @@
                                     Tree *tree)
 {
-    FILE *in = fopen(QFile::encodeName(filePath), "r");
-    if (!in) {
+    QFile in(filePath);
+    if (!in.open(QIODevice::ReadOnly)) {
         location.error(tr("Cannot open C++ header file '%1'").arg(filePath));
         return;
@@ -295,5 +296,5 @@
     if (!fileTokenizer.version().isEmpty())
         tree->setVersion(fileTokenizer.version());
-    fclose(in);
+    in.close();
 
     if (fileLocation.fileName() == "qiterator.h")
@@ -312,6 +313,6 @@
                                     Tree *tree)
 {
-    FILE *in = fopen(QFile::encodeName(filePath), "r");
-    if (!in) {
+    QFile in(filePath);
+    if (!in.open(QIODevice::ReadOnly)) {
         location.error(tr("Cannot open C++ source file '%1' (%2)").arg(filePath).arg(strerror(errno)));
         return;
@@ -325,5 +326,5 @@
     usedNamespaces.clear();
     matchDocsAndStuff();
-    fclose(in);
+    in.close();
 }
 
@@ -492,5 +493,5 @@
                 }
 
-                
+
                 /*
                     There are several functions with the correct
@@ -537,5 +538,6 @@
                            << COMMAND_QMLATTACHEDSIGNAL
                            << COMMAND_QMLMETHOD
-                           << COMMAND_QMLATTACHEDMETHOD;
+                           << COMMAND_QMLATTACHEDMETHOD
+                           << COMMAND_QMLBASICTYPE;
 #else
                            << COMMAND_VARIABLE;
@@ -544,5 +546,5 @@
 
 /*!
-  Process the topic \a command in context \a doc with argument \a arg.  
+  Process the topic \a command in context \a doc with argument \a arg.
  */
 Node *CppCodeParser::processTopicCommand(const Doc& doc,
@@ -727,5 +729,11 @@
                 classNode = static_cast<const ClassNode*>(n);
         }
-        return new QmlClassNode(tre->root(), names[0], classNode);
+        if (names[0].startsWith("Qt"))
+            return new QmlClassNode(tre->root(), QLatin1String("QML:")+names[0], classNode);
+        else
+            return new QmlClassNode(tre->root(), names[0], classNode);
+    }
+    else if (command == COMMAND_QMLBASICTYPE) {
+        return new QmlBasicTypeNode(tre->root(), arg);
     }
     else if ((command == COMMAND_QMLSIGNAL) ||
@@ -737,4 +745,6 @@
         QmlClassNode* qmlClass = 0;
         if (splitQmlMethodArg(doc,arg,type,element)) {
+            if (element.startsWith(QLatin1String("Qt")))
+                element = QLatin1String("QML:") + element;
             Node* n = tre->findNode(QStringList(element),Node::Fake);
             if (n && n->subType() == Node::QmlClass) {
@@ -897,11 +907,11 @@
                                 << COMMAND_PREVIOUSPAGE
                                 << COMMAND_INDEXPAGE
-#ifdef QDOC_QML        
+#ifdef QDOC_QML
                                 << COMMAND_STARTPAGE
                                 << COMMAND_QMLINHERITS
                                 << COMMAND_QMLDEFAULT;
-#else    
+#else
                                 << COMMAND_STARTPAGE;
-#endif    
+#endif
 }
 
@@ -1018,5 +1028,8 @@
     else if (command == COMMAND_QMLINHERITS) {
         setLink(node, Node::InheritsLink, arg);
-    }
+        if (node->subType() == Node::QmlClass) {
+            QmlClassNode::addInheritedBy(arg,node);
+        }
+   }
     else if (command == COMMAND_QMLDEFAULT) {
         QmlPropGroupNode* qpgn = static_cast<QmlPropGroupNode*>(node);
@@ -1105,4 +1118,15 @@
     else
         return false;
+}
+
+/*!
+  Skip to \a target. If \a target is found before the end
+  of input, return true. Otherwise return false.
+ */
+bool CppCodeParser::skipTo(int target)
+{
+    while ((tok != Tok_Eoi) && (tok != target))
+        readToken();
+    return (tok == target ? true : false);
 }
 
@@ -1350,5 +1374,7 @@
     if (!matchDataType(&returnType)) {
         if (tokenizer->parsingFnOrMacro()
-                && (match(Tok_Q_DECLARE_FLAGS) || match(Tok_Q_PROPERTY)))
+                && (match(Tok_Q_DECLARE_FLAGS) ||
+                    match(Tok_Q_PROPERTY) ||
+                    match(Tok_Q_PRIVATE_PROPERTY)))
             returnType = CodeChunk(previousLexeme());
         else {
@@ -1633,6 +1659,7 @@
     QString namespaceName = previousLexeme();
     NamespaceNode *namespasse = 0;
-    if (parent)
+    if (parent) {
         namespasse = static_cast<NamespaceNode*>(parent->findNode(namespaceName, Node::Namespace));
+    }
     if (!namespasse) {
         namespasse = new NamespaceNode(parent, namespaceName);
@@ -1783,9 +1810,17 @@
 bool CppCodeParser::matchProperty(InnerNode *parent)
 {
-    if (!match(Tok_Q_PROPERTY) &&
-        !match(Tok_Q_OVERRIDE) &&
-        !match(Tok_QDOC_PROPERTY))
+    int expected_tok = Tok_LeftParen;
+    if (match(Tok_Q_PRIVATE_PROPERTY)) {
+        expected_tok = Tok_Comma;
+        if (!skipTo(Tok_Comma))
+            return false;
+    }
+    else if (!match(Tok_Q_PROPERTY) &&
+             !match(Tok_Q_OVERRIDE) &&
+             !match(Tok_QDOC_PROPERTY)) {
         return false;
-    if (!match(Tok_LeftParen))
+    }
+    
+    if (!match(expected_tok))
         return false;
 
@@ -1831,8 +1866,18 @@
             tre->addPropertyFunction(property, value, PropertyNode::Setter);
             property->setWritable(true);
-        } else if (key == "STORED")
+        }
+        else if (key == "STORED")
             property->setStored(value.toLower() == "true");
-        else if (key == "DESIGNABLE")
-            property->setDesignable(value.toLower() == "true");
+        else if (key == "DESIGNABLE") {
+            QString v = value.toLower();
+            if (v == "true")
+                property->setDesignable(true);
+            else if (v == "false")
+                property->setDesignable(false);
+            else {
+                property->setDesignable(false);
+                property->setRuntimeDesFunc(value);
+            }
+        }
         else if (key == "RESET")
             tre->addPropertyFunction(property, value, PropertyNode::Resetter);
@@ -1840,5 +1885,19 @@
             tre->addPropertyFunction(property, value, PropertyNode::Notifier);
         }
-
+        else if (key == "SCRIPTABLE") {
+            QString v = value.toLower();
+            if (v == "true")
+                property->setScriptable(true);
+            else if (v == "false")
+                property->setScriptable(false);
+            else {
+                property->setScriptable(false);
+                property->setRuntimeScrFunc(value);
+            }
+        }
+        else if (key == "COSTANT") 
+            property->setConstant();
+        else if (key == "FINAL") 
+            property->setFinal();
     }
     match(Tok_RightParen);
@@ -1912,4 +1971,5 @@
         case Tok_Q_OVERRIDE:
         case Tok_Q_PROPERTY:
+        case Tok_Q_PRIVATE_PROPERTY:
         case Tok_QDOC_PROPERTY:
             matchProperty(parent);
@@ -2100,5 +2160,5 @@
                     ++a;
                 }
-#endif                
+#endif
             }
 
@@ -2249,10 +2309,7 @@
 {
     QString examplePath = fake->name();
-
-    // we can assume that this file always exists
-    QString proFileName = examplePath + "/" +
-        examplePath.split("/").last() + ".pro";
-
+    QString proFileName = examplePath + "/" + examplePath.split("/").last() + ".pro";
     QString userFriendlyFilePath;
+
     QString fullPath = Config::findFile(fake->doc().location(),
                                         exampleFiles,
@@ -2260,5 +2317,5 @@
                                         proFileName,
                                         userFriendlyFilePath);
-    
+
     if (fullPath.isEmpty()) {
         QString tmp = proFileName;
@@ -2271,7 +2328,16 @@
                                     userFriendlyFilePath);
         if (fullPath.isEmpty()) {
-            fake->doc().location().warning(
-               tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName));
-            return;
+            proFileName = examplePath + "/" + examplePath.split("/").last() + ".qmlproject";
+            userFriendlyFilePath.clear();
+            fullPath = Config::findFile(fake->doc().location(),
+                                        exampleFiles,
+                                        exampleDirs,
+                                        proFileName,
+                                        userFriendlyFilePath);
+            if (fullPath.isEmpty()) {
+                fake->doc().location().warning(
+                    tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName));
+                return;
+            }
         }
     }
@@ -2283,12 +2349,4 @@
     QString imagesPath = fullPath + "/images";
     QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter);
-
-#if 0    
-    qDebug() << "examplePath:" << examplePath;
-    qDebug() << " exampleFiles" <<  exampleFiles;
-    qDebug() << "imagesPath:" << imagesPath;
-    qDebug() << "fullPath:" << fullPath;
-    qDebug() << " imageFiles" <<  imageFiles;
-#endif    
 
     if (!exampleFiles.isEmpty()) {
@@ -2304,5 +2362,5 @@
             }
             else if (fileName.contains("/qrc_") || fileName.contains("/moc_")
-                    || fileName.contains("/ui_"))
+                || fileName.contains("/ui_"))
                 i.remove();
         }
@@ -2311,5 +2369,5 @@
 
         // add any qmake Qt resource files and qmake project files
-        exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro");
+        exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro qmldir");
     }
 
Index: trunk/tools/qdoc3/cppcodeparser.h
===================================================================
--- trunk/tools/qdoc3/cppcodeparser.h	(revision 769)
+++ trunk/tools/qdoc3/cppcodeparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -120,4 +120,5 @@
     QString lexeme();
     bool match(int target);
+    bool skipTo(int target);
     bool matchCompat();
     bool matchTemplateAngles(CodeChunk *type = 0);
Index: trunk/tools/qdoc3/cpptoqsconverter.cpp
===================================================================
--- trunk/tools/qdoc3/cpptoqsconverter.cpp	(revision 769)
+++ trunk/tools/qdoc3/cpptoqsconverter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/cpptoqsconverter.h
===================================================================
--- trunk/tools/qdoc3/cpptoqsconverter.h	(revision 769)
+++ trunk/tools/qdoc3/cpptoqsconverter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/dcfsection.cpp
===================================================================
--- trunk/tools/qdoc3/dcfsection.cpp	(revision 769)
+++ trunk/tools/qdoc3/dcfsection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/dcfsection.h
===================================================================
--- trunk/tools/qdoc3/dcfsection.h	(revision 769)
+++ trunk/tools/qdoc3/dcfsection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/ditaxmlgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/ditaxmlgenerator.cpp	(revision 846)
+++ trunk/tools/qdoc3/ditaxmlgenerator.cpp	(revision 846)
@@ -0,0 +1,5163 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+  ditaxmlgenerator.cpp
+*/
+
+#include "codemarker.h"
+#include "codeparser.h"
+#include "ditaxmlgenerator.h"
+#include "node.h"
+#include "separator.h"
+#include "tree.h"
+#include <ctype.h>
+#include <qdebug.h>
+#include <qlist.h>
+#include <qiterator.h>
+#include <qtextcodec.h>
+#include <QUuid>
+
+QT_BEGIN_NAMESPACE
+
+#define COMMAND_VERSION                         Doc::alias("version")
+int DitaXmlGenerator::id = 0;
+
+#define cxxapi_d_xref                      	Doc::alias("cxxapi-d-xref")
+#define cxxclass                           	Doc::alias("cxxclass")
+#define cxxdefine                          	Doc::alias("cxxdefine")
+#define cxxenumeration                     	Doc::alias("cxxenumeration")
+#define cxxfile                            	Doc::alias("cxxfile")
+#define cxxfunction                        	Doc::alias("cxxfunction")
+#define cxxstruct                          	Doc::alias("cxxstruct")
+#define cxxtypedef                         	Doc::alias("cxxtypedef")
+#define cxxunion                           	Doc::alias("cxxunion")
+#define cxxvariable                        	Doc::alias("cxxvariable")
+
+#define CXXAPIMAP                          	Doc::alias("cxxAPIMap")
+#define CXXCLASSREF                        	Doc::alias("cxxClassRef")
+#define CXXDEFINEREF                       	Doc::alias("cxxDefineRef")
+#define CXXENUMERATIONREF                  	Doc::alias("cxxEnumerationRef")
+#define CXXFILEREF                         	Doc::alias("cxxFileRef")
+#define CXXFUNCTIONREF                     	Doc::alias("cxxFunctionRef")
+#define CXXSTRUCTREF                       	Doc::alias("cxxStructRef")
+#define CXXTYPDEFREF                       	Doc::alias("cxxTypedefRef")
+#define CXXUNIONREF                        	Doc::alias("cxxUnionRef")
+#define CXXVARIABLEREF                     	Doc::alias("cxxVariableRef")
+
+#define CXXCLASS                           	Doc::alias("cxxClass")
+#define CXXCLASSABSTRACT                   	Doc::alias("cxxClassAbstract")
+#define CXXCLASSACCESSSPECIFIER            	Doc::alias("cxxClassAccessSpecifier")
+#define CXXCLASSAPIITEMLOCATION            	Doc::alias("cxxClassAPIItemLocation")
+#define CXXCLASSBASECLASS                  	Doc::alias("cxxClassBaseClass")
+#define CXXCLASSBASECLASSSTRUCT            	Doc::alias("cxxClassBaseStruct")
+#define CXXCLASSBASEUNION                  	Doc::alias("cxxClassBaseUnion")
+#define CXXCLASSDECLARATIONFILE            	Doc::alias("cxxClassDeclarationFile")
+#define CXXCLASSDECLARATIONFILELINE        	Doc::alias("cxxClassDeclarationFileLine")
+#define CXXCLASSDEFINITION                 	Doc::alias("cxxClassDefinition")
+#define CXXCLASSDEFINITIONFILE             	Doc::alias("cxxClassDefinitionFile")
+#define CXXCLASSDEFINITIONFILEEND          	Doc::alias("cxxClassDefinitionFileLineEnd")
+#define CXXCLASSDEFINITIONFILESTART        	Doc::alias("cxxClassDefinitionFileLineStart")
+#define CXXCLASSDERIVATION                 	Doc::alias("cxxClassDerivation")
+#define CXXCLASSDERIVATIONACCESSSPECIFIER  	Doc::alias("cxxClassDerivationAccessSpecifier")
+#define CXXCLASSDERIVATIONS                	Doc::alias("cxxClassDerivations")
+#define CXXCLASSDERIVATIONVIRTUAL          	Doc::alias("cxxClassDerivationVirtual")
+#define CXXCLASSDETAIL                     	Doc::alias("cxxClassDetail")
+#define CXXCLASSENUMERATIONINHERITED       	Doc::alias("cxxClassEnumerationInherited")
+#define CXXCLASSENUMERATORINHERITED        	Doc::alias("cxxClassEnumeratorInherited")
+#define CXXCLASSFUNCTIONINHERITED          	Doc::alias("cxxClassFunctionInherited")
+#define CXXCLASSINHERITS                   	Doc::alias("cxxClassInherits")
+#define CXXCLASSINHERITSDETAIL             	Doc::alias("cxxClassInheritsDetail")
+#define CXXCLASSNESTED                     	Doc::alias("cxxClassNested")
+#define CXXCLASSNESTEDCLASS                	Doc::alias("cxxClassNestedClass")
+#define CXXCLASSNESTEDDETAIL               	Doc::alias("cxxClassNestedDetail")
+#define CXXCLASSNESTEDSTRUCT               	Doc::alias("cxxClassNestedStruct")
+#define CXXCLASSNESTEDUNION                	Doc::alias("cxxClassNestedUnion")
+#define CXXCLASSTEMPLATEPARAMETER          	Doc::alias("cxxClassTemplateParameter")
+#define CXXCLASSTEMPLATEPARAMETERS         	Doc::alias("cxxClassTemplateParameters")
+#define CXXCLASSTEMPLATEPARAMETERTYPE      	Doc::alias("cxxClassTemplateParameterType")
+#define CXXCLASSVARIABLEINHERITED          	Doc::alias("cxxClassVariableInherited")
+
+#define CXXDEFINE                          	Doc::alias("cxxDefine")
+#define CXXDEFINEACCESSSPECIFIER           	Doc::alias("cxxDefineAccessSpecifier")
+#define CXXDEFINEAPIITEMLOCATION           	Doc::alias("cxxDefineAPIItemLocation")
+#define CXXDEFINEDECLARATIONFILE           	Doc::alias("cxxDefineDeclarationFile")
+#define CXXDEFINEDECLARATIONFILELINE       	Doc::alias("cxxDefineDeclarationFileLine")
+#define CXXDEFINEDEFINITION                	Doc::alias("cxxDefineDefinition")
+#define CXXDEFINEDETAIL                    	Doc::alias("cxxDefineDetail")
+#define CXXDEFINENAMELOOKUP                	Doc::alias("cxxDefineNameLookup")
+#define CXXDEFINEPARAMETER                 	Doc::alias("cxxDefineParameter")
+#define CXXDEFINEPARAMETERDECLARATIONNAME  	Doc::alias("cxxDefineParameterDeclarationName")
+#define CXXDEFINEPARAMETERS                	Doc::alias("cxxDefineParameters")
+#define CXXDEFINEPROTOTYPE                 	Doc::alias("cxxDefinePrototype")
+#define CXXDEFINEREIMPLEMENTED             	Doc::alias("cxxDefineReimplemented")
+
+#define CXXENUMERATION                     	Doc::alias("cxxEnumeration")
+#define CXXENUMERATIONACCESSSPECIFIER      	Doc::alias("cxxEnumerationAccessSpecifier")
+#define CXXENUMERATIONAPIITEMLOCATION      	Doc::alias("cxxEnumerationAPIItemLocation")
+#define CXXENUMERATIONDECLARATIONFILE      	Doc::alias("cxxEnumerationDeclarationFile")
+#define CXXENUMERATIONDECLARATIONFILELINE  	Doc::alias("cxxEnumerationDeclarationFileLine")
+#define CXXENUMERATIONDEFINITION                Doc::alias("cxxEnumerationDefinition")
+#define CXXENUMERATIONDEFINITIONFILE            Doc::alias("cxxEnumerationDefinitionFile")
+#define CXXENUMERATIONDEFINITIONFILELINEEND     Doc::alias("cxxEnumerationDefinitionFileLineEnd")
+#define CXXENUMERATIONDEFINITIONFILELINESTART   Doc::alias("cxxEnumerationDefinitionFileLineStart")
+#define CXXENUMERATIONDETAIL                    Doc::alias("cxxEnumerationDetail")
+#define CXXENUMERATIONNAMELOOKUP                Doc::alias("cxxEnumerationNameLookup")
+#define CXXENUMERATIONPROTOTYPE                 Doc::alias("cxxEnumerationPrototype")
+#define CXXENUMERATIONREIMPLEMENTED             Doc::alias("cxxEnumerationReimplemented")
+#define CXXENUMERATIONSCOPEDNAME                Doc::alias("cxxEnumerationScopedName")
+#define CXXENUMERATOR                           Doc::alias("cxxEnumerator")
+#define CXXENUMERATORAPIITEMLOCATION            Doc::alias("cxxEnumeratorAPIItemLocation")
+#define CXXENUMERATORDECLARATIONFILE            Doc::alias("cxxEnumeratorDeclarationFile")
+#define CXXENUMERATORDECLARATIONFILELINE        Doc::alias("cxxEnumeratorDeclarationFileLine")
+#define CXXENUMERATORINITIALISER                Doc::alias("cxxEnumeratorInitialiser")
+#define CXXENUMERATORNAMELOOKUP                 Doc::alias("cxxEnumeratorNameLookup")
+#define CXXENUMERATORPROTOTYPE                  Doc::alias("cxxEnumeratorPrototype")
+#define CXXENUMERATORS                          Doc::alias("cxxEnumerators")
+#define CXXENUMERATORSCOPEDNAME                 Doc::alias("cxxEnumeratorScopedName")
+
+#define CXXFILE_INFO_TYPES                      Doc::alias("cxxFile-info-types")
+#define CXXFILE_TYPES_DEFAULT                   Doc::alias("cxxFile-types-default")
+#define CXXFILE                                 Doc::alias("cxxFile")
+#define CXXFILEAPIITMELOCATION                  Doc::alias("cxxFileAPIItemLocation")
+#define CXXFILEDECLARATIONFILE                  Doc::alias("cxxFileDeclarationFile")
+
+#define CXXFUNCTION                             Doc::alias("cxxFunction")
+#define CXXFUNCTIONACCESSSPECIFIER              Doc::alias("cxxFunctionAccessSpecifier")
+#define CXXFUNCTIONAPIITEMLOCATION              Doc::alias("cxxFunctionAPIItemLocation")
+#define CXXFUNCTIONCONST                        Doc::alias("cxxFunctionConst")
+#define CXXFUNCTIONCONSTRUCTOR                  Doc::alias("cxxFunctionConstructor")
+#define CXXFUNCTIONDECLARATIONFILE              Doc::alias("cxxFunctionDeclarationFile")
+#define CXXFUNCTIONDECLARATIONFILELINE          Doc::alias("cxxFunctionDeclarationFileLine")
+#define CXXFUNCTIONDECLAREDTYPE                 Doc::alias("cxxFunctionDeclaredType")
+#define CXXFUNCTIONDEFINITION                   Doc::alias("cxxFunctionDefinition")
+#define CXXFUNCTIONDEFINITIONFILE               Doc::alias("cxxFunctionDefinitionFile")
+#define CXXFUNCTIONDEFINITIONFILELINEEND        Doc::alias("cxxFunctionDefinitionFileLineEnd")
+#define CXXFUNCTIONDEFINITIONFILELINESTART      Doc::alias("cxxFunctionDefinitionFileLineStart")
+#define CXXFUNCTIONDESTRUCTOR                   Doc::alias("cxxFunctionDestructor")
+#define CXXFUNCTIONDETAIL                       Doc::alias("cxxFunctionDetail")
+#define CXXFUNCTIONEXPLICIT                     Doc::alias("cxxFunctionExplicit")
+#define CXXFUNCTIONINLINE                       Doc::alias("cxxFunctionInline")
+#define CXXFUNCTIONNAMELOOKUP                   Doc::alias("cxxFunctionNameLookup")
+#define CXXFUNCTIONPARAMETER                    Doc::alias("cxxFunctionParameter")
+#define CXXFUNCTIONPARAMETERDECLARATIONNAME     Doc::alias("cxxFunctionParameterDeclarationName")
+#define CXXFUNCTIONPARAMETERDECLAREDTYPE        Doc::alias("cxxFunctionParameterDeclaredType")
+#define CXXFUNCTIONPARAMETERDEFAULTVALUE        Doc::alias("cxxFunctionParameterDefaultValue")
+#define CXXFUNCTIONPARAMETERDEFINITIONNAME      Doc::alias("cxxFunctionParameterDefinitionName")
+#define CXXFUNCTIONPARAMETERS                   Doc::alias("cxxFunctionParameters")
+#define CXXFUNCTIONPROTOTYPE                    Doc::alias("cxxFunctionPrototype")
+#define CXXFUNCTIONPUREVIRTUAL                  Doc::alias("cxxFunctionPureVirtual")
+#define CXXFUNCTIONREIMPLEMENTED                Doc::alias("cxxFunctionReimplemented")
+#define CXXFUNCTIONRETURNTYPE                   Doc::alias("cxxFunctionReturnType")
+#define CXXFUNCTIONSCOPEDNAME                   Doc::alias("cxxFunctionScopedName")
+#define CXXFUNCTIONSTORAGECLASSSPECIFIEREXTERN  Doc::alias("cxxFunctionStorageClassSpecifierExtern")
+#define CXXFUNCTIONSTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxFunctionStorageClassSpecifierMutable")
+#define CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC  Doc::alias("cxxFunctionStorageClassSpecifierStatic")
+#define CXXFUNCTIONTEMPLATEPARAMETER            Doc::alias("cxxFunctionTemplateParameter")
+#define CXXFUNCTIONTEMPLATEPARAMETERS           Doc::alias("cxxFunctionTemplateParameters")
+#define CXXFUNCTIONTEMPLATEPARAMETERTYPE        Doc::alias("cxxFunctionTemplateParameterType")
+#define CXXFUNCTIONVIRTUAL                      Doc::alias("cxxFunctionVirtual")
+#define CXXFUNCTIONVOLATILE                     Doc::alias("cxxFunctionVolatile")
+
+#define CXXSTRUCT                               Doc::alias("cxxStruct")
+#define CXXSTRUCTABSTRACT                       Doc::alias("cxxStructAbstract")
+#define CXXSTRUCTACCESSSPECIFIER                Doc::alias("cxxStructAccessSpecifier")
+#define CXXSTRUCTAPIITEMLOCATION                Doc::alias("cxxStructAPIItemLocation")
+#define CXXSTRUCTBASECLASS                      Doc::alias("cxxStructBaseClass")
+#define CXXSTRUCTBASESTRUCT                     Doc::alias("cxxStructBaseStruct")
+#define CXXSTRUCTBASEUNION                      Doc::alias("cxxStructBaseUnion")
+#define CXXSTRUCTDECLARATIONFILE                Doc::alias("cxxStructDeclarationFile")
+#define CXXSTRUCTDECLARATIONFILELINE            Doc::alias("cxxStructDeclarationFileLine")
+#define CXXSTRUCTDEFINITION                     Doc::alias("cxxStructDefinition")
+#define CXXSTRUCTDEFINITIONFILE                 Doc::alias("cxxStructDefinitionFile")
+#define CXXSTRUCTDEFINITIONFILELINEEND          Doc::alias("cxxStructDefinitionFileLineEnd")
+#define CXXSTRUCTDEFINITIONFILELINESTART        Doc::alias("cxxStructDefinitionFileLineStart")
+#define CXXSTRUCTDERIVATION                     Doc::alias("cxxStructDerivation")
+#define CXXSTRUCTDERIVATIONACCESSSPECIFIER      Doc::alias("cxxStructDerivationAccessSpecifier")
+#define CXXSTRUCTDERIVATIONS                    Doc::alias("cxxStructDerivations")
+#define CXXSTRUCTDERIVATIONVIRTUAL              Doc::alias("cxxStructDerivationVirtual")
+#define CXXSTRUCTDETAIL                         Doc::alias("cxxStructDetail")
+#define CXXSTRUCTENUMERATIONINHERITED           Doc::alias("cxxStructEnumerationInherited")
+#define CXXSTRUCTENUMERATORINHERITED            Doc::alias("cxxStructEnumeratorInherited")
+#define CXXSTRUCTFUNCTIONINHERITED              Doc::alias("cxxStructFunctionInherited")
+#define CXXSTRUCTINHERITS                       Doc::alias("cxxStructInherits")
+#define CXXSTRUCTINHERITSDETAIL                 Doc::alias("cxxStructInheritsDetail")
+#define CXXSTRUCTNESTED                         Doc::alias("cxxStructNested")
+#define CXXSTRUCTNESTEDCLASS                    Doc::alias("cxxStructNestedClass")
+#define CXXSTRUCTNESTEDDETAIL                   Doc::alias("cxxStructNestedDetail")
+#define CXXSTRUCTNESTEDSTRUCT                   Doc::alias("cxxStructNestedStruct")
+#define CXXSTRUCTNESTEDUNION                    Doc::alias("cxxStructNestedUnion")
+#define CXXSTRUCTTEMPLATEPARAMETER              Doc::alias("cxxStructTemplateParameter")
+#define CXXSTRUCTTEMPLATEPARAMETERS             Doc::alias("cxxStructTemplateParameters")
+#define CXXSTRUCTTEMPLATEPARAMETERTYPE          Doc::alias("cxxStructTemplateParameterType")
+#define CXXSTRUCTVARIABLEINHERITED              Doc::alias("cxxStructVariableInherited")
+
+#define CXXTYPEDEF                              Doc::alias("cxxTypedef")
+#define CXXTYPEDEFACCESSSPECIFIER               Doc::alias("cxxTypedefAccessSpecifier")
+#define CXXTYPEDEFAPIITEMLOCATION               Doc::alias("cxxTypedefAPIItemLocation")
+#define CXXTYPEDEFDECLARATIONFILE               Doc::alias("cxxTypedefDeclarationFile")
+#define CXXTYPEDEFDECLARATIONFILELINE           Doc::alias("cxxTypedefDeclarationFileLine")
+#define CXXTYPEDEFDECLAREDTYPE                  Doc::alias("cxxTypedefDeclaredType")
+#define CXXTYPEDEFDEFINITION                    Doc::alias("cxxTypedefDefinition")
+#define CXXTYPEDEFDETAIL                        Doc::alias("cxxTypedefDetail")
+#define CXXTYPEDEFNAMELOOKUP                    Doc::alias("cxxTypedefNameLookup")
+#define CXXTYPEDEFPROTOTYPE                     Doc::alias("cxxTypedefPrototype")
+#define CXXTYPEDEFREIMPLEMENTED                 Doc::alias("cxxTypedefReimplemented")
+#define CXXTYPEDEFSCOPEDNAME                    Doc::alias("cxxTypedefScopedName")
+
+#define CXXUNION                                Doc::alias("cxxUnion")
+#define CXXUNIONABSTRACT                        Doc::alias("cxxUnionAbstract")
+#define CXXUNIONACCESSSPECIFIER                 Doc::alias("cxxUnionAccessSpecifier")
+#define CXXUNIONAPIITEMLOCATION                 Doc::alias("cxxUnionAPIItemLocation")
+#define CXXUNIONDECLARATIONFILE                 Doc::alias("cxxUnionDeclarationFile")
+#define CXXUNIONDECLARATIONFILELINE             Doc::alias("cxxUnionDeclarationFileLine")
+#define CXXUNIONDEFINITION                      Doc::alias("cxxUnionDefinition")
+#define CXXUNIONDEFINITIONFILE                  Doc::alias("cxxUnionDefinitionFile")
+#define CXXUNIONDEFINITIONFILELINEEND           Doc::alias("cxxUnionDefinitionFileLineEnd")
+#define CXXUNIONDEFINITIONFILELINESTART         Doc::alias("cxxUnionDefinitionFileLineStart")
+#define CXXUNIONDETAIL                          Doc::alias("cxxUnionDetail")
+#define CXXUNIONNESTED                          Doc::alias("cxxUnionNested")
+#define CXXUNIONNESTEDCLASS                     Doc::alias("cxxUnionNestedClass")
+#define CXXUNIONNESTEDDETAIL                    Doc::alias("cxxUnionNestedDetail")
+#define CXXUNIONNESTEDSTRUCT                    Doc::alias("cxxUnionNestedStruct")
+#define CXXUNIONNESTEDUNION                     Doc::alias("cxxUnionNestedUnion")
+#define CXXUNIONTEMPLATEPARAMETER               Doc::alias("cxxUnionTemplateParameter")
+#define CXXUNIONTEMPLATEPARAMETERS              Doc::alias("cxxUnionTemplateParameters")
+#define CXXUNIONTEMPLATEPARAMETERTYPE           Doc::alias("cxxUnionTemplateParameterType")
+
+#define CXXVARIABLE                             Doc::alias("cxxVariable")
+#define CXXVARIABLEACCESSSPECIFIER              Doc::alias("cxxVariableAccessSpecifier")
+#define CXXVARIABLEAPIITEMLOCATION              Doc::alias("cxxVariableAPIItemLocation")
+#define CXXVARIABLECONST                        Doc::alias("cxxVariableConst")
+#define CXXVARIABLEDECLARATIONFILE              Doc::alias("cxxVariableDeclarationFile")
+#define CXXVARIABLEDECLARATIONFILELINE          Doc::alias("cxxVariableDeclarationFileLine")
+#define CXXVARIABLEDECLAREDTYPE                 Doc::alias("cxxVariableDeclaredType")
+#define CXXVARIABLEDEFINITION                   Doc::alias("cxxVariableDefinition")
+#define CXXVARIABLEDETAIL                       Doc::alias("cxxVariableDetail")
+#define CXXVARIABLENAMELOOKUP                   Doc::alias("cxxVariableNameLookup")
+#define CXXVARIABLEPROTOTYPE                    Doc::alias("cxxVariablePrototype")
+#define CXXVARIABLEREIMPLEMENTED                Doc::alias("cxxVariableReimplemented")
+#define CXXVARIABLESCOPEDNAME                   Doc::alias("cxxVariableScopedName")
+#define CXXVARIABLESTORAGECLASSSPECIFIEREXTERN  Doc::alias("cxxVariableStorageClassSpecifierExtern")
+#define CXXVARIABLESTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxVariableStorageClassSpecifierMutable")
+#define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC  Doc::alias("cxxVariableStorageClassSpecifierStatic")
+#define CXXVARIABLEVOLATILE                     Doc::alias("cxxVariableVolatile")
+
+#define APIREF		                        Doc::alias("apiRef")
+#define APINAME		                        Doc::alias("apiName")
+#define APIDETAIL		                Doc::alias("apiDetail")
+#define APISYNTAX		                Doc::alias("apiSyntax")
+#define APISYNTAXTEXT				Doc::alias("apiSyntaxText")
+#define APISYNTAXITEM				Doc::alias("apiSyntaxItem")
+#define APIDEF		        		Doc::alias("apiDef")
+#define APIQUALIFIER				Doc::alias("apiQualifier")
+#define APIRELATION				Doc::alias("apiRelation")
+#define APITYPE		        		Doc::alias("apiType")
+#define APIARRAY		        	Doc::alias("apiArray")
+#define APIDATA		        		Doc::alias("apiData")
+#define APIDEFNOTE		        	Doc::alias("apiDefNote")
+#define APIDEFITEM		        	Doc::alias("apiDefItem")
+#define APIITEMNAME				Doc::alias("apiItemName")
+#define APIDESC		        		Doc::alias("apiDesc")
+#define APIIMPL		        		Doc::alias("apiImpl")
+
+#define APIPACKAGE		        	Doc::alias("apiPackage")
+
+#define APICLASSIFIER				Doc::alias("apiClassifier")
+#define APICLASSIFIERDETAIL			Doc::alias("apiClassifierDetail")
+#define APICLASSIFIERDEF			Doc::alias("apiClassifierDef")
+#define APICLASSIFIERMEMBER			Doc::alias("apiClassifierMember")
+#define APIOTHERCLASSIFIER			Doc::alias("apiOtherClassifier")
+#define APIBASECLASSIFIER			Doc::alias("apiBaseClassifier")
+
+#define APIOPERATION				Doc::alias("apiOperation")
+#define APIOPERATIONDETAIL			Doc::alias("apiOperationDetail")
+#define APIOPERATIONDEF				Doc::alias("apiOperationDef")
+#define APIRETURN		        	Doc::alias("apiReturn")
+#define APIPARAM		        	Doc::alias("apiParam")
+#define APIEVENT		        	Doc::alias("apiEvent")
+#define APIOPERATIONDEFITEM			Doc::alias("apiOperationDefItem")
+#define APIOPERATIONCLASSIFIER			Doc::alias("apiOperationClassifier")
+#define APICONSTRUCTORDEF			Doc::alias("apiConstructorDef")
+
+#define APIVALUE		        	Doc::alias("apiValue")
+#define APIVALUEDETAIL				Doc::alias("apiValueDetail")
+#define APIVALUEDEF				Doc::alias("apiValueDef")
+#define APIVALUEMEMBER				Doc::alias("apiValueMember")
+#define APIVALUECLASSIFIER			Doc::alias("apiValueClassifier")
+
+#define APIclassifier				Doc::alias("apiclassifier")
+#define APIoperation				Doc::alias("apioperation")
+#define APIpackage		        	Doc::alias("apipackage")
+#define APIvalue		        	Doc::alias("apivalue")
+
+#define APIMAP		        		Doc::alias("apiMap")
+#define APIITEMREF		        	Doc::alias("apiItemRef")
+
+#define SHORTDESC                               Doc::alias("shortdesc")
+
+QString DitaXmlGenerator::sinceTitles[] =
+    {
+        "    New Namespaces",
+        "    New Classes",
+        "    New Member Functions",
+        "    New Functions in Namespaces",
+        "    New Global Functions",
+        "    New Macros",
+        "    New Enum Types",
+        "    New Typedefs",
+        "    New Properties",
+        "    New Variables",
+        "    New QML Elements",
+        "    New Qml Properties",
+        "    New Qml Signals",
+        "    New Qml Methods",
+        ""
+    };
+
+static bool showBrokenLinks = false;
+
+static void addLink(const QString &linkTarget,
+                    const QStringRef &nestedStuff,
+                    QString *res)
+{
+    if (!linkTarget.isEmpty()) {
+        *res += "<xref href=\"";
+        *res += linkTarget;
+        *res += "\">";
+        *res += nestedStuff;
+        *res += "</xref>";
+    }
+    else {
+        *res += nestedStuff;
+    }
+}
+
+
+DitaXmlGenerator::DitaXmlGenerator()
+    : inLink(false),
+      inContents(false),
+      inSectionHeading(false),
+      inTableHeader(false),
+      numTableRows(0),
+      threeColumnEnumValueTable(true),
+      offlineDocs(true),
+      funcLeftParen("\\S(\\()"),
+      myTree(0),
+      slow(false),
+      obsoleteLinks(false),
+      noLinks(0)
+{
+}
+
+DitaXmlGenerator::~DitaXmlGenerator()
+{
+    // nothing yet.
+}
+
+void DitaXmlGenerator::initializeGenerator(const Config &config)
+{
+    static const struct {
+        const char *key;
+        const char *tag;
+    } defaults[] = {
+        { ATOM_FORMATTING_BOLD, "b" },
+        { ATOM_FORMATTING_INDEX, "<!--" },
+        { ATOM_FORMATTING_ITALIC, "i" },
+        { ATOM_FORMATTING_PARAMETER, "i" },
+        { ATOM_FORMATTING_SUBSCRIPT, "sub" },
+        { ATOM_FORMATTING_SUPERSCRIPT, "sup" },
+        { ATOM_FORMATTING_TELETYPE, "tt", },
+        { ATOM_FORMATTING_UNDERLINE, "u", },
+        { 0, 0 }
+    };
+
+    Generator::initializeGenerator(config);
+    obsoleteLinks = config.getBool(QLatin1String(CONFIG_OBSOLETELINKS));
+    setImageFileExtensions(QStringList() << "png" << "jpg" << "jpeg" << "gif");
+    int i = 0;
+    while (defaults[i].key) {
+        formattingLeftMap().insert(defaults[i].key, defaults[i].tag);
+        i++;
+    }
+
+    style = config.getString(DitaXmlGenerator::format() +
+                             Config::dot +
+                             DITAXMLGENERATOR_STYLE);
+    postHeader = config.getString(DitaXmlGenerator::format() +
+                                  Config::dot +
+                                  DITAXMLGENERATOR_POSTHEADER);
+    postPostHeader = config.getString(DitaXmlGenerator::format() +
+                                      Config::dot +
+                                      DITAXMLGENERATOR_POSTPOSTHEADER);
+    footer = config.getString(DitaXmlGenerator::format() +
+                              Config::dot +
+                              DITAXMLGENERATOR_FOOTER);
+    address = config.getString(DitaXmlGenerator::format() +
+                               Config::dot +
+                               DITAXMLGENERATOR_ADDRESS);
+    pleaseGenerateMacRef = config.getBool(DitaXmlGenerator::format() +
+                                          Config::dot +
+                                          DITAXMLGENERATOR_GENERATEMACREFS);
+
+    project = config.getString(CONFIG_PROJECT);
+    projectDescription = config.getString(CONFIG_DESCRIPTION);
+    if (projectDescription.isEmpty() && !project.isEmpty())
+        projectDescription = project + " Reference Documentation";
+
+    projectUrl = config.getString(CONFIG_URL);
+
+    outputEncoding = config.getString(CONFIG_OUTPUTENCODING);
+    if (outputEncoding.isEmpty())
+        outputEncoding = QLatin1String("ISO-8859-1");
+    outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit());
+
+    naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE);
+    if (naturalLanguage.isEmpty())
+        naturalLanguage = QLatin1String("en");
+
+    QSet<QString> editionNames = config.subVars(CONFIG_EDITION);
+    QSet<QString>::ConstIterator edition = editionNames.begin();
+    while (edition != editionNames.end()) {
+        QString editionName = *edition;
+        QStringList editionModules = config.getStringList(CONFIG_EDITION +
+                                                          Config::dot +
+                                                          editionName +
+                                                          Config::dot +
+                                                          "modules");
+        QStringList editionGroups = config.getStringList(CONFIG_EDITION +
+                                                         Config::dot +
+                                                         editionName +
+                                                         Config::dot +
+                                                         "groups");
+
+        if (!editionModules.isEmpty())
+            editionModuleMap[editionName] = editionModules;
+        if (!editionGroups.isEmpty())
+            editionGroupMap[editionName] = editionGroups;
+
+        ++edition;
+    }
+
+    slow = config.getBool(CONFIG_SLOW);
+
+    stylesheets = config.getStringList(DitaXmlGenerator::format() +
+                                       Config::dot +
+                                       DITAXMLGENERATOR_STYLESHEETS);
+    customHeadElements = config.getStringList(DitaXmlGenerator::format() +
+                                              Config::dot +
+                                              DITAXMLGENERATOR_CUSTOMHEADELEMENTS);
+    codeIndent = config.getInt(CONFIG_CODEINDENT);
+
+}
+
+void DitaXmlGenerator::terminateGenerator()
+{
+    Generator::terminateGenerator();
+}
+
+QString DitaXmlGenerator::format()
+{
+    return "DITAXML";
+}
+
+/*!
+  Calls lookupGuid() to get a GUID for \a text, then writes
+  it to the XML stream as an "id" attribute, and returns it.
+ */
+QString DitaXmlGenerator::writeGuidAttribute(QString text)
+{
+    QString guid = lookupGuid(text);
+    writer.writeAttribute("id",guid);
+    return guid;
+}
+
+/*!
+  Looks up \a text in the GUID map. If it finds \a text,
+  it returns the associated GUID. Otherwise it inserts
+  \a text into the map with a new GUID, and it returns
+  the new GUID.
+ */
+QString DitaXmlGenerator::lookupGuid(QString text)
+{
+    QMap<QString, QString>::const_iterator i = name2guidMap.find(text);
+    if (i != name2guidMap.end())
+        return i.value();
+    QString guid = QUuid::createUuid().toString();
+    name2guidMap.insert(text,guid);
+    return guid;
+}
+
+/*!
+  This is where the DITA XML files are written.
+  \note The file generation is done in the base class,
+  PageGenerator::generateTree().
+ */
+void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
+{
+    myTree = tree;
+    nonCompatClasses.clear();
+    mainClasses.clear();
+    compatClasses.clear();
+    obsoleteClasses.clear();
+    moduleClassMap.clear();
+    moduleNamespaceMap.clear();
+    funcIndex.clear();
+    legaleseTexts.clear();
+    serviceClasses.clear();
+    qmlClasses.clear();
+    findAllClasses(tree->root());
+    findAllFunctions(tree->root());
+    findAllLegaleseTexts(tree->root());
+    findAllNamespaces(tree->root());
+    findAllSince(tree->root());
+
+    PageGenerator::generateTree(tree, marker);
+}
+
+void DitaXmlGenerator::startText(const Node* /* relative */,
+                                 CodeMarker* /* marker */)
+{
+    inLink = false;
+    inContents = false;
+    inSectionHeading = false;
+    inTableHeader = false;
+    numTableRows = 0;
+    threeColumnEnumValueTable = true;
+    link.clear();
+    sectionNumber.clear();
+}
+
+/*!
+  Generate html from an instance of Atom.
+ */
+int DitaXmlGenerator::generateAtom(const Atom *atom,
+                                   const Node *relative,
+                                   CodeMarker *marker)
+{
+    int skipAhead = 0;
+    QString hx;
+    static bool in_para = false;
+    QString guid;
+    
+    switch (atom->type()) {
+    case Atom::AbstractLeft:
+        break;
+    case Atom::AbstractRight:
+        break;
+    case Atom::AutoLink:
+        if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) {
+            const Node *node = 0;
+            QString link = getLink(atom, relative, marker, &node);
+            if (!link.isEmpty()) {
+                beginLink(link, node, relative, marker);
+                generateLink(atom, relative, marker);
+                endLink();
+            }
+            else {
+                writer.writeCharacters(protectEnc(atom->string()));
+            }
+        }
+        else {
+            writer.writeCharacters(protectEnc(atom->string()));
+        }
+        break;
+    case Atom::BaseName:
+        break;
+    case Atom::BriefLeft:
+        if (relative->type() == Node::Fake) {
+            skipAhead = skipAtoms(atom, Atom::BriefRight);
+            break;
+        }
+        writer.writeStartElement(SHORTDESC);
+        if (relative->type() == Node::Property ||
+            relative->type() == Node::Variable) {
+            QString str;
+            atom = atom->next();
+            while (atom != 0 && atom->type() != Atom::BriefRight) {
+                if (atom->type() == Atom::String ||
+                    atom->type() == Atom::AutoLink)
+                    str += atom->string();
+                skipAhead++;
+                atom = atom->next();
+            }
+            str[0] = str[0].toLower();
+            if (str.right(1) == ".")
+                str.truncate(str.length() - 1);
+            writer.writeCharacters("This ");
+            if (relative->type() == Node::Property)
+                writer.writeCharacters("property");
+            else
+                writer.writeCharacters("variable");
+            QStringList words = str.split(" ");
+            if (!(words.first() == "contains" || words.first() == "specifies"
+                || words.first() == "describes" || words.first() == "defines"
+                || words.first() == "holds" || words.first() == "determines"))
+                writer.writeCharacters(" holds ");
+            else
+                writer.writeCharacters(" ");
+            writer.writeCharacters(str + ".");
+        }
+        break;
+    case Atom::BriefRight:
+        if (relative->type() != Node::Fake) {
+            writer.writeEndElement(); // </shortdesc>
+        }
+        break;
+    case Atom::C:
+        writer.writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]);
+        if (inLink) {
+            writer.writeCharacters(protectEnc(plainCode(atom->string())));
+        }
+        else {
+            writer.writeCharacters(highlightedCode(atom->string(), marker, relative));
+        }
+        writer.writeEndElement(); // sse writeStartElement() above
+        break;
+    case Atom::Code:
+        writer.writeStartElement("pre");
+        writer.writeAttribute("outputclass","highlightedCode");
+        writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+                                                               marker,
+                                                               relative)));
+        writer.writeEndElement(); // </pre>
+	break;
+#ifdef QDOC_QML
+    case Atom::Qml:
+        writer.writeStartElement("pre");
+        writer.writeAttribute("outputclass","highlightedCode");
+        writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+                                                               marker,
+                                                               relative)));
+        writer.writeEndElement(); // pre
+	break;
+#endif
+    case Atom::CodeNew:
+        writer.writeStartElement("p");
+        writer.writeCharacters("you can rewrite it as");
+        writer.writeEndElement(); // </p>
+        writer.writeStartElement("pre");
+        writer.writeAttribute("outputclass","highlightedCode");
+        writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+                                                               marker,
+                                                               relative)));
+        writer.writeEndElement(); // </pre>
+        break;
+    case Atom::CodeOld:
+        writer.writeStartElement("p");
+        writer.writeCharacters("For example, if you have code like");
+        writer.writeEndElement(); // </p>
+        // fallthrough
+    case Atom::CodeBad:
+        writer.writeStartElement("pre");
+        writer.writeAttribute("outputclass","highlightedCode");
+        writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))));
+        writer.writeEndElement(); // </pre>
+	break;
+    case Atom::FootnoteLeft:
+        // ### For now
+        if (in_para) {
+            writer.writeEndElement(); // </p>
+            in_para = false;
+        }
+        writer.writeCharacters("<!-- ");
+        break;
+    case Atom::FootnoteRight:
+        // ### For now
+        writer.writeCharacters("-->");
+        break;
+    case Atom::FormatElse:
+    case Atom::FormatEndif:
+    case Atom::FormatIf:
+        break;
+    case Atom::FormattingLeft:
+        writer.writeStartElement(formattingLeftMap()[atom->string()]);
+        if (atom->string() == ATOM_FORMATTING_PARAMETER) {
+            if (atom->next() != 0 && atom->next()->type() == Atom::String) {
+                QRegExp subscriptRegExp("([a-z]+)_([0-9n])");
+                if (subscriptRegExp.exactMatch(atom->next()->string())) {
+                    writer.writeCharacters(subscriptRegExp.cap(1));
+                    writer.writeStartElement("sub");
+                    writer.writeCharacters(subscriptRegExp.cap(2));
+                    writer.writeEndElement(); // </sub>
+                    skipAhead = 1;
+                }
+            }
+        }
+        break;
+    case Atom::FormattingRight:
+        if (atom->string() == ATOM_FORMATTING_LINK) {
+            endLink();
+        }
+        else {
+            writer.writeEndElement(); // ?
+        }
+        break;
+    case Atom::AnnotatedList:
+        {
+            QList<Node*> values = myTree->groups().values(atom->string());
+            NodeMap nodeMap;
+            for (int i = 0; i < values.size(); ++i) {
+                const Node* n = values.at(i);
+                if ((n->status() != Node::Internal) && (n->access() != Node::Private)) {
+                    nodeMap.insert(n->nameForLists(),n);
+                }
+            }
+            generateAnnotatedList(relative, marker, nodeMap);
+        }
+        break;
+    case Atom::GeneratedList:
+        if (atom->string() == "annotatedclasses") {
+            generateAnnotatedList(relative, marker, nonCompatClasses);
+        }
+        else if (atom->string() == "classes") {
+            generateCompactList(relative, marker, nonCompatClasses, true);
+        }
+        else if (atom->string() == "qmlclasses") {
+            generateCompactList(relative, marker, qmlClasses, true);
+        }
+        else if (atom->string().contains("classesbymodule")) {
+            QString arg = atom->string().trimmed();
+            QString moduleName = atom->string().mid(atom->string().indexOf(
+                "classesbymodule") + 15).trimmed();
+            if (moduleClassMap.contains(moduleName))
+                generateAnnotatedList(relative, marker, moduleClassMap[moduleName]);
+        }
+        else if (atom->string().contains("classesbyedition")) {
+
+            QString arg = atom->string().trimmed();
+            QString editionName = atom->string().mid(atom->string().indexOf(
+                "classesbyedition") + 16).trimmed();
+
+            if (editionModuleMap.contains(editionName)) {
+
+                // Add all classes in the modules listed for that edition.
+                NodeMap editionClasses;
+                foreach (const QString &moduleName, editionModuleMap[editionName]) {
+                    if (moduleClassMap.contains(moduleName))
+                        editionClasses.unite(moduleClassMap[moduleName]);
+                }
+
+                // Add additional groups and remove groups of classes that
+                // should be excluded from the edition.
+
+                QMultiMap <QString, Node *> groups = myTree->groups();
+                foreach (const QString &groupName, editionGroupMap[editionName]) {
+                    QList<Node *> groupClasses;
+                    if (groupName.startsWith("-")) {
+                        groupClasses = groups.values(groupName.mid(1));
+                        foreach (const Node *node, groupClasses)
+                            editionClasses.remove(node->name());
+                    }
+                    else {
+                        groupClasses = groups.values(groupName);
+                        foreach (const Node *node, groupClasses)
+                            editionClasses.insert(node->name(), node);
+                    }
+                }
+                generateAnnotatedList(relative, marker, editionClasses);
+            }
+        }
+        else if (atom->string() == "classhierarchy") {
+            generateClassHierarchy(relative, marker, nonCompatClasses);
+        }
+        else if (atom->string() == "compatclasses") {
+            generateCompactList(relative, marker, compatClasses, false);
+        }
+        else if (atom->string() == "obsoleteclasses") {
+            generateCompactList(relative, marker, obsoleteClasses, false);
+        }
+        else if (atom->string() == "functionindex") {
+            generateFunctionIndex(relative, marker);
+        }
+        else if (atom->string() == "legalese") {
+            generateLegaleseList(relative, marker);
+        }
+        else if (atom->string() == "mainclasses") {
+            generateCompactList(relative, marker, mainClasses, true);
+        }
+        else if (atom->string() == "services") {
+            generateCompactList(relative, marker, serviceClasses, false);
+        }
+        else if (atom->string() == "overviews") {
+            generateOverviewList(relative, marker);
+        }
+        else if (atom->string() == "namespaces") {
+            generateAnnotatedList(relative, marker, namespaceIndex);
+        }
+        else if (atom->string() == "related") {
+            const FakeNode *fake = static_cast<const FakeNode *>(relative);
+            if (fake && !fake->groupMembers().isEmpty()) {
+                NodeMap groupMembersMap;
+                foreach (const Node *node, fake->groupMembers()) {
+                    if (node->type() == Node::Fake)
+                        groupMembersMap[fullName(node, relative, marker)] = node;
+                }
+                generateAnnotatedList(fake, marker, groupMembersMap);
+            }
+        }
+        else if (atom->string() == "relatedinline") {
+            const FakeNode *fake = static_cast<const FakeNode *>(relative);
+            if (fake && !fake->groupMembers().isEmpty()) {
+                // Reverse the list into the original scan order.
+                // Should be sorted.  But on what?  It may not be a
+                // regular class or page definition.
+                QList<const Node *> list;
+                foreach (const Node *node, fake->groupMembers())
+                    list.prepend(node);
+                foreach (const Node *node, list)
+                    generateBody(node, marker);
+            }
+        }
+        break;
+    case Atom::SinceList:
+        {
+            NewSinceMaps::const_iterator nsmap;
+            nsmap = newSinceMaps.find(atom->string());
+            NewClassMaps::const_iterator ncmap;
+            ncmap = newClassMaps.find(atom->string());
+            NewClassMaps::const_iterator nqcmap;
+            nqcmap = newQmlClassMaps.find(atom->string());
+            if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) {
+                QList<Section> sections;
+                QList<Section>::ConstIterator s;
+                for (int i=0; i<LastSinceType; ++i)
+                    sections.append(Section(sinceTitle(i),QString(),QString(),QString()));
+
+                NodeMultiMap::const_iterator n = nsmap.value().constBegin();
+                while (n != nsmap.value().constEnd()) {
+                    const Node* node = n.value();
+                    switch (node->type()) {
+                      case Node::Fake:
+                          if (node->subType() == Node::QmlClass) {
+                              sections[QmlClass].appendMember((Node*)node);
+                          }
+                          break;
+                      case Node::Namespace:
+                          sections[Namespace].appendMember((Node*)node);
+                          break;
+                      case Node::Class: 
+                          sections[Class].appendMember((Node*)node);
+                          break;
+                      case Node::Enum: 
+                          sections[Enum].appendMember((Node*)node);
+                          break;
+                      case Node::Typedef: 
+                          sections[Typedef].appendMember((Node*)node);
+                          break;
+                      case Node::Function: {
+                          const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+                          if (fn->isMacro())
+                              sections[Macro].appendMember((Node*)node);
+                          else {
+                              Node* p = fn->parent();
+                              if (p) {
+                                  if (p->type() == Node::Class)
+                                      sections[MemberFunction].appendMember((Node*)node);
+                                  else if (p->type() == Node::Namespace) {
+                                      if (p->name().isEmpty())
+                                          sections[GlobalFunction].appendMember((Node*)node);
+                                      else
+                                          sections[NamespaceFunction].appendMember((Node*)node);
+                                  }
+                                  else
+                                      sections[GlobalFunction].appendMember((Node*)node);
+                              }
+                              else
+                                  sections[GlobalFunction].appendMember((Node*)node);
+                          }
+                          break;
+                      }
+                      case Node::Property:
+                          sections[Property].appendMember((Node*)node);
+                          break;
+                      case Node::Variable: 
+                          sections[Variable].appendMember((Node*)node);
+                          break;
+                      case Node::QmlProperty:
+                          sections[QmlProperty].appendMember((Node*)node);
+                          break;
+                      case Node::QmlSignal:
+                          sections[QmlSignal].appendMember((Node*)node);
+                          break;
+                      case Node::QmlMethod:
+                          sections[QmlMethod].appendMember((Node*)node);
+                          break;
+                      default:
+                          break;
+                    }
+                    ++n;
+                }
+
+                /*
+                  First generate the table of contents.
+                 */
+                writer.writeStartElement("ul");
+                s = sections.constBegin();
+                while (s != sections.constEnd()) {
+                    if (!(*s).members.isEmpty()) {
+
+                        writer.writeStartElement("li");
+                        writer.writeStartElement("xref");
+                        writer.writeAttribute("href",QString("#" + Doc::canonicalTitle((*s).name)));
+                        writer.writeCharacters((*s).name);
+                        writer.writeEndElement(); // </xref>
+                        writer.writeEndElement(); // </li>
+                    }
+                    ++s;
+                }
+                writer.writeEndElement(); // </ul>
+
+                int idx = 0;
+                s = sections.constBegin();
+                while (s != sections.constEnd()) {
+                    if (!(*s).members.isEmpty()) {
+                        writer.writeStartElement("p");
+                        writeGuidAttribute(Doc::canonicalTitle((*s).name));
+                        writer.writeAttribute("outputclass","h3");
+                        writer.writeCharacters(protectEnc((*s).name));
+                        writer.writeEndElement(); // </p>
+                        if (idx == Class)
+                            generateCompactList(0, marker, ncmap.value(), false, QString("Q"));
+                        else if (idx == QmlClass)
+                            generateCompactList(0, marker, nqcmap.value(), false, QString("Q"));
+                        else if (idx == MemberFunction) {
+                            ParentMaps parentmaps;
+                            ParentMaps::iterator pmap;
+                            NodeList::const_iterator i = s->members.constBegin();
+                            while (i != s->members.constEnd()) {
+                                Node* p = (*i)->parent();
+                                pmap = parentmaps.find(p);
+                                if (pmap == parentmaps.end())
+                                    pmap = parentmaps.insert(p,NodeMultiMap());
+                                pmap->insert((*i)->name(),(*i));
+                                ++i;
+                            }
+                            pmap = parentmaps.begin();
+                            while (pmap != parentmaps.end()) {
+                                NodeList nlist = pmap->values();
+                                writer.writeStartElement("p");
+                                writer.writeCharacters("Class ");
+                                writer.writeStartElement("xref");
+                                writer.writeAttribute("href",linkForNode(pmap.key(), 0));
+                                QStringList pieces = fullName(pmap.key(), 0, marker).split("::");
+                                writer.writeCharacters(protectEnc(pieces.last()));
+                                writer.writeEndElement(); // </xref>
+                                writer.writeCharacters(":");
+                                writer.writeEndElement(); // </p>
+
+                                generateSection(nlist, 0, marker, CodeMarker::Summary);
+                                writer.writeEmptyElement("br");
+                                ++pmap;
+                            }
+                        }
+                        else
+                            generateSection(s->members, 0, marker, CodeMarker::Summary);
+                     }
+                    ++idx;
+                    ++s;
+                }
+            }
+        }
+        break;
+    case Atom::Image:
+    case Atom::InlineImage:
+        {
+            QString fileName = imageFileName(relative, atom->string());
+            QString text;
+            if (atom->next() != 0)
+                text = atom->next()->string();
+            if (atom->type() == Atom::Image) {
+                writer.writeStartElement("p");
+                writer.writeAttribute("outputclass","centerAlign");
+            }
+            if (fileName.isEmpty()) {
+                writer.writeStartElement("font");
+                writer.writeAttribute("color","red");
+                writer.writeCharacters("[Missing image: ");
+                writer.writeCharacters(protectEnc(atom->string()));
+                writer.writeEndElement(); // </font>
+            }
+            else {
+                writer.writeStartElement("img");
+                writer.writeAttribute("src",protectEnc(fileName));
+                if (!text.isEmpty())
+                    writer.writeAttribute("alt",protectEnc(text));
+                writer.writeEndElement(); // </img>
+            }
+            if (atom->type() == Atom::Image)
+                writer.writeEndElement(); // </p>
+        }
+        break;
+    case Atom::ImageText:
+        // nothing
+        break;
+    case Atom::LegaleseLeft:
+        writer.writeStartElement("p");
+        writer.writeAttribute("outputclass","legalese");
+        break;
+    case Atom::LegaleseRight:
+        writer.writeEndElement(); // </p>
+        break;
+    case Atom::LineBreak:
+        writer.writeEmptyElement("br");
+        break;
+    case Atom::Link:
+        {
+            const Node *node = 0;
+            QString myLink = getLink(atom, relative, marker, &node);
+            if (myLink.isEmpty()) {
+                relative->doc().location().warning(tr("Cannot link to '%1' in %2")
+                        .arg(atom->string())
+                        .arg(marker->plainFullName(relative)));
+            }
+            beginLink(myLink, node, relative, marker);
+            skipAhead = 1;
+        }
+        break;
+    case Atom::LinkNode:
+        {
+            const Node *node = CodeMarker::nodeForString(atom->string());
+            beginLink(linkForNode(node, relative), node, relative, marker);
+            skipAhead = 1;
+        }
+        break;
+    case Atom::ListLeft:
+        if (in_para) {
+            writer.writeEndElement(); // </p>
+            in_para = false;
+        }
+        if (atom->string() == ATOM_LIST_BULLET) {
+            writer.writeStartElement("ul");
+        }
+        else if (atom->string() == ATOM_LIST_TAG) {
+            writer.writeStartElement("dl");
+        }
+        else if (atom->string() == ATOM_LIST_VALUE) {
+            threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom);
+            if (threeColumnEnumValueTable) {
+                writer.writeStartElement("table");
+                writer.writeAttribute("outputclass","valuelist");
+                writer.writeStartElement("tr");
+                if (++numTableRows % 2 == 1)
+                    writer.writeAttribute("outputclass","odd");
+                else
+                    writer.writeAttribute("outputclass","even");
+                writer.writeStartElement("th");
+                writer.writeCharacters("Constant");
+                writer.writeEndElement(); // </th>
+                writer.writeStartElement("th");
+                writer.writeCharacters("Value");
+                writer.writeEndElement(); // </th>
+                writer.writeStartElement("th");
+                writer.writeCharacters("Description");
+                writer.writeEndElement(); // </th>
+                writer.writeEndElement(); // </tr>
+            }
+            else {
+                writer.writeStartElement("table");
+                writer.writeAttribute("outputclass","valuelist");
+                writer.writeStartElement("tr");
+                writer.writeStartElement("th");
+                writer.writeCharacters("Constant");
+                writer.writeEndElement(); // </th>
+                writer.writeStartElement("th");
+                writer.writeCharacters("Value");
+                writer.writeEndElement(); // </th>
+                writer.writeEndElement(); // </tr>
+            }
+        }
+        else {
+            writer.writeStartElement("ol");
+            if (atom->string() == ATOM_LIST_UPPERALPHA)
+                writer.writeAttribute("type","A");
+            else if (atom->string() == ATOM_LIST_LOWERALPHA)
+                writer.writeAttribute("type","a");
+            else if (atom->string() == ATOM_LIST_UPPERROMAN)
+                writer.writeAttribute("type","I");
+            else if (atom->string() == ATOM_LIST_LOWERROMAN)
+                writer.writeAttribute("type","i");
+            else // (atom->string() == ATOM_LIST_NUMERIC)
+                writer.writeAttribute("type","1");
+            if (atom->next() != 0 && atom->next()->string().toInt() != 1)
+                writer.writeAttribute("start",atom->next()->string());
+        }
+        break;
+    case Atom::ListItemNumber:
+        // nothing
+        break;
+    case Atom::ListTagLeft:
+        if (atom->string() == ATOM_LIST_TAG) {
+            writer.writeStartElement("dt");
+        }
+        else { // (atom->string() == ATOM_LIST_VALUE)
+            writer.writeStartElement("tr");
+            writer.writeStartElement("td");
+            writer.writeAttribute("outputclass","topAlign");
+            writer.writeStartElement("tt");
+            writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(),
+                                                                                  relative))));
+            writer.writeEndElement(); // </tt>
+            writer.writeEndElement(); // </td>
+            writer.writeStartElement("td");
+            writer.writeAttribute("outputclass","topAlign");
+
+            QString itemValue;
+            if (relative->type() == Node::Enum) {
+                const EnumNode *enume = static_cast<const EnumNode *>(relative);
+                itemValue = enume->itemValue(atom->next()->string());
+            }
+
+            if (itemValue.isEmpty())
+                writer.writeCharacters("?");
+            else {
+                writer.writeStartElement("tt");
+                writer.writeCharacters(protectEnc(itemValue));
+                writer.writeEndElement(); // </tt>
+            }
+            skipAhead = 1;
+        }
+        break;
+    case Atom::ListTagRight:
+        if (atom->string() == ATOM_LIST_TAG)
+            writer.writeEndElement(); // </dt>
+        break;
+    case Atom::ListItemLeft:
+        if (atom->string() == ATOM_LIST_TAG) {
+            writer.writeStartElement("dd");
+        }
+        else if (atom->string() == ATOM_LIST_VALUE) {
+            if (threeColumnEnumValueTable) {
+                writer.writeEndElement(); // </td>
+                writer.writeStartElement("td");
+                writer.writeAttribute("outputclass","topAlign");
+                if (matchAhead(atom, Atom::ListItemRight))
+                    writer.writeCharacters("&nbsp;");
+            }
+        }
+        else {
+            writer.writeStartElement("li");
+        }
+        if (matchAhead(atom, Atom::ParaLeft))
+            skipAhead = 1;
+        break;
+    case Atom::ListItemRight:
+        if (atom->string() == ATOM_LIST_TAG) {
+            writer.writeEndElement(); // </dd>
+        }
+        else if (atom->string() == ATOM_LIST_VALUE) {
+            writer.writeEndElement(); // </td>
+            writer.writeEndElement(); // </tr>
+        }
+        else {
+            writer.writeEndElement(); // </li>
+        }
+        break;
+    case Atom::ListRight:
+        if (atom->string() == ATOM_LIST_BULLET) {
+            writer.writeEndElement(); // </ul>
+        }
+        else if (atom->string() == ATOM_LIST_TAG) {
+            writer.writeEndElement(); // </dl>
+        }
+        else if (atom->string() == ATOM_LIST_VALUE) {
+            writer.writeEndElement(); // </table>
+        }
+        else {
+            writer.writeEndElement(); // </ol>
+        }
+        break;
+    case Atom::Nop:
+        // nothing
+        break;
+    case Atom::ParaLeft:
+        writer.writeStartElement("p");
+        in_para = true;
+        break;
+    case Atom::ParaRight:
+        endLink();
+        if (in_para) {
+            writer.writeEndElement(); // </p?
+            in_para = false;
+        }
+        break;
+    case Atom::QuotationLeft:
+        writer.writeStartElement("blockquote");
+        break;
+    case Atom::QuotationRight:
+        writer.writeEndElement(); // </blockquote>
+        break;
+    case Atom::RawString:
+        writer.writeCharacters(atom->string());
+        break;
+    case Atom::SectionLeft:
+        writer.writeStartElement("p");
+        writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString()));
+        writer.writeAttribute("outputclass","target");
+        writer.writeCharacters(protectEnc(Text::sectionHeading(atom).toString()));
+        writer.writeEndElement(); // </p>
+        break;
+    case Atom::SectionRight:
+        // nothing
+        break;
+    case Atom::SectionHeadingLeft:
+        writer.writeStartElement("p");
+        hx = "h" + QString::number(atom->string().toInt() + hOffset(relative));
+        writer.writeAttribute("outputclass",hx);
+        inSectionHeading = true;
+        break;
+    case Atom::SectionHeadingRight:
+        writer.writeEndElement(); // </p> (see case Atom::SectionHeadingLeft)
+        inSectionHeading = false;
+        break;
+    case Atom::SidebarLeft:
+        // nothing
+        break;
+    case Atom::SidebarRight:
+        // nothing
+        break;
+    case Atom::String:
+        if (inLink && !inContents && !inSectionHeading) {
+            generateLink(atom, relative, marker);
+        }
+        else {
+            writer.writeCharacters(protectEnc(atom->string()));
+        }
+        break;
+    case Atom::TableLeft:
+        if (in_para) {
+            writer.writeEndElement(); // </p>
+            in_para = false;
+        }
+        writer.writeStartElement("table");
+        writer.writeAttribute("outputclass","generic");
+        numTableRows = 0;
+        break;
+    case Atom::TableRight:
+        writer.writeEndElement(); // </table>
+        break;
+    case Atom::TableHeaderLeft:
+        writer.writeStartElement("thead");
+        writer.writeStartElement("tr");
+        writer.writeAttribute("outputclass","qt-style topAlign");
+        inTableHeader = true;
+        break;
+    case Atom::TableHeaderRight:
+        writer.writeEndElement(); // </tr>
+        if (matchAhead(atom, Atom::TableHeaderLeft)) {
+            skipAhead = 1;
+            writer.writeStartElement("tr");
+            writer.writeAttribute("outputclass","qt-style topAlign");
+        }
+        else { 
+            writer.writeEndElement(); // </thead>
+            inTableHeader = false;
+        }
+        break;
+    case Atom::TableRowLeft:
+        writer.writeStartElement("tr");
+        if (++numTableRows % 2 == 1)
+            writer.writeAttribute("outputclass","odd topAlign");
+        else
+            writer.writeAttribute("outputclass","even topAlign");
+        break;
+    case Atom::TableRowRight:
+        writer.writeEndElement(); // </tr>\n";
+        break;
+    case Atom::TableItemLeft:
+        {
+            if (inTableHeader)
+                writer.writeStartElement("th");
+            else
+                writer.writeStartElement("td");
+
+            QStringList spans = atom->string().split(",");
+            if (spans.size() == 2) {
+#if zzz        
+                
+                if (spans.at(0) != "1")
+                    out() << " colspan=\"" << spans.at(0) << "\"";
+                if (spans.at(1) != "1")
+                    out() << " rowspan=\"" << spans.at(1) << "\"";
+#endif                
+                if (!inTableHeader)
+                    writer.writeStartElement("p"); 
+            }
+            if (matchAhead(atom, Atom::ParaLeft))
+                skipAhead = 1;
+        }
+        break;
+    case Atom::TableItemRight:
+        if (inTableHeader)
+            writer.writeEndElement(); // </th>
+        else {
+            writer.writeEndElement(); // </p>
+            writer.writeEndElement(); // </td>
+        }
+        if (matchAhead(atom, Atom::ParaLeft))
+            skipAhead = 1;
+        break;
+    case Atom::TableOfContents:
+        {
+            int numColumns = 1;
+            const Node *node = relative;
+
+            Doc::SectioningUnit sectioningUnit = Doc::Section4;
+            QStringList params = atom->string().split(",");
+            QString columnText = params.at(0);
+            QStringList pieces = columnText.split(" ", QString::SkipEmptyParts);
+            if (pieces.size() >= 2) {
+                columnText = pieces.at(0);
+                pieces.pop_front();
+                QString path = pieces.join(" ").trimmed();
+                node = findNodeForTarget(path, relative, marker, atom);
+            }
+
+            if (params.size() == 2) {
+                numColumns = qMax(columnText.toInt(), numColumns);
+                sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt();
+            }
+
+            if (node)
+                generateTableOfContents(node,
+                                        marker,
+                                        sectioningUnit,
+                                        numColumns,
+                                        relative);
+        }
+        break;
+    case Atom::Target:
+        writer.writeStartElement("p");
+        writeGuidAttribute(Doc::canonicalTitle(atom->string()));
+        writer.writeAttribute("outputclass","target");
+        writer.writeCharacters(protectEnc(atom->string()));
+        writer.writeEndElement(); // </p>
+        break;
+    case Atom::UnhandledFormat:
+        writer.writeStartElement("b");
+        writer.writeAttribute("outputclass","redFont");
+        writer.writeCharacters("&lt;Missing DITAXML&gt");
+        writer.writeEndElement(); // </b>
+        break;
+    case Atom::UnknownCommand:
+        writer.writeStartElement("b");
+        writer.writeAttribute("outputclass","redFont code");
+        writer.writeCharacters(protectEnc(atom->string()));
+        writer.writeEndElement(); // </b>
+        break;
+#ifdef QDOC_QML
+    case Atom::QmlText:
+    case Atom::EndQmlText:
+        // don't do anything with these. They are just tags.
+        break;
+#endif
+    default:
+        //        unknownAtom(atom);
+        break;
+    }
+    return skipAhead;
+}
+
+/*!
+  Generate a reference page for a C++ class.
+ */
+void
+DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker)
+{
+    QList<Section> sections;
+    QList<Section>::ConstIterator s;
+
+    const ClassNode* cn = 0;
+    const NamespaceNode* namespasse = 0;
+
+    QString title;
+    QString rawTitle;
+    QString fullTitle;
+    if (inner->type() == Node::Namespace) {
+        namespasse = const_cast<NamespaceNode*>(static_cast<const NamespaceNode*>(inner));
+        rawTitle = marker->plainName(inner);
+        fullTitle = marker->plainFullName(inner);
+        title = rawTitle + " Namespace";
+    }
+    else if (inner->type() == Node::Class) {
+        cn = const_cast<ClassNode*>(static_cast<const ClassNode*>(inner));
+        rawTitle = marker->plainName(inner);
+        fullTitle = marker->plainFullName(inner);
+        title = rawTitle + " Class Reference";
+
+        generateHeader(inner);
+
+        writer.writeStartElement(CXXCLASS);
+        writer.writeAttribute("id",cn->guid());
+        writer.writeStartElement(APINAME);
+        writer.writeCharacters(fullTitle);
+        writer.writeEndElement(); // </apiName>
+
+        generateBrief(inner, marker);
+    
+        writer.writeStartElement(CXXCLASSDETAIL);
+        writer.writeStartElement(CXXCLASSDEFINITION);
+        writer.writeStartElement(CXXCLASSACCESSSPECIFIER);
+        writer.writeAttribute("value",inner->accessString());
+        writer.writeEndElement(); // <cxxClassAccessSpecifier>
+        if (cn->isAbstract()) {
+            writer.writeStartElement(CXXCLASSABSTRACT);
+            writer.writeAttribute("name","abstract");
+            writer.writeAttribute("value","abstract");
+            writer.writeEndElement(); // </cxxClassAbstract>
+        }
+        writeDerivations(cn, marker);
+        writeLocation(cn);
+        writer.writeEndElement(); // <cxxClassDefinition>
+        writer.writeStartElement(APIDESC);
+
+        if (!inner->doc().isEmpty()) {
+            writer.writeStartElement("p");
+            writer.writeAttribute("outputclass","h2");
+            writer.writeCharacters("Detailed Description");
+            writer.writeEndElement(); // </p>
+            generateBody(inner, marker);
+            //        generateAlsoList(inner, marker);
+        }
+    
+        writer.writeEndElement(); // </apiDesc>
+        writer.writeEndElement(); // </cxxClassDetail>
+
+        sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay);
+        s = sections.begin();
+        while (s != sections.end()) {
+            if ((*s).name == "Member Function Documentation") {
+                writeFunctions((*s),cn,marker);
+            }
+            else if ((*s).name == "Member Type Documentation") {
+                writeEnumerations((*s),cn,marker);
+                writeTypedefs((*s),cn,marker);
+            }
+            else if ((*s).name == "Member Variable Documentation") {
+                writeDataMembers((*s),cn,marker);
+            }
+            else if ((*s).name == "Property Documentation") {
+                writeProperties((*s),cn,marker);
+            }
+            else if ((*s).name == "Macro Documentation") {
+                writeMacros((*s),cn,marker);
+            }
+            ++s;
+        }
+        writer.writeEndElement(); // </cxxClass>
+    }
+
+#ifdef WRITE_HTML    
+    Text subtitleText;
+    if (rawTitle != fullTitle)
+        subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")"
+                     << Atom(Atom::LineBreak);
+
+    QString shortVersion;
+    shortVersion = project + " " + shortVersion + ": ";
+    shortVersion = myTree->version();
+    if (shortVersion.count(QChar('.')) == 2)
+        shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
+    if (!shortVersion.isEmpty()) {
+        if (project == "QSA")
+            shortVersion = "QSA " + shortVersion + ": ";
+        else
+            shortVersion = "Qt " + shortVersion + ": ";
+    }
+
+    out() << "  <title>" << shortVersion << protectEnc(title) << "</title>\n";
+
+#if 0    
+    out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+    generateBreadCrumbs(title,node,marker);
+    out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+#endif    
+    
+    sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
+    generateTableOfContents(inner,marker,&sections);
+    generateTitle(title, subtitleText, SmallSubTitle, inner, marker);
+
+#ifdef QDOC_QML
+    if (cn && !cn->qmlElement().isEmpty()) {
+        generateInstantiatedBy(cn,marker);
+    }
+#endif
+    
+    generateBrief(inner, marker);
+    generateIncludes(inner, marker);
+    generateStatus(inner, marker);
+    if (cn) {
+        generateInherits(cn, marker);
+        generateInheritedBy(cn, marker);
+    }
+    generateThreadSafeness(inner, marker);
+    generateSince(inner, marker);
+
+    out() << "<ul>\n";
+
+    QString membersLink = generateListOfAllMemberFile(inner, marker);
+    if (!membersLink.isEmpty())
+        out() << "<li><xref href=\"" << membersLink << "\">"
+              << "List of all members, including inherited members</xref></li>\n";
+
+    QString obsoleteLink = generateLowStatusMemberFile(inner,
+                                                       marker,
+                                                       CodeMarker::Obsolete);
+    if (!obsoleteLink.isEmpty())
+        out() << "<li><xref href=\"" << obsoleteLink << "\">"
+              << "Obsolete members</xref></li>\n";
+
+    QString compatLink = generateLowStatusMemberFile(inner,
+                                                     marker,
+                                                     CodeMarker::Compat);
+    if (!compatLink.isEmpty())
+        out() << "<li><xref href=\"" << compatLink << "\">"
+              << "Qt 3 support members</xref></li>\n";
+
+    out() << "</ul>\n";
+
+    bool needOtherSection = false;
+
+    /*
+      sections is built above for the call to generateTableOfContents().
+     */
+    s = sections.begin();
+    while (s != sections.end()) {
+        if (s->members.isEmpty() && s->reimpMembers.isEmpty()) {
+            if (!s->inherited.isEmpty())
+                needOtherSection = true;
+        }
+        else {
+            if (!s->members.isEmpty()) {
+                out() << "<hr />\n";
+                out() << "<a name=\""
+                      << registerRef((*s).name.toLower())
+                      << "\"></a>\n";
+                out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+                generateSection(s->members, inner, marker, CodeMarker::Summary);
+            }
+            if (!s->reimpMembers.isEmpty()) {
+                QString name = QString("Reimplemented ") + (*s).name;
+                out() << "<hr />\n";
+                out() << "<a name=\""
+                      << registerRef(name.toLower())
+                      << "\"></a>\n";
+                out() << "<h2>" << protectEnc(name) << "</h2>\n";
+                generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary);
+            }
+
+            if (!s->inherited.isEmpty()) {
+                out() << "<ul>\n";
+                generateSectionInheritedList(*s, inner, marker, true);
+                out() << "</ul>\n";
+            }
+        }
+        ++s;
+    }
+
+    if (needOtherSection) {
+        out() << "<h3>Additional Inherited Members</h3>\n"
+                 "<ul>\n";
+
+        s = sections.begin();
+        while (s != sections.end()) {
+            if (s->members.isEmpty() && !s->inherited.isEmpty())
+                generateSectionInheritedList(*s, inner, marker);
+            ++s;
+        }
+        out() << "</ul>\n";
+    }
+
+    out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+
+    if (!inner->doc().isEmpty()) {
+        out() << "<hr />\n"
+              << "<div class=\"descr\"/>\n" // QTBUG-9504
+              << "<h2>" << "Detailed Description" << "</h2>\n";
+        generateBody(inner, marker);
+        out() << "</div>\n"; // QTBUG-9504
+        generateAlsoList(inner, marker);
+    }
+
+    sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay);
+    s = sections.begin();
+    while (s != sections.end()) {
+        out() << "<hr />\n";
+        if (!(*s).divClass.isEmpty())
+            out() << "<div class=\"" << (*s).divClass << "\"/>\n"; // QTBUG-9504
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+
+        NodeList::ConstIterator m = (*s).members.begin();
+        while (m != (*s).members.end()) {
+            if ((*m)->access() != Node::Private) { // ### check necessary?
+                if ((*m)->type() != Node::Class)
+                    generateDetailedMember(*m, inner, marker);
+                else {
+                    out() << "<h3> class ";
+                    generateFullName(*m, inner, marker);
+                    out() << "</h3>";
+                    generateBrief(*m, marker, inner);
+                }
+
+                QStringList names;
+                names << (*m)->name();
+                if ((*m)->type() == Node::Function) {
+                    const FunctionNode *func = reinterpret_cast<const FunctionNode *>(*m);
+                    if (func->metaness() == FunctionNode::Ctor ||
+                        func->metaness() == FunctionNode::Dtor ||
+                        func->overloadNumber() != 1)
+                        names.clear();
+                }
+                else if ((*m)->type() == Node::Property) {
+                    const PropertyNode *prop = reinterpret_cast<const PropertyNode *>(*m);
+                    if (!prop->getters().isEmpty() &&
+                        !names.contains(prop->getters().first()->name()))
+                        names << prop->getters().first()->name();
+                    if (!prop->setters().isEmpty())
+                        names << prop->setters().first()->name();
+                    if (!prop->resetters().isEmpty())
+                        names << prop->resetters().first()->name();
+                }
+                else if ((*m)->type() == Node::Enum) {
+                    const EnumNode *enume = reinterpret_cast<const EnumNode*>(*m);
+                    if (enume->flagsType())
+                        names << enume->flagsType()->name();
+
+                    foreach (const QString &enumName,
+                             enume->doc().enumItemNames().toSet() -
+                             enume->doc().omitEnumItemNames().toSet())
+                        names << plainCode(marker->markedUpEnumValue(enumName,
+                                                                     enume));
+                }
+            }
+            ++m;
+        }
+        if (!(*s).divClass.isEmpty())
+            out() << "</div>\n"; // QTBUG-9504
+        ++s;
+    }
+#endif
+}
+
+/*!
+  Generate the html page for a qdoc file that doesn't map
+  to an underlying c++ file.
+ */
+void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
+{
+    return; // zzz
+    
+    SubTitleSize subTitleSize = LargeSubTitle;
+    QList<Section> sections;
+    QList<Section>::const_iterator s;
+    QString fullTitle = fake->fullTitle();
+    QString htmlTitle = fullTitle;
+
+    if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
+        subTitleSize = SmallSubTitle;
+        htmlTitle += " (" + fake->subTitle() + ")";
+    }
+    else if (fake->subType() == Node::QmlBasicType) {
+        fullTitle = "QML Basic Type: " + fullTitle;
+        htmlTitle = fullTitle;
+    }
+
+    generateHeader(fake);
+        
+    /*
+      Generate the TOC for the new doc format.
+      Don't generate a TOC for the home page.
+    */
+    if (fake->name() != QString("index.html"))
+        generateTableOfContents(fake,marker,0);
+
+    generateTitle(fullTitle,
+                  Text() << fake->subTitle(),
+                  subTitleSize,
+                  fake,
+                  marker);
+
+    if (fake->subType() == Node::Module) {
+        // Generate brief text and status for modules.
+        generateBrief(fake, marker);
+        generateStatus(fake, marker);
+
+        if (moduleNamespaceMap.contains(fake->name())) {
+            out() << "<a name=\"" << registerRef("namespaces") << "\"></a>\n";
+            out() << "<h2>Namespaces</h2>\n";
+            generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]);
+        }
+        if (moduleClassMap.contains(fake->name())) {
+            out() << "<a name=\"" << registerRef("classes") << "\"></a>\n";
+            out() << "<h2>Classes</h2>\n";
+            generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]);
+        }
+    }
+    else if (fake->subType() == Node::HeaderFile) {
+        // Generate brief text and status for modules.
+        generateBrief(fake, marker);
+        generateStatus(fake, marker);
+
+        out() << "<ul>\n";
+
+        QString membersLink = generateListOfAllMemberFile(fake, marker);
+        if (!membersLink.isEmpty())
+            out() << "<li><xref href=\"" << membersLink << "\">"
+                  << "List of all members, including inherited members</xref></li>\n";
+
+        QString obsoleteLink = generateLowStatusMemberFile(fake,
+                                                           marker,
+                                                           CodeMarker::Obsolete);
+        if (!obsoleteLink.isEmpty())
+            out() << "<li><xref href=\"" << obsoleteLink << "\">"
+                  << "Obsolete members</xref></li>\n";
+
+        QString compatLink = generateLowStatusMemberFile(fake,
+                                                         marker,
+                                                         CodeMarker::Compat);
+        if (!compatLink.isEmpty())
+            out() << "<li><xref href=\"" << compatLink << "\">"
+                  << "Qt 3 support members</xref></li>\n";
+
+        out() << "</ul>\n";
+    }
+#ifdef QDOC_QML
+    else if (fake->subType() == Node::QmlClass) {
+        const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake);
+        const ClassNode* cn = qml_cn->classNode();
+        generateQmlInherits(qml_cn, marker);
+        generateQmlInstantiates(qml_cn, marker);
+        generateBrief(qml_cn, marker);
+        generateQmlInheritedBy(qml_cn, marker);
+        sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0);
+        s = sections.begin();
+        while (s != sections.end()) {
+            out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n";
+            out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+            generateQmlSummary(*s,fake,marker);
+            ++s;
+        }
+
+        out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+        out() << "<h2>" << "Detailed Description" << "</h2>\n";
+        generateBody(fake, marker);
+        if (cn)
+            generateQmlText(cn->doc().body(), cn, marker, fake->name());
+        generateAlsoList(fake, marker);
+        out() << "<hr />\n";
+
+        sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0);
+        s = sections.begin();
+        while (s != sections.end()) {
+            out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+            NodeList::ConstIterator m = (*s).members.begin();
+            while (m != (*s).members.end()) {
+                generateDetailedQmlMember(*m, fake, marker);
+                out() << "<br/>\n";
+                ++m;
+            }
+            ++s;
+        }
+        return;
+    }
+#endif
+    
+    sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay);
+    s = sections.begin();
+    while (s != sections.end()) {
+        out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n";
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+        generateSectionList(*s, fake, marker, CodeMarker::Summary);
+        ++s;
+    }
+
+    Text brief = fake->doc().briefText();
+    if (fake->subType() == Node::Module && !brief.isEmpty()) {
+        out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+        out() << "<div class=\"descr\"/>\n"; // QTBUG-9504
+        out() << "<h2>" << "Detailed Description" << "</h2>\n";
+    }
+    else
+        out() << "<div class=\"descr\"/>\n"; // QTBUG-9504
+
+    generateBody(fake, marker);
+    out() << "</div>\n"; // QTBUG-9504
+    generateAlsoList(fake, marker);
+
+    if (!fake->groupMembers().isEmpty()) {
+        NodeMap groupMembersMap;
+        foreach (const Node *node, fake->groupMembers()) {
+            if (node->type() == Node::Class || node->type() == Node::Namespace)
+                groupMembersMap[node->name()] = node;
+        }
+        generateAnnotatedList(fake, marker, groupMembersMap);
+    }
+
+    sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay);
+    s = sections.begin();
+    while (s != sections.end()) {
+        out() << "<hr />\n";
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
+
+        NodeList::ConstIterator m = (*s).members.begin();
+        while (m != (*s).members.end()) {
+            generateDetailedMember(*m, fake, marker);
+            ++m;
+        }
+        ++s;
+    }
+}
+
+/*!
+  Returns "xml" for this subclass of Generator.
+ */
+QString DitaXmlGenerator::fileExtension(const Node * /* node */) const
+{
+    return "xml";
+}
+
+/*!
+  Output breadcrumb list in the html file.
+ */
+void DitaXmlGenerator::generateBreadCrumbs(const QString& title,
+                                           const Node *node,
+                                           CodeMarker *marker)
+{
+    Text breadcrumb;
+    if (node->type() == Node::Class) {
+        const ClassNode* cn = static_cast<const ClassNode*>(node);
+        QString name =  node->moduleName();
+        out() << "              <li><xref href=\"modules.html\">All Modules</xref></li>";
+        if (!name.isEmpty()) {
+            out() << "              <li>";
+            breadcrumb << Atom(Atom::AutoLink,name);
+            generateText(breadcrumb, node, marker);
+            out() << "</li>\n";
+        }
+        breadcrumb.clear();
+        if (!cn->name().isEmpty()) {
+            out() << "              <li>";
+            breadcrumb << Atom(Atom::AutoLink,cn->name());
+            generateText(breadcrumb, 0, marker);
+            out() << "</li>\n";
+        }
+    }
+    else if (node->type() == Node::Fake) {
+        const FakeNode* fn = static_cast<const FakeNode*>(node);
+        if (node->subType() == Node::Module) {
+            out() << "              <li><xref href=\"modules.html\">All Modules</xref></li>";
+            QString name =  node->name();
+            if (!name.isEmpty()) {
+                out() << "              <li>";
+                breadcrumb << Atom(Atom::AutoLink,name);
+                generateText(breadcrumb, 0, marker);
+                out() << "</li>\n";
+            }
+        }
+        else if (node->subType() == Node::Group) {
+            if (fn->name() == QString("modules"))
+                out() << "              <li><xref href=\"modules.html\">All Modules</xref></li>";
+            else {
+                out() << "              <li><xref href=\"" << fn->name() << "\">" << title
+                      << "</xref></li>";
+            }
+        }
+        else if (node->subType() == Node::Page) {
+            if (fn->name() == QString("examples.html")) {
+                out() << "              <li><xref href=\"all-examples.html\">Examples</xref></li>";
+            }
+            else if (fn->name().startsWith("examples-")) {
+                out() << "              <li><xref href=\"all-examples.html\">Examples</xref></li>";
+                out() << "              <li><xref href=\"" << fn->name() << "\">" << title
+                      << "</xref></li>";
+            }
+            else if (fn->name() == QString("namespaces.html")) {
+                out() << "              <li><xref href=\"namespaces.html\">All Namespaces</xref></li>";
+            }
+            else {
+                out() << "              <li><xref href=\"" << fn->name() << "\">" << title
+                      << "</xref></li>";
+            }
+        }
+        else if (node->subType() == Node::QmlClass) {
+            out() << "              <li><xref href=\"qdeclarativeelements.html\">QML Elements</xref></li>";
+            out() << "              <li><xref href=\"" << fn->name() << "\">" << title
+                  << "</xref></li>";
+        }
+        else if (node->subType() == Node::Example) {
+            out() << "              <li><xref href=\"all-examples.html\">Examples</xref></li>";
+            QStringList sl = fn->name().split('/');
+            QString name = "examples-" + sl.at(0) + ".html";
+            QString t = CodeParser::titleFromName(name);
+            out() << "              <li><xref href=\"" << name << "\">"
+                  << t << "</xref></li>";
+            out() << "              <li><xref href=\"" << sl.at(0)
+                  << "-" << sl.at(sl.size()-1) << ".html\">"
+                  << title << "</xref></li>";
+        }
+    }
+    else if (node->type() == Node::Namespace) {
+        const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node);
+        out() << "              <li><xref href=\"namespaces.html\">All Namespaces</xref></li>";
+        out() << "              <li><xref href=\"" << fileName(nsn) << "\">" << title
+              << "</xref></li>";
+    }
+}
+
+void DitaXmlGenerator::generateHeader(const Node* node)
+{
+    writer.setDevice(out().device());
+    writer.setAutoFormatting(true);
+    writer.setAutoFormattingIndent(4);
+    writer.writeStartDocument();
+    
+    if (!node)
+        return;
+
+    QString docType;
+    QString dtd;
+    QString version;
+    if (node->type() == Node::Class) {
+        docType = "cxxClass";
+        dtd = "dtd/cxxClass.dtd";
+        version = "0.6.0";
+    }
+
+    QString doctype = "<!DOCTYPE " + docType +
+        " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" +
+        version + "//EN\" \"" + dtd + "\">";
+    writer.writeDTD(doctype);
+    writer.writeComment(node->doc().location().fileName());
+}
+
+void DitaXmlGenerator::generateTitle(const QString& title,
+                                     const Text &subTitle,
+                                     SubTitleSize subTitleSize,
+                                     const Node *relative,
+                                     CodeMarker *marker)
+{
+    if (!title.isEmpty())
+        out() << "<h1 class=\"title\">" << protectEnc(title) << "</h1>\n";
+    if (!subTitle.isEmpty()) {
+ 			out() << "<span";
+       if (subTitleSize == SmallSubTitle)
+            out() << " class=\"small-subtitle\">";
+        else
+            out() << " class=\"subtitle\">";
+        generateText(subTitle, relative, marker);
+        out() << "</span>\n";
+    }
+}
+
+/*!
+  Outputs the brief command as a <shortdesc" element.
+ */
+void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker)
+{
+    Text brief = node->doc().briefText();
+    if (!brief.isEmpty()) {
+        ++noLinks;
+        writer.writeStartElement(SHORTDESC);
+        generateText(brief, node, marker);
+        writer.writeEndElement(); // shortdesc
+        --noLinks;
+    }
+}
+
+void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker)
+{
+    if (!inner->includes().isEmpty()) {
+        out() << "<pre class=\"highlightedCode\">"
+              << trimmedTrailing(highlightedCode(indent(codeIndent,
+                                                        marker->markedUpIncludes(inner->includes())),
+                                                 marker,inner))
+              << "</pre>";
+    }
+}
+
+/*!
+  Generates a table of contents beginning at \a node.
+ */
+void DitaXmlGenerator::generateTableOfContents(const Node *node,
+                                            CodeMarker *marker,
+                                            Doc::SectioningUnit sectioningUnit,
+                                            int numColumns,
+                                            const Node *relative)
+
+{
+    return;
+    if (!node->doc().hasTableOfContents())
+        return;
+    QList<Atom *> toc = node->doc().tableOfContents();
+    if (toc.isEmpty())
+        return;
+
+    QString nodeName = "";
+    if (node != relative)
+        nodeName = node->name();
+
+    QStringList sectionNumber;
+    int columnSize = 0;
+
+    QString tdTag;
+    if (numColumns > 1) {
+        tdTag = "<td>"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/
+        out() << "<table class=\"toc\">\n<tr class=\"topAlign\">"
+              << tdTag << "\n";
+    }
+
+    // disable nested links in table of contents
+    inContents = true;
+    inLink = true;
+
+    for (int i = 0; i < toc.size(); ++i) {
+        Atom *atom = toc.at(i);
+
+        int nextLevel = atom->string().toInt();
+        if (nextLevel > (int)sectioningUnit)
+            continue;
+
+        if (sectionNumber.size() < nextLevel) {
+            do {
+                out() << "<ul>";
+                sectionNumber.append("1");
+            } while (sectionNumber.size() < nextLevel);
+        }
+        else {
+            while (sectionNumber.size() > nextLevel) {
+                out() << "</ul>\n";
+                sectionNumber.removeLast();
+            }
+            sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1);
+        }
+        int numAtoms;
+        Text headingText = Text::sectionHeading(atom);
+
+        if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) {
+            out() << "</ul></td>" << tdTag << "<ul>\n";
+            columnSize = 0;
+        }
+        out() << "<li>";
+        out() << "<xref href=\""
+              << nodeName
+              << "#"
+              << Doc::canonicalTitle(headingText.toString())
+              << "\">";
+        generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
+        out() << "</xref></li>\n";
+
+        ++columnSize;
+    }
+    while (!sectionNumber.isEmpty()) {
+        out() << "</ul>\n";
+        sectionNumber.removeLast();
+    }
+
+    if (numColumns > 1)
+        out() << "</td></tr></table>\n";
+
+    inContents = false;
+    inLink = false;
+}
+
+/*!
+  Revised for the new doc format.
+  Generates a table of contents beginning at \a node.
+ */
+void DitaXmlGenerator::generateTableOfContents(const Node *node,
+                                            CodeMarker *marker,
+                                            QList<Section>* sections)
+{
+    QList<Atom*> toc;
+    if (node->doc().hasTableOfContents()) 
+        toc = node->doc().tableOfContents();
+    if (toc.isEmpty() && !sections && (node->subType() != Node::Module))
+        return;
+
+    QStringList sectionNumber;
+    int detailsBase = 0;
+
+    // disable nested links in table of contents
+    inContents = true;
+    inLink = true;
+
+    out() << "<div class=\"toc\">\n";
+    out() << "<h3>Contents</h3>\n";
+    sectionNumber.append("1");
+    out() << "<ul>\n";
+
+    if (node->subType() == Node::Module) {
+        if (moduleNamespaceMap.contains(node->name())) {
+            out() << "<li class=\"level"
+                  << sectionNumber.size()
+                  << "\"><xref href=\"#"
+                  << registerRef("namespaces")
+                  << "\">Namespaces</xref></li>\n";
+        }
+        if (moduleClassMap.contains(node->name())) {
+            out() << "<li class=\"level"
+                  << sectionNumber.size()
+                  << "\"><xref href=\"#"
+                  << registerRef("classes")
+                  << "\">Classes</xref></li>\n";
+        }
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\"><xref href=\"#"
+              << registerRef("details")
+              << "\">Detailed Description</xref></li>\n";
+        for (int i = 0; i < toc.size(); ++i) {
+            if (toc.at(i)->string().toInt() == 1) {
+                detailsBase = 1;
+                break;
+            }
+        }
+    }
+    else if (sections && (node->type() == Node::Class)) {
+        QList<Section>::ConstIterator s = sections->begin();
+        while (s != sections->end()) {
+            if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) {
+                out() << "<li class=\"level"
+                      << sectionNumber.size()
+                      << "\"><xref href=\"#"
+                      << registerRef((*s).pluralMember)
+                      << "\">" << (*s).name
+                      << "</xref></li>\n";
+            }
+            ++s;
+        }
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\"><xref href=\"#"
+              << registerRef("details")
+              << "\">Detailed Description</xref></li>\n";
+        for (int i = 0; i < toc.size(); ++i) {
+            if (toc.at(i)->string().toInt() == 1) {
+                detailsBase = 1;
+                break;
+            }
+        }
+    }
+
+    for (int i = 0; i < toc.size(); ++i) {
+        Atom *atom = toc.at(i);
+        int nextLevel = atom->string().toInt() + detailsBase;
+        if (sectionNumber.size() < nextLevel) {
+            do {
+                sectionNumber.append("1");
+            } while (sectionNumber.size() < nextLevel);
+        }
+        else {
+            while (sectionNumber.size() > nextLevel) {
+                sectionNumber.removeLast();
+            }
+            sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1);
+        }
+        int numAtoms;
+        Text headingText = Text::sectionHeading(atom);
+        QString s = headingText.toString();
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\">";
+        out() << "<xref href=\""
+              << "#"
+              << Doc::canonicalTitle(s)
+              << "\">";
+        generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
+        out() << "</xref></li>\n";
+    }
+    while (!sectionNumber.isEmpty()) {
+        sectionNumber.removeLast();
+    }
+    out() << "</ul>\n";
+    out() << "</div>\n";
+    inContents = false;
+    inLink = false;
+}
+
+QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner,
+                                                   CodeMarker *marker)
+{
+    QList<Section> sections;
+    QList<Section>::ConstIterator s;
+
+    sections = marker->sections(inner,
+                                CodeMarker::SeparateList,
+                                CodeMarker::Okay);
+    if (sections.isEmpty())
+        return QString();
+
+    QString fileName = fileBase(inner) + "-members." + fileExtension(inner);
+    beginSubPage(inner->location(), fileName);
+    QString title = "List of All Members for " + inner->name();
+    generateHeader(inner);
+    generateTitle(title, Text(), SmallSubTitle, inner, marker);
+    out() << "<p>This is the complete list of members for ";
+    generateFullName(inner, 0, marker);
+    out() << ", including inherited members.</p>\n";
+
+    Section section = sections.first();
+    generateSectionList(section, 0, marker, CodeMarker::SeparateList);
+
+    endSubPage();
+    return fileName;
+}
+
+QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner,
+                                                   CodeMarker *marker,
+                                                   CodeMarker::Status status)
+{
+    QList<Section> sections = marker->sections(inner,
+                                               CodeMarker::Summary,
+                                               status);
+    QMutableListIterator<Section> j(sections);
+    while (j.hasNext()) {
+        if (j.next().members.size() == 0)
+            j.remove();
+    }
+    if (sections.isEmpty())
+        return QString();
+
+    int i;
+
+    QString title;
+    QString fileName;
+
+    if (status == CodeMarker::Compat) {
+        title = "Qt 3 Support Members for " + inner->name();
+        fileName = fileBase(inner) + "-qt3." + fileExtension(inner);
+    }
+    else {
+        title = "Obsolete Members for " + inner->name();
+        fileName = fileBase(inner) + "-obsolete." + fileExtension(inner);
+    }
+
+    beginSubPage(inner->location(), fileName);
+    generateHeader(inner);
+    generateTitle(title, Text(), SmallSubTitle, inner, marker);
+
+    if (status == CodeMarker::Compat) {
+        out() << "<p><b>The following class members are part of the "
+                 "<xref href=\"qt3support.html\">Qt 3 support layer</xref>.</b> "
+                 "They are provided to help you port old code to Qt 4. We advise against "
+                 "using them in new code.</p>\n";
+    }
+    else {
+        out() << "<p><b>The following class members are obsolete.</b> "
+              << "They are provided to keep old source code working. "
+              << "We strongly advise against using them in new code.</p>\n";
+    }
+
+    out() << "<p><ul><li><xref href=\""
+          << linkForNode(inner, 0) << "\">"
+          << protectEnc(inner->name())
+          << " class reference</xref></li></ul></p>\n";
+
+    for (i = 0; i < sections.size(); ++i) {
+        out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n";
+        generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary);
+    }
+
+    sections = marker->sections(inner, CodeMarker::Detailed, status);
+    for (i = 0; i < sections.size(); ++i) {
+        out() << "<hr />\n";
+        out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n";
+
+        NodeList::ConstIterator m = sections.at(i).members.begin();
+        while (m != sections.at(i).members.end()) {
+            if ((*m)->access() != Node::Private)
+                generateDetailedMember(*m, inner, marker);
+            ++m;
+        }
+    }
+
+    endSubPage();
+    return fileName;
+}
+
+void DitaXmlGenerator::generateClassHierarchy(const Node *relative,
+                                           CodeMarker *marker,
+                                           const QMap<QString,const Node*> &classMap)
+{
+    if (classMap.isEmpty())
+        return;
+
+    NodeMap topLevel;
+    NodeMap::ConstIterator c = classMap.begin();
+    while (c != classMap.end()) {
+        const ClassNode *classe = static_cast<const ClassNode *>(*c);
+        if (classe->baseClasses().isEmpty())
+            topLevel.insert(classe->name(), classe);
+        ++c;
+    }
+
+    QStack<NodeMap > stack;
+    stack.push(topLevel);
+
+    out() << "<ul>\n";
+    while (!stack.isEmpty()) {
+        if (stack.top().isEmpty()) {
+            stack.pop();
+            out() << "</ul>\n";
+        }
+        else {
+            const ClassNode *child =
+                static_cast<const ClassNode *>(*stack.top().begin());
+            out() << "<li>";
+            generateFullName(child, relative, marker);
+            out() << "</li>\n";
+            stack.top().erase(stack.top().begin());
+
+            NodeMap newTop;
+            foreach (const RelatedClass &d, child->derivedClasses()) {
+                if (d.access != Node::Private)
+                    newTop.insert(d.node->name(), d.node);
+            }
+            if (!newTop.isEmpty()) {
+                stack.push(newTop);
+                out() << "<ul>\n";
+            }
+        }
+    }
+}
+
+void DitaXmlGenerator::generateAnnotatedList(const Node *relative,
+                                          CodeMarker *marker,
+                                          const NodeMap &nodeMap)
+{
+    out() << "<table class=\"annotated\">\n";
+
+    int row = 0;
+    foreach (const QString &name, nodeMap.keys()) {
+        const Node *node = nodeMap[name];
+
+        if (node->status() == Node::Obsolete)
+            continue;
+
+        if (++row % 2 == 1)
+            out() << "<tr class=\"odd topAlign\">";
+        else
+            out() << "<tr class=\"even topAlign\">";
+        out() << "<td><p>";
+        generateFullName(node, relative, marker);
+        out() << "</p></td>";
+
+        if (!(node->type() == Node::Fake)) {
+            Text brief = node->doc().trimmedBriefText(name);
+            if (!brief.isEmpty()) {
+                out() << "<td><p>";
+                generateText(brief, node, marker);
+                out() << "</p></td>";
+            }
+        }
+        else {
+            out() << "<td><p>";
+            out() << protectEnc(node->doc().briefText().toString());
+            out() << "</p></td>";
+        }
+        out() << "</tr>\n";
+    }
+    out() << "</table>\n";
+}
+
+/*!
+  This function finds the common prefix of the names of all
+  the classes in \a classMap and then generates a compact
+  list of the class names alphabetized on the part of the
+  name not including the common prefix. You can tell the
+  function to use \a comonPrefix as the common prefix, but
+  normally you let it figure it out itself by looking at
+  the name of the first and last classes in \a classMap.
+ */
+void DitaXmlGenerator::generateCompactList(const Node *relative,
+                                        CodeMarker *marker,
+                                        const NodeMap &classMap,
+                                        bool includeAlphabet,
+                                        QString commonPrefix)
+{
+    const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
+
+    if (classMap.isEmpty())
+        return;
+
+    /*
+      If commonPrefix is not empty, then the caller knows what
+      the common prefix is and has passed it in, so just use that
+      one.
+     */
+    int commonPrefixLen = commonPrefix.length();
+    if (commonPrefixLen == 0) {
+        QString first;
+        QString last;
+        
+        /*
+          The caller didn't pass in a common prefix, so get the common
+          prefix by looking at the class names of the first and last
+          classes in the class map. Discard any namespace names and
+          just use the bare class names. For Qt, the prefix is "Q".
+
+          Note that the algorithm used here to derive the common prefix
+          from the first and last classes in alphabetical order (QAccel
+          and QXtWidget in Qt 2.1), fails if either class name does not
+          begin with Q.
+        */
+
+        NodeMap::const_iterator iter = classMap.begin();
+        while (iter != classMap.end()) {
+            if (!iter.key().contains("::")) {
+                first = iter.key();
+                break;
+            }
+            ++iter;
+        }
+
+        if (first.isEmpty())
+            first = classMap.begin().key();
+
+        iter = classMap.end();
+        while (iter != classMap.begin()) {
+            --iter;
+            if (!iter.key().contains("::")) {
+                last = iter.key();
+                break;
+            }
+        }
+
+        if (last.isEmpty())
+            last = classMap.begin().key();
+
+        if (classMap.size() > 1) {
+            while (commonPrefixLen < first.length() + 1 &&
+                   commonPrefixLen < last.length() + 1 &&
+                   first[commonPrefixLen] == last[commonPrefixLen])
+                ++commonPrefixLen;
+        }
+
+        commonPrefix = first.left(commonPrefixLen);
+    }
+
+    /*
+      Divide the data into 37 paragraphs: 0, ..., 9, A, ..., Z,
+      underscore (_). QAccel will fall in paragraph 10 (A) and
+      QXtWidget in paragraph 33 (X). This is the only place where we
+      assume that NumParagraphs is 37. Each paragraph is a NodeMap.
+    */
+    NodeMap paragraph[NumParagraphs+1];
+    QString paragraphName[NumParagraphs+1];
+    QSet<char> usedParagraphNames;
+
+    NodeMap::ConstIterator c = classMap.begin();
+    while (c != classMap.end()) {
+        QStringList pieces = c.key().split("::");
+        QString key;
+        int idx = commonPrefixLen;
+        if (!pieces.last().startsWith(commonPrefix))
+            idx = 0;
+        if (pieces.size() == 1)
+            key = pieces.last().mid(idx).toLower();
+        else
+            key = pieces.last().toLower();
+
+        int paragraphNr = NumParagraphs - 1;
+
+        if (key[0].digitValue() != -1) {
+            paragraphNr = key[0].digitValue();
+        }
+        else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
+            paragraphNr = 10 + key[0].unicode() - 'a';
+        }
+
+        paragraphName[paragraphNr] = key[0].toUpper();
+        usedParagraphNames.insert(key[0].toLower().cell());
+        paragraph[paragraphNr].insert(key, c.value());
+        ++c;
+    }
+
+    /*
+      Each paragraph j has a size: paragraph[j].count(). In the
+      discussion, we will assume paragraphs 0 to 5 will have sizes
+      3, 1, 4, 1, 5, 9.
+
+      We now want to compute the paragraph offset. Paragraphs 0 to 6
+      start at offsets 0, 3, 4, 8, 9, 14, 23.
+    */
+    int paragraphOffset[NumParagraphs + 1];     // 37 + 1
+    paragraphOffset[0] = 0;
+    for (int i=0; i<NumParagraphs; i++)         // i = 0..36
+        paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count();
+
+    int curParNr = 0;
+    int curParOffset = 0;
+
+    /*
+      Output the alphabet as a row of links.
+     */
+    if (includeAlphabet) {
+        out() << "<p  class=\"centerAlign functionIndex\"><b>";
+        for (int i = 0; i < 26; i++) {
+            QChar ch('a' + i);
+            if (usedParagraphNames.contains(char('a' + i)))
+                out() << QString("<xref href=\"#%1\">%2</xref>&nbsp;").arg(ch).arg(ch.toUpper());
+        }
+        out() << "</b></p>\n";
+    }
+
+    /*
+      Output a <div> element to contain all the <dl> elements.
+     */
+    out() << "<div class=\"flowListDiv\">\n";
+
+    for (int i=0; i<classMap.count()-1; i++) {
+        while ((curParNr < NumParagraphs) &&
+               (curParOffset == paragraph[curParNr].count())) {
+            ++curParNr;
+            curParOffset = 0;
+        }
+
+        /*
+          Starting a new paragraph means starting a new <dl>.
+        */
+        if (curParOffset == 0) {
+            if (i > 0)
+                out() << "</dl>\n";
+            if (++numTableRows % 2 == 1)
+                out() << "<dl class=\"flowList odd\">";
+            else
+                out() << "<dl class=\"flowList even\">";
+            out() << "<dt class=\"alphaChar\">";
+            if (includeAlphabet) {
+                QChar c = paragraphName[curParNr][0].toLower();
+                out() << QString("<a name=\"%1\"></a>").arg(c);
+            }
+            out() << "<b>"
+                  << paragraphName[curParNr]
+                  << "</b>";
+            out() << "</dt>\n";
+        }
+
+        /*
+          Output a <dd> for the current offset in the current paragraph.
+         */
+        out() << "<dd>";
+        if ((curParNr < NumParagraphs) &&
+            !paragraphName[curParNr].isEmpty()) {
+            NodeMap::Iterator it;
+            it = paragraph[curParNr].begin();
+            for (int i=0; i<curParOffset; i++)
+                ++it;
+
+            /*
+              Previously, we used generateFullName() for this, but we
+              require some special formatting.
+            */
+            out() << "<xref href=\"" << linkForNode(it.value(), relative) << "\">";
+            
+            QStringList pieces;
+            if (it.value()->subType() == Node::QmlClass)
+                pieces << it.value()->name();
+            else
+                pieces = fullName(it.value(), relative, marker).split("::");
+            out() << protectEnc(pieces.last());
+            out() << "</xref>";
+            if (pieces.size() > 1) {
+                out() << " (";
+                generateFullName(it.value()->parent(), relative, marker);
+                out() << ")";
+            }
+        }
+        out() << "</dd>\n";
+        curParOffset++;
+    }
+    out() << "</dl>\n";
+    out() << "</div>\n";
+}
+
+void DitaXmlGenerator::generateFunctionIndex(const Node *relative,
+                                          CodeMarker *marker)
+{
+    out() << "<p  class=\"centerAlign functionIndex\"><b>";
+    for (int i = 0; i < 26; i++) {
+        QChar ch('a' + i);
+        out() << QString("<xref href=\"#%1\">%2</xref>&nbsp;").arg(ch).arg(ch.toUpper());
+    }
+    out() << "</b></p>\n";
+
+    char nextLetter = 'a';
+    char currentLetter;
+
+#if 1
+    out() << "<ul>\n";
+#endif
+    QMap<QString, NodeMap >::ConstIterator f = funcIndex.begin();
+    while (f != funcIndex.end()) {
+#if 1
+        out() << "<li>";
+#else
+        out() << "<p>";
+#endif
+        out() << protectEnc(f.key()) << ":";
+
+        currentLetter = f.key()[0].unicode();
+        while (islower(currentLetter) && currentLetter >= nextLetter) {
+            out() << QString("<a name=\"%1\"></a>").arg(nextLetter);
+            nextLetter++;
+        }
+
+        NodeMap::ConstIterator s = (*f).begin();
+        while (s != (*f).end()) {
+            out() << " ";
+            generateFullName((*s)->parent(), relative, marker, *s);
+            ++s;
+        }
+#if 1
+        out() << "</li>";
+#else
+        out() << "</p>";
+#endif
+        out() << "\n";
+        ++f;
+    }
+#if 1
+    out() << "</ul>\n";
+#endif
+}
+
+void DitaXmlGenerator::generateLegaleseList(const Node *relative,
+                                         CodeMarker *marker)
+{
+    QMap<Text, const Node *>::ConstIterator it = legaleseTexts.begin();
+    while (it != legaleseTexts.end()) {
+        Text text = it.key();
+        out() << "<hr />\n";
+        generateText(text, relative, marker);
+        out() << "<ul>\n";
+        do {
+            out() << "<li>";
+            generateFullName(it.value(), relative, marker);
+            out() << "</li>\n";
+            ++it;
+        } while (it != legaleseTexts.end() && it.key() == text);
+        out() << "</ul>\n";
+    }
+}
+
+/*void DitaXmlGenerator::generateSynopsis(const Node *node,
+                                     const Node *relative,
+                                     CodeMarker *marker,
+                                     CodeMarker::SynopsisStyle style)
+{
+    QString marked = marker->markedUpSynopsis(node, relative, style);
+    QRegExp templateTag("(<[^@>]*>)");
+    if (marked.indexOf(templateTag) != -1) {
+        QString contents = protectEnc(marked.mid(templateTag.pos(1),
+                                              templateTag.cap(1).length()));
+        marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
+                        contents);
+    }
+    marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
+                   "<i>\\1<sub>\\2</sub></i>");
+    marked.replace("<@param>", "<i>");
+    marked.replace("</@param>", "</i>");
+
+    if (style == CodeMarker::Summary)
+        marked.replace("@name>", "b>");
+
+    if (style == CodeMarker::SeparateList) {
+        QRegExp extraRegExp("<@extra>.*</@extra>");
+        extraRegExp.setMinimal(true);
+        marked.replace(extraRegExp, "");
+    }
+    else {
+        marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
+        marked.replace("</@extra>", "</tt>");
+    }
+
+    if (style != CodeMarker::Detailed) {
+        marked.replace("<@type>", "");
+        marked.replace("</@type>", "");
+    }
+    out() << highlightedCode(marked, marker, relative);
+}*/
+
+#ifdef QDOC_QML
+void DitaXmlGenerator::generateQmlItem(const Node *node,
+                                    const Node *relative,
+                                    CodeMarker *marker,
+                                    bool summary)
+{ 
+    QString marked = marker->markedUpQmlItem(node,summary);
+    QRegExp templateTag("(<[^@>]*>)");
+    if (marked.indexOf(templateTag) != -1) {
+        QString contents = protectEnc(marked.mid(templateTag.pos(1),
+                                              templateTag.cap(1).length()));
+        marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
+                        contents);
+    }
+    marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
+                   "<i>\\1<sub>\\2</sub></i>");
+    marked.replace("<@param>", "<i>");
+    marked.replace("</@param>", "</i>");
+
+    if (summary)
+        marked.replace("@name>", "b>");
+
+    marked.replace("<@extra>", "<tt>");
+    marked.replace("</@extra>", "</tt>");
+
+    if (summary) {
+        marked.replace("<@type>", "");
+        marked.replace("</@type>", "");
+    }
+    out() << highlightedCode(marked, marker, relative);
+}
+#endif
+
+void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */)
+{
+    QMap<const FakeNode *, QMap<QString, FakeNode *> > fakeNodeMap;
+    QMap<QString, const FakeNode *> groupTitlesMap;
+    QMap<QString, FakeNode *> uncategorizedNodeMap;
+    QRegExp singleDigit("\\b([0-9])\\b");
+
+    const NodeList children = myTree->root()->childNodes();
+    foreach (Node *child, children) {
+        if (child->type() == Node::Fake && child != relative) {
+            FakeNode *fakeNode = static_cast<FakeNode *>(child);
+
+            // Check whether the page is part of a group or is the group
+            // definition page.
+            QString group;
+            bool isGroupPage = false;
+            if (fakeNode->doc().metaCommandsUsed().contains("group")) {
+                group = fakeNode->doc().metaCommandArgs("group")[0];
+                isGroupPage = true;
+            }
+
+            // there are too many examples; they would clutter the list
+            if (fakeNode->subType() == Node::Example)
+                continue;
+
+            // not interested either in individual (Qt Designer etc.) manual chapters
+            if (fakeNode->links().contains(Node::ContentsLink))
+                continue;
+
+            // Discard external nodes.
+            if (fakeNode->subType() == Node::ExternalPage)
+                continue;
+
+            QString sortKey = fakeNode->fullTitle().toLower();
+            if (sortKey.startsWith("the "))
+                sortKey.remove(0, 4);
+            sortKey.replace(singleDigit, "0\\1");
+
+            if (!group.isEmpty()) {
+                if (isGroupPage) {
+                    // If we encounter a group definition page, we add all
+                    // the pages in that group to the list for that group.
+                    foreach (Node *member, fakeNode->groupMembers()) {
+                        if (member->type() != Node::Fake)
+                            continue;
+                        FakeNode *page = static_cast<FakeNode *>(member);
+                        if (page) {
+                            QString sortKey = page->fullTitle().toLower();
+                            if (sortKey.startsWith("the "))
+                                sortKey.remove(0, 4);
+                            sortKey.replace(singleDigit, "0\\1");
+                            fakeNodeMap[const_cast<const FakeNode *>(fakeNode)].insert(sortKey, page);
+                            groupTitlesMap[fakeNode->fullTitle()] = const_cast<const FakeNode *>(fakeNode);
+                        }
+                    }
+                }
+                else if (!isGroupPage) {
+                    // If we encounter a page that belongs to a group then
+                    // we add that page to the list for that group.
+                    const FakeNode *groupNode = static_cast<const FakeNode *>(myTree->root()->findNode(group, Node::Fake));
+                    if (groupNode)
+                        fakeNodeMap[groupNode].insert(sortKey, fakeNode);
+                    //else
+                    //    uncategorizedNodeMap.insert(sortKey, fakeNode);
+                }// else
+                //    uncategorizedNodeMap.insert(sortKey, fakeNode);
+            }// else
+            //    uncategorizedNodeMap.insert(sortKey, fakeNode);
+        }
+    }
+
+    // We now list all the pages found that belong to groups.
+    // If only certain pages were found for a group, but the definition page
+    // for that group wasn't listed, the list of pages will be intentionally
+    // incomplete. However, if the group definition page was listed, all the
+    // pages in that group are listed for completeness.
+
+    if (!fakeNodeMap.isEmpty()) {
+        foreach (const QString &groupTitle, groupTitlesMap.keys()) {
+            const FakeNode *groupNode = groupTitlesMap[groupTitle];
+            out() << QString("<h3><xref href=\"%1\">%2</xref></h3>\n").arg(
+                        linkForNode(groupNode, relative)).arg(
+                        protectEnc(groupNode->fullTitle()));
+
+            if (fakeNodeMap[groupNode].count() == 0)
+                continue;
+
+            out() << "<ul>\n";
+
+            foreach (const FakeNode *fakeNode, fakeNodeMap[groupNode]) {
+                QString title = fakeNode->fullTitle();
+                if (title.startsWith("The "))
+                    title.remove(0, 4);
+                out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">"
+                      << protectEnc(title) << "</xref></li>\n";
+            }
+            out() << "</ul>\n";
+        }
+    }
+
+    if (!uncategorizedNodeMap.isEmpty()) {
+        out() << QString("<h3>Miscellaneous</h3>\n");
+        out() << "<ul>\n";
+        foreach (const FakeNode *fakeNode, uncategorizedNodeMap) {
+            QString title = fakeNode->fullTitle();
+            if (title.startsWith("The "))
+                title.remove(0, 4);
+            out() << "<li><xref href=\"" << linkForNode(fakeNode, relative) << "\">"
+                  << protectEnc(title) << "</xref></li>\n";
+        }
+        out() << "</ul>\n";
+    }
+}
+
+void DitaXmlGenerator::generateSection(const NodeList& nl,
+                                    const Node *relative,
+                                    CodeMarker *marker,
+                                    CodeMarker::SynopsisStyle style)
+{
+    bool name_alignment = true;
+    if (!nl.isEmpty()) {
+        bool twoColumn = false;
+        if (style == CodeMarker::SeparateList) {
+            name_alignment = false;
+            twoColumn = (nl.count() >= 16);
+        }
+        else if (nl.first()->type() == Node::Property) {
+            twoColumn = (nl.count() >= 5);
+            name_alignment = false;
+        }
+        if (name_alignment) {
+            out() << "<table class=\"alignedsummary\">\n";
+        }
+        else {
+            if (twoColumn)
+                out() << "<table class=\"propsummary\">\n"
+                      << "<tr><td  class=\"topAlign\">";
+            out() << "<ul>\n";
+        }
+
+        int i = 0;
+        NodeList::ConstIterator m = nl.begin();
+        while (m != nl.end()) {
+            if ((*m)->access() == Node::Private) {
+                ++m;
+                continue;
+            }
+
+            if (name_alignment) {
+                out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> ";
+            }
+            else {
+                if (twoColumn && i == (int) (nl.count() + 1) / 2)
+                    out() << "</ul></td><td  class=\"topAlign\"><ul>\n";
+                out() << "<li class=\"fn\">";
+            }
+
+            generateSynopsis(*m, relative, marker, style, name_alignment);
+            if (name_alignment)
+                out() << "</td></tr>\n";
+            else
+                out() << "</li>\n";
+            i++;
+            ++m;
+        }
+        if (name_alignment)
+            out() << "</table>\n";
+        else {
+            out() << "</ul>\n";
+            if (twoColumn)
+                out() << "</td></tr>\n</table>\n";
+        }
+    }
+}
+
+void DitaXmlGenerator::generateSectionList(const Section& section,
+                                        const Node *relative,
+                                        CodeMarker *marker,
+                                        CodeMarker::SynopsisStyle style)
+{
+    bool name_alignment = true;
+    if (!section.members.isEmpty()) {
+        bool twoColumn = false;
+        if (style == CodeMarker::SeparateList) {
+            name_alignment = false;
+            twoColumn = (section.members.count() >= 16);
+        }
+        else if (section.members.first()->type() == Node::Property) {
+            twoColumn = (section.members.count() >= 5);
+            name_alignment = false;
+        }
+        if (name_alignment) {
+            out() << "<table class=\"alignedsummary\">\n";
+        }
+        else {
+            if (twoColumn)
+                out() << "<table class=\"propsummary\">\n"
+                      << "<tr><td  class=\"topAlign\">";
+            out() << "<ul>\n";
+        }
+
+        int i = 0;
+        NodeList::ConstIterator m = section.members.begin();
+        while (m != section.members.end()) {
+            if ((*m)->access() == Node::Private) {
+                ++m;
+                continue;
+            }
+
+            if (name_alignment) {
+                out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> ";
+            }
+            else {
+                if (twoColumn && i == (int) (section.members.count() + 1) / 2)
+                    out() << "</ul></td><td class=\"topAlign\"><ul>\n";
+                out() << "<li class=\"fn\">";
+            }
+
+            generateSynopsis(*m, relative, marker, style, name_alignment);
+            if (name_alignment)
+                out() << "</td></tr>\n";
+            else
+                out() << "</li>\n";
+            i++;
+            ++m;
+        }
+        if (name_alignment)
+            out() << "</table>\n";
+        else {
+            out() << "</ul>\n";
+            if (twoColumn)
+                out() << "</td></tr>\n</table>\n";
+        }
+    }
+
+    if (style == CodeMarker::Summary && !section.inherited.isEmpty()) {
+        out() << "<ul>\n";
+        generateSectionInheritedList(section, relative, marker, name_alignment);
+        out() << "</ul>\n";
+    }
+}
+
+void DitaXmlGenerator::generateSectionInheritedList(const Section& section,
+                                                 const Node *relative,
+                                                 CodeMarker *marker,
+                                                 bool nameAlignment)
+{
+    QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin();
+    while (p != section.inherited.end()) {
+        if (nameAlignment)
+            out() << "<li class=\"fn\">";
+        else
+            out() << "<li class=\"fn\">";
+        out() << (*p).second << " ";
+        if ((*p).second == 1) {
+            out() << section.singularMember;
+        }
+        else {
+            out() << section.pluralMember;
+        }
+        out() << " inherited from <xref href=\"" << fileName((*p).first)
+              << "#" << DitaXmlGenerator::cleanRef(section.name.toLower()) << "\">"
+              << protectEnc(marker->plainFullName((*p).first, relative))
+              << "</xref></li>\n";
+        ++p;
+    }
+}
+
+void DitaXmlGenerator::generateSynopsis(const Node *node,
+                                     const Node *relative,
+                                     CodeMarker *marker,
+                                     CodeMarker::SynopsisStyle style,
+                                     bool nameAlignment)
+{
+    QString marked = marker->markedUpSynopsis(node, relative, style);
+    QRegExp templateTag("(<[^@>]*>)");
+    if (marked.indexOf(templateTag) != -1) {
+        QString contents = protectEnc(marked.mid(templateTag.pos(1),
+                                              templateTag.cap(1).length()));
+        marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
+                        contents);
+    }
+    marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
+                   "<i>\\1<sub>\\2</sub></i>");
+    marked.replace("<@param>", "<i>");
+    marked.replace("</@param>", "</i>");
+
+    if (style == CodeMarker::Summary) {
+        marked.replace("<@name>", "");   // was "<b>"
+        marked.replace("</@name>", "");  // was "</b>"
+    }
+
+    if (style == CodeMarker::SeparateList) {
+        QRegExp extraRegExp("<@extra>.*</@extra>");
+        extraRegExp.setMinimal(true);
+        marked.replace(extraRegExp, "");
+    } else {
+        marked.replace("<@extra>", "<tt>");
+        marked.replace("</@extra>", "</tt>");
+    }
+
+    if (style != CodeMarker::Detailed) {
+        marked.replace("<@type>", "");
+        marked.replace("</@type>", "");
+    }
+    out() << highlightedCode(marked, marker, relative, style, nameAlignment);
+}
+
+QString DitaXmlGenerator::highlightedCode(const QString& markedCode,
+                                       CodeMarker *marker,
+                                       const Node *relative,
+                                       CodeMarker::SynopsisStyle ,
+                                       bool nameAlignment)
+{
+    QString src = markedCode;
+    QString html;
+    QStringRef arg;
+    QStringRef par1;
+
+    const QChar charLangle = '<';
+    const QChar charAt = '@';
+
+    // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
+    static const QString linkTag("link");
+    bool done = false;
+    for (int i = 0, n = src.size(); i < n;) {
+        if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') {
+            if (nameAlignment && !done) {// && (i != 0)) Why was this here?
+                html += "</td><td class=\"memItemRight bottomAlign\">";
+                done = true;
+            }
+            i += 2;
+            if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
+                html += "<b>";
+                QString link = linkForNode(
+                    CodeMarker::nodeForString(par1.toString()), relative);
+                addLink(link, arg, &html);
+                html += "</b>";
+            }
+            else {
+                html += charLangle;
+                html += charAt;
+            }
+        }
+        else {
+            html += src.at(i++);
+        }
+    }
+
+
+    if (slow) {
+        // is this block ever used at all?
+        // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)"
+        src = html;
+        html = QString();
+        static const QString funcTag("func");
+        for (int i = 0, n = src.size(); i < n;) {
+            if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+                i += 2;
+                if (parseArg(src, funcTag, &i, n, &arg, &par1)) {
+                    QString link = linkForNode(
+                            marker->resolveTarget(par1.toString(),
+                                                  myTree,
+                                                  relative),
+                            relative);
+                    addLink(link, arg, &html);
+                    par1 = QStringRef();
+                }
+                else {
+                    html += charLangle;
+                    html += charAt;
+                }
+            }
+            else {
+                html += src.at(i++);
+            }
+        }
+    }
+
+    // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags
+    src = html;
+    html = QString();
+    static const QString typeTags[] = { "type", "headerfile", "func" };
+    for (int i = 0, n = src.size(); i < n;) {
+        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+            i += 2;
+            bool handled = false;
+            for (int k = 0; k != 3; ++k) {
+                if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) {
+                    par1 = QStringRef();
+                    QString link = linkForNode(
+                            marker->resolveTarget(arg.toString(), myTree, relative),
+                            relative);
+                    addLink(link, arg, &html);
+                    handled = true;
+                    break;
+                }
+            }
+            if (!handled) {
+                html += charLangle;
+                html += charAt;
+            }
+        }
+        else {
+            html += src.at(i++);
+        }
+    }
+
+    // replace all
+    // "<@comment>" -> "<span class=\"comment\">";
+    // "<@preprocessor>" -> "<span class=\"preprocessor\">";
+    // "<@string>" -> "<span class=\"string\">";
+    // "<@char>" -> "<span class=\"char\">";
+    // "</@(?:comment|preprocessor|string|char)>" -> "</span>"
+    src = html;
+    html = QString();
+    static const QString spanTags[] = {
+        "<@comment>",      "<span class=\"comment\">",
+        "<@preprocessor>", "<span class=\"preprocessor\">",
+        "<@string>",       "<span class=\"string\">",
+        "<@char>",         "<span class=\"char\">",
+        "</@comment>",     "</span>",
+        "</@preprocessor>","</span>",
+        "</@string>",      "</span>",
+        "</@char>",        "</span>"
+        // "<@char>",      "<font color=blue>",
+        // "</@char>",     "</font>",
+        // "<@func>",      "<font color=green>",
+        // "</@func>",     "</font>",
+        // "<@id>",        "<i>",
+        // "</@id>",       "</i>",
+        // "<@keyword>",   "<b>",
+        // "</@keyword>",  "</b>",
+        // "<@number>",    "<font color=yellow>",
+        // "</@number>",   "</font>",
+        // "<@op>",        "<b>",
+        // "</@op>",       "</b>",
+        // "<@param>",     "<i>",
+        // "</@param>",    "</i>",
+        // "<@string>",    "<font color=green>",
+        // "</@string>",  "</font>",
+    };
+    for (int i = 0, n = src.size(); i < n;) {
+        if (src.at(i) == charLangle) {
+            bool handled = false;
+            for (int k = 0; k != 8; ++k) {
+                const QString & tag = spanTags[2 * k];
+                if (tag == QStringRef(&src, i, tag.length())) {
+                    html += spanTags[2 * k + 1];
+                    i += tag.length();
+                    handled = true;
+                    break;
+                }
+            }
+            if (!handled) {
+                ++i;
+                if (src.at(i) == charAt ||
+                    (src.at(i) == QLatin1Char('/') && src.at(i + 1) == charAt)) {
+                    // drop 'our' unknown tags (the ones still containing '@')
+                    while (i < n && src.at(i) != QLatin1Char('>'))
+                        ++i;
+                    ++i;
+                }
+                else {
+                    // retain all others
+                    html += charLangle;
+                }
+            }
+        }
+        else {
+            html += src.at(i);
+            ++i;
+        }
+    }
+
+    return html;
+}
+
+void DitaXmlGenerator::generateLink(const Atom* atom,
+                                 const Node* /* relative */,
+                                 CodeMarker* marker)
+{
+    static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_");
+
+    if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) {
+        // hack for C++: move () outside of link
+        int k = funcLeftParen.pos(1);
+        writer.writeCharacters(protectEnc(atom->string().left(k)));
+        if (link.isEmpty()) {
+            if (showBrokenLinks)
+                writer.writeEndElement(); // </i>
+        }
+        else {
+            writer.writeEndElement(); // </xref>
+        }
+        inLink = false;
+        writer.writeCharacters(protectEnc(atom->string().mid(k)));
+    } else if (marker->recognizeLanguage("Java")) {
+	// hack for Java: remove () and use <tt> when appropriate
+        bool func = atom->string().endsWith("()");
+        bool tt = (func || atom->string().contains(camelCase));
+        if (tt)
+            writer.writeStartElement("tt");
+        if (func) {
+            writer.writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2)));
+        }
+        else {
+            writer.writeCharacters(protectEnc(atom->string()));
+        }
+        writer.writeEndElement(); // </tt>
+    }
+    else {
+        writer.writeCharacters(protectEnc(atom->string()));
+    }
+}
+
+QString DitaXmlGenerator::cleanRef(const QString& ref)
+{
+    QString clean;
+
+    if (ref.isEmpty())
+        return clean;
+
+    clean.reserve(ref.size() + 20);
+    const QChar c = ref[0];
+    const uint u = c.unicode();
+
+    if ((u >= 'a' && u <= 'z') ||
+         (u >= 'A' && u <= 'Z') ||
+         (u >= '0' && u <= '9')) {
+        clean += c;
+    } else if (u == '~') {
+        clean += "dtor.";
+    } else if (u == '_') {
+        clean += "underscore.";
+    } else {
+        clean += "A";
+    }
+
+    for (int i = 1; i < (int) ref.length(); i++) {
+        const QChar c = ref[i];
+        const uint u = c.unicode();
+        if ((u >= 'a' && u <= 'z') ||
+             (u >= 'A' && u <= 'Z') ||
+             (u >= '0' && u <= '9') || u == '-' ||
+             u == '_' || u == ':' || u == '.') {
+            clean += c;
+        } else if (c.isSpace()) {
+            clean += "-";
+        } else if (u == '!') {
+            clean += "-not";
+        } else if (u == '&') {
+            clean += "-and";
+        } else if (u == '<') {
+            clean += "-lt";
+        } else if (u == '=') {
+            clean += "-eq";
+        } else if (u == '>') {
+            clean += "-gt";
+        } else if (u == '#') {
+            clean += "#";
+        } else {
+            clean += "-";
+            clean += QString::number((int)u, 16);
+        }
+    }
+    return clean;
+}
+
+QString DitaXmlGenerator::registerRef(const QString& ref)
+{
+    QString clean = DitaXmlGenerator::cleanRef(ref);
+
+    for (;;) {
+        QString& prevRef = refMap[clean.toLower()];
+        if (prevRef.isEmpty()) {
+            prevRef = ref;
+            break;
+        } else if (prevRef == ref) {
+            break;
+        }
+        clean += "x";
+    }
+    return clean;
+}
+
+QString DitaXmlGenerator::protectEnc(const QString &string)
+{
+    return protect(string, outputEncoding);
+}
+
+QString DitaXmlGenerator::protect(const QString &string, const QString &outputEncoding)
+{
+#define APPEND(x) \
+    if (xml.isEmpty()) { \
+        xml = string; \
+        xml.truncate(i); \
+    } \
+    xml += (x);
+
+    QString xml;
+    int n = string.length();
+
+    for (int i = 0; i < n; ++i) {
+        QChar ch = string.at(i);
+
+        if (ch == QLatin1Char('&')) {
+            APPEND("&amp;");
+        } else if (ch == QLatin1Char('<')) {
+            APPEND("&lt;");
+        } else if (ch == QLatin1Char('>')) {
+            APPEND("&gt;");
+        } else if (ch == QLatin1Char('"')) {
+            APPEND("&quot;");
+        } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F)
+                   || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/'))
+                   || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) {
+            // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator
+            APPEND("&#x");
+            xml += QString::number(ch.unicode(), 16);
+            xml += QLatin1Char(';');
+        } else {
+            if (!xml.isEmpty())
+                xml += ch;
+        }
+    }
+
+    if (!xml.isEmpty())
+        return xml;
+    return string;
+
+#undef APPEND
+}
+
+QString DitaXmlGenerator::fileBase(const Node *node)
+{
+    QString result;
+
+    result = PageGenerator::fileBase(node);
+
+    if (!node->isInnerNode()) {
+        switch (node->status()) {
+        case Node::Compat:
+            result += "-qt3";
+            break;
+        case Node::Obsolete:
+            result += "-obsolete";
+            break;
+        default:
+            ;
+        }
+    }
+    return result;
+}
+
+#if 0
+QString DitaXmlGenerator::fileBase(const Node *node,
+                                const SectionIterator& section)
+{
+    QStringList::ConstIterator s = section.sectionNumber().end();
+    QStringList::ConstIterator b = section.baseNameStack().end();
+
+    QString suffix;
+    QString base = fileBase(node);
+
+    while (s != section.sectionNumber().begin()) {
+        --s;
+        --b;
+        if (!(*b).isEmpty()) {
+            base = *b;
+            break;
+        }
+        suffix.prepend("-" + *s);
+    }
+    return base + suffix;
+}
+#endif
+
+QString DitaXmlGenerator::fileName(const Node *node)
+{
+    if (node->type() == Node::Fake) {
+        if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
+            return node->name();
+        if (static_cast<const FakeNode *>(node)->subType() == Node::Image)
+            return node->name();
+    }
+    return PageGenerator::fileName(node);
+}
+
+QString DitaXmlGenerator::refForNode(const Node *node)
+{
+    const FunctionNode *func;
+    const TypedefNode *typedeffe;
+    QString ref;
+
+    switch (node->type()) {
+    case Node::Namespace:
+    case Node::Class:
+    default:
+        break;
+    case Node::Enum:
+        ref = node->name() + "-enum";
+        break;
+    case Node::Typedef:
+        typedeffe = static_cast<const TypedefNode *>(node);
+        if (typedeffe->associatedEnum()) {
+            return refForNode(typedeffe->associatedEnum());
+        }
+        else {
+            ref = node->name() + "-typedef";
+        }
+        break;
+    case Node::Function:
+        func = static_cast<const FunctionNode *>(node);
+        if (func->associatedProperty()) {
+            return refForNode(func->associatedProperty());
+        }
+        else {
+            ref = func->name();
+            if (func->overloadNumber() != 1)
+                ref += "-" + QString::number(func->overloadNumber());
+        }
+        break;
+#ifdef QDOC_QML        
+    case Node::Fake:
+        if (node->subType() != Node::QmlPropertyGroup)
+            break;
+    case Node::QmlProperty:
+#endif        
+    case Node::Property:
+        ref = node->name() + "-prop";
+        break;
+#ifdef QDOC_QML
+    case Node::QmlSignal:
+        ref = node->name() + "-signal";
+        break;
+    case Node::QmlMethod:
+        ref = node->name() + "-method";
+        break;
+#endif        
+    case Node::Variable:
+        ref = node->name() + "-var";
+        break;
+    case Node::Target:
+        return protectEnc(node->name());
+    }
+    return registerRef(ref);
+}
+
+QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative)
+{
+    QString link;
+    QString fn;
+    QString ref;
+
+    if (node == 0 || node == relative)
+        return QString();
+    if (!node->url().isEmpty())
+        return node->url();
+    if (fileBase(node).isEmpty())
+        return QString();
+    if (node->access() == Node::Private)
+        return QString();
+
+    fn = fileName(node);
+    link += fn;
+
+    if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) {
+        ref = refForNode(node);
+        if (relative && fn == fileName(relative) && ref == refForNode(relative))
+            return QString();
+
+        link += "#";
+        link += ref;
+    }
+    return link;
+}
+
+QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */)
+{
+    if (atom->type() == Atom::SectionLeft) {
+        return Doc::canonicalTitle(Text::sectionHeading(atom).toString());
+    }
+    else if (atom->type() == Atom::Target) {
+        return Doc::canonicalTitle(atom->string());
+    }
+    else {
+        return QString();
+    }
+}
+
+void DitaXmlGenerator::generateFullName(const Node *apparentNode,
+                                     const Node *relative,
+                                     CodeMarker *marker,
+                                     const Node *actualNode)
+{
+    if (actualNode == 0)
+        actualNode = apparentNode;
+    out() << "<xref href=\"" << linkForNode(actualNode, relative);
+    if (true || relative == 0 || relative->status() != actualNode->status()) {
+        switch (actualNode->status()) {
+        case Node::Obsolete:
+            out() << "\" class=\"obsolete";
+            break;
+        case Node::Compat:
+            out() << "\" class=\"compat";
+            break;
+        default:
+            ;
+        }
+    }
+    out() << "\">";
+    out() << protectEnc(fullName(apparentNode, relative, marker));
+    out() << "</xref>";
+}
+
+void DitaXmlGenerator::generateDetailedMember(const Node *node,
+                                           const InnerNode *relative,
+                                           CodeMarker *marker)
+{
+    const EnumNode *enume;
+
+#ifdef GENERATE_MAC_REFS    
+    generateMacRef(node, marker);
+#endif    
+    if (node->type() == Node::Enum
+            && (enume = static_cast<const EnumNode *>(node))->flagsType()) {
+#ifdef GENERATE_MAC_REFS    
+        generateMacRef(enume->flagsType(), marker);
+#endif        
+        out() << "<h3 class=\"flags\">";
+        out() << "<a name=\"" + refForNode(node) + "\"></a>";
+        generateSynopsis(enume, relative, marker, CodeMarker::Detailed);
+        out() << "<br/>";
+        generateSynopsis(enume->flagsType(),
+                         relative,
+                         marker,
+                         CodeMarker::Detailed);
+        out() << "</h3>\n";
+    }
+    else {
+        out() << "<h3 class=\"fn\">";
+        out() << "<a name=\"" + refForNode(node) + "\"></a>";
+        generateSynopsis(node, relative, marker, CodeMarker::Detailed);
+        out() << "</h3>\n";
+    }
+
+    generateStatus(node, marker);
+    generateBody(node, marker);
+    generateThreadSafeness(node, marker);
+    generateSince(node, marker);
+
+    if (node->type() == Node::Property) {
+        const PropertyNode *property = static_cast<const PropertyNode *>(node);
+        Section section;
+
+        section.members += property->getters();
+        section.members += property->setters();
+        section.members += property->resetters();
+
+        if (!section.members.isEmpty()) {
+            out() << "<p><b>Access functions:</b></p>\n";
+            generateSectionList(section, node, marker, CodeMarker::Accessors);
+        }
+
+        Section notifiers;
+        notifiers.members += property->notifiers();
+        
+        if (!notifiers.members.isEmpty()) {
+            out() << "<p><b>Notifier signal:</b></p>\n";
+            //out() << "<p>This signal is emitted when the property value is changed.</p>\n";
+            generateSectionList(notifiers, node, marker, CodeMarker::Accessors);
+        }
+    }
+    else if (node->type() == Node::Enum) {
+        const EnumNode *enume = static_cast<const EnumNode *>(node);
+        if (enume->flagsType()) {
+            out() << "<p>The " << protectEnc(enume->flagsType()->name())
+                  << " type is a typedef for "
+                  << "<xref href=\"qflags.html\">QFlags</xref>&lt;"
+                  << protectEnc(enume->name())
+                  << "&gt;. It stores an OR combination of "
+                  << protectEnc(enume->name())
+                  << " values.</p>\n";
+        }
+    }
+    generateAlsoList(node, marker);
+}
+
+void DitaXmlGenerator::findAllClasses(const InnerNode *node)
+{
+    NodeList::const_iterator c = node->childNodes().constBegin();
+    while (c != node->childNodes().constEnd()) {
+        if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) {
+            if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) {
+                QString className = (*c)->name();
+                if ((*c)->parent() &&
+                    (*c)->parent()->type() == Node::Namespace &&
+                    !(*c)->parent()->name().isEmpty())
+                    className = (*c)->parent()->name()+"::"+className;
+
+                if (!(static_cast<const ClassNode *>(*c))->hideFromMainList()) {
+                    if ((*c)->status() == Node::Compat) {
+                        compatClasses.insert(className, *c);
+                    }
+                    else if ((*c)->status() == Node::Obsolete) {
+                        obsoleteClasses.insert(className, *c);
+                    }
+                    else {
+                        nonCompatClasses.insert(className, *c);
+                        if ((*c)->status() == Node::Main)
+                            mainClasses.insert(className, *c);
+                    }
+                }
+
+                QString moduleName = (*c)->moduleName();
+                if (moduleName == "Qt3SupportLight") {
+                    moduleClassMap[moduleName].insert((*c)->name(), *c);
+                    moduleName = "Qt3Support";
+                }
+                if (!moduleName.isEmpty())
+                    moduleClassMap[moduleName].insert((*c)->name(), *c);
+
+                QString serviceName =
+                    (static_cast<const ClassNode *>(*c))->serviceName();
+                if (!serviceName.isEmpty())
+                    serviceClasses.insert(serviceName, *c);
+            }
+            else if ((*c)->type() == Node::Fake &&
+                     (*c)->subType() == Node::QmlClass &&
+                     !(*c)->doc().isEmpty()) {
+                QString qmlClassName = (*c)->name();
+                qmlClasses.insert(qmlClassName,*c);
+            }
+            else if ((*c)->isInnerNode()) {
+                findAllClasses(static_cast<InnerNode *>(*c));
+            }
+        }
+        ++c;
+    }
+}
+
+/*!
+  For generating the "New Classes... in 4.6" section on the
+  What's New in 4.6" page.
+ */
+void DitaXmlGenerator::findAllSince(const InnerNode *node)
+{
+    NodeList::const_iterator child = node->childNodes().constBegin();
+    while (child != node->childNodes().constEnd()) {
+        QString sinceVersion = (*child)->since();
+        if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) {
+            NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion);
+            if (nsmap == newSinceMaps.end())
+                nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap());
+            NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion);
+            if (ncmap == newClassMaps.end())
+                ncmap = newClassMaps.insert(sinceVersion,NodeMap());
+            NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion);
+            if (nqcmap == newQmlClassMaps.end())
+                nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap());
+ 
+            if ((*child)->type() == Node::Function) {
+                FunctionNode *func = static_cast<FunctionNode *>(*child);
+                if ((func->status() > Node::Obsolete) &&
+                    (func->metaness() != FunctionNode::Ctor) &&
+                    (func->metaness() != FunctionNode::Dtor)) {
+                    nsmap.value().insert(func->name(),(*child));
+                }
+            }
+            else if ((*child)->url().isEmpty()) {
+                if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) {
+                    QString className = (*child)->name();
+                    if ((*child)->parent() &&
+                        (*child)->parent()->type() == Node::Namespace &&
+                        !(*child)->parent()->name().isEmpty())
+                        className = (*child)->parent()->name()+"::"+className;
+                    nsmap.value().insert(className,(*child));
+                    ncmap.value().insert(className,(*child));
+                }
+                else if ((*child)->subType() == Node::QmlClass) {
+                    QString className = (*child)->name();
+                    if ((*child)->parent() &&
+                        (*child)->parent()->type() == Node::Namespace &&
+                        !(*child)->parent()->name().isEmpty())
+                        className = (*child)->parent()->name()+"::"+className;
+                    nsmap.value().insert(className,(*child));
+                    nqcmap.value().insert(className,(*child));
+                }
+            }
+            else {
+                QString name = (*child)->name();
+                if ((*child)->parent() &&
+                    (*child)->parent()->type() == Node::Namespace &&
+                    !(*child)->parent()->name().isEmpty())
+                    name = (*child)->parent()->name()+"::"+name;
+                nsmap.value().insert(name,(*child));
+            }
+            if ((*child)->isInnerNode()) {
+                findAllSince(static_cast<InnerNode *>(*child));
+            }
+        }
+        ++child;
+    }
+}
+
+#if 0
+    const QRegExp versionSeparator("[\\-\\.]");
+    const int minorIndex = version.indexOf(versionSeparator);
+    const int patchIndex = version.indexOf(versionSeparator, minorIndex+1);
+    version = version.left(patchIndex);
+#endif
+
+void DitaXmlGenerator::findAllFunctions(const InnerNode *node)
+{
+    NodeList::ConstIterator c = node->childNodes().begin();
+    while (c != node->childNodes().end()) {
+        if ((*c)->access() != Node::Private) {
+            if ((*c)->isInnerNode() && (*c)->url().isEmpty()) {
+                findAllFunctions(static_cast<const InnerNode *>(*c));
+            }
+            else if ((*c)->type() == Node::Function) {
+                const FunctionNode *func = static_cast<const FunctionNode *>(*c);
+                if ((func->status() > Node::Obsolete) &&
+                    (func->metaness() != FunctionNode::Ctor) &&
+                    (func->metaness() != FunctionNode::Dtor)) {
+                    funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c);
+                }
+            }
+        }
+        ++c;
+    }
+}
+
+void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node)
+{
+    NodeList::ConstIterator c = node->childNodes().begin();
+    while (c != node->childNodes().end()) {
+        if ((*c)->access() != Node::Private) {
+            if (!(*c)->doc().legaleseText().isEmpty())
+                legaleseTexts.insertMulti((*c)->doc().legaleseText(), *c);
+            if ((*c)->isInnerNode())
+                findAllLegaleseTexts(static_cast<const InnerNode *>(*c));
+        }
+        ++c;
+    }
+}
+
+void DitaXmlGenerator::findAllNamespaces(const InnerNode *node)
+{
+    NodeList::ConstIterator c = node->childNodes().begin();
+    while (c != node->childNodes().end()) {
+        if ((*c)->access() != Node::Private) {
+            if ((*c)->isInnerNode() && (*c)->url().isEmpty()) {
+                findAllNamespaces(static_cast<const InnerNode *>(*c));
+                if ((*c)->type() == Node::Namespace) {
+                    const NamespaceNode *nspace = static_cast<const NamespaceNode *>(*c);
+                    // Ensure that the namespace's name is not empty (the root
+                    // namespace has no name).
+                    if (!nspace->name().isEmpty()) {
+                        namespaceIndex.insert(nspace->name(), *c);
+                        QString moduleName = (*c)->moduleName();
+                        if (moduleName == "Qt3SupportLight") {
+                            moduleNamespaceMap[moduleName].insert((*c)->name(), *c);
+                            moduleName = "Qt3Support";
+                        }
+                        if (!moduleName.isEmpty())
+                            moduleNamespaceMap[moduleName].insert((*c)->name(), *c);
+                    }
+                }
+            }
+        }
+        ++c;
+    }
+}
+
+int DitaXmlGenerator::hOffset(const Node *node)
+{
+    switch (node->type()) {
+    case Node::Namespace:
+    case Node::Class:
+        return 2;
+    case Node::Fake:
+        return 1;
+#if 0        
+        if (node->doc().briefText().isEmpty())
+            return 1;
+        else
+            return 2;
+#endif        
+    case Node::Enum:
+    case Node::Typedef:
+    case Node::Function:
+    case Node::Property:
+    default:
+        return 3;
+    }
+}
+
+bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom)
+{
+    while (atom != 0 && !(atom->type() == Atom::ListRight && atom->string() == ATOM_LIST_VALUE)) {
+        if (atom->type() == Atom::ListItemLeft && !matchAhead(atom, Atom::ListItemRight))
+            return true;
+        atom = atom->next();
+    }
+    return false;
+}
+
+const Node *DitaXmlGenerator::findNodeForTarget(const QString &target,
+                                             const Node *relative,
+                                             CodeMarker *marker,
+                                             const Atom *atom)
+{
+    const Node *node = 0;
+
+    if (target.isEmpty()) {
+        node = relative;
+    }
+    else if (target.endsWith(".html")) {
+        node = myTree->root()->findNode(target, Node::Fake);
+    }
+    else if (marker) {
+        node = marker->resolveTarget(target, myTree, relative);
+        if (!node)
+            node = myTree->findFakeNodeByTitle(target);
+        if (!node && atom) {
+            node = myTree->findUnambiguousTarget(target,
+                *const_cast<Atom**>(&atom));
+        }
+    }
+
+    if (!node)
+        relative->doc().location().warning(tr("Cannot link to '%1'").arg(target));
+
+    return node;
+}
+
+const QPair<QString,QString> DitaXmlGenerator::anchorForNode(const Node *node)
+{
+    QPair<QString,QString> anchorPair;
+
+    anchorPair.first = PageGenerator::fileName(node);
+    if (node->type() == Node::Fake) {
+        const FakeNode *fakeNode = static_cast<const FakeNode*>(node);
+        anchorPair.second = fakeNode->title();
+    }
+
+    return anchorPair;
+}
+
+QString DitaXmlGenerator::getLink(const Atom *atom,
+                               const Node *relative,
+                               CodeMarker *marker,
+                               const Node** node)
+{
+    QString link;
+    *node = 0;
+    inObsoleteLink = false;
+
+    if (atom->string().contains(":") &&
+            (atom->string().startsWith("file:")
+             || atom->string().startsWith("http:")
+             || atom->string().startsWith("https:")
+             || atom->string().startsWith("ftp:")
+             || atom->string().startsWith("mailto:"))) {
+
+        link = atom->string();
+    }
+    else {
+        QStringList path;
+        if (atom->string().contains('#')) {
+            path = atom->string().split('#');
+        }
+        else {
+            path.append(atom->string());
+        }
+
+        Atom *targetAtom = 0;
+
+        QString first = path.first().trimmed();
+        if (first.isEmpty()) {
+            *node = relative;
+        }
+        else if (first.endsWith(".html")) {
+            *node = myTree->root()->findNode(first, Node::Fake);
+        }
+        else {
+            *node = marker->resolveTarget(first, myTree, relative);
+            if (!*node) {
+                *node = myTree->findFakeNodeByTitle(first);
+            }
+            if (!*node) {
+                *node = myTree->findUnambiguousTarget(first, targetAtom);
+            }
+        }
+
+        if (*node) {
+            if (!(*node)->url().isEmpty())
+                return (*node)->url();
+            else
+                path.removeFirst();
+        }
+        else {
+            *node = relative;
+        }
+
+        if (*node) {
+            if ((*node)->status() == Node::Obsolete) {
+                if (relative) {
+                    if (relative->parent() != *node) {
+                        if (relative->status() != Node::Obsolete) {
+                            bool porting = false;
+                            if (relative->type() == Node::Fake) {
+                                const FakeNode* fake = static_cast<const FakeNode*>(relative);
+                                if (fake->title().startsWith("Porting"))
+                                    porting = true;
+                            }
+                            QString name = marker->plainFullName(relative);
+                            if (!porting && !name.startsWith("Q3")) {
+                                if (obsoleteLinks) {
+                                    relative->doc().location().warning(tr("Link to obsolete item '%1' in %2")
+                                                                       .arg(atom->string())
+                                                                       .arg(name));
+                                }
+                                inObsoleteLink = true;
+                            }
+                        }
+                    }
+                }
+                else {
+                    qDebug() << "Link to Obsolete entity"
+                             << (*node)->name() << "no relative";
+                }
+            }
+#if 0                    
+            else if ((*node)->status() == Node::Deprecated) {
+                qDebug() << "Link to Deprecated entity";
+            }
+            else if ((*node)->status() == Node::Internal) {
+                qDebug() << "Link to Internal entity";
+            }
+#endif                
+        }
+
+        while (!path.isEmpty()) {
+            targetAtom = myTree->findTarget(path.first(), *node);
+            if (targetAtom == 0)
+                break;
+            path.removeFirst();
+        }
+
+        if (path.isEmpty()) {
+            link = linkForNode(*node, relative);
+            if (*node && (*node)->subType() == Node::Image)
+                link = "images/used-in-examples/" + link;
+            if (targetAtom)
+                link += "#" + refForAtom(targetAtom, *node);
+        }
+    }
+    return link;
+}
+
+void DitaXmlGenerator::generateIndex(const QString &fileBase,
+                                  const QString &url,
+                                  const QString &title)
+{
+    myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title);
+}
+
+void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker)
+{
+    Text text;
+
+    switch (node->status()) {
+    case Node::Obsolete:
+        if (node->isInnerNode())
+	    Generator::generateStatus(node, marker);
+        break;
+    case Node::Compat:
+        if (node->isInnerNode()) {
+            text << Atom::ParaLeft
+                 << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
+                 << "This "
+                 << typeString(node)
+                 << " is part of the Qt 3 support library."
+                 << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
+                 << " It is provided to keep old source code working. "
+                 << "We strongly advise against "
+                 << "using it in new code. See ";
+
+            const FakeNode *fakeNode = myTree->findFakeNodeByTitle("Porting To Qt 4");
+            Atom *targetAtom = 0;
+            if (fakeNode && node->type() == Node::Class) {
+                QString oldName(node->name());
+                targetAtom = myTree->findTarget(oldName.replace("3", ""),
+                                                fakeNode);
+            }
+
+            if (targetAtom) {
+                text << Atom(Atom::Link, linkForNode(fakeNode, node) + "#" +
+                                         refForAtom(targetAtom, fakeNode));
+            }
+            else
+                text << Atom(Atom::Link, "Porting to Qt 4");
+
+            text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+                 << Atom(Atom::String, "Porting to Qt 4")
+                 << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
+                 << " for more information."
+                 << Atom::ParaRight;
+        }
+        generateText(text, node, marker);
+        break;
+    default:
+        Generator::generateStatus(node, marker);
+    }
+}
+
+#ifdef GENERATE_MAC_REFS    
+/*
+  No longer valid.
+ */
+void DitaXmlGenerator::generateMacRef(const Node *node, CodeMarker *marker)
+{
+    if (!pleaseGenerateMacRef || marker == 0)
+        return;
+
+    QStringList macRefs = marker->macRefsForNode(node);
+    foreach (const QString &macRef, macRefs)
+        out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n";
+}
+#endif
+
+void DitaXmlGenerator::beginLink(const QString &link,
+                              const Node *node,
+                              const Node *relative,
+                              CodeMarker *marker)
+{
+    Q_UNUSED(marker)
+    Q_UNUSED(relative)
+
+    this->link = link;
+    if (link.isEmpty()) {
+        if (showBrokenLinks)
+            writer.writeStartElement("i");
+    }
+    else if (node == 0 || (relative != 0 &&
+                           node->status() == relative->status())) {
+        writer.writeStartElement("xref");
+        writer.writeAttribute("href",link);
+    }
+    else {
+        switch (node->status()) {
+        case Node::Obsolete:
+            writer.writeStartElement("xref");
+            writer.writeAttribute("href",link);
+            writer.writeAttribute("outputclass","obsolete");
+            break;
+        case Node::Compat:
+            writer.writeStartElement("xref");
+            writer.writeAttribute("href",link);
+            writer.writeAttribute("outputclass","compat");
+            break;
+        default:
+            writer.writeStartElement("xref");
+            writer.writeAttribute("href",link);
+        }
+    }
+    inLink = true;
+}
+
+void DitaXmlGenerator::endLink()
+{
+    if (inLink) {
+        if (link.isEmpty()) {
+            if (showBrokenLinks)
+                writer.writeEndElement(); // i
+        }
+        else {
+            if (inObsoleteLink) {
+                writer.writeStartElement("sup");
+                writer.writeCharacters("(obsolete)");
+                writer.writeEndElement(); // sup
+            }
+            writer.writeEndElement(); // xref
+        }
+    }
+    inLink = false;
+    inObsoleteLink = false;
+}
+
+#ifdef QDOC_QML
+
+/*!
+  Generates the summary for the \a section. Only used for
+  sections of QML element documentation.
+
+  Currently handles only the QML property group.
+ */
+void DitaXmlGenerator::generateQmlSummary(const Section& section,
+                                       const Node *relative,
+                                       CodeMarker *marker)
+{
+    if (!section.members.isEmpty()) {
+        NodeList::ConstIterator m;
+        int count = section.members.size();
+        bool twoColumn = false;
+        if (section.members.first()->type() == Node::QmlProperty) {
+            twoColumn = (count >= 5);
+        }
+        if (twoColumn)
+            out() << "<table class=\"qmlsummary\">\n";
+			        if (++numTableRows % 2 == 1)
+				out() << "<tr class=\"odd topAlign\">";
+				else
+				out() << "<tr class=\"even topAlign\">";
+            //      << "<tr><td class=\"topAlign\">";
+        out() << "<ul>\n";
+
+        int row = 0;
+        m = section.members.begin();
+        while (m != section.members.end()) {
+            if (twoColumn && row == (int) (count + 1) / 2)
+                out() << "</ul></td><td class=\"topAlign\"><ul>\n";
+            out() << "<li class=\"fn\">";
+            generateQmlItem(*m,relative,marker,true);
+            out() << "</li>\n";
+            row++;
+            ++m;
+        }
+        out() << "</ul>\n";
+        if (twoColumn)
+            out() << "</td></tr>\n</table>\n";
+    }
+}
+
+/*!
+  Outputs the html detailed documentation for a section
+  on a QML element reference page.
+ */
+void DitaXmlGenerator::generateDetailedQmlMember(const Node *node,
+                                              const InnerNode *relative,
+                                              CodeMarker *marker)
+{
+    const QmlPropertyNode* qpn = 0;
+#ifdef GENERATE_MAC_REFS    
+    generateMacRef(node, marker);
+#endif    
+    out() << "<div class=\"qmlitem\">";
+    if (node->subType() == Node::QmlPropertyGroup) {
+        const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node);
+        NodeList::ConstIterator p = qpgn->childNodes().begin();
+        out() << "<div class=\"qmlproto\">";
+        out() << "<table class=\"qmlname\">";
+
+        while (p != qpgn->childNodes().end()) {
+            if ((*p)->type() == Node::QmlProperty) {
+                qpn = static_cast<const QmlPropertyNode*>(*p);
+                
+				if (++numTableRows % 2 == 1)
+					out() << "<tr class=\"odd\">";
+				else
+					out() << "<tr class=\"even\">";
+				
+				out() << "<td><p>";
+                //out() << "<tr><td>"; // old
+                out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
+                if (!qpn->isWritable(myTree))
+                    out() << "<span class=\"qmlreadonly\">read-only</span>";
+                if (qpgn->isDefault())
+                    out() << "<span class=\"qmldefault\">default</span>";
+                generateQmlItem(qpn, relative, marker, false);
+                out() << "</td></tr>";
+            }
+            ++p;
+        }
+        out() << "</table>";
+        out() << "</div>";
+    }
+    else if (node->type() == Node::QmlSignal) {
+        const FunctionNode* qsn = static_cast<const FunctionNode*>(node);
+        out() << "<div class=\"qmlproto\">";
+        out() << "<table class=\"qmlname\">";
+        //out() << "<tr>";
+		if (++numTableRows % 2 == 1)
+			out() << "<tr class=\"odd\">";
+		else
+			out() << "<tr class=\"even\">";
+        out() << "<td><p>";
+        out() << "<a name=\"" + refForNode(qsn) + "\"></a>";
+        generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false);
+        //generateQmlItem(qsn,relative,marker,false);
+        out() << "</p></td></tr>";
+        out() << "</table>";
+        out() << "</div>";
+    }
+    else if (node->type() == Node::QmlMethod) {
+        const FunctionNode* qmn = static_cast<const FunctionNode*>(node);
+        out() << "<div class=\"qmlproto\">";
+        out() << "<table class=\"qmlname\">";
+        //out() << "<tr>";
+		if (++numTableRows % 2 == 1)
+			out() << "<tr class=\"odd\">";
+		else
+			out() << "<tr class=\"even\">";
+        out() << "<td><p>";
+        out() << "<a name=\"" + refForNode(qmn) + "\"></a>";
+        generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false);
+        out() << "</p></td></tr>";
+        out() << "</table>";
+        out() << "</div>";
+    }
+    out() << "<div class=\"qmldoc\">";
+    generateStatus(node, marker);
+    generateBody(node, marker);
+    generateThreadSafeness(node, marker);
+    generateSince(node, marker);
+    generateAlsoList(node, marker);
+    out() << "</div>";
+    out() << "</div>";
+}
+
+/*!
+  Output the "Inherits" line for the QML element,
+  if there should be one.
+ */
+void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn,
+                                        CodeMarker* marker)
+{
+    if (cn && !cn->links().empty()) {
+        if (cn->links().contains(Node::InheritsLink)) {
+            QPair<QString,QString> linkPair;
+            linkPair = cn->links()[Node::InheritsLink];
+            QStringList strList(linkPair.first);
+            const Node* n = myTree->findNode(strList,Node::Fake);
+            if (n && n->subType() == Node::QmlClass) {
+                const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
+                out() << "<p class=\"centerAlign\">";
+                Text text;
+                text << "[Inherits ";
+                text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+                text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+                text << Atom(Atom::String, linkPair.second);
+                text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+                text << "]";
+                generateText(text, cn, marker);
+                out() << "</p>";
+            }
+        }
+    }
+}
+
+/*!
+  Output the "Inherit by" list for the QML element,
+  if it is inherited by any other elements.
+ */
+void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn,
+                                           CodeMarker* marker)
+{
+    if (cn) {
+        NodeList subs;
+        QmlClassNode::subclasses(cn->name(),subs);
+        if (!subs.isEmpty()) {
+            Text text;
+            text << Atom::ParaLeft << "Inherited by ";
+            appendSortedQmlNames(text,cn,subs,marker);
+            text << Atom::ParaRight;
+            generateText(text, cn, marker);
+        }
+    }
+}
+
+/*!
+  Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]"
+  line for the QML element, if there should be one.
+
+  If there is no class node, or if the class node status
+  is set to Node::Internal, do nothing. 
+ */
+void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn,
+                                            CodeMarker* marker)
+{
+    const ClassNode* cn = qcn->classNode();
+    if (cn && (cn->status() != Node::Internal)) {
+        out() << "<p class=\"centerAlign\">";
+        Text text;
+        text << "[";
+        text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+        text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+        text << Atom(Atom::String, qcn->name());
+        text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+        text << " instantiates the C++ class ";
+        text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+        text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+        text << Atom(Atom::String, cn->name());
+        text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+        text << "]";
+        generateText(text, qcn, marker);
+        out() << "</p>";
+    }
+}
+
+/*!
+  Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]"
+  line for the class, if there should be one.
+
+  If there is no QML element, or if the class node status
+  is set to Node::Internal, do nothing. 
+ */
+void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn,
+                                           CodeMarker* marker)
+{
+    if (cn &&  cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) {
+        const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake);
+        if (n && n->subType() == Node::QmlClass) {
+            out() << "<p class=\"centerAlign\">";
+            Text text;
+            text << "[";
+            text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+            text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+            text << Atom(Atom::String, cn->name());
+            text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+            text << " is instantiated by QML element ";
+            text << Atom(Atom::LinkNode,CodeMarker::stringForNode(n));
+            text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+            text << Atom(Atom::String, n->name());
+            text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+            text << "]";
+            generateText(text, cn, marker);
+            out() << "</p>";
+        }
+    }
+}
+
+/*!
+  Generate the <page> element for the given \a node using the \a writer.
+  Return true if a <page> element was written; otherwise return false.
+ */
+bool DitaXmlGenerator::generatePageElement(QXmlStreamWriter& writer,
+                                        const Node* node,
+                                        CodeMarker* marker) const
+{
+    if (node->pageType() == Node::NoPageType)
+        return false;
+    if (node->name().isEmpty())
+        return true;
+    if (node->access() == Node::Private)
+        return false;
+    if (!node->isInnerNode())
+        return false;
+
+    QString title;
+    QString rawTitle;
+    QString fullTitle;
+    const InnerNode* inner = static_cast<const InnerNode*>(node);
+        
+    writer.writeStartElement("page");
+    QXmlStreamAttributes attributes;
+    QString t;
+    t.setNum(id++);
+    switch (node->type()) {
+    case Node::Fake:
+        {
+            const FakeNode* fake = static_cast<const FakeNode*>(node);
+            title = fake->fullTitle();
+            break;
+        }
+    case Node::Class:
+        {
+            title = node->name() + " Class Reference";
+            break;
+        }
+    case Node::Namespace:
+        {
+            rawTitle = marker->plainName(inner);
+            fullTitle = marker->plainFullName(inner);
+            title = rawTitle + " Namespace Reference";
+            break;
+        }
+    default:
+        title = node->name();
+        break;
+    }
+    writer.writeAttribute("id",t);
+    writer.writeStartElement("pageWords");
+    writer.writeCharacters(title);
+    if (!inner->pageKeywords().isEmpty()) {
+        const QStringList& w = inner->pageKeywords();
+        for (int i = 0; i < w.size(); ++i) {
+            writer.writeCharacters(" ");
+            writer.writeCharacters(w.at(i).toLocal8Bit().constData());
+        }
+    }
+    writer.writeEndElement();
+    writer.writeStartElement("pageTitle");
+    writer.writeCharacters(title);
+    writer.writeEndElement();
+    writer.writeStartElement("pageUrl");
+    writer.writeCharacters(PageGenerator::fileName(node));
+    writer.writeEndElement();
+    writer.writeStartElement("pageType");
+    switch (node->pageType()) {
+    case Node::ApiPage:
+        writer.writeCharacters("APIPage");
+        break;
+    case Node::ArticlePage:
+        writer.writeCharacters("Article");
+        break;
+    case Node::ExamplePage:
+        writer.writeCharacters("Example");
+        break;
+    default:
+        break;
+    }
+    writer.writeEndElement();
+    writer.writeEndElement();
+    return true;
+}
+
+/*!
+  Traverse the tree recursively and generate the <keyword>
+  elements.
+ */
+void DitaXmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const
+{
+    if (generatePageElement(writer, node, marker)) {
+
+        if (node->isInnerNode()) {
+            const InnerNode *inner = static_cast<const InnerNode *>(node);
+
+            // Recurse to write an element for this child node and all its children.
+            foreach (const Node *child, inner->childNodes())
+                generatePageElements(writer, child, marker);
+        }
+    }
+}
+
+/*!
+  Outputs the file containing the index used for searching the html docs.
+ */
+void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const
+{
+    QFile file(fileName);
+    if (!file.open(QFile::WriteOnly | QFile::Text))
+        return ;
+
+    QXmlStreamWriter writer(&file);
+    writer.setAutoFormatting(true);
+    writer.writeStartDocument();
+    writer.writeStartElement("qtPageIndex");
+
+    generatePageElements(writer, myTree->root(), marker);
+
+    writer.writeEndElement(); // qtPageIndex
+    writer.writeEndDocument();
+    file.close();
+}
+
+#endif
+
+/*!
+  Return the full qualification of the node \a n, but without
+  the name of \a n itself. e.g. A::B::C
+ */
+QString DitaXmlGenerator::fullQualification(const Node* n)
+{
+    QString fq;
+    InnerNode* in = n->parent();
+    while (in) {
+        if ((in->type() == Node::Class) ||
+            (in->type() == Node::Namespace)) {
+            if (in->name().isEmpty())
+                break;
+            if (fq.isEmpty())
+                fq = in->name();
+            else
+                fq = in->name() + "::" + fq;
+        }
+        else
+            break;
+        in = in->parent();
+    }
+    return fq;
+}
+
+void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker)
+{
+    QList<RelatedClass>::ConstIterator r;
+    int index;
+
+    if (!cn->baseClasses().isEmpty()) {
+        writer.writeStartElement(CXXCLASSDERIVATIONS);
+        r = cn->baseClasses().begin();
+        index = 0;
+        while (r != cn->baseClasses().end()) {
+            writer.writeStartElement(CXXCLASSDERIVATION);
+            writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER);
+            writer.writeAttribute("value",(*r).accessString());
+            writer.writeEndElement(); // </cxxClassDerivationAccessSpecifier>
+            writer.writeStartElement(CXXCLASSBASECLASS);
+            writer.writeAttribute("href",(*r).node->ditaXmlHref());
+            writer.writeCharacters(marker->plainFullName((*r).node));
+            writer.writeEndElement(); // </cxxClassBaseClass>
+            writer.writeEndElement(); // </cxxClassDerivation>
+             ++r;
+        }
+        writer.writeEndElement(); // </cxxClassDerivations>
+     }
+}
+
+void DitaXmlGenerator::writeLocation(const Node* n)
+{
+    QString s1, s2, s3;
+    if (n->type() == Node::Class) {
+        s1 = CXXCLASSAPIITEMLOCATION;
+        s2 = CXXCLASSDECLARATIONFILE;
+        s3 = CXXCLASSDECLARATIONFILELINE;
+    }
+    else if (n->type() == Node::Function) {
+        s1 = CXXFUNCTIONAPIITEMLOCATION;
+        s2 = CXXFUNCTIONDECLARATIONFILE;
+        s3 = CXXFUNCTIONDECLARATIONFILELINE;
+    }
+    else if (n->type() == Node::Enum) {
+        s1 = CXXENUMERATIONAPIITEMLOCATION;
+        s2 = CXXENUMERATIONDECLARATIONFILE;
+        s3 = CXXENUMERATIONDECLARATIONFILELINE;
+    }
+    else if (n->type() == Node::Typedef) {
+        s1 = CXXTYPEDEFAPIITEMLOCATION;
+        s2 = CXXTYPEDEFDECLARATIONFILE;
+        s3 = CXXTYPEDEFDECLARATIONFILELINE;
+    }
+    else if ((n->type() == Node::Property) ||
+             (n->type() == Node::Variable)) {
+        s1 = CXXVARIABLEAPIITEMLOCATION;
+        s2 = CXXVARIABLEDECLARATIONFILE;
+        s3 = CXXVARIABLEDECLARATIONFILELINE;
+    }
+    writer.writeStartElement(s1);
+    writer.writeStartElement(s2);
+    writer.writeAttribute("name","filePath");
+    writer.writeAttribute("value",n->location().filePath());
+    writer.writeEndElement(); // </cxx<s2>DeclarationFile>
+    writer.writeStartElement(s3);
+    writer.writeAttribute("name","lineNumber");
+    QString lineNr;
+    writer.writeAttribute("value",lineNr.setNum(n->location().lineNo()));
+    writer.writeEndElement(); // </cxx<s3>DeclarationFileLine>
+    writer.writeEndElement(); // </cxx<s1>ApiItemLocation>
+}
+
+void DitaXmlGenerator::writeFunctions(const Section& s, 
+                                      const ClassNode* cn, 
+                                      CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Function) {
+            FunctionNode* fn = const_cast<FunctionNode*>(static_cast<const FunctionNode*>(*m));
+            writer.writeStartElement(CXXFUNCTION);
+            writer.writeAttribute("id",fn->guid());
+            writer.writeStartElement(APINAME);
+            writer.writeCharacters(fn->name());
+            writer.writeEndElement(); // </apiName>
+            generateBrief(fn,marker);
+            writer.writeStartElement(CXXFUNCTIONDETAIL);
+            writer.writeStartElement(CXXFUNCTIONDEFINITION);
+            writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER);
+            writer.writeAttribute("value",fn->accessString());
+            writer.writeEndElement(); // <cxxFunctionAccessSpecifier>
+
+            if (fn->isStatic()) {
+                writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC);
+                writer.writeAttribute("name","static");
+                writer.writeAttribute("value","static");
+                writer.writeEndElement(); // <cxxFunctionStorageClassSpecifierStatic>
+            }
+            
+            if (fn->isConst()) {
+                writer.writeStartElement(CXXFUNCTIONCONST);
+                writer.writeAttribute("name","const");
+                writer.writeAttribute("value","const");
+                writer.writeEndElement(); // <cxxFunctionConst>
+            }
+
+            if (fn->virtualness() != FunctionNode::NonVirtual) {
+                writer.writeStartElement(CXXFUNCTIONVIRTUAL);
+                writer.writeAttribute("name","virtual");
+                writer.writeAttribute("value","virtual");
+                writer.writeEndElement(); // <cxxFunctionVirtual>
+                if (fn->virtualness() == FunctionNode::PureVirtual) {
+                    writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL);
+                    writer.writeAttribute("name","pure virtual");
+                    writer.writeAttribute("value","pure virtual");
+                    writer.writeEndElement(); // <cxxFunctionPureVirtual>
+                }
+            }
+            
+            if (fn->name() == cn->name()) {
+                writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR);
+                writer.writeAttribute("name","constructor");
+                writer.writeAttribute("value","constructor");
+                writer.writeEndElement(); // <cxxFunctionConstructor>
+            }
+            else if (fn->name()[0] == QChar('~')) {
+                writer.writeStartElement(CXXFUNCTIONDESTRUCTOR);
+                writer.writeAttribute("name","destructor");
+                writer.writeAttribute("value","destructor");
+                writer.writeEndElement(); // <cxxFunctionDestructor>
+            }
+            else {
+                writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE);
+                writer.writeCharacters(fn->returnType());
+                writer.writeEndElement(); // <cxxFunctionDeclaredType>
+            }
+            QString fq = fullQualification(fn);
+            if (!fq.isEmpty()) {
+                writer.writeStartElement(CXXFUNCTIONSCOPEDNAME);
+                writer.writeCharacters(fq);
+                writer.writeEndElement(); // <cxxFunctionScopedName>
+            }
+            writer.writeStartElement(CXXFUNCTIONPROTOTYPE);
+            writer.writeCharacters(fn->signature(true));
+            writer.writeEndElement(); // <cxxFunctionPrototype>
+
+            QString fnl = fn->signature(false);
+            int idx = fnl.indexOf(' ');
+            if (idx < 0)
+                idx = 0;
+            else
+                ++idx;
+            fnl = fn->parent()->name() + "::" + fnl.mid(idx);
+            writer.writeStartElement(CXXFUNCTIONNAMELOOKUP);
+            writer.writeCharacters(fnl);
+            writer.writeEndElement(); // <cxxFunctionNameLookup>
+
+            if (fn->isReimp() && fn->reimplementedFrom() != 0) {
+                FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom();
+                writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED);
+                writer.writeAttribute("href",rfn->ditaXmlHref());
+                writer.writeCharacters(marker->plainFullName(rfn));
+                writer.writeEndElement(); // </cxxFunctionReimplemented>
+            }
+            writeParameters(fn,marker);
+            writeLocation(fn);
+            writer.writeEndElement(); // <cxxFunctionDefinition>
+            writer.writeStartElement(APIDESC);
+
+            if (!fn->doc().isEmpty()) {
+                generateBody(fn, marker);
+                //        generateAlsoList(inner, marker);
+            }
+
+            writer.writeEndElement(); // </apiDesc>
+            writer.writeEndElement(); // </cxxFunctionDetail>
+            writer.writeEndElement(); // </cxxFunction>
+
+            if (fn->metaness() == FunctionNode::Ctor ||
+                fn->metaness() == FunctionNode::Dtor ||
+                fn->overloadNumber() != 1) {
+            }
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker)
+{
+    const QList<Parameter>& parameters = fn->parameters();
+    if (!parameters.isEmpty()) {
+        writer.writeStartElement(CXXFUNCTIONPARAMETERS);
+        QList<Parameter>::ConstIterator p = parameters.begin();
+        while (p != parameters.end()) {
+            writer.writeStartElement(CXXFUNCTIONPARAMETER);
+            writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE);
+            writer.writeCharacters((*p).leftType());
+            if (!(*p).rightType().isEmpty())
+                writer.writeCharacters((*p).rightType());
+            writer.writeEndElement(); // <cxxFunctionParameterDeclaredType>
+            writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME);
+            writer.writeCharacters((*p).name());
+            writer.writeEndElement(); // <cxxFunctionParameterDeclarationName>
+            if (!(*p).defaultValue().isEmpty()) {
+                writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE);
+                writer.writeCharacters((*p).defaultValue());
+                writer.writeEndElement(); // <cxxFunctionParameterDefaultValue>
+            }
+            writer.writeEndElement(); // <cxxFunctionParameter>
+            ++p;
+        }
+        writer.writeEndElement(); // <cxxFunctionParameters>
+    }
+}
+
+void DitaXmlGenerator::writeEnumerations(const Section& s, 
+                                         const ClassNode* cn, 
+                                         CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Enum) {
+            const EnumNode* en = static_cast<const EnumNode*>(*m);
+            writer.writeStartElement(CXXENUMERATION);
+            writer.writeAttribute("id",en->guid());
+            writer.writeStartElement(APINAME);
+            writer.writeCharacters(en->name());
+            writer.writeEndElement(); // </apiName>
+            generateBrief(en,marker);
+            writer.writeStartElement(CXXENUMERATIONDETAIL);
+            writer.writeStartElement(CXXENUMERATIONDEFINITION);
+            writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER);
+            writer.writeAttribute("value",en->accessString());
+            writer.writeEndElement(); // <cxxEnumerationAccessSpecifier>
+
+            QString fq = fullQualification(en);
+            if (!fq.isEmpty()) {
+                writer.writeStartElement(CXXENUMERATIONSCOPEDNAME);
+                writer.writeCharacters(fq);
+                writer.writeEndElement(); // <cxxEnumerationScopedName>
+            }
+            const QList<EnumItem>& items = en->items();
+            if (!items.isEmpty()) {
+                writer.writeStartElement(CXXENUMERATIONPROTOTYPE);
+                writer.writeCharacters(en->name());
+                writer.writeCharacters(" = { ");
+                QList<EnumItem>::ConstIterator i = items.begin();
+                while (i != items.end()) {
+                    writer.writeCharacters((*i).name());
+                    if (!(*i).value().isEmpty()) {
+                        writer.writeCharacters(" = ");
+                        writer.writeCharacters((*i).value());
+                    }
+                    ++i;
+                    if (i != items.end())
+                        writer.writeCharacters(", ");
+                }
+                writer.writeCharacters(" }");
+                writer.writeEndElement(); // <cxxEnumerationPrototype>
+            }
+
+            writer.writeStartElement(CXXENUMERATIONNAMELOOKUP);
+            writer.writeCharacters(en->parent()->name() + "::" + en->name());
+            writer.writeEndElement(); // <cxxEnumerationNameLookup>
+
+            if (!items.isEmpty()) {
+                writer.writeStartElement(CXXENUMERATORS);
+                QList<EnumItem>::ConstIterator i = items.begin();
+                while (i != items.end()) {
+                    writer.writeStartElement(CXXENUMERATOR);
+                    writer.writeStartElement(APINAME);
+                    writer.writeCharacters((*i).name());
+                    writer.writeEndElement(); // </apiName>
+
+                    QString fq = fullQualification(en->parent());
+                    if (!fq.isEmpty()) {
+                        writer.writeStartElement(CXXENUMERATORSCOPEDNAME);
+                        writer.writeCharacters(fq + "::" + (*i).name());
+                        writer.writeEndElement(); // <cxxEnumeratorScopedName>
+                    }
+                    writer.writeStartElement(CXXENUMERATORPROTOTYPE);
+                    writer.writeCharacters((*i).name());
+                    writer.writeEndElement(); // <cxxEnumeratorPrototype>
+                    writer.writeStartElement(CXXENUMERATORNAMELOOKUP);
+                    writer.writeCharacters(en->parent()->name() + "::" + (*i).name());
+                    writer.writeEndElement(); // <cxxEnumeratorNameLookup>
+
+                    if (!(*i).value().isEmpty()) {
+                        writer.writeStartElement(CXXENUMERATORINITIALISER);
+                        writer.writeAttribute("value", (*i).value());
+                        writer.writeEndElement(); // <cxxEnumeratorInitialiser>
+                    }
+                    if (!(*i).text().isEmpty()) {
+                        writer.writeStartElement(APIDESC);
+                        generateText((*i).text(), en, marker);
+                        writer.writeEndElement(); // </apiDesc>
+                    }
+                    writer.writeEndElement(); // <cxxEnumerator>
+                    ++i;
+                }
+                writer.writeEndElement(); // <cxxEnumerators>
+            }
+            
+            writeLocation(en);
+            writer.writeEndElement(); // <cxxEnumerationDefinition>
+            writer.writeStartElement(APIDESC);
+
+            if (!en->doc().isEmpty()) {
+                generateBody(en, marker);
+            }
+
+            writer.writeEndElement(); // </apiDesc>
+            writer.writeEndElement(); // </cxxEnumerationDetail>
+            writer.writeEndElement(); // </cxxEnumeration>
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writeTypedefs(const Section& s, 
+                                     const ClassNode* cn, 
+                                     CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Typedef) {
+            const TypedefNode* tn = static_cast<const TypedefNode*>(*m);
+            writer.writeStartElement(CXXTYPEDEF);
+            writer.writeAttribute("id",tn->guid());
+            writer.writeStartElement(APINAME);
+            writer.writeCharacters(tn->name());
+            writer.writeEndElement(); // </apiName>
+            generateBrief(tn,marker);
+            writer.writeStartElement(CXXTYPEDEFDETAIL);
+            writer.writeStartElement(CXXTYPEDEFDEFINITION);
+            writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER);
+            writer.writeAttribute("value",tn->accessString());
+            writer.writeEndElement(); // <cxxTypedefAccessSpecifier>
+
+            QString fq = fullQualification(tn);
+            if (!fq.isEmpty()) {
+                writer.writeStartElement(CXXTYPEDEFSCOPEDNAME);
+                writer.writeCharacters(fq);
+                writer.writeEndElement(); // <cxxTypedefScopedName>
+            }
+            writer.writeStartElement(CXXTYPEDEFNAMELOOKUP);
+            writer.writeCharacters(tn->parent()->name() + "::" + tn->name());
+            writer.writeEndElement(); // <cxxTypedefNameLookup>
+            
+            writeLocation(tn);
+            writer.writeEndElement(); // <cxxTypedefDefinition>
+            writer.writeStartElement(APIDESC);
+
+            if (!tn->doc().isEmpty()) {
+                generateBody(tn, marker);
+            }
+
+            writer.writeEndElement(); // </apiDesc>
+            writer.writeEndElement(); // </cxxTypedefDetail>
+            writer.writeEndElement(); // </cxxTypedef>
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writeProperties(const Section& s, 
+                                       const ClassNode* cn, 
+                                       CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Property) {
+            const PropertyNode* pn = static_cast<const PropertyNode*>(*m);
+            writer.writeStartElement(CXXVARIABLE);
+            writer.writeAttribute("id",pn->guid());
+            writer.writeStartElement(APINAME);
+            writer.writeCharacters(pn->name());
+            writer.writeEndElement(); // </apiName>
+            generateBrief(pn,marker);
+            writer.writeStartElement(CXXVARIABLEDETAIL);
+            writer.writeStartElement(CXXVARIABLEDEFINITION);
+            writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER);
+            writer.writeAttribute("value",pn->accessString());
+            writer.writeEndElement(); // <cxxVariableAccessSpecifier>
+
+            if (!pn->qualifiedDataType().isEmpty()) {
+                writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
+                writer.writeCharacters(pn->qualifiedDataType());
+                writer.writeEndElement(); // <cxxVariableDeclaredType>
+            }
+            QString fq = fullQualification(pn);
+            if (!fq.isEmpty()) {
+                writer.writeStartElement(CXXVARIABLESCOPEDNAME);
+                writer.writeCharacters(fq);
+                writer.writeEndElement(); // <cxxVariableScopedName>
+            }
+            
+            writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+            writer.writeCharacters("Q_PROPERTY(");
+            writer.writeCharacters(pn->qualifiedDataType());
+            writer.writeCharacters(" ");
+            writer.writeCharacters(pn->name());
+            writePropParams("READ",pn->getters());
+            writePropParams("WRITE",pn->setters());
+            writePropParams("RESET",pn->resetters());
+            writePropParams("NOTIFY",pn->notifiers());
+            if (pn->isDesignable() != pn->designableDefault()) {
+                writer.writeCharacters(" DESIGNABLE ");
+                if (!pn->runtimeDesignabilityFunction().isEmpty())
+                    writer.writeCharacters(pn->runtimeDesignabilityFunction());
+                else
+                    writer.writeCharacters(pn->isDesignable() ? "true" : "false");
+            }
+            if (pn->isScriptable() != pn->scriptableDefault()) {
+                writer.writeCharacters(" SCRIPTABLE ");
+                if (!pn->runtimeScriptabilityFunction().isEmpty())
+                    writer.writeCharacters(pn->runtimeScriptabilityFunction());
+                else
+                    writer.writeCharacters(pn->isScriptable() ? "true" : "false");
+            }
+            if (pn->isWritable() != pn->writableDefault()) {
+                writer.writeCharacters(" STORED ");
+                writer.writeCharacters(pn->isStored() ? "true" : "false");
+            }
+            if (pn->isUser() != pn->userDefault()) {
+                writer.writeCharacters(" USER ");
+                writer.writeCharacters(pn->isUser() ? "true" : "false");
+            }
+            if (pn->isConstant())
+                writer.writeCharacters(" CONSTANT");
+            if (pn->isFinal())
+                writer.writeCharacters(" FINAL");
+            writer.writeCharacters(")");
+            writer.writeEndElement(); // <cxxVariablePrototype>
+
+            writer.writeStartElement(CXXVARIABLENAMELOOKUP);
+            writer.writeCharacters(pn->parent()->name() + "::" + pn->name());
+            writer.writeEndElement(); // <cxxVariableNameLookup>
+
+            if (pn->overriddenFrom() != 0) {
+                PropertyNode* opn = (PropertyNode*)pn->overriddenFrom();
+                writer.writeStartElement(CXXVARIABLEREIMPLEMENTED);
+                writer.writeAttribute("href",opn->ditaXmlHref());
+                writer.writeCharacters(marker->plainFullName(opn));
+                writer.writeEndElement(); // </cxxVariableReimplemented>
+            }
+
+            writeLocation(pn);
+            writer.writeEndElement(); // <cxxVariableDefinition>
+            writer.writeStartElement(APIDESC);
+
+            if (!pn->doc().isEmpty()) {
+                generateBody(pn, marker);
+            }
+
+            writer.writeEndElement(); // </apiDesc>
+            writer.writeEndElement(); // </cxxVariableDetail>
+            writer.writeEndElement(); // </cxxVariable>
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writeDataMembers(const Section& s, 
+                                        const ClassNode* cn, 
+                                        CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Variable) {
+            const VariableNode* vn = static_cast<const VariableNode*>(*m);
+            writer.writeStartElement(CXXVARIABLE);
+            writer.writeAttribute("id",vn->guid());
+            writer.writeStartElement(APINAME);
+            writer.writeCharacters(vn->name());
+            writer.writeEndElement(); // </apiName>
+            generateBrief(vn,marker);
+            writer.writeStartElement(CXXVARIABLEDETAIL);
+            writer.writeStartElement(CXXVARIABLEDEFINITION);
+            writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER);
+            writer.writeAttribute("value",vn->accessString());
+            writer.writeEndElement(); // <cxxVariableAccessSpecifier>
+
+            if (vn->isStatic()) {
+                writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC);
+                writer.writeAttribute("name","static");
+                writer.writeAttribute("value","static");
+                writer.writeEndElement(); // <cxxVariableStorageClassSpecifierStatic>
+            }
+
+            writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
+            writer.writeCharacters(vn->leftType());
+            if (!vn->rightType().isEmpty())
+                writer.writeCharacters(vn->rightType());
+            writer.writeEndElement(); // <cxxVariableDeclaredType>
+
+            QString fq = fullQualification(vn);
+            if (!fq.isEmpty()) {
+                writer.writeStartElement(CXXVARIABLESCOPEDNAME);
+                writer.writeCharacters(fq);
+                writer.writeEndElement(); // <cxxVariableScopedName>
+            }
+            
+            writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+            writer.writeCharacters(vn->leftType() + " ");
+            //writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); 
+            writer.writeCharacters(vn->name()); 
+            if (!vn->rightType().isEmpty())
+                writer.writeCharacters(vn->rightType());
+            writer.writeEndElement(); // <cxxVariablePrototype>
+
+            writer.writeStartElement(CXXVARIABLENAMELOOKUP);
+            writer.writeCharacters(vn->parent()->name() + "::" + vn->name());
+            writer.writeEndElement(); // <cxxVariableNameLookup>
+
+            writeLocation(vn);
+            writer.writeEndElement(); // <cxxVariableDefinition>
+            writer.writeStartElement(APIDESC);
+
+            if (!vn->doc().isEmpty()) {
+                generateBody(vn, marker);
+            }
+
+            writer.writeEndElement(); // </apiDesc>
+            writer.writeEndElement(); // </cxxVariableDetail>
+            writer.writeEndElement(); // </cxxVariable>
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writeMacros(const Section& s, 
+                                   const ClassNode* cn, 
+                                   CodeMarker* marker)
+{
+    NodeList::ConstIterator m = s.members.begin();
+    while (m != s.members.end()) {
+        if ((*m)->type() == Node::Function) {
+            const FunctionNode* fn = static_cast<const FunctionNode*>(*m);
+            if (fn->isMacro()) {
+                writer.writeStartElement(CXXDEFINE);
+                writer.writeAttribute("id",fn->guid());
+                writer.writeStartElement(APINAME);
+                writer.writeCharacters(fn->name());
+                writer.writeEndElement(); // </apiName>
+                generateBrief(fn,marker);
+                writer.writeStartElement(CXXDEFINEDETAIL);
+                writer.writeStartElement(CXXDEFINEDEFINITION);
+                writer.writeStartElement(CXXDEFINEACCESSSPECIFIER);
+                writer.writeAttribute("value",fn->accessString());
+                writer.writeEndElement(); // <cxxDefineAccessSpecifier>
+            
+                writer.writeStartElement(CXXDEFINEPROTOTYPE);
+                writer.writeCharacters("#define ");
+                writer.writeCharacters(fn->name());
+                if (fn->metaness() == FunctionNode::MacroWithParams) {
+                    QStringList params = fn->parameterNames();
+                    if (!params.isEmpty()) {
+                        writer.writeCharacters("(");
+                        for (int i = 0; i < params.size(); ++i) {
+                            if (params[i].isEmpty())
+                                writer.writeCharacters("...");
+                            else
+                                writer.writeCharacters(params[i]);
+                            if ((i+1) < params.size()) 
+                                writer.writeCharacters(", ");
+                        }
+                        writer.writeCharacters(")");
+                    }
+                }
+                writer.writeEndElement(); // <cxxDefinePrototype>
+
+                writer.writeStartElement(CXXDEFINENAMELOOKUP);
+                writer.writeCharacters(fn->name());
+                writer.writeEndElement(); // <cxxDefineNameLookup>
+
+                if (fn->reimplementedFrom() != 0) {
+                    FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom();
+                    writer.writeStartElement(CXXDEFINEREIMPLEMENTED);
+                    writer.writeAttribute("href",rfn->ditaXmlHref());
+                    writer.writeCharacters(marker->plainFullName(rfn));
+                    writer.writeEndElement(); // </cxxDefineReimplemented>
+                }
+
+                if (fn->metaness() == FunctionNode::MacroWithParams) {
+                    QStringList params = fn->parameterNames();
+                    if (!params.isEmpty()) {
+                        writer.writeStartElement(CXXDEFINEPARAMETERS);
+                        for (int i = 0; i < params.size(); ++i) {
+                            writer.writeStartElement(CXXDEFINEPARAMETER);
+                            writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME);
+                            writer.writeCharacters(params[i]);
+                            writer.writeEndElement(); // <cxxDefineParameterDeclarationName>
+                            writer.writeEndElement(); // <cxxDefineParameter>
+                        }
+                        writer.writeEndElement(); // <cxxDefineParameters>
+                    }
+                }
+
+                writeLocation(fn);
+                writer.writeEndElement(); // <cxxDefineDefinition>
+                writer.writeStartElement(APIDESC);
+
+                if (!fn->doc().isEmpty()) {
+                    generateBody(fn, marker);
+                }
+
+                writer.writeEndElement(); // </apiDesc>
+                writer.writeEndElement(); // </cxxDefineDetail>
+                writer.writeEndElement(); // </cxxDefine>
+            }
+        }
+        ++m;
+    }
+}
+
+void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist)
+{
+    NodeList::const_iterator n = nlist.begin();
+    while (n != nlist.end()) {
+        writer.writeCharacters(" ");
+        writer.writeCharacters(tag);
+        writer.writeCharacters(" ");
+        writer.writeCharacters((*n)->name());
+        ++n;
+    }
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/qdoc3/ditaxmlgenerator.h
===================================================================
--- trunk/tools/qdoc3/ditaxmlgenerator.h	(revision 846)
+++ trunk/tools/qdoc3/ditaxmlgenerator.h	(revision 846)
@@ -0,0 +1,338 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+  ditaxmlgenerator.h
+*/
+
+#ifndef DITAXMLGENERATOR_H
+#define DITAXMLGENERATOR_H
+
+#include <qmap.h>
+#include <qregexp.h>
+#include <QXmlStreamWriter>
+#include "codemarker.h"
+#include "config.h"
+#include "pagegenerator.h"
+
+QT_BEGIN_NAMESPACE
+
+typedef QMultiMap<QString, Node*> NodeMultiMap;
+typedef QMap<QString, NodeMultiMap> NewSinceMaps;
+typedef QMap<Node*, NodeMultiMap> ParentMaps;
+typedef QMap<QString, const Node*> NodeMap;
+typedef QMap<QString, NodeMap> NewClassMaps;
+
+class HelpProjectWriter;
+
+class DitaXmlGenerator : public PageGenerator
+{
+ public:
+    enum SinceType { 
+        Namespace, 
+        Class, 
+        MemberFunction,
+        NamespaceFunction,
+        GlobalFunction,
+        Macro,
+        Enum, 
+        Typedef, 
+        Property,
+        Variable, 
+        QmlClass,
+        QmlProperty,
+        QmlSignal,
+        QmlMethod,
+        LastSinceType
+    };
+
+ public:
+    DitaXmlGenerator();
+    ~DitaXmlGenerator();
+
+    virtual void initializeGenerator(const Config& config);
+    virtual void terminateGenerator();
+    virtual QString format();
+    virtual void generateTree(const Tree *tree, CodeMarker *marker);
+
+    QString protectEnc(const QString &string);
+    static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
+    static QString cleanRef(const QString& ref);
+    static QString sinceTitle(int i) { return sinceTitles[i]; }
+
+ protected:
+    virtual void startText(const Node *relative, CodeMarker *marker);
+    virtual int generateAtom(const Atom *atom, 
+                             const Node *relative,
+                             CodeMarker *marker);
+    virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
+    virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
+    virtual QString fileExtension(const Node *node) const;
+    virtual QString refForNode(const Node *node);
+    virtual QString linkForNode(const Node *node, const Node *relative);
+    virtual QString refForAtom(Atom *atom, const Node *node);
+    
+    QString fullQualification(const Node* n);
+
+    void writeDerivations(const ClassNode* cn, CodeMarker* marker);
+    void writeLocation(const Node* n);
+    void writeFunctions(const Section& s, 
+                        const ClassNode* cn, 
+                        CodeMarker* marker);
+    void writeParameters(const FunctionNode* fn, CodeMarker* marker);
+    void writeEnumerations(const Section& s, 
+                           const ClassNode* cn, 
+                           CodeMarker* marker);
+    void writeTypedefs(const Section& s, 
+                       const ClassNode* cn, 
+                       CodeMarker* marker);
+    void writeDataMembers(const Section& s, 
+                          const ClassNode* cn, 
+                          CodeMarker* marker);
+    void writeProperties(const Section& s, 
+                         const ClassNode* cn, 
+                         CodeMarker* marker);
+    void writeMacros(const Section& s, 
+                     const ClassNode* cn, 
+                     CodeMarker* marker);
+    void writePropParams(const QString& tag, const NodeList& nlist);
+
+ private:
+    enum SubTitleSize { SmallSubTitle, LargeSubTitle };
+
+    const QPair<QString,QString> anchorForNode(const Node *node);
+    const Node *findNodeForTarget(const QString &target, 
+                                  const Node *relative,
+                                  CodeMarker *marker, 
+                                  const Atom *atom = 0);
+    void generateBreadCrumbs(const QString& title,
+                             const Node *node,
+                             CodeMarker *marker);
+    void generateHeader(const Node* node);
+    void generateTitle(const QString& title, 
+                       const Text &subTitle, 
+                       SubTitleSize subTitleSize,
+                       const Node *relative, 
+                       CodeMarker *marker);
+    void generateBrief(const Node* node, CodeMarker* marker);
+    void generateIncludes(const InnerNode *inner, CodeMarker *marker);
+    void generateTableOfContents(const Node *node, 
+                                 CodeMarker *marker,
+                                 Doc::SectioningUnit sectioningUnit,
+                                 int numColumns, 
+                                 const Node *relative = 0);
+    void generateTableOfContents(const Node *node, 
+                                 CodeMarker *marker, 
+                                 QList<Section>* sections = 0);
+    QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker);
+    QString generateLowStatusMemberFile(const InnerNode *inner, 
+                                        CodeMarker *marker,
+                                        CodeMarker::Status status);
+    void generateClassHierarchy(const Node *relative, 
+                                CodeMarker *marker,
+				const NodeMap &classMap);
+    void generateAnnotatedList(const Node *relative, 
+                               CodeMarker *marker,
+			       const NodeMap &nodeMap);
+    void generateCompactList(const Node *relative, 
+                             CodeMarker *marker,
+			     const NodeMap &classMap,
+                             bool includeAlphabet,
+                             QString commonPrefix = QString());
+    void generateFunctionIndex(const Node *relative, CodeMarker *marker);
+    void generateLegaleseList(const Node *relative, CodeMarker *marker);
+    void generateOverviewList(const Node *relative, CodeMarker *marker);
+    void generateSectionList(const Section& section, 
+                             const Node *relative,
+			     CodeMarker *marker, 
+                             CodeMarker::SynopsisStyle style);
+#ifdef QDOC_QML
+    void generateQmlSummary(const Section& section,
+                            const Node *relative,
+                            CodeMarker *marker);
+    void generateQmlItem(const Node *node,
+                         const Node *relative,
+                         CodeMarker *marker,
+                         bool summary);
+    void generateDetailedQmlMember(const Node *node,
+                                   const InnerNode *relative,
+                                   CodeMarker *marker);
+    void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker);
+    void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker);
+    void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker);
+    void generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker);
+#endif
+
+    void generateSection(const NodeList& nl,
+                         const Node *relative,
+                         CodeMarker *marker,
+                         CodeMarker::SynopsisStyle style);
+    void generateSynopsis(const Node *node, 
+                          const Node *relative, 
+                          CodeMarker *marker,
+			  CodeMarker::SynopsisStyle style,
+                          bool nameAlignment = false);
+    void generateSectionInheritedList(const Section& section, 
+                                      const Node *relative,
+                                      CodeMarker *marker,
+                                      bool nameAlignment = false);
+    QString highlightedCode(const QString& markedCode, 
+                            CodeMarker *marker, 
+                            const Node *relative,
+                            CodeMarker::SynopsisStyle style = CodeMarker::Accessors,
+                            bool nameAlignment = false);
+
+    void generateFullName(const Node *apparentNode, 
+                          const Node *relative, 
+                          CodeMarker *marker,
+			  const Node *actualNode = 0);
+    void generateDetailedMember(const Node *node, 
+                                const InnerNode *relative, 
+                                CodeMarker *marker);
+    void generateLink(const Atom *atom, 
+                      const Node *relative, 
+                      CodeMarker *marker);
+    void generateStatus(const Node *node, CodeMarker *marker);
+    
+    QString registerRef(const QString& ref);
+    QString fileBase(const Node *node);
+#if 0
+    QString fileBase(const Node *node, const SectionIterator& section);
+#endif
+    QString fileName(const Node *node);
+    void findAllClasses(const InnerNode *node);
+    void findAllFunctions(const InnerNode *node);
+    void findAllLegaleseTexts(const InnerNode *node);
+    void findAllNamespaces(const InnerNode *node);
+    void findAllSince(const InnerNode *node);
+    static int hOffset(const Node *node);
+    static bool isThreeColumnEnumValueTable(const Atom *atom);
+    virtual QString getLink(const Atom *atom, 
+                            const Node *relative, 
+                            CodeMarker *marker, 
+                            const Node** node);
+    virtual void generateIndex(const QString &fileBase, 
+                               const QString &url,
+                               const QString &title);
+#ifdef GENERATE_MAC_REFS    
+    void generateMacRef(const Node *node, CodeMarker *marker);
+#endif
+    void beginLink(const QString &link, 
+                   const Node *node, 
+                   const Node *relative, 
+                   CodeMarker *marker);
+    void endLink();
+    bool generatePageElement(QXmlStreamWriter& writer, 
+                             const Node* node, 
+                             CodeMarker* marker) const;
+    void generatePageElements(QXmlStreamWriter& writer, 
+                              const Node* node, 
+                              CodeMarker* marker) const;
+    void generatePageIndex(const QString& fileName, 
+                           CodeMarker* marker) const;
+    QString writeGuidAttribute(QString text);
+    QString lookupGuid(QString text);
+
+ private:
+    QMap<QString, QString> refMap;
+    QMap<QString, QString> name2guidMap;
+    int codeIndent;
+    bool inLink;
+    bool inObsoleteLink;
+    bool inContents;
+    bool inSectionHeading;
+    bool inTableHeader;
+    int numTableRows;
+    bool threeColumnEnumValueTable;
+    bool offlineDocs;
+    QString link;
+    QStringList sectionNumber;
+    QRegExp funcLeftParen;
+    QString style;
+    QString postHeader;
+    QString postPostHeader;
+    QString footer;
+    QString address;
+    bool pleaseGenerateMacRef;
+    QString project;
+    QString projectDescription;
+    QString projectUrl;
+    QString navigationLinks;
+    QStringList stylesheets;
+    QStringList customHeadElements;
+    const Tree *myTree;
+    bool slow;
+    bool obsoleteLinks;
+    int noLinks;
+    QMap<QString, NodeMap > moduleClassMap;
+    QMap<QString, NodeMap > moduleNamespaceMap;
+    NodeMap nonCompatClasses;
+    NodeMap mainClasses;
+    NodeMap compatClasses;
+    NodeMap obsoleteClasses;
+    NodeMap namespaceIndex;
+    NodeMap serviceClasses;
+#ifdef QDOC_QML    
+    NodeMap qmlClasses;
+#endif
+    QMap<QString, NodeMap > funcIndex;
+    QMap<Text, const Node *> legaleseTexts;
+    NewSinceMaps newSinceMaps;
+    static QString sinceTitles[];
+    NewClassMaps newClassMaps;
+    NewClassMaps newQmlClassMaps;
+    static int id;
+    QXmlStreamWriter    writer;
+};
+
+#define DITAXMLGENERATOR_ADDRESS           "address"
+#define DITAXMLGENERATOR_FOOTER            "footer"
+#define DITAXMLGENERATOR_GENERATEMACREFS   "generatemacrefs" // ### document me
+#define DITAXMLGENERATOR_POSTHEADER        "postheader"
+#define DITAXMLGENERATOR_POSTPOSTHEADER    "postpostheader"
+#define DITAXMLGENERATOR_STYLE             "style"
+#define DITAXMLGENERATOR_STYLESHEETS       "stylesheets"
+#define DITAXMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements"
+
+QT_END_NAMESPACE
+
+#endif
+
Index: trunk/tools/qdoc3/doc.cpp
===================================================================
--- trunk/tools/qdoc3/doc.cpp	(revision 769)
+++ trunk/tools/qdoc3/doc.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -2747,16 +2747,4 @@
 }
 
-#if notyet // ###
-Doc::SectioningUnit Doc::sectioningUnit() const
-{
-    if (priv == 0 || priv->extra == 0) {
-	return DocPrivateExtra().sectioningUnit;
-    }
-    else {
-	return priv->extra->sectioningUnit;
-    }
-}
-#endif
-
 const QSet<QString> &Doc::parameterNames() const
 {
@@ -3037,5 +3025,5 @@
     result.reserve(title.size());
 
-    bool slurping = false;
+    bool dashAppended = false;
     bool begun = false;
     int lastAlnum = 0;
@@ -3048,15 +3036,19 @@
             result += QLatin1Char(c);
             begun = true;
-            slurping = false;
+            dashAppended = false;
             lastAlnum = result.size();
         }
-        else if (!slurping) {
+        else if (!dashAppended) {
             if (begun)
                 result += QLatin1Char('-');
-            slurping = true;
+            dashAppended = true;
         }
+#if 0
+        // This was screwing things up.
         else {
-            // !alnum && slurping -> nothin
+            result += title[i];
+            lastAlnum = result.size();
         }
+#endif        
     }
     result.truncate(lastAlnum);
Index: trunk/tools/qdoc3/doc.h
===================================================================
--- trunk/tools/qdoc3/doc.h	(revision 769)
+++ trunk/tools/qdoc3/doc.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -49,4 +49,5 @@
 #include <QSet>
 #include <QString>
+#include <QMap>
 
 #include "location.h"
Index: trunk/tools/qdoc3/doc/classic.css
===================================================================
--- trunk/tools/qdoc3/doc/classic.css	(revision 846)
+++ trunk/tools/qdoc3/doc/classic.css	(revision 846)
@@ -0,0 +1,284 @@
+BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+  font-family: Arial, Geneva, Helvetica, sans-serif;
+}
+H1 {
+  text-align: center;
+  font-size: 160%;
+}
+H2 {
+  font-size: 120%;
+}
+H3 {
+  font-size: 100%;
+}
+
+h3.fn,span.fn
+{
+  background-color: #eee;
+  border-width: 1px;
+  border-style: solid;
+  border-color: #ddd;
+  font-weight: bold;
+  padding: 6px 0px 6px 10px;
+  margin: 42px 0px 0px 0px;
+}
+
+hr {
+  border: 0;
+  color: #a0a0a0;
+  background-color: #ccc;
+  height: 1px;
+  width: 100%;
+  text-align: left;
+  margin: 34px 0px 34px 0px;
+}
+
+table.valuelist {
+	border-width: 1px 1px 1px 1px;
+	border-style: solid;
+	border-color: #dddddd;
+	border-collapse: collapse;
+	background-color: #f0f0f0;
+}
+
+table.indextable {
+	border-width: 1px 1px 1px 1px;
+	border-style: solid;
+	border-collapse: collapse;
+	background-color: #f0f0f0;
+    border-color:#555;
+    font-size: 100%;
+}
+
+table td.largeindex {
+	border-width: 1px 1px 1px 1px;
+	border-collapse: collapse;
+	background-color: #f0f0f0;
+    border-color:#555;
+    font-size: 120%;
+}
+
+table.valuelist th {
+	border-width: 1px 1px 1px 2px;
+	padding: 4px;
+	border-style: solid;
+	border-color: #666;
+    color:white;
+    background-color:#666;
+}
+
+th.titleheader  {
+	border-width: 1px 0px 1px 0px;
+	padding: 2px;
+	border-style: solid;
+	border-color: #666;
+    color:white;
+    background-color:#555;
+    background-image:url('images/gradient.png')};
+    background-repeat: repeat-x;
+    font-size: 100%;
+}
+
+
+th.largeheader {
+	border-width: 1px 0px 1px 0px;
+	padding: 4px;
+	border-style: solid;
+	border-color: #444;
+    color:white;
+    background-color:#555555;
+    font-size: 120%;
+}
+
+p {
+
+  margin-left: 4px;
+  margin-top: 8px;
+  margin-bottom: 8px;
+}
+
+a:link
+{
+  color: #0046ad;
+  text-decoration: none
+}
+
+a:visited
+{
+  color: #672967;
+  text-decoration: none
+}
+
+a.obsolete
+{
+  color: #661100;
+  text-decoration: none
+}
+
+a.compat
+{
+  color: #661100;
+  text-decoration: none
+}
+
+a.obsolete:visited
+{
+  color: #995500;
+  text-decoration: none
+}
+
+a.compat:visited
+{
+  color: #995500;
+  text-decoration: none
+}
+
+body
+{
+  background: #ffffff;
+  color: black
+}
+
+table.generic, table.annotated
+{
+  border-width: 1px;
+  border-color:#bbb;
+  border-style:solid;  
+  border-collapse:collapse;
+}
+
+table td.memItemLeft {
+  width: 180px;
+  padding: 2px 0px 0px 8px;
+  margin: 4px;
+  border-width: 1px;
+  border-color: #E0E0E0;
+  border-style: none;
+  font-size: 100%;
+  white-space: nowrap
+}
+
+table td.memItemRight {
+  padding: 2px 8px 0px 8px;
+  margin: 4px;
+  border-width: 1px;
+  border-color: #E0E0E0;
+  border-style: none;
+  font-size: 100%;
+}
+
+table tr.odd {
+  background: #f0f0f0;
+  color: black;
+}
+
+table tr.even {
+  background: #e4e4e4;
+  color: black;
+}
+
+table.annotated th {
+  padding: 3px;
+  text-align: left
+}
+
+table.annotated td {
+  padding: 3px;
+}
+
+table tr pre
+{
+  padding-top: 0px;
+  padding-bottom: 0px;
+  padding-left: 0px;
+  padding-right: 0px;
+  border: none;
+  background: none
+}
+
+tr.qt-style
+{
+  background: #96E066;
+  color: black
+}
+
+body pre
+{
+  padding: 0.2em;
+  border: #e7e7e7 1px solid;
+  background: #f1f1f1;
+  color: black
+}
+
+table tr.qt-code pre
+{
+  padding: 0.2em;
+  border: #e7e7e7 1px solid;
+  background: #f1f1f1;
+  color: black
+}
+
+span.preprocessor, span.preprocessor a
+{
+  color: darkblue;
+}
+
+span.comment
+{
+  color: darkred;
+  font-style: italic
+}
+
+span.string,span.char
+{
+  color: darkgreen;
+}
+
+.title
+{
+    text-align: center
+}
+
+.subtitle
+{
+    font-size: 0.8em
+}
+
+.small-subtitle
+{
+    font-size: 0.65em
+}
+
+.qmlitem {
+    padding: 0;
+}
+
+.qmlname {
+    white-space: nowrap;
+}
+
+.qmltype {
+    text-align: center;
+    font-size: 160%;
+}
+
+.qmlproto {
+    background-color: #eee;
+    border-width: 1px;
+    border-style: solid;
+    border-color: #ddd;
+    font-weight: bold;
+    padding: 6px 10px 6px 10px;
+    margin: 42px 0px 0px 0px;
+}
+
+.qmlreadonly {
+    float: right;
+    color: red
+}
+
+.qmldoc {
+}
+
+*.qmlitem p {
+}
Index: trunk/tools/qdoc3/doc/examples/layoutmanagement.qdocinc
===================================================================
--- trunk/tools/qdoc3/doc/examples/layoutmanagement.qdocinc	(revision 846)
+++ trunk/tools/qdoc3/doc/examples/layoutmanagement.qdocinc	(revision 846)
@@ -0,0 +1,13 @@
+\section1 Layout Classes
+
+The Qt layout system provides a simple and powerful way of specifying
+the layout of child widgets.
+
+By specifying the logical layout once, you get the following benefits:
+
+\list
+    \o Positioning of child widgets.
+    \o Sensible default sizes for windows.
+    \o Sensible minimum sizes for windows.
+    \o ...
+\endlist
Index: trunk/tools/qdoc3/doc/examples/main.cpp
===================================================================
--- trunk/tools/qdoc3/doc/examples/main.cpp	(revision 846)
+++ trunk/tools/qdoc3/doc/examples/main.cpp	(revision 846)
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QPushButton>
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    QPushButton hello("Hello world!");
+    hello.resize(100, 30);
+
+    hello.show();
+    return app.exec();
+}
Index: trunk/tools/qdoc3/doc/examples/minimum.qdocconf
===================================================================
--- trunk/tools/qdoc3/doc/examples/minimum.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/doc/examples/minimum.qdocconf	(revision 846)
@@ -0,0 +1,42 @@
+# QDoc is a tool that constantly evolves to suit our needs,
+# and there are some compatibility issues between old and new
+# practices. For that reason, any QDoc configuration file needs to
+# include compat.qdocconf.
+
+#include(compat.qdocconf)
+
+
+# The outputdir variable specifies the directory 
+# where QDoc will put the generated documentation.
+
+outputdir   = html
+
+
+# The headerdirs variable specifies the directories 
+# containing the header files associated 
+# with the .cpp source files used in the documentation.
+
+headerdirs  = .
+
+
+# The sourcedirs variable specifies the 
+# directories containing the .cpp or .qdoc 
+# files used in the documentation.
+
+#sourcedirs  = .
+
+
+# The exampledirs variable specifies the directories containing 
+# the source code of the example files.
+
+exampledirs = .
+
+
+# The imagedirs variable specifies the 
+# directories containing the images used in the documentation.
+
+imagedirs   = ./images
+
+
+
+
Index: trunk/tools/qdoc3/doc/examples/objectmodel.qdocinc
===================================================================
--- trunk/tools/qdoc3/doc/examples/objectmodel.qdocinc	(revision 846)
+++ trunk/tools/qdoc3/doc/examples/objectmodel.qdocinc	(revision 846)
@@ -0,0 +1,11 @@
+\section1 Qt Object Model
+
+The standard C++ object model provides very efficient runtime support
+for the object paradigm. But its static nature is inflexibile in
+certain problem domains. Graphical user interface programming is a
+domain that requires both runtime efficiency and a high level of
+flexibility. Qt provides this, by combining the speed of C++ with the
+flexibility of the Qt Object Model.
+
+...
+
Index: trunk/tools/qdoc3/doc/examples/signalandslots.qdocinc
===================================================================
--- trunk/tools/qdoc3/doc/examples/signalandslots.qdocinc	(revision 846)
+++ trunk/tools/qdoc3/doc/examples/signalandslots.qdocinc	(revision 846)
@@ -0,0 +1,9 @@
+\section1 Signals and Slots
+
+Signals and slots are used for communication between objects. The signals and
+slots mechanism is a central feature of Qt and probably the part that differs 
+most from the features provided by other frameworks.
+
+\section2 Introduction
+
+In GUI programming, when we ...
Index: trunk/tools/qdoc3/doc/files/compat.qdocconf
===================================================================
--- trunk/tools/qdoc3/doc/files/compat.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/doc/files/compat.qdocconf	(revision 846)
@@ -0,0 +1,31 @@
+alias.i				= e
+alias.include			= input
+
+macro.0                         = "\\\\0"
+macro.b                         = "\\\\b"
+macro.n                         = "\\\\n"
+macro.r                         = "\\\\r"
+macro.i                         = "\\o"
+macro.i11                       = "\\o{1,1}"
+macro.i12                       = "\\o{1,2}"
+macro.i13                       = "\\o{1,3}"
+macro.i14                       = "\\o{1,4}"
+macro.i15                       = "\\o{1,5}"
+macro.i16                       = "\\o{1,6}"
+macro.i17                       = "\\o{1,7}"
+macro.i18                       = "\\o{1,8}"
+macro.i19                       = "\\o{1,9}"
+macro.i21                       = "\\o{2,1}"
+macro.i31                       = "\\o{3,1}"
+macro.i41                       = "\\o{4,1}"
+macro.i51                       = "\\o{5,1}"
+macro.i61                       = "\\o{6,1}"
+macro.i71                       = "\\o{7,1}"
+macro.i81                       = "\\o{8,1}"
+macro.i91                       = "\\o{9,1}"
+macro.img                       = "\\image"
+macro.endquote                  = "\\endquotation"
+macro.relatesto                 = "\\relates"
+
+spurious			= "Missing comma in .*" \
+				  "Missing pattern .*"
Index: trunk/tools/qdoc3/doc/files/qt.qdocconf
===================================================================
--- trunk/tools/qdoc3/doc/files/qt.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/doc/files/qt.qdocconf	(revision 846)
@@ -0,0 +1,115 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qt
+versionsym              =
+version                 = 4.7.2
+description             = Qt Reference Documentation
+url                     = http://qt.nokia.com/doc/4.7
+
+edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \
+                          QtXmlPatterns QtTest
+edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \
+                          QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \
+                          QtDesigner QtAssistant QAxContainer Phonon \
+                          QAxServer QtUiTools QtTest QtDBus
+edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest
+edition.DesktopLight.groups       = -graphicsview-api
+
+qhp.projects            = Qt
+
+qhp.Qt.file                = qt.qhp
+qhp.Qt.namespace           = com.trolltech.qt.472
+qhp.Qt.virtualFolder       = qdoc
+qhp.Qt.indexTitle          = Qt Reference Documentation
+qhp.Qt.indexRoot           =
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = classic.css \
+                             images/qt-logo.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             images/stylesheet-coffee-plastique.png
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.subprojects         = classes overviews examples
+qhp.Qt.subprojects.classes.title = Classes
+qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
+qhp.Qt.subprojects.classes.selectors = class fake:headerfile
+qhp.Qt.subprojects.classes.sortPages = true
+qhp.Qt.subprojects.overviews.title = Overviews
+qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
+qhp.Qt.subprojects.overviews.selectors = fake:page,group,module
+qhp.Qt.subprojects.examples.title = Tutorials and Examples
+qhp.Qt.subprojects.examples.indexTitle = Qt Examples
+qhp.Qt.subprojects.examples.selectors = fake:example
+
+language                = Cpp
+
+headerdirs              = $QTDIR/src \
+                          $QTDIR/extensions/activeqt \
+                          $QTDIR/tools/assistant/lib \
+                          $QTDIR/tools/assistant/compat/lib \
+                          $QTDIR/tools/designer/src/uitools \
+                          $QTDIR/tools/designer/src/lib/extension \
+                          $QTDIR/tools/designer/src/lib/sdk \
+                          $QTDIR/tools/designer/src/lib/uilib \
+                          $QTDIR/tools/qtestlib/src \
+                          $QTDIR/tools/qdbus/src
+sourcedirs              = $QTDIR/src \
+                          $QTDIR/doc/src \
+                          $QTDIR/extensions/activeqt \
+                          $QTDIR/tools/assistant/lib \
+                          $QTDIR/tools/assistant/compat/lib \
+                          $QTDIR/tools/designer/src/uitools \
+                          $QTDIR/tools/designer/src/lib/extension \
+                          $QTDIR/tools/designer/src/lib/sdk \
+                          $QTDIR/tools/designer/src/lib/uilib \
+                          $QTDIR/tools/qtestlib/src \
+                          $QTDIR/tools/qdbus
+
+excludedirs             = $QTDIR/src/3rdparty/clucene \
+                          $QTDIR/src/3rdparty/des \
+                          $QTDIR/src/3rdparty/freetype \
+                          $QTDIR/src/3rdparty/harfbuzz \
+                          $QTDIR/src/3rdparty/kdebase \
+                          $QTDIR/src/3rdparty/libjpeg \
+                          $QTDIR/src/3rdparty/libmng \
+                          $QTDIR/src/3rdparty/libpng \
+                          $QTDIR/src/3rdparty/libtiff \
+                          $QTDIR/src/3rdparty/md4 \
+                          $QTDIR/src/3rdparty/md5 \
+                          $QTDIR/src/3rdparty/patches \
+                          $QTDIR/src/3rdparty/sha1 \
+                          $QTDIR/src/3rdparty/sqlite \
+                          $QTDIR/src/3rdparty/webkit/JavaScriptCore \
+                          $QTDIR/src/3rdparty/webkit/WebCore \
+                          $QTDIR/src/3rdparty/wintab \
+                          $QTDIR/src/3rdparty/zlib \
+                          $QTDIR/doc/src/snippets \
+                          $QTDIR/src/3rdparty/phonon/gstreamer \
+                          $QTDIR/src/3rdparty/phonon/ds9 \
+                          $QTDIR/src/3rdparty/phonon/qt7 \
+                          $QTDIR/src/3rdparty/phonon/waveout
+
+sources.fileextensions  = "*.cpp *.qdoc *.mm"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+
+exampledirs             = $QTDIR/doc/src \
+                          $QTDIR/examples \
+                          $QTDIR/examples/tutorials \
+                          $QTDIR \
+                          $QTDIR/qmake/examples \
+                          $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QTDIR/doc/src/images \
+                          $QTDIR/examples
+outputdir               = $QTDIR/doc/html
+tagfile                 = $QTDIR/doc/html/qt.tags
+base                    = file:$QTDIR/doc/html
Index: trunk/tools/qdoc3/doc/qdoc-manual.qdoc
===================================================================
--- trunk/tools/qdoc3/doc/qdoc-manual.qdoc	(revision 846)
+++ trunk/tools/qdoc3/doc/qdoc-manual.qdoc	(revision 846)
@@ -0,0 +1,8774 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+    \page index.html
+    \nextpage QDoc Manual
+
+    \title QDoc Manual - Table of Contents
+
+    \list
+    \o \l{QDoc Manual}
+    \o \l{QDoc Commands}
+       \list
+       \o \l{Markup Commands}
+       \o \l{Text Formatting Commands}
+       \o \l{Document Structuring Commands}
+       \o \l{Verbatim Code Commands}
+       \o \l{Quoting External Code Commands}
+          \list
+          \o \l{Example File}
+          \endlist
+       \o \l{Linking Commands}
+       \o \l{Graphic Commands}
+       \o \l{Container Commands}
+       \o \l{Document Contents Commands}
+       \o \l{Miscellaneous Commands}
+          \list
+          \o \l{signalandslots.qdocinc}
+          \o \l{objectmodel.qdocinc}
+          \o \l{layoutmanagement.qdocinc}
+          \endlist
+       \o \l{Topical Commands}
+       \o \l{Contextual Commands}
+       \o \l{Navigation Commands}
+       \o \l{Status Commands}
+       \o \l{Thread Support Commands}
+       \o \l{Relating Commands}
+       \o \l{Grouping Commands}
+       \o \l{Title Commands}
+       \endlist
+    \o \l{QDoc Configuration}
+       \list
+       \o \l{General Configuration Variables}
+       \o \l{Creating Help Project Files}
+       \o \l{C++ Specific Configuration Variables}
+       \o \l{HTML Specific Configuration Variables}
+       \o \l{Supporting Derived Projects}
+       \o \l{QDoc Compatibility}
+       \o \l{qt.qdocconf}
+       \o \l{minimum.qdocconf}
+       \endlist
+    \o \l{QDoc Commands - Alphabetical List}
+    \endlist
+*/
+
+/*!
+    \page 01-qdoc-manual.html
+    \contentspage QDoc Manual - Table of Contents
+    \previouspage QDoc Manual - Table of Contents
+    \nextpage QDoc Commands
+
+    \title QDoc Manual
+
+    QDoc is the internal tool used by Qt Development Frameworks for generating
+    documentation. This document is a reference for QDoc command syntax and
+    configuration.
+
+    \section1 Overview
+
+    \list I
+    \o \section2 \l {QDoc Commands}
+
+       \l {QDoc Commands - Alphabetical List}{A complete alphabetical
+       list}.
+
+       There are two main categories of commands for QDoc: markup
+       commands and meta-commands.
+
+       The markup commands indicate the generated documentation's
+       appearance and logical structure. The meta-commands provide
+       information about the document as well as the documented
+       item. The meta-commands can be further categorized as topical
+       commands and contextual commands.
+
+       \list
+       \o \l {Markup Commands}
+           \list
+           \o \l {Text Formatting Commands}{Text Formatting}
+           \o \l {Document Structuring Commands}{Document Structuring}
+           \o \l {Verbatim Code Commands}{Verbatim Code}
+           \o \l {Quoting External Code Commands}{Quoting External Code}
+           \o \l {Linking Commands}{Linking}
+           \o \l {Graphic Commands}{Graphic}
+           \o \l {Container Commands}{Container}
+           \o \l {Document Contents Commands}{Document Contents}
+           \o \l {Miscellaneous Commands}{Miscellaneous}
+           \endlist
+       \o \l {Topical Commands}
+       \o \l {Contextual Commands}
+           \list
+           \o \l {Navigation Commands}{Navigation}
+           \o \l {Status Commands}{Status}
+           \o \l {Thread Support Commands}{Thread Support}
+           \o \l {Relating Commands}{Relating}
+           \o \l {Grouping Commands}{Grouping}
+           \o \l {Title Commands}{Title}
+           \endlist
+       \endlist
+    \endlist
+
+    \list II
+    \o \section2 \l {QDoc Configuration}
+
+       When running QDoc to generate the documentation, you must
+       specify a configuration file on the command line. The
+       configuration file is a list of entries of entries of the form
+       "variable = value".
+
+       \list
+       \o \l {Configuration Variables}
+       \o \l {Configuration File Examples}
+       \endlist
+
+       Some particular configuration variables allow you to use QDoc
+       to support Qt-based projects; i.e to make projects, such as Qt
+       Solutions, contain references to the online Qt documentation.
+
+       \list
+       \o \l {Supporting Derived Projects}
+       \endlist
+
+       QDoc is a tool that constantly evolves to suit our needs, for
+       that reason there are some compatibility issues between old and
+       new practices.
+
+       \list
+       \o \l {QDoc Compatibility}
+       \endlist
+    \endlist
+*/
+
+/*!
+    \page 02-qdoc-commands.html
+    \previouspage QDoc Manual
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Markup Commands
+
+    \title QDoc Commands
+
+    There are two main categories of commands for QDoc: markup
+    commands and meta-commands.
+
+    The markup commands indicate the generated documentation's visual
+    appearance and logical structure. The meta-commands provide
+    information about the documentation unit as well as the documented
+    item. The meta-commands can be further categorized as topical
+    commands and contextual commands.
+
+    \section1 Alphabetical List
+
+    A complete \l{QDoc Commands - Alphabetical List }
+    {alphabetical list of the QDoc commands}.
+
+    \section1 Categories
+
+    \list
+    \o \l {Markup Commands}
+    \o \l {Topical Commands}
+    \o \l {Contextual Commands}
+    \endlist
+*/
+
+/*!
+    \page 03-qdoc-commands-markup.html
+    \contentspage QDoc Manual - Table of Contents
+    \previouspage QDoc Commands
+    \nextpage Text Formatting Commands
+
+    \title Markup Commands
+
+    The markup commands indicate the generated documentation's visual
+    appearance and logical structure.
+
+    \section1 Alphabetical List
+
+    \l {04-qdoc-commands-textformatting.html#backslash}{\\\\},
+    \l {04-qdoc-commands-textformatting.html#a}{\\a},
+    \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract},
+    \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode},
+    \l {04-qdoc-commands-textformatting.html#bold}{\\bold},
+    \l {11-qdoc-commands-documentcontents.html#brief}{\\brief},
+    \l {04-qdoc-commands-textformatting.html#c}{\\c},
+    \l {09-qdoc-commands-graphic.html#caption}{\\caption},
+    \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter},
+    \l {06-qdoc-commands-verbatimcode.html#code}{\\code},
+    \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline},
+    \l {07-0-qdoc-commands-quoting.html#dots}{\\dots},
+    \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else},
+    \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif},
+    \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire},
+    \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote},
+    \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist},
+    \l {10-qdoc-commands-container.html#header}{\\header},
+    \l {04-qdoc-commands-textformatting.html#i}{\\i},
+    \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if},
+    \l {09-qdoc-commands-graphic.html#image}{\\image},
+    \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include},
+    \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage},
+    \l {08-qdoc-commands-linking.html#keyword}{\\keyword},
+    \l {08-qdoc-commands-linking.html#l}{\\l},
+    \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese},
+    \l {10-qdoc-commands-container.html#list}{\\list},
+    \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta},
+    \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode},
+    \l {10-qdoc-commands-container.html#o}{\\o},
+    \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode},
+    \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit},
+    \l {05-qdoc-commands-documentstructuring.html#part}{\\part},
+    \l {07-0-qdoc-commands-quoting.html#printline}{\\printline},
+    \l {07-0-qdoc-commands-quoting.html#printto}{\\printto},
+    \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil},
+    \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation},
+    \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile},
+    \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile},
+    \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw},
+    \l {10-qdoc-commands-container.html#row}{\\row},
+    \l {08-qdoc-commands-linking.html#sa}{\\sa},
+    \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1},
+    \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2},
+    \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3},
+    \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4},
+    \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline},
+    \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto},
+    \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil},
+    \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet},
+    \l {04-qdoc-commands-textformatting.html#sub}{\\sub},
+    \l {04-qdoc-commands-textformatting.html#sup}{\\sup},
+    \l {10-qdoc-commands-container.html#table}{\\table},
+    \l {11-qdoc-commands-documentcontents.html#tableofcontents}
+       {\\tableofcontents},
+    \l {08-qdoc-commands-linking.html#target}{\\target},
+    \l {04-qdoc-commands-textformatting.html#tt}{\\tt},
+    \l {04-qdoc-commands-textformatting.html#underline}{\\underline},
+    \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\unicode},
+    \l {11-qdoc-commands-documentcontents.html#warning}{\\warning}
+
+    \section1 Categories
+    \list
+    \o \l {Text Formatting Commands}
+    \o \l {Document Structuring Commands}
+    \o \l {Verbatim Code Commands}
+    \o \l {Quoting External Code Commands}
+    \o \l {Linking Commands}
+    \o \l {Graphic Commands}
+    \o \l {Container Commands}
+    \o \l {Document Contents Commands}
+    \o \l {Miscellaneous Commands}
+    \endlist
+
+*/
+
+/*!
+    \page 04-qdoc-commands-textformatting.html
+    \contentspage QDoc Manual - Table of Contents
+    \previouspage Markup Commands
+    \nextpage Document Structuring Commands
+
+    \title Text Formatting Commands
+
+    The text formatting commands indicate how the regular text in the
+    documentation is rendered.
+
+    \section1 Alphabetical List
+
+    \l {04-qdoc-commands-textformatting.html#backslash}{\\\\},
+    \l {04-qdoc-commands-textformatting.html#a}{\\a},
+    \l {04-qdoc-commands-textformatting.html#bold}{\\bold},
+    \l {04-qdoc-commands-textformatting.html#c}{\\c},
+    \l {04-qdoc-commands-textformatting.html#i}{\\i},
+    \l {04-qdoc-commands-textformatting.html#sub}{\\sub},
+    \l {04-qdoc-commands-textformatting.html#sup}{\\sup},
+    \l {04-qdoc-commands-textformatting.html#tt}{\\tt},
+    \l {04-qdoc-commands-textformatting.html#underline}{\\underline}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+
+        \o \bold \\\\ \target backslash
+        \o \bold {The \\\\ command expands to a single backslash.}
+
+           QDoc commands always start with a backslash alone. To
+           display an actual backslash in the text you need to type
+           two of the kind. If you want to display two backslashes,
+           you need to type four, and so forth. For example:
+
+           \code
+           / *!
+               The \\\\ command is useful if you want a
+               backslash to appear verbatim, for example,
+               writing C:\\windows\\home\\.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The \\\\ command is useful if you want a
+               backslash to appear verbatim, for example,
+               writing C:\\windows\\home\\.
+           \endquotation
+
+           However, if you want your text to appear in a typewriter
+           font as well, you can use the \l {c}{\\c} command instead,
+           which accepts and renders the backslash as any other
+           character. For example:
+
+           \code
+           / *!
+               The \\c command is useful if you want a
+               backslash to appear verbatim, and the word
+               that contains it written in a typewriter font,
+               like this: \c {C:\windows\home\}.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The \\c command is useful if you want a
+               backslash to appear verbatim, and the word
+               that contains it written in a typewriter font,
+               like this: \c {C:\windows\home\}.
+           \endquotation
+
+    \row
+        \o \bold \\a \target a
+        \o \bold {The \\a command indicates that the next word
+           is a parameter when documenting functions.}
+
+           Warnings are emitted when function parameters are
+           undocumented or misspelled, so whenever you write
+           documentation for functions you should make sure you
+           mention all the parameters and precede each of these by the
+           \\a command. The parameter is then rendered in italic. For
+           example:
+
+           \code
+           / *!
+               Constructs a line edit containing the text
+               \a contents.
+
+               The \a parent parameter is sent to the
+               QWidget constructor.
+           * /
+
+           QLineEdit::QLineEdit(const QString &contents, QWidget *parent)
+               :QWidget(parent)
+           {
+               ...
+           }
+
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \bold {QLineEdit::QLineEdit ( const QString &
+               contents, QWidget *parent )}
+
+           Constructs a line edit containing the text \a contents.
+
+           The \a parent parameter is sent to the QWidget
+           constructor.
+
+           \endquotation
+
+           The \\a command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation, parentheses
+           and use of braces} for the argument. However, a parameter
+           is always a single word, so braces are rarely
+           necessary. And for the same reason, parentheses seldom
+           occur.
+
+    \row
+        \o \bold \\c \target c
+        \o \bold {The \\c command can be used to render variables,
+           user-defined classes and C++ keywords like \c int,
+           \c for, etc.}
+
+           The command renders its argument using a typewriter font. For
+           example:
+
+           \code
+           / *!
+               The \c AnalogClock class provides a clock widget with hour
+               and minute hands that is automatically updated every
+               few seconds.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The \c AnalogClock class provides a clock widget with hour
+               and minute hands that is automatically updated every
+               few seconds.
+           \endquotation
+
+           The \\c command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation, parentheses
+           and use of braces} for the argument.
+
+           The \\c command accepts the special character \c \ within
+           its argument, i.e. it renders it as a normal character. So
+           if you want to use nested commands, you must use the \l
+           {tt}{teletype (\\tt)} command instead.
+
+           See also \l {tt}{\\tt} and \l {code}{\\code}.
+
+    \row
+        \o \bold \\tt \target tt
+        \o \bold {The \\tt command can be used to render variables,
+           user-defined classes and C++ keywords like \c int, \c
+           for, etc.}
+
+           The \\tt command behaves just like the \l {c}{\\c} command,
+           except that \\tt parses QDoc commands (like \l {i}{\\i}, \l
+           {bold}{\\bold} and \l {underline}{\\underline}) contained
+           within its argument.
+
+           The command renders its argument using a monospace
+           font. For example:
+
+           \code
+           / *!
+               After \c setupUi() populates the main container with
+               child widgets it scans the main container's list of
+               slots for names with the form
+               \tt{on_\i{objectName}_\i{signalName}().}
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               After \c setupUi() populates the main container with
+               child widgets it scans the main container's list of
+               slots for names with the form
+               \tt{on_\i{objectName}_\i{signalName}().}
+           \endquotation
+
+           The \\tt command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation, parentheses
+           and use of braces} for the argument.
+
+           See also \l {c}{\\c}.
+
+    \row
+        \o \bold \\bold \target bold
+        \o \bold {The \\bold command renders its argument using
+           a bold font.}
+
+           For example:
+
+           \code
+           / *!
+               This is regular text; \bold {this text is
+               rendered using the \\bold command}.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+           This is regular text; \bold {this text is rendered using
+           the \\bold command}.
+           \endquotation
+
+           The command follows the same conventions as the \l {i}{\\i}
+           command for \l {argument}{punctuation, parentheses and use
+           of braces} for the argument.
+
+    \row
+        \o \bold \\i \target i
+        \o \bold {The \\i command renders its argument in italic.}
+
+           \warning This is preliminary functionality. For
+           more information, see the \l
+           {26-qdoc-commands-compatibility.html#i-versus-e}{compatibility}
+           section.
+
+           \target argument
+           Normally, a command argument ends at the next whitespace [1],
+           but braces can be used to group words [2]. For example:
+
+           \code
+           / *!
+               Here, we render \i {a few words} in italic.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               Here, we render \i {a few words} in italic.
+           \endquotation
+
+           If you want to use other QDoc commands within an argument
+           that contains spaces, you always need to enclose the
+           argument with braces. But QDoc is smart enough to count
+           parentheses [3], so you don't need braces in cases like this:
+
+           \code
+           / *!
+               An argument can sometimes contain whitespaces,
+               for example: \i QPushButton(tr("A Brand New Button"))
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               An argument can sometimes contain whitespaces,
+               for example: \i QPushButton(tr("A Brand New Button"))
+           \endquotation
+
+           Finally, trailing punctuation is not included in an
+           argument [4], nor is 's [5]
+
+           \raw HTML
+               <table align="center" cellpadding="2"
+                   cellspacing="1" border="0">
+               <tr valign="top" bgcolor="#a2c511">
+                   <th></th>
+                   <th>QDoc Syntax</th>
+                   <th>Generated Documentation</th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>1</td>
+                   <td>A variation of a command button is a \i menu
+                       button.</td>
+                   <td>A variation of a command button is a <i>menu</i>
+                       button.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>2</td>
+                   <td>The QPushButton widget provides a
+                       \i {command button}.</td>
+                   <td>The QPushButton widget provides a
+                       <i>command button</i>.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>3</td>
+                   <td>Another class of buttons are option buttons
+                       \i (see QRadioButton).</td>
+                   <td>Another class of buttons are option buttons
+                       <i> (see QRadioButton)</i>.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>4</td>
+                   <td>A push button emits the signal \i clicked().</td>
+                   <td>A push button emits the signal <i>clicked</i>().</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>5</td>
+                   <td>The \i QPushButton's checked property is
+                       false by default.</td>
+                   <td>The <i>QPushButton</i>'s checked property is
+                       false by default.</td>
+               </tr>
+
+               </table>
+           \endraw
+
+    \row
+        \o \bold \\sub \target sub
+        \o \bold {The \\sub command renders its argument lower
+           than the baseline of the regular text, using a smaller font.}
+
+           For example:
+
+           \code
+           / *!
+               Definition (Range): Consider the sequence
+               {x\sub n}\sub {n > 1} . The set
+
+               {x\sub 2, x\sub 3, x\sub 4, ...} = {x\sub n ; n = 2, 3, 4, ...}
+
+               is called the range of the sequence.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               Definition (Range): Consider the sequence
+               {x\sub n}\sub {n > 1} . The set
+
+               {x\sub 2, x\sub 3, x\sub 4, ...} = {x\sub n ; n = 2, 3, 4, ...}
+
+               is called the range of the sequence.
+           \endquotation
+
+           The \\sub command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation, parentheses
+           and use of braces} for the argument.
+
+    \row
+        \o \bold \\sup \target sup
+        \o \bold {The \\sup command renders its argument higher than
+           the baseline of the regular text, using a smaller font.}
+
+           For example:
+
+           \code
+           / *!
+               The series
+
+               1 + a + a\sup 2 + a\sup 3 + a\sup 4 + ...
+
+               is called the \i {geometric series}.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The series
+
+               1 + a + a\sup 2 + a\sup 3 + a\sup 4 + ...
+
+               is called the \i {geometric series}.
+           \endquotation
+
+           The \\sup command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation, parentheses
+           and use of braces} for the argument.
+
+    \row
+        \o \bold \\underline \target underline
+        \o \bold {The \\underline command renders its argument underlined.}
+
+           For example:
+
+           \code
+           / *!
+               The \underline {F}ile menu gives the users the possibility
+               to open, and edit, an existing file, save a new or modified
+               file, and exit the application.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The \underline {F}ile menu gives the users the possibility
+               to open, and edit, an existing file, save a new or modified
+               file, and exit the application.
+           \endquotation
+
+           The \\underline command follows the same conventions as the
+           \l {i}{\\i} command for \l {argument}{punctuation,
+           parentheses and use of braces} for the argument.  \endtable
+*/
+
+/*!
+    \page 05-qdoc-commands-documentstructuring.html
+    \previouspage Text Formatting Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Verbatim Code Commands
+
+    \title Document Structuring Commands
+
+    The document structuring commands divide the documentation into
+    sections. In total, there are six levels of sections in QDoc: \c
+    \part, \c \chapter, \c \section1, \c \section2, \c \section3 and
+    \c \section4. \c \section1 to \c \section4 correspond to the
+    traditional section, subsection, subsubsection and
+    subsubsubsection.
+
+    \section1 Alphabetical List
+
+    \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter},
+    \l {05-qdoc-commands-documentstructuring.html#part}{\\part},
+    \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1},
+    \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2},
+    \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3},
+    \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\part \target part
+        \o \bold {The \\part command is intended for use in
+           larger documents, and divides the document into parts.}
+
+           In general a document structuring command considers
+           everything that follows it until the first line break as
+           its argument. The argument is rendered as the unit's
+           title. If the title needs to be spanned over several lines,
+           make sure that each line (except the last one) is ended
+           with a backslash.
+
+           In total, there are six levels of sections in QDoc: \c
+           \part, \c \chapter, \c \section1, \c \section2, \c
+           \section3 and \c \section4. \c \section1 to \c \section4
+           correspond to the traditional section, subsection,
+           subsubsection and subsubsubsection.
+
+           There is a strict ordering of the section units:
+
+           \code
+           part
+              |
+              chapter
+                    |
+                    section1
+                           |
+                           section2
+                                  |
+                                  section3
+                                         |
+                                         section4
+           \endcode
+
+           For example, a \c section1 unit can only appear as the top
+           level section or inside a \c chapter unit. Skipping a
+           section unit, for example from \c part to \c section1, is
+           not allowed.
+
+           You can \i begin with either of the three: \c part, \c
+           chapter or \c section1. For example:
+
+
+           \code
+           / *!
+               \part Basic Qt
+
+               This is the first part.
+
+
+                   \chapter Getting Started
+
+                   This is the first part's first chapter.
+
+
+                       \section1 Hello Qt
+
+                       This is the first chapter's first section.
+
+
+                       \section1 Making Connections
+
+                       This is the first chapter's second section.
+
+
+                       \section1 Using the Reference Documentation
+
+                       This is the first chapter's third section.
+
+
+                   \chapter Creating Dialogs
+
+                   This is the first part's second chapter.
+
+
+                       \section1 Subclassing QDialog
+
+                       This is the second chapter's first section.
+
+                       ...
+
+
+               \part Intermediate Qt
+
+               This is the second part.
+
+
+                   \chapter Layout Management
+
+                   This is the second part's first chapter.
+
+
+                       \section1 Basic Layouts
+
+                       This is the first chapter's first section.
+
+               ...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+           \raw HTML
+               <a name="Basic Qt">
+               <h1>Basic Qt</h1>
+               </a>
+               <p>This is the first part.</p>
+
+                   <a name="Getting started">
+                   <h2>Getting Started</h2>
+                   </a>
+                   This is the first part's first chapter.</p>
+
+                       <a name="Hello Qt">
+                       <h3>Hello Qt</h3>
+                       </a>
+                       <p>This is the first chapter's first section.</p>
+
+                       <a name="Making Connections">
+                       <h3>Making Connections</h3>
+                       </a>
+                       <p>This is the first chapter's second section.</p>
+
+                       <a name="Using the Reference Documentation">
+                       <h3>Using the Reference Documentation</h3>
+                       </a>
+                       <p>This is the first chapter's third section.</p>
+
+                   <a name="Creating Dialogs">
+                   <h2>Creating Dialogs</h2>
+                   </a>
+                   <p>This is the first part's second chapter.</p>
+
+                       <a name="Subclassing QDialog">
+                       <h3>Subclassing QDialog</h3>
+                       </a>
+                       <p>This is the second chapter's first section.</p>
+
+                       ...
+
+               <a name="Intermediate Qt">
+               <h1>Intermediate Qt</h1>
+               </a>
+               <p>This is the second part.</p>
+
+                   <a name="Layout Management">
+                   <h2>Layout Management</h2>
+                   </a>
+                   <p>This is the second part's first chapter.</p>
+
+                       <a name="Basic Layouts">
+                       <h3>Basic Layouts</h3>
+                       </a>
+                       <p>This is the first chapter's first section.</p>
+
+               ...
+
+           \endraw
+           \endquotation
+
+           Each section level is a logical unit within the
+           document. Its title will appear on the table of contents
+           generated by the \l
+           {11-qdoc-commands-documentcontents.html#tableofcontents}
+           {\\tableofcontents} command. For example:
+
+           \code
+           / *!
+               Contents:
+
+               \tableofcontents
+
+               ...
+            * /
+            \endcode
+
+            will expand to
+
+            \quotation
+            \raw HTML
+                <p>Contents:</p>
+
+                <ul>
+                <li><a href="#Basic Qt">Basic Qt</a></li>
+                    <ul>
+                    <li><a href="#Getting Started">Getting Started</a></li>
+                        <ul>
+                        <li><a href="#Hello Qt">Hello Qt</a></li>
+                        <li><a href="#Making Connections">
+                            Making Connections</a></li>
+                        <li><a href="#Using the Reference Documentation">
+                            Using the Reference Documentation</a></li>
+                        </ul>
+                    <li><a href="#Creating Dialogs">Creating Dialogs</a></li>
+                        <ul>
+                        <li><a href="#Subclassing QDialog">
+                            Subclassing QDialog</a></li>
+                        </ul>
+                    </ul>
+                <li><a href="#Intermediate Qt">Intermediate Qt</a></li>
+                    <ul>
+                    <li><a href="#Layout Management">
+                        Layout Management</a></li>
+                        <ul>
+                        <li><a href="#Basic Layouts">Basic Layouts</a></li>
+                        </ul>
+                    </ul>
+                </ul>
+
+                ...
+            \endraw
+            \endquotation
+
+    \row
+        \o \bold \\chapter \target chapter
+        \o \bold {The \\chapter command is intended for use in
+           larger documents, and divides the document into chapters.}
+
+           See \l{part}{\\part} for an explanation of the various
+           section units, command argument and rendering.
+
+    \row
+        \o \bold \\section1 \target sectionOne
+        \o \bold {The \\section1 command starts a new section.}
+
+           See \l{part}{\\part} for an explanation of the various
+           section units, command argument and rendering.
+    \row
+        \o \bold \\section2 \target sectionTwo
+        \o \bold {The \\section2 command starts a new section.}
+
+           See \l{part}{\\part} for an explanation of the various
+           section units, command argument and rendering.
+
+    \row
+        \o \bold \\section3 \target sectionThree
+        \o \bold {The \\section3 command starts a new section.}
+
+           See \l{part}{\\part} for an explanation of the various
+           section units, command argument and rendering.
+
+    \row
+        \o \bold \\section4 \target sectionFour
+        \o \bold {The \\section4 command starts a new section.}
+
+           See \l{part}{\\part} for an explanation of the various
+           section units, command argument and rendering.
+
+    \endtable
+*/
+
+/*!
+    \page 06-qdoc-commands-verbatimcode.html
+    \previouspage Document Structuring Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Quoting External Code Commands
+
+    \title Verbatim Code Commands
+
+    The following commands are used to render verbatim code within the
+    documentation. The code is rendered on a new line, using a
+    typewriter font and the standard indentation.
+
+    \bold{Note:} Although all of these commands can be used to present
+    C++ code, the \l{07-0-qdoc-commands-quoting.html#snippet}{\\snippet}
+    and \l{07-0-qdoc-commands-quoting.html#codeline}{\\codeline} commands
+    should be used in preference to
+    the others when presenting valid code. This allows auxilliary tools
+    for Qt language bindings to substitute the relevant code snippets in
+    place of the C++ ones.
+
+    \section1 Alphabetical List
+
+    \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode},
+    \l {06-qdoc-commands-verbatimcode.html#code}{\\code},
+    \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode},
+    \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\code \target code
+        \o \bold {The \\code command and the corresponding
+           \\endcode command delimit a piece of verbatim code.}
+
+           Whereas the \l {c}{\\c} command can be used for short code
+           fragments within a sentence, the \\code command is for
+           longer code snippets and renders the code verbatim in a
+           separate paragraph using a typewriter font and the standard
+           indentation.
+
+           When processing any of the \\code, \l {badcode}{\\badcode},
+           \l {newcode}{\\newcode} and \l {oldcode}{\\oldcode}
+           commands, QDoc basically removes all indentation that is
+           common for the verbatim code blocks within a \c{/}\c{*!} ...
+           \c{*}\c{/} comment before it adds the standard
+           indentation. For that reason the recommended style is to
+           use 8 spaces for the verbatim code contained within these
+           commands (note that this doesn't apply to externally
+           quoted code using the \l {quotefromfile}{\\quotefromfile}
+           or \l {quotefile}{\\quotefile} command).
+
+           For example:
+
+           \code
+           / *!
+               \code
+                   #include <QApplication>
+                   #include <QPushButton>
+
+                   int main(int argc, char *argv[])
+                   {
+                       ...
+                   }
+               \ endcode
+           * /
+           \endcode
+
+           will be rendered as
+
+           \code
+               #include <QApplication>
+               #include <QPushButton>
+
+               int main(int argc, char *argv[])
+               {
+                   ...
+               }
+           \endcode
+
+           Other QDoc commands are disabled within
+           \\code... \\endcode, and the special character '\\' is
+           accepted and rendered like the rest of the code.
+
+           You need to type the code manually between the \\code and
+           \\endcode commands. If you want to include code snippets
+           from a particular file, use the \l
+           {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile}
+           command instead.
+
+           See also \l {c}{\\c}, \l
+           {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile},
+           \l {badcode}{\\badcode}, \l {newcode}{\\newcode} and \l
+           {oldcode}{\\oldcode}.
+
+    \row
+        \o \bold \\badcode \target badcode
+        \o \bold {The \\badcode command and the corresponding
+           \\endcode command delimit a piece of code that doesn't
+           compile or is wrong for some other reason.}
+
+           The \\badcode command is similar the \l {code}{\\code}
+           command, but renders the code using a grey font instead of
+           black (the default).
+
+           Like the \l {code}{\\code} command, it renders its code on
+           a new line in the documentation using a typewriter font and
+           the standard indentation. For example:
+
+           \code
+           / *!
+               The statement below is rendered using the
+               regular \\code command:
+
+               \code
+                   statusbar()->message(tr("Host %1 found").arg(hostName));
+               \ endcode
+
+               While the following  statement is rendered using
+               the \\badcode command:
+
+               \badcode
+                   statusbar()->message(tr("Host" + hostName + " found"));
+               \ endcode
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The statement below is rendered using the
+               regular \\code command:
+
+               \code
+                   statusbar()->message(tr("Host %1 found").arg(hostName));
+               \endcode
+
+               While the following  statement is rendered using
+               the \\badcode command:
+
+               \badcode
+                   statusbar()->message(tr("Host" + hostName + " found"));
+               \endcode
+           \endquotation
+
+           Other QDoc commands are disabled within
+           \\badcode... \\endcode, and the special character '\\' is
+           accepted and rendered like the rest of the code.
+
+           See also \l {code}{\\code}, \l {newcode}{\\newcode} and \l
+           {oldcode}{\\oldcode}.
+
+    \row
+        \o \bold \\newcode \target newcode
+        \o \bold {The \\newcode command, and the associated \\oldcode
+           and \\endcode commands, indicate how to port a piece of
+           code to a new version of an API.}
+
+           The \\newcode command, and its companion the \\oldcode
+           command, is a convenience combination of the \l
+           {code}{\\code} and \l {badcode}{\\badcode} commands: The
+           combination provides a text relating the two code snippets
+           to each other. The command requires a preceding \\oldcode
+           statement.
+
+           Like the \l {code}{\\code} and \l {badcode}{\\badcode}
+           commands, the \\newcode command renders its code on a new
+           line in the documentation using a typewriter font and the
+           standard indentation. For example:
+
+           \code
+           / *!
+               \oldcode
+                   if (printer->setup(parent))
+                       ...
+               \newcode
+                   QPrintDialog dialog(printer, parent);
+                       if (dialog.exec())
+                           ...
+               \ endcode
+           * /
+           \endcode
+
+           is rendered like this:
+
+           \quotation
+               \oldcode
+                   if (printer->setup(parent))
+                       ...
+               \newcode
+                   QPrintDialog dialog(printer, parent);
+                       if (dialog.exec())
+                           ...
+               \endcode
+           \endquotation
+
+           Other QDoc commands are disabled within
+           \\oldcode ... \\endcode, and the '\\' character doesn't need
+           to be escaped.
+
+    \row
+        \o \bold \\oldcode \target oldcode
+        \o \bold {The \\oldcode command requires a corresponding
+           \\newcode statement; otherwise QDoc fails to parse the command
+           and emits a warning.}
+
+           See also \l {newcode}{\\newcode} and \l {badcode}{\\badcode}.
+    \endtable
+*/
+
+/*!
+    \page 07-0-qdoc-commands-quoting.html
+    \previouspage Verbatim Code Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Linking Commands
+
+    \title Quoting External Code Commands
+
+    The following commands enable quoting from files in the
+    documentation: You can make QDoc include the complete contents of
+    a file, or you can quote specific parts of the file and skip
+    others. The typical use of the latter is to quote a file chunk by
+    chunk.
+
+    \bold{Note:} Although all of these commands can be used to present
+    C++ code, the \l{#snippet}{\\snippet} and \l{#codeline}{\\codeline}
+    commands should be used in preference to
+    the others when presenting valid code. This allows auxilliary tools
+    for Qt language bindings to substitute the relevant code snippets in
+    place of the C++ ones.
+
+    \section1 Alphabetical List
+
+    \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline},
+    \l {07-0-qdoc-commands-quoting.html#dots}{\\dots},
+    \l {07-0-qdoc-commands-quoting.html#printline}{\\printline},
+    \l {07-0-qdoc-commands-quoting.html#printto}{\\printto},
+    \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil},
+    \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile},
+    \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile},
+    \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline},
+    \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto},
+    \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil},
+    \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\quotefile \target quotefile
+        \o \bold {The \\quotefile command expands to the complete
+           contents of the file given as argument.}
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the file name with a line
+           break.
+
+           The file's contents is rendered in a separate paragraph,
+           using a typewriter font and the standard indentation. The
+           code is shown verbatim.
+
+           For example:
+
+           \code
+           / *!
+               This is a simple "Hello world" example:
+
+               \quotefile examples/main.cpp
+
+               It contains only the bare minimum you need
+               to get a Qt application up and running.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               This is a simple "Hello world" example:
+
+               \quotefile examples/main.cpp
+
+               It contains only the bare minimum you need to get a Qt
+               application up and running.
+           \endquotation
+
+           \warning If you use the \l {QDoc
+           Compatibility}{compat.qdocconf} file this command is called
+           \\include.
+
+           See also \l {quotefromfile}{\\quotefromfile} and \l
+           {code}{\\code}.
+
+    \row
+        \o \bold \\quotefromfile \target quotefromfile
+        \o \bold {The \\quotefromfile command opens the file
+           given as argument for quoting.}
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the file name with a line
+           break.
+
+           The command is intended for use when quoting parts from
+           file with the walkthrough commands: \l
+           {printline}{\\printline}, \l {printto}{\\printto}, \l
+           {printuntil}{\\printuntil}, \l {skipline}{\\skipline}, \l
+           {skipto}{\\skipto}, \l {skipuntil}{\\skipuntil}. This
+           enables you to quote specific portions of a file. For
+           example:
+
+           \code
+           / *!
+               The whole application is contained within
+               the \c main() function:
+
+               \quotefromfile examples/main.cpp
+
+               \skipto main
+               \printuntil app(argc, argv)
+
+               First we create a QApplication object using
+               the \c argc and \c argv parameters.
+
+               \skipto QPushButton
+               \printuntil resize
+
+               Then we create a QPushButton, and give it a reasonable
+               size using the QWidget::resize() function.
+
+               ...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The whole application is contained within
+               the \c main() function:
+
+               \quotefromfile examples/main.cpp
+
+               \skipto main
+               \printuntil app(argc, argv)
+
+               First we create a QApplication object using the \c argc
+               and \c argv parameters.
+
+               \skipto QPushButton
+               \printuntil resize
+
+               Then we create a QPushButton, and give it a reasonable
+               size using the QWidget::resize() function.
+
+               ...
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           QDoc remembers which file it's quoting, and the current
+           position within that file (see \l {file}{\\printline} for
+           more information). There is no need to "close" the file.
+
+           Earlier we called this command \\quotefile. For more
+           information, see the \l
+           {26-qdoc-commands-compatibility.html#quotefromfile-versus-quotefile}
+           {compatibility} section.
+
+           See also \l {quotefile}{\\quotefile}, \l {code}{\\code} and
+           \l {dots}{\\dots}.
+
+    \row
+        \o \bold \\printline \target printline
+        \o \bold {The \\printline command expands to the line
+           from the current position to the next non-blank line of
+           the current souce file.}
+
+           To ensure that the documentation always is synchronized
+           with the source file, a substring of the line must be
+           specified as an argument to the command. Note that the
+           command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break.
+
+           The line from the source file is rendered as a separate
+           paragraph, using a typewriter font and the standard
+           indentation. The code is shown verbatim.
+
+           For example:
+
+           \code
+           / *!
+               There has to be exactly one QApplication object
+               in every GUI application that uses Qt.
+
+               \quotefromfile examples/main.cpp
+
+               \printline QApplication
+
+               This line includes the QApplication class
+               definition. QApplication manages various
+               application-wide resources, such as the
+               default font and cursor.
+
+               \printline QPushButton
+
+               This line includes the QPushButton class
+               definition. The QPushButton widget provides a command
+               button.
+
+               \printline main
+
+               The main function...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               There has to be exactly one QApplication object
+               in every GUI application that uses Qt.
+
+               \quotefromfile examples/main.cpp
+
+               \skipto QApplication
+               \printline QApplication
+
+               This line includes the QApplication class
+               definition. QApplication manages various
+               application-wide resources, such as the
+               default font and cursor.
+
+               \printline QPushButton
+
+               This line includes the QPushButton class
+               definition. The QPushButton widget provides a command
+               button.
+
+               \printline main
+
+               The main function...
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           \target file
+
+           QDoc reads the file sequentially. To move the current
+           position forward you can use either of the \l
+           {skipline}{\\skip...} commands. To move the current
+           position backward, you can use the \l
+           {quotefromfile}{\\quotefromfile} command again.
+
+           \target substring
+
+           If the substring argument is surrounded by slashes it is
+           interpreted as a \l {regular expression}.
+
+           For example:
+
+           \code
+           / *!
+               \quotefromfile widgets/scribble/mainwindow.cpp
+
+               \skipto closeEvent
+               \printuntil /^\}/
+
+               Close events are sent to widgets that the users want to
+               close, usually by clicking \c File|Exit or by clicking
+               the \c X title bar button. By reimplementing the event
+               handler, we can intercept attempts to close the
+               application.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \quotefromfile widgets/scribble/mainwindow.cpp
+
+               \skipto closeEvent
+               \printuntil /^\}/
+
+               Close events are sent to widgets that the users want to
+               close, usually by clicking \c File|Exit or by clicking
+               the \c X title bar button. By reimplementing the event
+               handler, we can intercept attempts to close the
+               application.
+           \endquotation
+
+           (\l {widgets/scribble}{The complete example file...})
+
+           The regular expression \c /^\}/ makes QDoc print until the
+           first '}' character occurring at the beginning of the line
+           without indentation. /.../ encloses the regular expression,
+           and '^' means the beginning of the line. The '}' character
+           must be escaped since it is a special character in regular
+           expressions.
+
+           QDoc will emit a warning if the specified substring or
+           regular expression cannot be located, i.e. if the source
+           code has changed.
+
+           See also \l {printto}{\\printto} and \l
+           {printuntil}{\\printuntil}.
+
+    \row
+        \o \bold \\printto \target printto
+        \o \bold {The \\printto command expands to all the lines
+           from the current position up to and \i excluding the
+           next line containing a given substring.}
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break. The command also follows the same conventions for \l
+           {file}{positioning} and \l {substring}{argument} as the \l
+           {printline}{\\printline} command.
+
+           The lines from the source file are rendered in a separate
+           paragraph, using a typewriter font and the standard
+           indentation. The code is shown verbatim.
+
+           For example:
+
+           \code
+           / *!
+               The whole application is contained within the
+               \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \printto hello
+
+               First we create a QApplication object using the \c argc and
+               \c argv parameters...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The whole application is contained within the
+               \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printto hello
+
+               First we create a QApplication object using the \c argc
+               and \c argv parameters...
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           See also \l {printline}{\\printline} and \l
+           {printuntil}{\\printuntil}.
+
+    \row
+        \o \bold \\printuntil \target printuntil
+        \o \bold {The \\printuntil command expands to all the lines
+           from the current position up to and \i including the next line
+           containing a given substring.}
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break. The command also follows the same conventions for \l
+           {file}{positioning} and \l {substring}{argument} as the \l
+           {printline}{\\printline} command.
+
+           The lines from the source file are rendered in a separate
+           paragraph, using a typewriter font and the standard
+           indentation. The code is shown verbatim.
+
+           For example:
+
+           \code
+           / *!
+               The whole application is contained within the
+               \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printuntil hello
+
+               First we create a QApplication object using the
+               \c argc and \c argv parameters, then we create
+               a QPushButton.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The whole application is contained within the
+               \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printuntil hello
+
+               First we create a \l
+               {http://qt.nokia.com/doc/4.0/qapplication}{QApplication}
+               object using the \c argc and \c argv parameters, then we
+               create a \l
+               {http://qt.nokia.com/doc/4.0/qpushbutton}{QPushButton}.
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           See also \l {printline}{\\printline} and \l
+           {printto}{\\printto}.
+
+    \row
+        \o \bold \\skipline \target skipline
+        \o \bold {The \\skipline command ignores the next non-blank
+           line in the current source file.}
+
+           Doc reads the file sequentially, and the \\skipline command
+           is used to move the current position (omitting a line of
+           the source file). See the remark about \l {file}{file
+           positioning} above.
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break. The command also follows the same conventions for \l
+           {substring}{argument} as the \l {printline}{\\printline}
+           command, and it is used in conjunction with the \l
+           {quotefromfile}{\\quotefromfile} command. For example:
+
+           \code
+           / *!
+               QPushButton is a GUI push button that the user
+               can press and release.
+
+               \quotefromfile examples/main.cpp
+               \skipline QApplication
+               \printline QPushButton
+
+               This line includes the QPushButton class
+               definition. For each class that is part of the
+               public Qt API, there exists a header file of
+               the same name that contains its definition.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \l
+               QPushButton is a GUI push button that the user
+               can press and release.
+
+               \quotefromfile examples/main.cpp
+               \skipto QApplication
+               \skipline QApplication
+               \printline QPushButton
+
+               This line includes the QPushButton class
+               definition. For each class that is part of the public
+               Qt API, there exists a header file of the same name
+               that contains its definition.
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           See also \l {skipto}{\\skipto}, \l
+           {skipuntil}{\\skipuntil} and \l {dots}{\\dots}.
+
+    \row
+        \o \bold \\skipto \target skipto
+        \o \bold {The \\skipto command ignores all the lines from the
+           current position up to and \i excluding the next line
+           containing a given substring.}
+
+           QDoc reads the file sequentially, and the \\skipto command
+           is used to move the current position (omitting one or
+           several lines of the source file). See the remark about \l
+           {file}{file positioning} above.
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break.
+
+           The command also follows the same conventions for \l
+           {substring}{argument} as the \l {printline}{\\printline}
+           command, and it is used in conjunction with the \l
+           {quotefromfile}{\\quotefromfile} command. For example:
+
+           \code
+           / *!
+               The whole application is contained within
+               the \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printuntil }
+
+               First we create a QApplication object.  There
+               has to be exactly one such object in
+               every GUI application that uses Qt. Then
+               we create a QPushButton, resize it to a reasonable
+               size...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The whole application is contained within
+               the \c main() function:
+
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printuntil }
+
+               First we create a QApplication object.  There has to be
+               exactly one such object in every GUI application that
+               uses Qt. Then we create a QPushButton, resize it to a
+               reasonable size ...
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           See also \l {skipline}{\\skipline}, \l
+           {skipuntil}{\\skipuntil} and \l {dots}{\\dots}.
+
+    \row
+        \o \bold \\skipuntil \target skipuntil
+        \o \bold {The \\skipuntil command ignores all the lines from
+           the current position up to and \i including the next line
+           containing a given substring.}
+
+           QDoc reads the file sequentially, and the \\skipuntil
+           command is used to move the current position (omitting one
+           or several lines of the source file). See the remark about
+           \l {file}{file positioning} above.
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the substring with a line
+           break.
+
+           The command also follows the same conventions for \l
+           {substring}{argument} as the \l {printline}{\\printline}
+           command, and it is used in conjunction with the \l
+           {quotefromfile}{\\quotefromfile} command. For example:
+
+           \code
+           / *!
+               The first thing we did in the \c main() function
+               was to create a QApplication object \c app.
+
+               \quotefromfile examples/main.cpp
+               \skipuntil show
+               \dots
+               \printuntil }
+
+               In the end we must remember to make \c main() pass the
+               control to Qt. QCoreApplication::exec() will return when
+               the application exits...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The first thing we did in the \c main() function was to
+               create a QApplication object \c app.
+
+               \quotefromfile examples/main.cpp
+               \skipuntil show
+               \dots
+               \printuntil }
+
+               In the end we must remember to make \c main() pass the
+               control to Qt. QCoreApplication::exec()
+               will return when the application exits...
+           \endquotation
+
+           (\l {Example File}{The complete example file...})
+
+           See also \l {skipline}{\\skipline}, \l {skipto}{\\skipto}
+           and \l {dots}{\\dots}.
+
+    \row
+        \o \bold \\dots \target dots
+        \o \bold {The \\dots command indicates that parts of the
+           source file have been omitted when quoting a file.}
+
+           The command is used in conjunction with the \l
+           {quotefromfile}{\\quotefromfile} command, and should be
+           stated on its own line. The dots are rendered on a new
+           line, using a typewriter font. For example:
+
+           \code
+           / *!
+               \quotefromfile examples/main.cpp
+               \skipto main
+               \printuntil {
+               \dots
+               \skipuntil exec
+               \printline }
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotefromfile examples/main.cpp
+           \skipto main
+           \printuntil {
+           \dots
+           \skipuntil exec
+           \printline }
+
+           (\l {Example File}{The complete example file...})
+
+           The default indentation is 4 spaces, but this can be
+           adjusted using the command's optional argument. For
+           example:
+
+            \code
+           / *!
+               \dots 0
+               \dots
+               \dots 8
+               \dots 12
+               \dots 16
+           * /
+           \endcode
+
+           will be rendered as
+
+           \dots 0
+           \dots
+           \dots 8
+           \dots 12
+           \dots 16
+
+           See also \l {skipline}{\\skipline}, \l
+           {skipto}{\\skipto} and \l {skipuntil}{\\skipuntil}.
+
+    \row
+        \o \bold \\snippet \target snippet
+        \o \bold {The \\snippet command causes a code snippet to be included
+           verbatim as preformatted text, which may be syntax highlighted.}
+           
+           Each code snippet are referenced by the file that holds it and by
+           a unique identifier for that file. Snippet files are typically
+           stored in a \c{snippets} directory inside the documentation
+           directory (e.g., \c{$QTDIR/doc/src/snippets}).
+
+           For example, the following documentation references a snippet in
+           a file residing in a subdirectory of the documentation directory:
+           
+           \code
+           \snippet snippets/textdocument-resources/main.cpp Adding a resource
+           \endcode
+           
+           The text following the file name is the unique identifier for the
+           snippet. This is used to delimit the quoted code in the relevant
+           snippet file as shown in the following example that corresponds to
+           the above \c{\\snippet} command:
+           
+           \dots
+           \code
+               QImage image(64, 64, QImage::Format_RGB32);
+               image.fill(qRgb(255, 160, 128));
+
+           //! [Adding a resource]
+               document->addResource(QTextDocument::ImageResource,
+                   QUrl("mydata://image.png"), QVariant(image));
+           //! [Adding a resource]
+           \endcode
+           \dots
+    \row
+        \o \bold \\codeline \target codeline
+        \o \bold{The \\codeline command inserts a blank line of preformatted
+           text. It is used to insert gaps between snippets without closing
+           the current preformatted text area and opening a new one.}
+    \endtable
+*/
+
+/*!
+    \page  07-1-example.html
+    \previouspage Quoting External Code Commands
+    \contentspage QDoc Manual - Table of Contents
+
+    \title Example File
+
+    \quotefile examples/main.cpp
+*/
+
+/*!
+    \page 08-qdoc-commands-linking.html
+    \previouspage Quoting External Code Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Graphic Commands
+
+    \title Linking Commands
+
+    The linking commands make it possible to create hyperlinks to
+    classes, functions, header files and examples. They also make it
+    possible to link to targets within a document, as well as to other
+    documents and URLs.
+
+    \section1 Alphabetical List
+
+    \l {08-qdoc-commands-linking.html#keyword}{\\keyword},
+    \l {08-qdoc-commands-linking.html#l}{\\l},
+    \l {08-qdoc-commands-linking.html#sa}{\\sa},
+    \l {08-qdoc-commands-linking.html#target}{\\target}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\l \target l
+        \o \bold {The \\l command is used to create hyperlinks. }
+
+           The command's general syntax is
+
+           \code
+           \l {link target}{link text}
+           \endcode
+
+           For example:
+
+           \code
+           / *!
+               Read the \l {http://qt.nokia.com/doc/4.0/}
+               {Qt's Reference Documentation} carefully.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+              Read the \l {http://qt.nokia.com/doc/4.0/}
+              {Qt's Reference Documentation} carefully.
+           \endquotation
+
+           If the link target is equivalent to the link text, the
+           second argument can be omitted.
+
+           For example, if you have documentation like:
+
+           \code
+           / *!
+               \target assertions
+
+               Assertions make some statement about the text at the
+               point where they occur in the regexp but they do not
+               match any characters.
+
+               ...
+
+               Regexps are built up from expressions, quantifiers, and
+               \l {assertions}{assertions}.
+           * /
+           \endcode
+
+           you can rewrite it as
+
+           \code
+           / *!
+               \target assertions
+
+               Assertions make some statement about the text at the
+               point where they occur in the regexp but they do not
+               match any characters.
+
+               ...
+
+               Regexps are built up from expressions, quantifiers, and
+               \l assertions.
+           * /
+           \endcode
+
+           For the one-parameter version the braces can often
+           be omitted. See the \l {i}{\\i} command for the \l
+           {argument}{argument conventions}.
+
+           The \\l command supports several kinds of links:
+
+           \list
+           \o \c {\l QWidget} - a defined \l {class}{\\class}
+           \o \c {\l QWidget::sizeHint()} - a defined member
+               function (\l {fn}{\\fn})
+           \o \c {\l <QtGlobal>} - a defined \l {headerfile}{\\headerfile}
+           \o \c {\l widgets/wiggly} - a defined
+              \l {example-command}{\\example}
+           \o \c {\l {QWidget Class Reference}} - a defined \l {title}{\\title}
+           \o \c {\l {Introduction}}- a defined \l{part}{\\part},
+              \l{chapter}{\\chapter} or \l {sectionOne}{\\section...}
+           \o \c {\l fontmatching} - a defined \l {target}{\\target}
+           \o \c {\l {Shared Classes}} - a defined \l {keyword}{\\keyword}
+           \o \c {\l network.html} - a defined \l {page}{\\page}
+           \o \c {\l http://www.trolltech.com/} - a URL
+           \endlist
+
+           QDoc also tries to make a link out of any words that don't
+           resemble any normal English words, for example Qt class
+           names or functions, like QWidget or QWidget::sizeHint(). In
+           these cases, the \\l command can actually be omitted, but
+           by using the command, you ensure that QDoc will emit a
+           warning if it cannot find the link target. In addition, if
+           you only want the function name to appear in the link, you
+           can use the following syntax:
+
+           \list
+               \o \c {\l {QWidget::}{sizeHint()}}
+           \endlist
+
+           See also \l {sa}{\\sa}, \l {target}{\\target} and \l
+           {keyword}{\\keyword}.
+
+    \row
+        \o \bold \\sa \target sa
+        \o \bold {The \\sa command defines a list of links that will
+           be rendered in a separate "See also" section at the bottom
+           of the documentation.}
+
+           The command takes a comma-separated list of links as its
+           argument. If the line ends with a comma, you can continue
+           on a second line.  The general syntax is:
+
+           \code
+           \sa {the first link}, {the second link},
+               {the third link}, ...
+           \endcode
+
+           QDoc will automatically try to generate "See also" links
+           interconnecting a property's various functions. For
+           example, an setVisible() function will automatically get a
+           link to visible() and vice versa.
+
+           In general, QDoc will generate "See also" links that
+           interconnect the functions that access the same
+           property. It recognizes four different syntax versions:
+
+           \list
+           \o \c property()
+           \o \c setProperty()
+           \o \c isProperty()
+           \o \c hasProperty()
+           \endlist
+
+           The \\sa command supports the same kind
+           of links as the \l {l}{\\l} command. For example:
+
+           \code
+           / *!
+               Appends the actions \a actions to this widget's
+               list of actions.
+
+               \sa removeAction(), QMenu, addAction()
+           * /
+           void QWidget::addActions(QList<QAction *> actions)
+           {
+           ...
+           }
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \bold {void QWidget::addActions ( QList<QAction*>
+               \i actions )}
+
+               Appends the actions \i actions to this widget's
+               list of actions.
+
+               See also \l {QWidget::removeAction()}{removeAction()},
+               \l QMenu, and \l {QWidget::addAction()}{addAction()}.
+           \endquotation
+
+           See also \l {l}{\\l}, \l {target}{\\target} and \l
+           {keyword}{\\keyword}.
+
+    \row
+        \o \bold \\target \target target
+        \o \bold {The \\target command defines an explicit point in the
+           documentation that you can later link to using the \l {l}{\\l}
+           and \l {sa}{\\sa} commands.}
+
+           The command considers the rest of the line as part of its
+           argument, make sure to follow the target name with a line
+           break.
+
+           For example:
+
+           \code
+           / *!
+               \target capturing parentheses
+               \section1 Capturing Text
+
+               Parentheses allow us to group elements together so that
+               we can quantify and capture them.
+
+               ...
+           * /
+           \endcode
+
+           can be referenced with
+
+           \list
+           \o \c {\l {capturing parentheses}}
+              (from elsewhere in the same comment)
+           \o \c {\l qregexp.html#capturing-parentheses}
+              (from anywhere else)
+           \endlist
+
+           within a documentation unit, and with
+
+           \list
+           \o \c {\l http://www.trolltech.com/4.0/doc/html/qregexp.html#capturing-parentheses}
+           \endlist
+
+           on a more global scale.
+
+           If the target name does't contain any spaces, the brackets can
+           be omitted as well.
+
+           See also \l {l}{\\l}, \l {sa}{\\sa} and \l
+           {keyword}{\\keyword}.
+
+    \row
+        \o \bold \\keyword \target keyword
+        \o \bold {The \\keyword command defines an explicit point in the
+           documentation that you can later link to using the \l {l}{\\l}
+           and \l {sa}{\\sa} commands.}
+
+           Keywords must be unique within the entire set of
+           documentation processed in on QDoc run.  The command
+           considers the rest of the line as part of its argument,
+           make sure to follow the keyword with a line break.
+
+           The \\keyword command is similar to \l {target}{\\target},
+           but stronger.  A keyword can be referenced from anywhere
+           using a simple syntax. For example:
+
+           \code
+           / *!
+               \class QRegExp
+               \reentrant
+               \brief The QRegExp class provides pattern
+                      matching using regular expressions.
+               \ingroup tools
+               \ingroup misc
+               \ingroup shared
+               \mainclass
+
+               \keyword regular expression
+
+               Regular expressions, or "regexps", provide a way to
+               find patterns within text.
+
+               ...
+           * /
+           \endcode
+
+           can be referenced like this
+
+           \code
+           / *!
+               When a string is surrounded by slashes, it's
+               interpreted as a \l regular expression.
+           * /
+           \endcode
+
+           which will be rendered as
+
+           \quotation
+               When a string is surrounded by slashes, it's
+               interpreted as a \l {regular expression}.
+           \endquotation
+
+           If the keyword does't contain any spaces, the brackets can
+           be omitted as well.
+
+           See also \l {l}{\\l}, \l {sa}{\\sa} and \l
+           {target}{\\target}.
+    \endtable
+*/
+
+/*!
+    \page 09-qdoc-commands-graphic.html
+    \previouspage Linking Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Container Commands
+
+    \title Graphic Commands
+
+    The graphic commands makes it possible to include images in the
+    documentation. The images can be rendered as separate paragraphs,
+    or within running text.
+
+    \section1 Alphabetical List
+
+    \l {09-qdoc-commands-graphic.html#caption}{\\caption},
+    \l {09-qdoc-commands-graphic.html#image}{\\image},
+    \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\image \target image
+        \o \bold {The \\image command expands to the image specified by its
+           argument, and renders it centered as a separate paragraph.}
+
+           The \\image command replaces the old \\img command. For more
+           information, see the \l
+           {26-qdoc-commands-compatibility.html#image-versus-img}
+           {compatibility} section.
+
+           The command takes two arguments. The first is the name of
+           the image file. The second argument is optional and is a
+           simple description of the image equivalent to the HTML
+           alt="" in an image tag. The description is used for
+           tooltips, and when a browser doesn't support images like
+           the Lynx text browser.
+
+           The command considers the rest of the line after the file
+           name its second argument, make sure that you follow the
+           filename or description with a line break. Braces are only
+           necessary if the description spans several lines.
+
+           For example:
+
+           \code
+           / *!
+               Qt by Trolltech is a C++ toolkit for cross-platform GUI
+               application development.
+
+               \image happyguy.jpg "Happy guy"
+
+               Qt provides single-source portability across Microsoft
+               Windows, Mac OS X, Linux, and all major commercial Unix
+               variants. It is also available for embedded devices.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               Qt by Trolltech is a C++ toolkit for cross-platform GUI
+               application development.
+
+               \image happyguy.jpg image "Happy guy"
+
+               Qt provides single-source portability across Microsoft
+               Windows, Mac OS X, Linux, and all major commercial Unix
+               variants. It is also available for embedded devices.
+           \endquotation
+
+           See also \l {inlineimage}{\\inlineimage} and \l
+           {caption}{\\caption}.
+
+    \row
+        \o \bold \\inlineimage \target inlineimage
+        \o \bold {The \\inlineimage command expands to the image
+           specified by its argument; the image is rendered inline
+           with the rest of the text.}
+
+           The command takes two arguments. The first is the name of
+           the image file. The second argument is optional and is a
+           simple description of the image equivalent to the HTML
+           alt="" in an image tag. The description is used for
+           tooltips, and when a browser doesn't support images like
+           the Lynx text browser.
+
+           The most common use of the \\inlineimage command is in
+           lists and tables. For example:
+
+           \code
+           / *!
+               \list 1
+               \o \inlineimage happy.gif Oh so happy!
+               \o \inlineimage happy.gif Oh so happy!
+               \o \inlineimage happy.gif Oh so happy!
+               \endlist
+           * /
+           \endcode
+
+           will be rendered as
+
+           \list 1
+           \o \inlineimage happy.gif Oh so happy!
+           \o \inlineimage happy.gif Oh so happy!
+           \o \inlineimage happy.gif Oh so happy!
+           \endlist
+
+           And
+
+           \code
+           / *!
+               \table
+               \header
+                   \o Trolltech
+                   \o Trolltech
+               \row
+                   \o \inlineimage happy.gif Oh so happy!
+                   \o \inlineimage happy.gif Oh so happy!
+               \row
+                   \o \inlineimage happy.gif Oh so happy!
+                   \o \inlineimage happy.gif Oh so happy!
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2"
+                   cellspacing="1" border="0">
+               <tr valign="top" bgcolor="#a2c511">
+                   <th>Trolltech</th>
+                   <th>Trolltech</th>
+               </tr>
+
+               <tr valign="top" bgcolor="#f0f0f0">
+                   <td><img src="images/happy.gif" alt="Oh so happy!" />
+                   </td>
+                   <td><img src="images/happy.gif" alt="Oh so happy!" />
+                   </td>
+               </tr>
+
+               <tr valign="top" bgcolor="#f0f0f0">
+                   <td><img src="images/happy.gif" alt="Oh so happy!"/>
+                   </td>
+                   <td><img src="images/happy.gif" alt="Oh so happy!" />
+                   </td>
+               </tr>
+
+               </table>
+           \endraw
+
+           The command can also be used to insert an image
+           inline with the regular text. For example:
+
+           \code
+           / *!
+               \inlineimage training.jpg Training by Trolltech
+               The Qt Programming course is offered as a
+               five day Open Enrollment Course. The classes
+               are open to the public.While the course is open
+               to anyone who wants to learn, attendees should
+               have significant experience in C++ development
+               to derive maximum benefit from the course.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \inlineimage training.jpg Training by Trolltech
+               The Qt Programming course is offered as a
+               five day Open Enrollment Course. The classes
+               are open to the public.While the course is open
+               to anyone who wants to learn, attendees should
+               have significant experience in C++ development
+               to derive maximum benefit from the course.
+           \endquotation
+
+           See also \l {image}{\\image} and \l {caption}{\\caption}.
+
+    \row
+        \o \bold \\caption \target caption
+        \o \bold {The \\caption command provides a caption for an image.}
+
+           The command follows the same conventions for parentheses and use
+           of braces for its \l argument as the \l {i}{\\i} command.
+
+           \warning This is preliminary functionality. The
+           command is not fully implemented.
+
+           See also \l {image}{\\image} and \l
+           {inlineimage}{\\inlineimage}
+
+    \endtable
+*/
+
+/*!
+    \page 10-qdoc-commands-container.html
+    \previouspage Graphic Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Document Contents Commands
+
+    \title Container Commands
+
+    The container commands create tables and lists with associated
+    items and contents. A list is rendered left aligned as a separate
+    paragraph. A table is rendered centered as a separate paragraph,
+    and its width depends on its content.
+
+   \section1 Alphabetical List
+
+    \l {10-qdoc-commands-container.html#header}{\\header},
+    \l {10-qdoc-commands-container.html#list}{\\list},
+    \l {10-qdoc-commands-container.html#o}{\\o},
+    \l {10-qdoc-commands-container.html#omitvalue}{\\omitvalue},
+    \l {10-qdoc-commands-container.html#row}{\\row},
+    \l {10-qdoc-commands-container.html#table}{\\table},
+    \l {10-qdoc-commands-container.html#value}{\\value}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\table \target table
+        \o \bold {The \\table command and the corresponding \\endtable
+           command delimit the contents of a table.}
+
+           The command accepts a single argument specifying the
+           table's width in percentage:
+
+           \code
+           / *!
+               \table 100 %
+
+                  ...
+
+               \endtable
+           * /
+           \endcode
+
+           The code above ensures that the table will fill all
+           available space. If the table's width is smaller than 100 %,
+           the table will be centered in the generated documentation.
+
+           A table can contain headers, rows and columns. A row starts
+           with a \l {row}{\\row} command and consists of cells, which
+           starts with a \l {o}{\\o} command. There is also a \l
+           {header}{\\header} command which is a special kind of row
+           with a special formatting. For example:
+
+           \code
+           / *!
+               \table
+               \header
+                   \o Qt Core Feature
+                   \o Brief Description
+               \row
+                   \o \l {Signal and Slots}
+                   \o Signals and slots are used for communication
+                      between objects.
+               \row
+                   \o \l {Layout Management}
+                   \o The Qt layout system provides a simple
+                      and powerful way of specifying the layout
+                      of child widgets.
+               \row
+                   \o \l {Drag and Drop}
+                   \o Drag and drop provides a simple visual
+                      mechanism which users can use to transfer
+                      information between and within applications.
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2"
+                   cellspacing="1" border="0">
+               <tr valign="top" bgcolor="#a2c511">
+                   <th>Qt Core Feature</th>
+                   <th>Brief Description</th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>
+                   <a href="http://qt.nokia.com/doc/4.0/signalsandslots.html">
+                       Signals and Slots</a>
+                   </td>
+                   <td>Signals and slots are used for communication
+                       between objects.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>
+                   <a href=http://qt.nokia.com/doc/4.0/layout.html">
+                       Layout Management</a></td>
+                   <td>The Qt layout system provides a simple
+                       and powerful way of specifying the layout
+                       of child widgets.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>
+                   <a href=http://qt.nokia.com/doc/4.0/dnd.html">
+                       Drag and Drop</a></td>
+                   <td>Drag and drop provides a simple visual
+                       mechanism which users can use to transfer
+                       information between and within applications.</td>
+               </tr>
+
+               </table>
+           \endraw
+
+           You can also make cells span several rows and columns. For
+           example:
+
+           \code
+           / *!
+               \table
+               \header
+                   \o {3,1} This header cell spans three columns
+                      but only one row.
+               \row
+                   \o {2, 1} This table cell spans two columns
+                      but only one row
+                   \o {1, 2} This table cell spans only one column,
+                   but two rows.
+               \row
+                   \o A regular table cell
+                   \o A regular table cell
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2" cellspacing="1"
+                border="0">
+
+               <tr valign="top" bgcolor="#a2c511">
+                   <th colspan="3" rowspan=" 1">
+                   This header cell spans three columns but only one row
+                   </th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td colspan="2" rowspan=" 1">
+                   This table cell spans two columns but only one row
+                   </td>
+                   <td rowspan=" 2">
+                   This table cell spans only one column, but two rows.
+                   </td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>A regular table cell</td>
+                   <td>A regular table cell</td>
+               </tr>
+
+               </table>
+           \endraw
+
+           See also \l {header}{\\header}, \l {row}{\\row} and \l {o}{\\o}.
+
+    \row
+        \o \bold \\header \target header
+        \o \bold {The \\header command indicates that the following
+           table cells are the current table's column headers.}
+
+           The command can only be used within the \l{table}
+           {\\table...\\endtable} commands. A header can contain
+           several cells. A cell is created with the \l {o}{\\o}
+           command.
+
+           A header cell's text is centered within the table cell and
+           rendered using a bold font. For example:
+
+           \code
+           / *!
+               \table
+               \header
+                   \o Qt Core Feature
+                   \o Brief Description
+               \row
+                   \o \l {Signal and Slots}
+                   \o Signals and slots are used for communication
+                      between objects.
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2"
+                   cellspacing="1" border="0">
+               <tr valign="top" bgcolor="#a2c511">
+                   <th>Qt Core Feature</th>
+                   <th>Brief Description</th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>
+                   <a href="http://qt.nokia.com/doc/4.0/signalsandslots.html">
+                       Signals and Slots</a>
+                   </td>
+                   <td>Signals and slots are used for communication
+                       between objects.</td>
+               </tr>
+               </table>
+           \endraw
+
+           See also \l {table}{\\table}, \l {row}{\\row} and \l {o}{\\o}.
+
+    \row
+        \o \bold \\row \target row
+        \o \bold {The \\row command indicates that the following table
+           cells belong to the same row in the current table.}
+
+           The command can only be used within the \l{table}
+           {\\table...\\endtable} commands. A row can contain
+           several cells. A cell is created with the \l {o}{\\o}
+           command.
+
+           The background cell color of each row alternate between two
+           shades of grey, making it easier to distinguish the rows
+           from each other. The cells' contents is left aligned.
+
+           For example:
+
+           \code
+           / *!
+               \table
+               \header
+                   \o Qt Core Feature
+                   \o Brief Description
+               \row
+                   \o \l {Signal and Slots}
+                   \o Signals and slots are used for communication
+                      between objects.
+               \row
+                   \o \l {Layout Management}
+                   \o The Qt layout system provides a simple
+                      and powerful way of specifying the layout
+                      of child widgets.
+               \row
+                   \o \l {Drag and Drop}
+                   \o Drag and drop provides a simple visual
+                      mechanism which users can use to transfer
+                      information between and within applications.
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2"
+                   cellspacing="1" border="0">
+               <tr valign="top" bgcolor="#a2c511">
+                   <th>Qt Core Feature</th>
+                   <th>Brief Description</th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>
+                   <a href="http://qt.nokia.com/doc/4.0/signalsandslots.html">
+                       Signals and Slots</a>
+                   </td>
+                   <td>Signals and slots are used for communication
+                       between objects.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>
+                   <a href=http://qt.nokia.com/doc/4.0/layout.html">
+                       Layout Management</a></td>
+                   <td>The Qt layout system provides a simple
+                       and powerful way of specifying the layout
+                       of child widgets.</td>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td>
+                   <a href=http://qt.nokia.com/doc/4.0/dnd.html">
+                       Drag and Drop</a></td>
+                   <td>Drag and drop provides a simple visual
+                       mechanism which users can use to transfer
+                       information between and within applications.</td>
+               </tr>
+
+               </table>
+           \endraw
+
+           See also \l {table}{\\table}, \l {header}{\\header} and \l
+           {o}{\\o}.
+
+    \row
+        \o \bold \\value \target value
+        \o \bold {The \\value command starts the documentation of a C++ enum
+           item}.
+
+           The command's first argument is the enum item. Then follows
+           its associated description. The description argument ends
+           at the next blank line or \\value. The arguments are
+           rendered within a table.
+
+           The documentation will be located in the associated class,
+           header file or namespace documentation. See the \l
+           {enum}{\\enum} documentation for an example.
+
+           See also \l {enum}{\\enum} and \l {omitvalue}{\\omitvalue}.
+
+    \row
+        \o \bold \\omitvalue \target omitvalue
+        \o \bold {The \\omitvalue command excludes a C++ enum item
+           from the documentation}.
+
+           The command's only argument is the name of the enum item
+           that will be omitted. See the \l {enum}{\\enum}
+           documentation for an example.
+
+           See also \l {enum}{\\enum} and \l {value}{\\value}.
+
+    \row
+        \o \bold \\list \target list
+        \o \bold {The \\list command and the corresponding \\endlist
+           command delimit a list of items.}
+
+           You need to create each list item explicitly using the \l
+           {o}{\\o} command. A list can contain one or more items; it
+           can also be nested. For example:
+
+           \code
+           / *!
+               \list
+               \o Qt Reference Documentation: Getting Started
+                   \list
+                   \o How to Learn Qt
+                   \o Installation
+                       \list
+                       \o Qt/X11
+                       \o Qt/Windows
+                       \o Qt/Mac
+                       \o Qt/Embedded
+                       \endlist
+                   \o Tutorial and Examples
+                   \endlist
+               \endlist
+           * /
+           \endcode
+
+           will be rendered as
+
+           \list
+           \o Qt Reference Documentation: Getting Started
+               \list
+               \o How to Learn Qt
+               \o Installation
+                   \list
+                   \o Qt/X11
+                   \o Qt/Windows
+                   \o Qt/Mac
+                   \o Qt/Embedded
+                   \endlist
+               \o Tutorial and Examples
+               \endlist
+           \endlist
+
+           The \\list command takes an optional argument providing
+           alternative appearances for the list items. For example:
+
+           \code
+           / *!
+               \list
+                   \o How to Learn Qt
+                   \o Installation
+                   \o Tutorial and Examples
+               \endlist
+           * /
+           \endcode
+
+           will render the list items with bullets (the default):
+
+           \list
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+           \endlist
+
+           If you provide 'A' as an argument to the \\list command,
+           the bullets are replaced with characters following in
+           alphabetical order:
+
+           \list A
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+           \endlist
+
+           If you replace 'A' with '1', the list items are rendered
+           with numbers following in ascending order:
+
+           \list 1
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+
+           \endlist
+
+           If you provide 'i' as the argument, the default bullets are
+           replaced with roman numerals:
+
+           \list i
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+           \endlist
+
+           Or finally, you can make the list items appear with roman
+           numbers following in ascending order if you provide 'I' as
+           the optional argument:
+
+           \list I
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+           \endlist
+
+           You can also make the listing start at any character or
+           number by simply provide the number or character you want
+           to start at. For example:
+
+           \code
+           / *!
+               \list G
+                   \o How to Learn Qt
+                   \o Installation
+                   \o Tutorial and Examples
+               \endlist
+           * /
+           \endcode
+
+           will be rendered as
+
+           \list G
+               \o How to Learn Qt
+               \o Installation
+               \o Tutorial and Examples
+           \endlist
+
+           See also \l {o}{\\o}.
+
+    \row
+        \o \bold \\o \target o
+        \o \bold {The \\o command announce a table or list item.}
+
+           Earlier we used the \l {i}{\\i} command for this purpose. For more
+           information see the \l
+           {26-qdoc-commands-compatibility.html#o-versus-i}{compatibility}
+           section.
+
+           The command can only be used within the \l{table}
+           {\\table...\\endtable} or \l{list}{\\list... \\endlist}
+           commands.
+
+           It considers everything until the next occurrence
+           of the \\o command, or the currently applicable \l
+           {table}{\\endtable} or \l {list}{\\endlist} command, as its
+           argument. For examples, see \l {table}{\\table} and \l
+           {list}{\\list}.
+
+           If the command is used within a table, you can in addition
+           specify how many rows or columns the item should span. For
+           example:
+
+           \code
+           / *!
+               \table
+               \header
+                   \o {3,1} This header cell spans three columns
+                      but only one row.
+               \row
+                   \o {2, 1} This table item spans two columns
+                      but only one row
+                   \o {1, 2} This table item spans only one column,
+                   but two rows.
+               \row
+                   \o A regular table item
+                   \o A regular table item
+               \endtable
+           * /
+           \endcode
+
+           will be rendered as
+
+           \raw HTML
+               <table align="center" cellpadding="2" cellspacing="1"
+                border="0">
+
+               <tr valign="top" bgcolor="#a2c511">
+                   <th colspan="3" rowspan=" 1">
+                   This header cell spans three columns but only one row
+                   </th>
+               </tr>
+
+               <tr valign="top" bgcolor="#d0d0d0">
+                   <td colspan="2" rowspan=" 1">
+                   This table item spans two columns but only one row
+                   </td>
+                   <td rowspan=" 2">
+                   This table item spans only one column, but two rows.
+                   </td>
+               </tr>
+
+               <tr valign="top" bgcolor="#c0c0c0">
+                   <td>A regular table item</td>
+                   <td>A regular table item</td>
+               </tr>
+
+               </table>
+           \endraw
+
+           If not specified, the item will span one column and one row.
+
+           See also \l {table}{\\table}, \l {header}{\\header},
+           \l {list}{\\list} and \l {o}{\\o}.
+    \endtable
+*/
+
+/*!
+    \page 11-qdoc-commands-documentcontents.html
+    \previouspage Container Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Miscellaneous Commands
+
+    \title Document Contents Commands
+
+    The document contents commands identify parts of the documentation,
+    i.e. parts with a special rendering, conceptual meaning or
+    function.
+
+    \section1 Alphabetical List
+
+    \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract},
+    \l {11-qdoc-commands-documentcontents.html#brief}{\\brief},
+    \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote},
+    \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese},
+    \l {11-qdoc-commands-documentcontents.html#tableofcontents}
+       {\\tableofcontents},
+    \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation},
+    \l {11-qdoc-commands-documentcontents.html#warning}{\\warning}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\abstract \target abstract
+        \o \bold {The \\abstract command and the corresponding \\endabstract
+           command delimit a document's abstract section.}
+
+           The abstract section is rendered as an indented italicized
+           paragraph.
+
+           \warning This is preliminary funcionality. The
+           command is not fully implemented. Currently, the abstract
+           section is rendered as a regular HTML paragraph. For
+           example:
+
+           \code
+           / *!
+               \abstract
+                   Qt by Trolltech is a C++ toolkit for cross-platform
+                   GUI application development. Qt provides
+                   single-source portability across Microsoft Windows,
+                   Mac OS X, Linux, and all major commercial Unix
+                   variants. It is also available for embedded
+                   devices.
+               \endabstract
+           * /
+           \endcode
+
+           will be rendered as
+
+           \abstract
+              Qt by Trolltech is a C++ toolkit for cross-platform GUI
+              application development. Qt provides single-source
+              portability across Microsoft Windows, Mac OS X, Linux,
+              and all major commercial Unix variants. It is also
+              available for embedded devices.
+           \endabstract
+
+    \row
+        \o \bold \\quotation \target quotation
+        \o \bold { The \\quotation command and the corresponding
+           \\endquotation command delimit a quotation remark.}
+
+           This command replaces the old \\quote command. For more
+           information see the \l
+           {26-qdoc-commands-compatibility.html#quotation-versus-quote}
+           {compatibility} section.
+
+           The remark is rendered as a separate centered
+           paragraph. For example:
+
+           \code
+           / *!
+               While the prospect of a significantly broader market is
+               good news for Firstlogic, the notion also posed some
+               challenges. Dave Dobson, director of technology for the La
+               Crosse, Wisconsin-based company, said:
+
+
+               \quotation
+                   As our solutions were being adopted into new
+                   environments, we saw an escalating need for easier
+                   integration with a wider range of enterprise
+                   applications.
+               \endquotation
+           * /
+           \endcode
+
+           will be rendered as
+
+           While the prospect of a significantly broader market is
+           good news for Firstlogic, the notion also posed some
+           challenges. Dave Dobson, director of technology for the La
+           Crosse, Wisconsin-based company, said:
+
+           \quotation
+               As our solutions were being adopted into new
+               environments, we saw an escalating need for easier
+               integration with a wider range of enterprise
+               applications.
+           \endquotation
+
+    \row
+        \o \bold \\footnote \target footnote
+        \o \bold {The \\footnote command and the corresponding
+           \\endfootnote command delimit a footnote.}
+
+           The footnote follows the standard conventions, rendered at the
+           bottom of the page.
+
+           \warning This is preliminary funcionality. The
+           command is not fully implemented.
+
+           For example:
+
+           \code
+           / *!
+               In Qt 4 we have tried to simplify the constructors of
+               QObject/QWidget subclasses. This makes subclassing
+               easier, at the same time as it helps make the Qt
+               library more efficient.
+
+               \footnote
+               Constructors no longer take a "const char *name"
+               parameter. If you want to specify a name for a QObject,
+               you must call QObject::setObjectName() after
+               construction. The object name is now a QString.
+               \endfootnote
+
+               QWidget's WFlags data type has been split in two:
+               Qt::WindowFlags specifies low-level window flags (the
+               type of window and the frame style), whereas
+               Qt::WidgetAttribute specifies various higher-level
+               attributes about the widget (e.g.,
+               WA_StaticContents).
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               In Qt 4 we have tried to simplify the constructors of
+               QObject/QWidget subclasses. This makes subclassing
+               easier, at the same time as it helps make the Qt
+               library more efficient.
+
+               \footnote
+               Constructors no longer take a "const char *name"
+               parameter. If you want to specify a name for a QObject,
+               you must call QObject::setObjectName() after
+               construction. The object name is now a QString.
+               \endfootnote
+
+               QWidget's WFlags data type has been split in two:
+               Qt::WindowFlags specifies low-level window flags (the
+               type of window and the frame style), whereas
+               Qt::WidgetAttribute specifies various higher-level
+               attributes about the widget (e.g.,
+               WA_StaticContents).
+           \endquotation
+
+    \row
+        \o \bold \\tableofcontents \target tableofcontents
+        \o \bold {The \\tableofcontents command generates a
+           table displaying the titles of the current documentation
+           unit's parts, chapters, sections, etc.}
+
+           The command accepts a single optional argument:
+
+           \code
+               \tableofcontents sectionN
+           \endcode
+
+           where \c sectionN is the deepest section to include (by
+           default all sections are included).
+
+           For example, it the documentation unit's structure looks
+           something like this:
+
+           \quotation
+           \raw HTML
+               <a name="Basic Qt">
+               <h1>Basic Qt</h1>
+               </a>
+               <p>This is the first part.</p>
+
+                   <a name="Getting started">
+                   <h2>Getting Started</h2>
+                   </a>
+                   This is the first part's first chapter.</p>
+
+                       <a name="Hello Qt">
+                       <h3>Hello Qt</h3>
+                       </a>
+                       <p>This is the first chapter's first section.</p>
+
+                       <a name="Making Connections">
+                       <h3>Making Connections</h3>
+                       </a>
+                       <p>This is the first chapter's second section.</p>
+
+                       <a name="Using the Reference Documentation">
+                       <h3>Using the Reference Documentation</h3>
+                       </a>
+                       <p>This is the first chapter's third section.</p>
+
+                   <a name="Creating Dialogs">
+                   <h2>Creating Dialogs</h2>
+                   </a>
+                   <p>This is the first part's second chapter.</p>
+
+                       <a name="Subclassing QDialog">
+                       <h3>Subclassing QDialog</h3>
+                       </a>
+                       <p>This is the second chapter's first section.</p>
+
+                       ...
+
+               <a name="Intermediate Qt">
+               <h1>Intermediate Qt</h1>
+               </a>
+               <p>This is the second part.</p>
+
+                   <a name="Layout Management">
+                   <h2>Layout Management</h2>
+                   </a>
+                   <p>This is the second part's first chapter.</p>
+
+                       <a name="Basic Layouts">
+                       <h3>Basic Layouts</h3>
+                       </a>
+                       <p>This is the first chapter's first section.</p>
+
+               ...
+
+           \endraw
+           \endquotation
+
+           Then
+
+           \code
+           / *!
+               Contents:
+
+               \tableofcontents
+
+               ...
+           * /
+           \endcode
+
+           will expand to
+
+           \quotation
+           \raw HTML
+               <p>Contents:</p>
+
+               <ul>
+               <li><a href="#Basic Qt">Basic Qt</a></li>
+                   <ul>
+                   <li><a href="#Getting Started">Getting Started</a></li>
+                       <ul>
+                       <li><a href="#Hello Qt">Hello Qt</a></li>
+                       <li><a href="#Making Connections">
+                           Making Connections</a></li>
+                       <li><a href="#Using the Reference Documentation">
+                           Using the Reference Documentation</a></li>
+                       </ul>
+                   <li><a href="#Creating Dialogs">Creating Dialogs</a></li>
+                       <ul>
+                       <li><a href="#Subclassing QDialog">
+                           Subclassing QDialog</a></li>
+                       </ul>
+                   </ul>
+               <li><a href="#Intermediate Qt">Intermediate Qt</a></li>
+                   <ul>
+                   <li><a href="#Layout Management">Layout Management</a></li>
+                       <ul>
+                       <li><a href="#Basic Layouts">Basic Layouts</a></li>
+                       </ul>
+                   </ul>
+               </ul>
+
+               ...
+           \endraw
+           \endquotation
+
+           Each table entry becomes a link to the corresponding part,
+           chapter or section.
+
+    \row
+        \o \bold \\brief \target brief
+        \o \bold {The \\brief command introduces a one-sentence
+           description of a class, namespace, header file, property
+           or variable.}
+
+           The brief text is used to introduce the documentation of
+           the associated object, and in lists generated using the \l
+           {generatelist}{\\generatelist} command.
+
+           The \\brief command can be used in two significant
+           different ways: \l {brief class}{One for classes,
+           namespaces and header files}, and \l {brief property}{one
+           for properties and variables}.
+
+           \target brief property
+
+           When the \\brief command is used to describe a property or
+           a variable, the brief text must only be a sentence fragment
+           and start with "whether" (for boolean properties and
+           variables) or "the" (for any other property or variable).
+
+           For example the boolean QWidget::isWindow property:
+
+           \code
+           / *!
+               \property QWidget::isActiveWindow
+               \brief whether this widget's window is the active window
+
+               The active window is the window that contains the widget that
+               has keyboard focus.
+
+               When popup windows are visible, this property is true
+               for both the active window \e and for the popup.
+
+               \sa activateWindow(), QApplication::activeWindow()
+           * /
+           \endcode
+
+           and the QWidget::geometry property
+
+           \code
+           / *!
+               \property QWidget::geometry
+               \brief the geometry of the widget relative to its parent and
+               excluding the window frame
+
+               When changing the geometry, the widget, if visible,
+               receives a move event (moveEvent()) and/or a resize
+               event (resizeEvent()) immediately.
+
+               ...
+
+              \sa frameGeometry(), rect(), ...
+           * /
+           \endcode
+
+           The latter will be rendered as
+
+           \quotation
+               \raw HTML
+                   <h3>geometry :
+                   <a href="http://qt.nokia.com/doc/4.0/qrect.html">QRect</a>
+                   </h3>
+               \endraw
+
+               This property holds the geometry of the widget relative
+               to its parent and excluding the window frame.
+
+               ...
+
+               Access functions:
+               \list
+                   \o \bold {const QRect & geometry () const}
+                   \o \bold {void setGeometry ( int x, int y, int w, int h )}
+                   \o \bold {void setGeometry ( const QRect & )}
+               \endlist
+
+               See also \l
+               {QWidget::frameGeometry()}{frameGeometry()}, \l
+               {QWidget::rect()}{rect()}, ...
+           \endquotation
+
+           \target brief class
+
+           When the \\brief command is used to describe a class, the
+           brief text should be a complete sentence and must start
+           like this:
+
+           \code
+           The <classname> class is|provides|contains|specifies...
+           \endcode
+
+           and likewise when the command is used for namespaces or
+           header files.
+
+           \warning The brief statement is used as the first
+           paragraph of the detailed description. Do not repeat the
+           sentence.
+
+           For example:
+
+           \code
+           / *!
+               \class PreviewWindow
+               \brief The PreviewWindow class is a custom widget
+                      displaying the names of its currently set
+                      window flags in a read-only text editor.
+
+               The PreviewWindow class inherits QWidget. The widget
+               displays the names of its window flags set with the
+               setWindowFlags() function. It is also provided with a
+               QPushButton that closes the window.
+
+               ...
+
+               \sa QWidget
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+                   <h1>PreviewWindow Class Reference</h1>
+               \endraw
+
+               The PreviewWindow class is a custom widget displaying
+               the names of its currently set window flags in a
+               read-only text editor. \l {preview window}{More...}
+
+               \raw HTML
+                   <h3>Properties</h3>
+               \endraw
+
+               \list
+                   \o 52 properties inherited from QWidget
+                   \o 1 property inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Public Functions</h3>
+               \endraw
+
+               \list
+                   \o \l {constructor}{PreviewWindow}(QWidget *parent = 0)
+                   \o void \l {function}{setWindowFlags}(Qt::WindowFlags flags)
+               \endlist
+
+               \list
+                   \o 183 public functions inherited from QWidget
+                   \o 28 public functions inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Public Slots</h3>
+               \endraw
+
+               \list
+                   \o 17 public slots inherited from QWidget
+                   \o 1 public slot inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Additional Inherited Members</h3>
+               \endraw
+
+               \list
+                   \o 1 signal inherited from QWidget
+                   \o 1 signal inherited from QObject
+                   \o 4 static public members inherited from QWidget
+                   \o 4 static public members inherited from QObject
+                   \o 39 protected functions inherited from QWidget
+                   \o 7 protected functions inherited from QObject
+               \endlist
+
+               \target preview window
+
+               \raw HTML
+                   <hr />
+                   <h2>Detailed Description</h2>
+               \endraw
+               The PreviewWindow class is a custom widget displaying
+               the names of its currently set window flags in a
+               read-only text editor.
+
+               The PreviewWindow class inherits QWidget. The widget
+               displays the names of its window flags set with the \l
+               {function}{setWindowFlags()} function. It is also
+               provided with a QPushButton that closes the window.
+
+               ...
+
+               See also QWidget.
+
+               \raw HTML
+                   <hr />
+                   <h2>Member Function Documentation</h2>
+               \endraw
+
+               \target constructor
+               \raw HTML
+                   <h3>PreviewWindow(QWidget *parent = 0)</h3>
+               \endraw
+
+               Constructs a preview window widget with \i parent.
+
+               \target function
+               \raw HTML
+                   <h3>setWindowFlags(Qt::WindowFlags flags)</h3>
+               \endraw
+
+               Sets the widgets flags using the
+               QWidget::setWindowFlags() function.
+
+               Then runs through the available window flags,
+               creating a text that contains the names of the flags
+               that matches the flags parameter, displaying
+               the text in the widgets text editor.
+           \endquotation
+
+           Using \\brief with a namespace can for example look like this:
+
+           \code
+           / *!
+               \namespace Qt
+
+               \brief The Qt namespace contains miscellaneous identifiers
+               used throughout the Qt library.
+           * /
+           \endcode
+
+           and finally using \\brief with a header file can look
+           something like this:
+
+           \code
+           / *!
+               \headerfile <QtGlobal>
+               \title Global Qt Declarations
+
+               \brief The <QtGlobal> header file provides basic
+               declarations and is included by all other Qt headers.
+
+               \sa <QtAlgorithms>
+           * /
+           \endcode
+
+           See also \l{property}{\\property}, \l{class}{\\class},
+           \l{namespace}{\\namespace} and  \l{headerfile}{\\headerfile}.
+
+    \row
+        \o \bold \\legalese \target legalese
+        \o \bold {The \\legalese command, and the corresponding \\endlegalese
+           command, delimit a licence agreement.}
+
+           If the \\endlegalese command is omitted, QDoc will still
+           process the \\legalese command but considers the rest of
+           the documentation page as the license agreement.
+
+           Ideally, the license documentation is located where the
+           licensed code is used.
+
+           Later the documentation identified by the \\legalese
+           command can be accumulated into a list using the \l
+           {generatelist}{\\generatelist} command with the \c legalese
+           argument. This is useful to generate an overview of all the
+           licenses associated with the source code.
+
+           For example:
+
+           \code
+           \ * !
+               ...
+
+               On X11, Qt also supports drops via the Motif Drag \&
+               Drop Protocol. The implementation incorporates some
+               code that was originally written by Daniel Dardailler,
+               and adapted for Qt by Matt Koss \<koss@napri.sk\> and
+               Trolltech. Here is the original copyright notice:
+
+               \legalese
+               \code
+
+               Copyright 1996 Daniel Dardailler.
+
+               Permission to use, copy, modify, distribute, and sell
+               this software for any purpose is hereby granted without
+               fee, provided that the above copyright notice appear in
+               all copies and that both that copyright notice and this
+               permission notice appear in supporting documentation,
+               and that the name of Daniel Dardailler not be used in
+               advertising or publicity pertaining to distribution of
+               the software without specific, written prior
+               permission. Daniel Dardailler makes no representations
+               about the suitability of this software for any
+               purpose. It is provided "as is" without express or
+               implied warranty.
+
+               Modifications Copyright 1999 Matt Koss, under the same
+               license as above.
+
+               \ endcode
+               \endlegalese
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               ...
+
+               On X11, Qt also supports drops via the Motif Drag \&
+               Drop Protocol. The implementation incorporates some
+               code that was originally written by Daniel Dardailler,
+               and adapted for Qt by Matt Koss \<koss@napri.sk\> and
+               Trolltech. Here is the original copyright notice:
+
+               \legalese
+               \code
+
+               Copyright 1996 Daniel Dardailler.
+
+               Permission to use, copy, modify, distribute, and sell
+               this software for any purpose is hereby granted without
+               fee, provided that the above copyright notice appear in
+               all copies and that both that copyright notice and this
+               permission notice appear in supporting documentation,
+               and that the name of Daniel Dardailler not be used in
+               advertising or publicity pertaining to distribution of
+               the software without specific, written prior
+               permission. Daniel Dardailler makes no representations
+               about the suitability of this software for any
+               purpose. It is provided "as is" without express or
+               implied warranty.
+
+               Modifications Copyright 1999 Matt Koss, under the same
+               license as above.
+
+               \endcode
+               \endlegalese
+           \endquotation
+
+    \row
+        \o \bold \\warning \target warning
+        \o \bold {The \\warning command renders a "Warning:" prefix to
+           the command's argument.}
+
+           For example:
+
+           \code
+           / *!
+               Qt::HANDLE is a platform-specific handle type
+               for system objects. This is  equivalent to
+               \c{void *} on Windows and Mac OS X, and to
+               \c{unsigned long} on X11.
+
+               \warning Using this type is not portable.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               Qt::HANDLE is a platform-specific handle type
+               for system objects. This is  equivalent to
+               \c{void *} on Windows and Mac OS X, and to
+               \c{unsigned long} on X11.
+
+               \warning Using this type is not portable.
+           \endquotation
+    \endtable
+*/
+
+/*!
+    \page 12-0-qdoc-commands-miscellaneous.html
+    \previouspage Document Contents Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Topical Commands
+
+    \title Miscellaneous Commands
+
+    These commands provide miscellaneous functions
+    connected to the visual appearance of the documentation, and to the
+    process of generating the documentation.
+
+    \section1 Alphabetical List
+
+    \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else},
+    \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif},
+    \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire},
+    \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist},
+    \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if},
+    \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include},
+    \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta},
+    \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit},
+    \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw},
+    \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\unicode}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\expire \target expire
+        \o \bold {The \\expire command allows you to define an expiration
+           date for your documentation.}
+
+           When using the \\expire command, QDoc will emit a warning
+           when the current date is larger than the specified
+           date. The command accepts one argument; the argument's
+           format is yyyy-mm-dd. For example:
+
+           \code
+           / *!
+               \page porting.html
+
+               \title Porting to Qt 3.x
+
+               \expire 2004-12-31
+
+               This document describes porting applications from Qt
+               2.x to Qt 3.x.
+
+               The Qt 3.x series is not binary compatible with the
+               2.x series.
+               ...
+           * /
+           \endcode
+
+           If you run QDoc on 4 July 2005, it will emit the warning
+
+           \quotation
+               porting.qdoc:6: Documentation expired 185 days ago
+           \endquotation
+
+    \row
+        \o \bold \\generatelist \target generatelist
+        \o \bold {The \\generatelist command expands to a list of
+           various documentation or links to documentation.}
+
+           For example in the Qt Reference Documentation:
+
+           \code
+           / *!
+               \page classes.html
+               \title All Qt Classes (main index)
+
+               For a shorter list that only includes the most
+               frequently used classes, see \l{Qt's Main Classes}. For
+               a list of Qt 3 support classes, see \l{Qt3Support
+               Classes}.
+
+               \generatelist classes
+           * /
+           \endcode
+
+           is used to generate \l {All Qt Classes (main index)}.
+
+           The command accepts the following arguments:
+
+           \target table example
+
+           \list
+           \o \c annotatedclasses
+
+              The \c annotatedclasses argument provides a table
+              containing the names of all the classes, and a
+              description of each class. Each class name is a link to
+              the class's reference documentation.
+
+              For example:
+
+              \quotation
+                  \raw HTML
+                  <table align="center" cellpadding="2"
+                      cellspacing="1" border="0">
+
+                  <tr valign="top" bgcolor="#d0d0d0">
+                      <td>
+                      <a href="http://qt.nokia.com/doc/4.0/qdial.html">
+                          QDial</a>
+                      </td>
+                      <td>Rounded range control (like a speedometer
+                          or potentiometer)</td>
+                  </tr>
+
+                  <tr valign="top" bgcolor="#d0d0d0">
+                      <td>
+                      <a href="http://qt.nokia.com/doc/4.0/qdialog.html">
+                          QDialog</a>
+                      </td>
+                      <td>The base class of dialog windows</td>
+                  </tr>
+
+                  <tr valign="top" bgcolor="#d0d0d0">
+                      <td>
+                      <a href="http://qt.nokia.com/doc/4.0/qdir.html">
+                          QDir</a>
+                      </td>
+                      <td>Access to directory structures and their
+                          contents</td>
+                  </tr>
+                  </table>
+                  \endraw
+              \endquotation
+
+              A class is identified within the documentation by the
+              the \l {class}{\\class} command, and the descriptions
+              are based on the argument of the \l {brief}{\\brief}
+              commands in the class documentation.
+
+           \target list example
+
+           \o \c classes
+
+              The \c classes argument provides a complete alphabetical
+              list of the classes. Each class name is a link to the
+              class's reference documentation.
+
+              For example:
+
+              \quotation
+                  \raw HTML
+                      <p><table width="100%">
+
+                      <tr>
+                      <td align="right"><b>A&nbsp;</b></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractbutton.html">QAbstractButton</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractextensionmanager.html">QAbstractExtensionManager</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractitemmodel.html">QAbstractItemModel</a></td>
+                      </tr>
+
+                      <tr>
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstracteventdispatcher.html">QAbstractEventDispatcher</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractformbuilder.html">QAbstractFormBuilder</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractitemview.html">QAbstractItemView</a></td>
+                      </tr>
+
+                      <tr>
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractextensionfactory.html">QAbstractExtensionFactory</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractitemdelegate.html">QAbstractItemDelegate</a></td>
+
+                      <td align="right"></td>
+                      <td><a href="http://qt.nokia.com/doc/4.0/qabstractlistmodel.html">QAbstractListModel</a></td>
+                      </tr>
+                      </table></p>
+                  \endraw
+              \endquotation
+
+              A class is identified within the documentation by the
+              the \l {class}{\\class} command.
+
+           \o \c classesbymodule
+
+              This particular argument requests an additional argument,
+              i.e. a specification of the module.
+
+              For example:
+
+              \code
+              / *!
+                  \page qtgui.html
+                  \contentspage Qt Classes by Module
+                  \previouspage QtCore Classes
+                  \nextpage QtNetwork Classes
+
+                  \title QtGui Classes
+
+                  \keyword QtGui
+
+                  \generatelist {classesbymodule QtGui}
+              * /
+              \endcode
+
+              Together, these arguments provide a table containing the
+              classes considered members of the specified module,
+              accompanied with a brief description. Each class name is
+              a link to the class's reference documentation.
+
+              The generated table is rendered similarily to the one
+              generated when using the \l {table example}{\c
+              annotatedclasses} argument.
+
+              For the basic classes in Qt, a class's module is
+              determined by its location, i.e. its directory. However,
+              for extensions, like ActiveQt and Qt Designer, a class
+              is related to a module with the \l
+              {inmodule}{\\inmodule} command.
+
+           \o \c classesbyedition
+
+              This particular argument requests an additional argument,
+              i.e. a specification of the edition.
+
+              For example:
+
+              \code
+              / *!
+                  \page console-edition-classes.html
+                  \title Qt Console Edition Classes
+
+                  \generatelist{classesbyedition Console}
+              * /
+              \endcode
+
+              Together, these arguments provide a table containing the
+              classes considered members of the specified edition,
+              accompanied with a brief description. Each class name is
+              a link to the class's reference documentation.
+
+              The edition a given class can be found in is determined by
+              the module it belongs to.
+
+           \o \c compatclasses
+
+              The \c compatclasses argument provides a complete and
+              alphabetical list of the support classes.  A support
+              class is identified within the documentation by the \l
+              {compat}{\\compat} command. Each class name is a link to
+              the class's reference documentation. The list is
+              rendered similarily to the list generated by the \l
+              {list example}{\c classes} argument.
+
+              \warning The \c classesbymodule argument will at some
+              point replace the this argument.
+
+           \o \c functionindex
+
+              The \c functionindex argument provides a complete
+              alphabetical list of all the documented member
+              functions.
+
+              For example:
+
+              \quotation
+                  \raw HTML
+                      <p><center><font size="+1"><b><a href="#a">A</a>&nbsp;<a href="#b">B</a>&nbsp;<a href="#c">C</a>&nbsp;<a href="#d">D</a>&nbsp;<a href="#e">E</a>&nbsp;<a href="#f">F</a>&nbsp;<a href="#g">G</a>&nbsp;<a href="#h">H</a>&nbsp;<a href="#i">I</a>&nbsp;<a href="#j">J</a>&nbsp;<a href="#k">K</a>&nbsp;<a href="#l">L</a>&nbsp;<a href="#m">M</a>&nbsp;<a href="#n">N</a>&nbsp;<a href="#o">O</a>&nbsp;<a href="#p">P</a>&nbsp;<a href="#q">Q</a>&nbsp;<a href="#r">R</a>&nbsp;<a href="#s">S</a>&nbsp;<a href="#t">T</a>&nbsp;<a href="#u">U</a>&nbsp;<a href="#v">V</a>&nbsp;<a href="#w">W</a>&nbsp;<a href="#x">X</a>&nbsp;<a href="#y">Y</a>&nbsp;<a href="#z">Z</a>&nbsp;</b></font></center></p>
+
+                      <p>DTDHandler: <a href="http://qt.nokia.com/doc/4.0/qxmlreader.html#DTDHandler">QXmlReader</a></p>
+
+                      <p>QAXCLASS: <a href="http://qt.nokia.com/doc/4.0/qaxfactory.html#QAXCLASS">global</a></p>
+
+                      <p>QAXFACTORY_BEGIN: <a href="http://qt.nokia.com/doc/4.0/qaxfactory.html#QAXFACTORY_BEGIN">global</a></p>
+
+                      <p>QAXFACTORY_DEFAULT: <a href="http://qt.nokia.com/doc/4.0/qaxfactory.html#QAXFACTORY_DEFAULT">global</a></p>
+
+                      <p>QAXFACTORY_END: <a href="http://qt.nokia.com/doc/4.0/qaxfactory.html#QAXFACTORY_END">global</a></p>
+
+                  \endraw
+
+                  ...
+              \endquotation
+
+           \o \c legalese
+
+              The \c legalese argument provides a complete list of all
+              the licenses. The licenses are identified within the
+              documentation using the \l {legalese}{\\legalese}
+              command.
+
+              For example:
+
+              \quotation
+                  \raw HTML
+                      <hr />
+                      <p>
+                      Copyright (c) 1989 The Regents of the
+                      University of California. All rights reserved.
+                      </p>
+
+                      <p>
+                      Redistribution and use in source and binary
+                      forms are permitted provided that the above
+                      copyright notice and this paragraph are
+                      duplicated in all such forms and that any
+                      documentation, advertising materials, and other
+                      materials related to such distribution and use
+                      acknowledge that the software was developed by
+                      the University of California, Berkeley...
+                      </p>
+
+                      <ul>
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/qdate.html#weekNumber">QDate::weekNumber()</a>
+                      </li>
+                      </ul>
+
+                      <hr />
+                      <p>
+                      Copyright (c) 1991 by AT&amp;T.
+                      </p>
+
+                      <p>
+                      Permission to use, copy, modify, and distribute
+                      this software for any purpose without fee is
+                      hereby granted, provided that this entire notice
+                      is included in all copies of any software which
+                      is or includes a copy or modification of this
+                      software and in all copies of the supporting
+                      documentation for such software...
+                      </p>
+
+                      <ul>
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/qlocale.html">QLocale</a>
+                      </li>
+                      </ul>
+                      <hr />
+                  \endraw
+                  ...
+              \endquotation
+
+           \o \c mainclasses
+
+              The \c mainclasses argument provides a complete
+              alphabetical list of the main classes. Each class name
+              is a link to the class's reference documentation. A
+              class is related to the group of main classes by using
+              the \l {mainclass}{\\mainclass} command.
+
+              The list is rendered similarily to the list generated by
+              the \l {list example}{\c classes} argument.
+
+           \o \c overviews
+
+              The \c overviews argument provides a complete
+              alphabetical overview of the documentation. Each list
+              entry is a link to the respective documentation page.
+
+              The list includes pages declared using commands like \l
+              {page}{\\page} and \l {group}{\\group}. The list omits
+              examples and classes, and only lists the first page of
+              documentation that contains two or more pages using
+              commands like \l {nextpage}{\\nextpage}.
+
+              For example:
+
+              \quotation
+                  \raw HTML
+                      <ul>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/qtalgorithms.html">
+                      &lt;QtAlgorithms&gt; - Generic Algorithms
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/qtglobal.html">
+                      &lt;QtGlobal&gt; - Global Qt Declarations
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/qaxserver-demo-simple.html">
+                      A standard ActiveX and the &quot;simple&quot; ActiveQt widget
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/aboutqt.html">
+                      About Qt
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/trolltech.html">
+                      About Trolltech
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/abstractwidgets.html">
+                      Abstract Widget Classes
+                      </a>
+                      </li>
+
+                      <li>
+                      <a href="http://qt.nokia.com/doc/4.0/accessibility.html">
+                      Accessibility Classes
+                      </a>
+                      </li>
+                      ...
+                      </ul>
+                  \endraw
+              \endquotation
+
+           \o \c related
+
+              The \c related argument is used in combination with the
+              \l {group}{\\group} command to list all the overviews
+              related to the given group. Each list entry is a link to
+              the respective documentation page.
+
+           \o \c relatedinline
+
+              The \c related argument is used in combination with the
+              \l {group}{\\group} command to collect all documentation
+              related to the given group. The various documentation
+              snippets are copied directly into the group page.
+
+           \o \c service
+
+              The \c service argument provides a complete alphabetical
+              list of the services. Each service name is a link to the
+              service's reference documentation.
+
+              A service is identified within the documentation by the
+              \l {service}{\\service} command.
+
+        \endlist
+
+
+    \row
+        \o \bold \\if \target if
+        \o \bold {The \\if command and the corresponding \\endif command
+           enclose parts of a QDoc comment that only will be included if
+           the condition specified by the command's argument is true.}
+
+           The command reads the rest of the line and parses it as an
+           C++ #if statement. For example:
+
+           \code
+           / *!
+               \if defined(opensourceedition)
+
+               \bold{Note:} This edition is for the development of
+               \l{Qt Open Source Edition}{Free and Open Source}
+               software only; see \l{Qt Commercial Editions}.
+
+               \endif
+           * /
+           \endcode
+
+           This QDoc comment will only be rendered if the \c
+           opensourceedition preprocessor symbol is defined, and
+           specified in the \l {definesvariable}{defines} variable in
+           the configuration file to make QDoc process
+           the code within #ifdef and #endif:
+
+           \code
+               defines = opensourceedition
+           \endcode
+
+           You can also define the preprocessor symbol manually on the
+           command line. For more information see the documentation of
+           the \l {definesvariable}{defines} variable.
+
+           See also \l{endif}{\\endif}, \l{else}{\\else}, \l
+           {definesvariable}{defines} and \l falsehoods.
+
+    \row
+        \o \bold \\endif \target endif
+        \o \bold {The \\endif command and the corresponding \\if command
+           enclose parts of a QDoc comment that will be included if
+           the condition specified by the \l {if}{\\if} command's
+           argument is true.}
+
+           For more information, see the documentation of the \l
+           {if}{\\if} command.
+
+           See also \l{if}{\\if}, \l{else}{\\else}, \l
+           {definesvariable}{defines} and \l falsehoods.
+
+    \row
+        \o \bold \\else \target else
+        \o \bold {The \\else command specifies an alternative if the
+           condition in the \l {if}{\\if} command is false.}
+
+           The \\else command can only be used within \l
+           {if}{\\if...\\endif} commands, but is useful when there is
+           only two alternatives. For example:
+
+           \code
+           / *!
+               The Qt 3 support library is provided to keep old
+               source code working.
+
+               In addition to the \c Qt3Support classes, Qt 4 provides
+               compatibility functions when it's possible for an old
+               API to cohabit with the new one.
+
+               \if !defined(QT3_SUPPORT)
+                   \if defined(QT3_SUPPORTWARNINGS)
+                       The compiler emits a warning when a
+                       compatibility function is called. (This works
+                       only with GCC 3.2+ and MSVC 7.)
+                   \else
+                       To use the Qt 3 support library, you need to
+                       have the line QT += qt3support in your .pro
+                       file (qmake automatically define the
+                       QT3_SUPPORT symbol, turning on compatibility
+                       function support).
+
+                       You can also define the symbol manually (e.g.,
+                       if you don't want to link against the \c
+                       Qt3Support library), or you can define \c
+                       QT3_SUPPORT_WARNINGS instead, telling the
+                       compiler to emit a warning when a compatibility
+                       function is called. (This works only with GCC
+                       3.2+ and MSVC 7.)
+                   \endif
+               \endif
+           * /
+           \endcode
+
+           If the \c QT3_SUPPORT is defined, the comment will be rendered
+           as
+
+           \quotation
+               The Qt 3 support library is provided to keep old source
+               code working.
+
+               In addition to the Qt3Support classes, Qt 4 provides
+               compatibility functions when it's possible for an old
+               API to cohabit with the new one.
+           \endquotation
+
+           If \c QT3_SUPPORT isn't defined but \c QT3_SUPPORT_WARNINGS
+           is, the comment will be rendered as
+
+           \quotation
+               The Qt 3 support library is provided to keep old source
+               code working.
+
+               In addition to the Qt3Support classes, Qt 4 provides
+               compatibility functions when it's possible for an old
+               API to cohabit with the new one.
+
+               The compiler emits a warning when a compatibility
+               function is called. (This works only with GCC 3.2+ and
+               MSVC 7.)
+           \endquotation
+
+           If none of the symbols are defined, the comment will be
+           rendered as
+
+           \quotation
+               The Qt 3 support library is provided to keep old
+               source code working.
+
+               In addition to the \c Qt3Support classes, Qt 4 provides
+               compatibility functions when it's possible for an old
+               API to cohabit with the new one.
+
+               To use the Qt 3 support library, you need to have the
+               line QT += qt3support in your .pro file (qmake
+               automatically define the QT3_SUPPORT symbol, turning on
+               compatibility function support).
+
+               You can also define the symbol manually (e.g., if you
+               don't want to link against the \c Qt3Support library),
+               or you can define \c QT3_SUPPORT_WARNINGS instead,
+               telling the compiler to emit a warning when a
+               compatibility function is called. (This works only with
+               GCC 3.2+ and MSVC 7.)
+           \endquotation
+
+           See also \l{if}{\\if}, \l{endif}{\\endif}, \l
+           {definesvariable}{defines} and \l falsehoods.
+
+    \row
+        \o \bold \\include \target include
+        \o \bold {The \\include command  expands to the contents of the
+            file specified by the command's argument.}
+
+            \warning This is preliminary functionality. For more
+            information, see the \l
+            {26-qdoc-commands-compatibility.html#include-versus-input}
+            {compatibility} section.
+
+            The command takes a file name as an argument, and is
+            useful when some piece of the documentation is used
+            repeatedly: Move the repetetive text into a separate file,
+            and use the \\include command whenever you want to insert
+            the separate documentation.
+
+            The contents of such a file should follow QDoc syntax,
+            excluding the enclosing \c{/}\c{*!} ... \c{*}\c{/} marks.
+            To ensure that QDoc won't attempt to read the file as a
+            stand-alone piece of documentation, we recommend that you
+            use the \c .qdocinc extension.
+
+            For example:
+
+            \code
+            / *!
+                \page corefeatures.html
+                \title Core Features
+
+                \include examples/signalandslots.qdocinc
+                \include examples/objectmodel.qdocinc
+                \include examples/layoutmanagement.qdocinc
+            * /
+            \endcode
+
+            will be rendered as
+
+            \quotation
+                \raw HTML
+                <h1>Core Features</h1>
+                \endraw
+
+                \include examples/signalandslots.qdocinc
+                \include examples/objectmodel.qdocinc
+                \include examples/layoutmanagement.qdocinc
+            \endquotation
+
+            Here is the actual \c .qdocinc files: \l
+            signalandslots.qdocinc, \l objectmodel.qdocinc, \l
+            layoutmanagement.qdocinc
+
+    \row
+        \o \bold \\meta \target meta
+        \o \bold {The \\meta command is the QDoc equivalent to the HTML
+           \c meta tag.}
+
+           The command accepts two arguments: The first argument (the
+           following word) is equivalent to the HTML meta tag's \i
+           name variable, and the second argument (the rest of the
+           line) is equivalent to the tag's \i contents variable.
+
+           For example:
+
+           \code
+           / *!
+               \meta author Summerfield
+
+               \section1 Automatic Dialogs
+
+               \abstract
+                   This article shows how to maintain sets of
+                   "attributes" (QVariant values), and how to allow
+                   users to view and edit them using dialogs that are
+                   created dynamically based on the attributes and
+                   their types.
+               \endabstract
+
+               The Attributes class described in this article holds a
+               set of QVariants, and can create a dialog to present
+               the QVariants to the user in an appropriate way.
+
+               ...
+           * /
+           \endcode
+
+           will be included in the generated HTML page as
+
+           \code
+           <head>
+                ...
+                <meta name="author" content="Summerfield" />
+                ...
+           </head>
+           \endcode
+
+    \row
+        \o \bold \\omit \target omit
+        \o \bold {The \\omit command and the correspondning \\endomit
+           command delimit parts of the documentation that
+           you want QDoc to skip.}
+
+           For example:
+
+            \code
+            / *!
+                \table
+                \row
+                    \o Basic Widgets
+                    \o Basic GUI widgets such as buttons, comboboxes
+                       and scrollbars.
+
+                \omit
+                \row
+                    \o Component Model
+                    \o Interfaces and helper classes for the Qt
+                       Component Model.
+                \endomit
+
+                \row
+                    \o Database Classes
+                    \o Database related classes, e.g. for SQL databases.
+                \endtable
+            * /
+            \endcode
+
+            will be rendered as
+
+            \raw HTML
+                <table align="center" cellpadding="2"
+                    cellspacing="1" border="0">
+
+                <tr valign="top" bgcolor="#d0d0d0">
+                    <td>Basic Widgets</td>
+                    <td>Basic GUI widgets such as buttons, comboboxes
+                       and scrollbars.</td>
+                </tr>
+
+                <tr valign="top" bgcolor="#c0c0c0">
+                    <td>Database Classes</td>
+                    <td>Database related classes, e.g. for SQL databases.</td>
+                </tr>
+                </table>
+            \endraw
+
+
+    \row
+        \o \bold \\raw \target raw
+        \o \bold {The \\raw command and the corresponding
+           \\endraw command delimit a block of raw mark-up language code.}
+
+           The command takes an argument specifying the code's format;
+           currently the only supported format is HTML.
+
+           The \\raw command is useful if you want some special HTML
+           effects in your documentation. For example:
+
+           \code
+           / *!
+               Qt has some predefined QColor objects. For example:
+
+               \raw HTML
+               <style type="text/css" id="colorstyles">
+               #blue { background-color: #0000ff; color: #ffffff }
+               #darkBlue { background-color: #000080; color: #ffffff }
+               #cyan { background-color: #00ffff; color: #000000 }
+               </style>
+
+               <p>
+               <tt id="blue">Blue(#0000ff)</tt>,
+               <tt id="darkBlue">dark blue(#000080)</tt> and
+               <tt id="cyan">cyan(#00ffff)</tt>.
+               \endraw
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               Qt has some predefined QColor objects. For example:
+
+               \raw HTML
+               <style type="text/css" id="colorstyles">
+               #blue { background-color: #0000ff; color: #ffffff }
+               #darkBlue { background-color: #000080; color: #ffffff }
+               #cyan { background-color: #00ffff; color: #000000 }
+               </style>
+
+               <p>
+               <tt id="blue">Blue(#0000ff)</tt>,
+               <tt id="darkBlue">dark blue(#000080)</tt> and
+               <tt id="cyan">cyan(#00ffff)</tt>.
+               \endraw
+           \endquotation
+
+    \row
+        \o \bold \\unicode \target unicode
+        \o \bold {The \\unicode command allows you to insert an
+                  arbitrary Unicode character in the document.}
+
+           The command takes an argument specifying the character as
+           an integer. By default, base 10 is assumed, unless a '0x'
+           or '0' prefix is specified (for base 16 and 8,
+           respectively). For example:
+
+           \code
+                O G\unicode{0xEA}nio e as Rosas
+
+                \unicode 0xC0 table en famille avec 15 \unicode 0x20AC par jour
+
+                \unicode 0x3A3 \i{a}\sub{\i{i}}
+           \endcode
+
+           will be rendered as
+
+           \quotation
+                O G\unicode{0xEA}nio e as Rosas
+
+                \unicode 0xC0 table en famille avec 15 \unicode 0x20AC par jour
+
+                \unicode 0x3A3 \i{a}\sub{\i{i}}
+           \endquotation
+
+           The \\raw command follows the same conventions as the \l
+           {i}{\\i} command for \l {argument}{punctuation and use of
+           braces} for the argument.
+    \endtable
+*/
+
+/*!
+    \page 12-1-signalandslots.html
+    \previouspage Miscellaneous Commands
+    \contentspage QDoc Manual - Table of Contents
+
+    \title signalandslots.qdocinc
+
+    \quotefile examples/signalandslots.qdocinc
+*/
+
+/*!
+    \page 12-2-objectmodel.html
+    \previouspage Miscellaneous Commands
+    \contentspage QDoc Manual - Table of Contents
+
+    \title objectmodel.qdocinc
+
+    \quotefile examples/objectmodel.qdocinc
+*/
+
+/*!
+    \page 12-3-layoutmanagement.html
+    \previouspage Miscellaneous Commands
+    \contentspage QDoc Manual - Table of Contents
+
+    \title layoutmanagement.qdocinc
+
+    \quotefile examples/layoutmanagement.qdocinc
+*/
+
+/*!
+    \page 13-qdoc-commands-topical.html
+    \previouspage Miscellaneous Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Contextual Commands
+
+    \title Topical Commands
+
+    The topical commands tell QDoc what is being documented
+    (i.e. existing units like classes, functions and examples), and
+    some of the commands allows you to create extra pages.
+
+    \section1 Alphabetical List
+
+    \l {13-qdoc-commands-topical.html#class}{\\class},
+    \l {13-qdoc-commands-topical.html#enum}{\\enum},
+    \l {13-qdoc-commands-topical.html#example-command}{\\example},
+    \l {13-qdoc-commands-topical.html#externalpage}{\\externalpage},
+    \l {13-qdoc-commands-topical.html#fn}{\\fn},
+    \l {13-qdoc-commands-topical.html#group}{\\group},
+    \l {13-qdoc-commands-topical.html#headerfile}{\\headerfile},
+    \l {13-qdoc-commands-topical.html#macro}{\\macro},
+    \l {13-qdoc-commands-topical.html#module}{\\module},
+    \l {13-qdoc-commands-topical.html#namespace}{\\namespace},
+    \l {13-qdoc-commands-topical.html#page}{\\page},
+    \l {13-qdoc-commands-topical.html#property}{\\property},
+    \l {13-qdoc-commands-topical.html#service}{\\service},
+    \l {13-qdoc-commands-topical.html#typedef}{\\typedef},
+    \l {13-qdoc-commands-topical.html#variable}{\\variable},
+
+    \section1 General Description
+
+    When QDoc is processing a comment, it will try to connect the
+    documentation to the source code. For that reason it will first
+    look for the topical commands. If there is no such command, it
+    will try to tie the documentation to the immediately following
+    code. If there is no topical command, and the documentation cannot
+    be tied to following code, the documentation is simply lost.
+
+    \target topical argument
+
+    The documented unit's name is passed as the unique argument for
+    all the topical commands. The argument's naming convention is the
+    documented unit's complete name. For example:
+
+    \code
+        \enum QComboBox::InsertPolicy
+    \endcode
+
+    Functions is a special case, the argument's naming convention for
+    the \l {fn}{\\fn} command is that of the function's definition
+    outside the class definition. For example:
+
+    \code
+        \fn void PreviewWindow::setWindowFlags()
+    \endcode
+
+    A topical command can appear anywhere in a comment, but must stand
+    alone on its own line. If the argument spans several lines, make
+    sure that each line (except the last one) is ended with a
+    backslash. In addition QDoc counts parentheses, which means that
+    if it encounters a '(' it considers everything until the closing
+    ')' as its argument.
+
+    If a topical command is repeated with different arguments, the
+    same documentation will appear for both the units. For example:
+
+    \code
+    / *!
+        \fn void PreviewWindow::setWindowFlags()
+        \fn void ControllerWindow::setWindowFlags()
+
+        Sets the widgets flags using the QWidget::setWindowFlags()
+        function.
+
+        Then runs through the available window flags, creating a text
+        that contains the names of the flags that matches the flags
+        parameter, displaying the text in the widgets text editor.
+    * /
+    \endcode
+
+    The \c PreviewWindow::setWindowFlags() and \c
+    ControllerWindow::setWindowFlags() functions will get the same
+    documentation.
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\class \target class
+        \o \bold {The \\class command tells QDoc that a class is
+           part of the public API, and lets you enter a detailed
+           description.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument, and supports
+           nested classes, for example:
+
+           \code
+           / *!
+               \class QMap::iterator
+
+               \brief The QMap::iterator class provides an STL-style
+               non-const iterator for QMap and QMultiMap.
+
+               QMap features both \l{STL-style iterators} and
+               \l{Java-style iterators}. The STL-style iterators ...
+           * /
+           \endcode
+
+           The generated HTML documentation for the specified class is
+           put in \c <lower-case>classname.html. For example, the
+           documentation for the \c PreviewWindow class is located in
+           \c previewwindow.html.
+
+           \target framework
+
+           In addition to render the detailed description, the \\class
+           comand will generate the documentation framework, i.e. a
+           list of the class's types, properties, functions, signals
+           and slots with empty documentation.
+
+           The command is typically accompanied with a \l
+           {brief}{\\brief} command, a \l {mainclass}{\\mainclass}
+           command, an \l {ingroup}{\\ingroup} command and a \l
+           {sa}{\\sa} command. For example:
+
+           \code
+           / *!
+               \class PreviewWindow
+               \brief The PreviewWindow class is a custom widget
+                      displaying the names of its currently set
+                      window flags in a read-only text editor.
+
+               \mainclass
+               \ingroup miscellaneous
+
+               The PreviewWindow class inherits QWidget. The widget
+               displays the names of its window flags set with the \l
+               {function}{setWindowFlags()} function. It is also
+               provided with a QPushButton that closes the window.
+
+               ...
+
+              \sa QWidget
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+                   <h1>PreviewWindow Class Reference</h1>
+               \endraw
+
+               The PreviewWindow class is a custom widget displaying
+               the names of its currently set window flags in a
+               read-only text editor. \l {preview window}{More...}
+
+               \raw HTML
+                   <h3>Properties</h3>
+               \endraw
+
+               \list
+                   \o 52 properties inherited from QWidget
+                   \o 1 property inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Public Functions</h3>
+               \endraw
+
+               \list
+                   \o \l {constructor}{PreviewWindow}(QWidget *parent = 0)
+                   \o void \l {function}{setWindowFlags}(Qt::WindowFlags flags)
+               \endlist
+
+               \list
+                   \o 183 public functions inherited from QWidget
+                   \o 28 public functions inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Public Slots</h3>
+               \endraw
+
+               \list
+                   \o 17 public slots inherited from QWidget
+                   \o 1 public slot inherited from QObject
+               \endlist
+
+               \raw HTML
+                   <h3>Additional Inherited Members</h3>
+               \endraw
+
+               \list
+                   \o 1 signal inherited from QWidget
+                   \o 1 signal inherited from QObject
+                   \o 4 static public members inherited from QWidget
+                   \o 4 static public members inherited from QObject
+                   \o 39 protected functions inherited from QWidget
+                   \o 7 protected functions inherited from QObject
+               \endlist
+
+               \target preview window
+
+               \raw HTML
+                   <hr />
+                   <h2>Detailed Description</h2>
+               \endraw
+
+               The PreviewWindow class is a custom widget displaying
+               the names of its currently set window flags in a
+               read-only text editor.
+
+               The PreviewWindow class inherits QWidget. The widget
+               displays the names of its window flags set with the \l
+               {function}{setWindowFlags()} function. It is also
+               provided with a QPushButton that closes the window.
+
+               ...
+
+               See also QWidget.
+
+               \raw HTML
+                   <hr />
+                   <h2>Member Function Documentation</h2>
+               \endraw
+
+               \target constructor
+               \raw HTML
+                   <h3>PreviewWindow(QWidget *parent = 0)</h3>
+               \endraw
+
+               Constructs a preview window widget with \i parent.
+
+               \target function
+               \raw HTML
+                   <h3>setWindowFlags(Qt::WindowFlags flags)</h3>
+               \endraw
+
+               Sets the widgets flags using the
+               QWidget::setWindowFlags() function.
+
+               Then runs through the available window flags,
+               creating a text that contains the names of the flags
+               that matches the flags parameter, displaying
+               the text in the widgets text editor.
+           \endquotation
+
+    \row
+        \o \bold \\enum \target enum
+        \o \bold {The \\enum command allows you to document a C++ enum.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           The enum items are documented using the \l {value}{\\value}
+           command. If an item isn't documented, QDoc will emit a
+           warning. This can be avoided using the \l
+           {omitvalue}{\\omitvalue} command excluding an item from the
+           documentation. The enum documentation will be located in
+           the associated class, header file or namespace
+           documentation.
+
+           For example:
+
+           \code
+               enum Corner {
+                   TopLeftCorner = 0x00000,
+                   TopRightCorner = 0x00001,
+                   BottomLeftCorner = 0x00002,
+                   BottomRightCorner = 0x00003
+           #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
+                   ,TopLeft = TopLeftCorner,
+                   TopRight = TopRightCorner,
+                   BottomLeft = BottomLeftCorner,
+                   BottomRight = BottomRightCorner
+           #endif
+               };
+           \endcode
+
+           In case of the Qt::Corner enum,
+
+           \code
+           / *!
+               \enum Qt::Corner
+
+               This enum type specifies a corner in a rectangle:
+
+               \value TopLeftCorner
+                      The top-left corner of the rectangle.
+               \value TopRightCorner
+                      The top-right corner of the rectangle.
+               \value BottomLeftCorner
+                      The bottom-left corner of the rectangle.
+               \value BottomRightCorner
+                      The bottom-right corner of the rectangle.
+
+               \omitvalue TopLeft
+               \omitvalue TopRight
+               \omitvalue BottomLeft
+               \omitvalue BottomRight
+           * /
+           \endcode
+
+           this associated QDoc comment will be rendered as
+
+           \quotation
+           \raw HTML
+               <h3 class="fn"><a name="Corner-enum"></a>enum Qt::Corner</h3>
+
+               <p>This enum type specifies a corner in a rectangle:</p>
+
+               <table border="1" cellpadding="2" cellspacing="1" width="100%">
+               <tr>
+               <th width="25%">Constant</th>
+               <th width="15%">Value</th>
+               <th width="60%">Description</th>
+               </tr>
+
+               <tr>
+               <td valign="top"><tt>Qt::TopLeftCorner</tt></td>
+               <td align="center" valign="top"><tt>0x00000</tt></td>
+               <td valign="top">The top-left corner of the rectangle.</td>
+               </tr>
+
+               <tr>
+               <td valign="top"><tt>Qt::TopRightCorner</tt></td>
+               <td align="center" valign="top"><tt>0x00001</tt></td>
+               <td valign="top">The top-right corner of the rectangle.</td>
+               </tr>
+
+               <tr>
+               <td valign="top"><tt>Qt::BottomLeftCorner</tt></td>
+               <td align="center" valign="top"><tt>0x00002</tt></td>
+               <td valign="top">The bottom-left corner of the rectangle.</td>
+               </tr>
+
+               <tr>
+               <td valign="top"><tt>Qt::BottomRightCorner</tt></td>
+               <td align="center" valign="top"><tt>0x00003</tt></td>
+               <td valign="top">The bottom-right corner of the rectangle.</td>
+               </tr>
+
+               </table>
+           \endraw
+           \endquotation
+
+           in qt.html.
+
+           See also \l {value}{\\value} and \l {omitvalue}{\\omitvalue}.
+
+    \row
+        \o \bold \\example \target example-command
+        \o \bold {The \\example command allows you to document an
+           example.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument. In particular
+           the command's argument is the example's path relative to
+           the paths listed in the \l exampledirs configuration
+           variable.
+
+           The documentation will be located in \i
+           {path-to-example}.html, and QDoc will add a list of all the
+           example files at the top of this documentation page.
+
+           For example, if \l exampledirs contain \c
+           $QTDIR/examples/widgets/imageviewer, then
+
+           \code
+           / *!
+               \example widgets/imageviewer
+               \title ImageViewer Example
+               \subtitle
+
+               The example shows how to combine QLabel and QScrollArea
+               to display an image.
+
+               ...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <center><h1>Image Viewer Example</h1></center>
+               \endraw
+
+               Files:
+               \list
+               \o \l{http://qt.nokia.com/doc/4.0/widgets-imageviewer-imageviewer-cpp.html}
+                  {widgets/imageviewer/imageviewer.cpp}
+               \o \l{http://qt.nokia.com/doc/4.0/widgets-imageviewer-imageviewer-h.html}
+                  {widgets/imageviewer/imageviewer.h}
+               \o \l{http://qt.nokia.com/doc/4.0/widgets-imageviewer-main-cpp.html}
+                  {widgets/imageviewer/main.cpp}
+               \endlist
+
+               The example shows how to combine QLabel and QScrollArea
+               to display an image.
+
+               ...
+           \endquotation
+
+           in widgets-imageviewer.html.
+
+    \row
+        \o \bold \\fn \target fn
+        \o \bold {The \\fn command allows you to document a function.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument. In particular
+           it is important that the return type of the function,
+           whether it is \c const or not and the complete set of
+           arguments with type are included in the argument.  If the
+           referenced function doesn't exist, QDoc will emit a
+           warning.
+
+           Also, the \\fn command is QDoc's default command, i.e. when
+           no topical command can be found within a QDoc comment, QDoc
+           tries to tie the documentation to the following code as if
+           it was function documentation.
+
+           This means that the command normally isn't necessary since
+           the recommended style is to write the function
+           documentation directly before the function implementation
+           in the \c .cpp file. In fact, it should only be used for
+           inline functions implemented in the \c .h file.
+
+           For example:
+
+           \code
+           / *!
+               \fn bool QToolBar::isAreaAllowed(Qt::ToolBarArea area) const
+
+               Returns true if this toolbar is dockable in the given
+               \a area; otherwise returns false.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>bool QToolBar::isAreaAllowed(Qt::ToolBarArea area) const
+               </h3>
+               \endraw
+
+               Returns true if this toolbar is dockable in the given
+               \a area; otherwise returns false.
+           \endquotation
+
+           See also \l {overload}{\\overload}.
+
+    \row
+        \o \bold \\group \target group
+        \o \bold {The \\group command creates a separate page that
+           lists the classes belonging to the group specified by the
+           command's argument.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument. The \\group
+           command is typically followed by a \l {title}{\\title}
+           command and a short introduction to the group.  The
+           generated HTML documentation for the specified group is put
+           in <lower-case>\i{group}.html.
+
+           A class can be related to a group by using the \l
+           {ingroup}{\\ingroup} command. In addition, overviews can be
+           related to a group using the same command, but these must
+           be listed explicitly using the \l
+           {generatelist}{\\generatelist} command (see example below).
+
+           Each class is listed with a link to the class reference
+           page and a brief description based on the classes' \l
+           {brief}{\\brief} texts. For example:
+
+           \code
+           / *!
+               \group io
+
+               \title Input/Output and Networking
+
+               These classes are used to handle input and output to
+               and from external devices, processes, files etc. as
+               well as manipulating files and directories.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+                \raw HTML
+
+                <h1>Input/Output and Networking</h1>
+
+                <p>These classes are used to handle input and output
+                to and from external devices, processes, files etc. as
+                well as manipulating files and directories.</p>
+
+                <p>
+                <table width="100%">
+                    <tr valign="top" bgcolor="#e0e0e0">
+                    <td><b>
+                    <a href="http://qt.nokia.com/doc/4.0/qabstractsocket.html">QAbstractSocket</a>
+                    </b></td>
+                    <td>
+                    The base functionality common to all socket types
+                    </td></tr>
+
+                    <tr valign="top" bgcolor="#e0e0e0">
+                    <td><b>
+                    <a href="http://qt.nokia.com/doc/4.0/qbuffer.html">QBuffer</a>
+                    </b></td>
+                    <td>
+                    QIODevice interface for a QByteArray
+                    </td></tr>
+
+                    <tr valign="top" bgcolor="#e0e0e0">
+                    <td><b>
+                    <a href="http://qt.nokia.com/doc/4.0/qclipboard.html">QClipboard</a>
+                    </b></td>
+                    <td>
+                    Access to the window system clipboard
+                    </td></tr>
+                </table>
+                \endraw
+           \endquotation
+
+           in io.html.
+
+           Note that overviews related to the given group, must be
+           listed explicitly using the \l
+           {generatelist}{\\generatelist} command with the \c related
+           argument. For example:
+
+           \code
+           / *!
+               \group architecture
+
+               \title Architecture
+
+               These documents describe aspects of Qt's architecture
+               and design, including overviews of core Qt features and
+               technologies.
+
+               \generatelist{related}
+           * /
+           \endcode
+
+           See also \l {ingroup}{\\ingroup} and \l
+           {generatelist}{\\generatelist}.
+
+    \row
+        \o \bold \\headerfile \target headerfile
+        \o \bold {The \\headerfile command allows you to document
+           global functions, types and macros declared in a header file.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument, and the
+           generated HTML documentation for the specified header file
+           is put in <lower-case>\i{headerfilename}.html.
+
+           A function, type or macro can be associated with a
+           headerfile using the \l {relates}{\\relates} command.
+
+           If the referenced header file doesn't exist, the
+           \\headerfile command will still create a documentation page
+           for a header file with the referenced file's name.
+
+           For example:
+
+           \code
+           / *!
+               \headerfile <QtAlgorithms>
+
+               \title Generic Algorithms
+
+               \brief The <QtAlgorithms> header file provides
+                generic template-based algorithms.
+
+               Qt provides a number of global template functions in \c
+               <QtAlgorithms> that work on containers and perform
+               well-know algorithms.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <center><h1>&lt;QtAlgorithms&gt; -
+                           Generic Algorithms</h1></center>
+               <p>The <QtAlgorithms> header file provides generic
+               template-based algorithms.
+               <a href="13-qdoc-commands-topical.html#header">More...</a>
+               </p>
+
+               <h3>Functions</h3>
+               <ul>
+               <li>RandomAccessIterator
+               <a href="http://qt.nokia.com/doc/4.0/qlineedit.html#EchoMode-enum">qBinaryFind</a></b>
+               (RandomAccessIterator begin, RandomAccessIterator end,
+               const T & value)</li>
+               <li>...</li></ul>
+               <hr />
+               \endraw
+
+               \target header
+
+               \raw HTML
+               <h2>Detailed Description</h2>
+               <p>The <QtAlgorithms> header file provides generic
+               template-based algorithms. </p>
+               \endraw
+
+               Qt provides a number of global template functions in \c
+               <QtAlgorithms> that work on containers and perform
+               well-know algorithms.
+
+               ...
+           \endquotation
+
+           in qtalgorithms.html.
+
+    \row
+        \o \bold \\macro \target macro
+        \o \bold {The \\macro command allows you to document a C++ macro.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           QDoc recognizes three different macro syntax: function-like
+           macros like Q_ASSERT(), declaration-style macros like
+           Q_PROPERTY() and macros without parentheses like Q_OBJECT.
+
+           The \\macro command must be followed by a \l
+           {relates}{\\relates} command which attaches the
+           documentation to that of a related class, header file. or
+           namespace. Otherwise the documentation will be lost.
+
+           For example:
+
+           \code
+           / *!
+               \macro void Q_ASSERT(bool test)
+               \relates <QtGlobal>
+
+               Prints a warning message containing the source code
+               file name and line number if \a test is false.
+
+               ...
+
+               \sa Q_ASSERT_X(), qFatal(), {Debugging Techniques}
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>void Q_ASSERT ( bool <i>test</i> )</h3>
+               \endraw
+
+               Prints a warning message containing the source code
+               file name and line number if \a test is false.
+
+               ...
+
+               See also Q_ASSERT_X(), qFatal() and \l {Debugging
+               Techniques}.
+           \endquotation
+
+           in qtglobal.html. And
+
+           \code
+           / *!
+               \macro Q_PROPERTY(...)
+               \relates QObject
+
+               This macro declares a QObject property. The syntax is:
+
+               ...
+
+               \sa {Qt's Property System}
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>Q_PROPERTY ( ... )</h3>
+               \endraw
+
+               This macro declares a QObject property. The syntax is:
+
+               ...
+
+               See also \l {Qt's Property System}.
+           \endquotation
+
+           in qobject.html. And
+
+           \code
+           / *!
+               \macro Q_OBJECT
+               \relates QObject
+
+               The Q_OBJECT macro must appear in the private section
+               of a class definition that declares its own signals and
+               slots or that uses other services provided by Qt's
+               meta-object system.
+
+               ...
+
+               \sa {Meta-Object System}, {Signals and Slots}, {Qt's
+               Property System}
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>Q_OBJECT</h3>
+               \endraw
+
+               The Q_OBJECT macro must appear in the private section
+               of a class definition that declares its own signals and
+               slots or that uses other services provided by Qt's
+               meta-object system.
+
+               ...
+
+               See also \l {Meta-Object System}, \l {Signals and
+               Slots} and \l {Qt's Property System}.
+           \endquotation
+
+           in qobject.html.
+
+    \row
+        \o \bold \\module \target module
+        \o \bold {The \\module creates a separate page that lists the
+           classes belonging to the module specified by the command's
+           argument.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           A class can be related to a module using the \l
+           {inmodule}{\\inmodule} command.
+
+           The \\module command is typically followed by the \l
+           {title}{\\title} and \l {brief}{\\brief} commands. Each
+           class is listed with a link to the class reference page and
+           a brief description based on the classes' \l
+           {brief}{\\brief} texts.
+
+           For example:
+
+           \code
+           / *!
+               \module QtNetwork
+
+               \title QtNetwork Module
+
+               \brief The QtNetwork module offers classes that allow
+               you to write TCP/IP clients and servers.
+
+               The network module provides classes to make network
+               programming easier and portable. It offers both
+               high-level classes such as QHttp and QFtp that
+               implement specific application-level protocols, and
+               lower-level classes such as QTcpSocket, QTcpServer, and
+               QUdpSocket.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h1><center>QtNetwork Module</center></h1>
+               \endraw
+
+               The QtNetwork module offers classes that allow you to
+               write TCP/IP clients and servers.\l {module
+               details}{More...}
+
+               \raw HTML
+               <p>
+               <table width="100%">
+                   <tr valign="top" bgcolor="#d0d0d0">
+                   <td><b>
+                   <a href="http://qt.nokia.com/doc/4.0/qabstractsocket.html">QAbstractSocket</a>
+                   </b></td>
+                   <td>
+                   The base functionality common to all socket types
+                   </td></tr>
+
+                   <tr valign="top" bgcolor="#d0d0d0">
+                   <td><b>
+                   <a href="http://qt.nokia.com/doc/4.0/qftp.html">QFtp</a>
+                   </b></td>
+                   <td>
+                   Implementation of the FTP protocol
+                   </td></tr>
+
+                   <tr valign="top" bgcolor="#d0d0d0">
+                   <td>...</td>
+                   <td>...</td>
+                   </tr>
+               </table>
+
+               <p><hr /></p>
+               \endraw
+
+               \target module details
+
+               \raw HTML
+               <h2>Detailed Description</h2>
+
+               <p>
+               The QtNetwork module offers classes that allow you to
+               write TCP/IP clients and servers.
+               </p>
+
+               <p>
+               The network module provides classes to make network
+               programming easier and portable. It offers both
+               high-level classes such as QHttp and QFtp that
+               implement specific application-level protocols, and
+               lower-level classes such as QTcpSocket, QTcpServer, and
+               QUdpSocket.
+               </p>
+               \endraw
+
+               ...
+
+           \endquotation
+
+           in qtnetwork.html.
+
+           See also \l {inmodule}{\\inmodule}
+
+    \row
+        \o \bold \\namespace \target namespace
+        \o \bold {The \\namespace command allows you to document a C++
+           namespace.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           QDoc will generate the same additional links and
+           documentation for all the members of the namespace as it
+           does for \l {framework}{classes}. The documentation for
+           the specified namespace is put in <lower-case>\i
+           {namespace}.html.
+
+           For example:
+
+           \code
+           / *!
+               \namespace Qt
+
+               \brief The Qt namespace contains miscellaneous
+               identifiers used throughout the Qt library.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <center><h1>Qt Namespace Reference</h1></center>
+               <p>The Qt namespace contains miscellaneous
+               identifiers used throughout the Qt library.
+               <a href="13-qdoc-commands-topical.html#name">More...</a>
+               </p>
+
+               <pre>#include &lt;Qt&gt;</pre>
+               <ul>
+               <li>
+               <a href="http://qt.nokia.com/doc/4.0/qt-qt3.html">
+                   Qt 3 support members</a></li>
+               </ul>
+
+
+               <h3>Types</h3>
+               <ul>
+               <li>flags
+               <a href="http://qt.nokia.com/doc/4.0/qt.html#AlignmentFlag-enum">Alignment</a></b></li>
+               <li>...</li></ul>
+               <hr />
+               \endraw
+
+               \target name
+
+               \raw HTML
+               <h2>Detailed Description</h2>
+               <p>The Qt namespace contains miscellaneous identifiers
+               used throughout the Qt library.</p>
+               \endraw
+
+               ...
+           \endquotation
+
+           in qt.html.
+
+    \row
+        \o \bold \\page \target page
+        \o \bold {The \\page command allows you to create a stand-alone
+           documentation page.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           The page's title can be set using the \l {title}{\\title}
+           command. For example:
+
+           \code
+           / *!
+               \page aboutqt.html
+
+               \title About Qt
+
+               Qt by Trolltech is a C++ toolkit for cross-platform GUI
+               application development. Qt provides single-source
+               portability across Microsoft Windows, Mac OS X, Linux,
+               and all major commercial Unix variants. (A version of
+               Qt 4 for embedded Linux will be available in
+               August/September 2005.)
+
+               Qt provides application developers with all the
+               functionality needed to build applications with
+               state-of-the-art graphical user interfaces. Qt is fully
+               object-oriented, easily extensible, and allows true
+               component programming.
+
+               ...
+            * /
+            \endcode
+
+           will be rendered in its own HTML file: \l{About Qt}.
+
+    \row
+        \o \bold {\\externalpage} \target externalpage
+        \o \bold {The \\externalpage command gives a title to
+            an external URL.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           For example:
+
+           \code
+           / *!
+               \externalpage http://www.trolltech.com/products/embedded/index.html
+               \title Qtopia Core
+           * /
+           \endcode
+
+           The QDoc comment above allows you to link to the Qtopia
+           Core webpage by simply linking to the given title. For
+           example:
+
+           \code
+           / *!
+               The broad scope of the \l {Qtopia Core} API enables it to
+               be used across a wide variety of development projects.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               The broad scope of the \l
+               {http://www.trolltech.com/products/embedded/index.html}{Qtopia
+               Core} API enables it to be used across a wide variety
+               of development projects.
+           \endquotation
+
+           To achieve the same result without using the
+           \\externalpage command, you would have to hard code the
+           adress into your documentation:
+
+           \code
+           / *!
+               The broad scope of the \l
+               {http://www.trolltech.com/products/embedded/index.html}{Qtopia
+               Core} API enables it to be used across a wide variety
+               of development projects.
+           * /
+           \endcode
+
+           The \\externalpage command makes it easier to maintain the
+           documentation. If the adress changes, you only need to change the
+           argument of the \\externalpage command.
+
+    \row
+        \o \bold \\property \target property
+        \o \bold {The \\property command allows you to document a Qt
+           property.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           A property is defined using the Q_PROPERTY() macro. The
+           macro takes as arguments the property's name and its set,
+           reset and get functions. For example:
+
+           \code
+           Q_PROPERTY(QString state READ state WRITE setState)
+           \endcode
+
+           The set, reset and get functions don't need to be
+           documented, documenting the property is sufficient. QDoc
+           will generate a list of the access function that will
+           appear in the property documentation which in turn will be
+           located in the documentation of the class that defines the
+           property.
+
+           The \\property command is typically accompanied with a \l
+           {brief}{\\brief} command.  In the case of a property, the
+           \l {brief}{\\brief} command's argument is a sentence
+           fragment that will be included in a one-sentence
+           description of the property generated by QDoc. The command
+           follows the same rules for the \l {brief
+           property}{description} as the \l {variable}{\\variable}
+           command.
+
+           For example:
+
+           \code
+           / *!
+               \property QPushButton::flat
+               \brief whether the border is disabled
+
+               This property's default is false.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>flat : bool</h3>
+               \endraw
+
+               This property holds whether the border is disabled.
+
+               This property's default is false.
+
+               Access functions:
+
+               \list
+               \o \bold { bool isFlat () const}
+               \o \bold { void setFlat ( bool )}
+               \endlist
+
+           \endquotation
+
+           in qpushbutton.html. And
+
+           \code
+           / *!
+               \property QWidget::width
+               \brief the width of the widget excluding any window frame
+
+               See the \l {Window Geometry} documentation for an
+               overview of window geometry.
+
+               \sa geometry, height, size
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>width : const int</h3>
+               \endraw
+
+               This property holds the width of the widget excluding
+               any window frame.
+
+               See the \l {Window Geometry} documentation for an
+               overview of window geometry.
+
+               Access functions:
+
+               \list
+               \o \bold { int width () const}
+               \endlist
+
+               See also \l{QWidget::geometry}{geometry},
+               \l{QWidget::height}{height}, and \l{QWidget::size}{size}.
+           \endquotation
+
+           in qwidget.html.
+
+    \row
+        \o \bold \\service \target service
+
+        \o \bold {The \\service command tells QDoc that a class is a
+            service class and specifies its alias, i.e. the associated
+            service's name.}
+
+            The command takes two arguments, the service class's name
+            and the associated alias. For example:
+
+            \code
+                / *!
+                    \service TimeService Time
+                    ...
+                * /
+                class TimeService : public QCopObjectService
+                {
+                    ...
+                }
+            \endcode
+
+            See also \l {class}{\\class} and \l
+            {generatelist}{\\generatelist}.
+
+    \row
+        \o \bold \\typedef \target typedef
+        \o \bold {The \\typedef command allows you to document a C++ type
+           definition.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           The documentation will be located in the associated class,
+           header file or namespace documentation. When documenting a
+           global type definition, the \\typedef command must be
+           accompanied with a \l {relates}{\\relates} command. For
+           example:
+
+           \code
+           / *!
+               \typedef QObjectList
+               \relates QObject
+
+               Synonym for QList<QObject>.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>typedef QObjectList</h3>
+               \endraw
+
+               Synonym for QList<QObject>.
+           \endquotation
+
+           in qobject.html. Another, although more rare, example is
+
+           \code
+           / *!
+               \typedef QMsgHandler
+               \relates QtGlobal
+
+               This is a typedef for a pointer to a function with the
+               following signature:
+
+               \code
+                   void myMsgHandler(QtMsgType, const char *);
+               \ endcode
+
+               \sa QtMsgType, qInstallMsgHandler()
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>typedef QtMsgHandler</h3>
+               \endraw
+
+               This is a typedef for a pointer to a function with the
+               following signature:
+
+               \raw HTML
+               <tt>
+               <pre>    void myMsgHandler(QtMsgType, const char *);</pre>
+               </tt>
+               \endraw
+
+               See also QtMsgType and qInstallMsgHandler().
+
+           \endquotation
+
+           in qtglobal.html. Other type definitions are located in the
+           documentation of the class that defines it, for example:
+
+           \code
+           / *!
+               \typedef QLinkedList::Iterator
+
+               Qt-style synonym for QList::iterator.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>typedef QLinkedList::Iterator</h3>
+               \endraw
+
+               Qt-style synonym for QList::iterator.
+           \endquotation
+
+           in qlinkedlist.html.
+
+    \row
+        \o \bold \\variable \target variable
+        \o \bold {The \\variable command allows you to document a
+           member variable or a constant.}
+
+           The command follows \l {topical argument}{the general
+           topical command convention} for the argument.
+
+           The \\variable command is typically followed by a \l
+           {brief}{\\brief} command; QDoc will generate the
+           documentation for the variable based on the brief
+           description. The command follows the same rules for the \l
+           {brief property}{description} as the \l
+           {property}{\\property} command.
+
+           The documentation will be located in the in the associated
+           class, header file or namespace documentation.
+
+           In case of a member variable:
+
+           \code
+           / *!
+               \variable QStyleOption::palette
+               \brief the palette that should be used when painting
+                      the control
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>
+               <a href="http://qt.nokia.com/doc/4.0/qpalette.html">
+               QPalette
+               </a>
+               QStyleOption::palette
+               </h3>
+               \endraw
+
+               This variable holds the palette that should be used
+               when painting the control.
+           \endquotation
+
+           in qstyleoption.html.
+
+           But you can also use the \\variable command to document
+           constants like for example the \c Type and \c UserType
+           constants in the QTreeWidgetItem class:
+
+           \code
+           enum { Type = 0, UserType = 1000 };
+           \endcode
+
+           Then
+
+           \code
+           / *!
+               \variable QTreeWidgetItem::Type
+
+               The default type for tree widget items.
+
+               \sa UserType, type()
+           * /
+           \endcode
+
+           and
+
+           \code
+           / *!
+               \variable QTreeWidgetItem::UserType
+
+               The minimum value for custom types. Values below
+               UserType are reserved by Qt.
+
+               \sa Type, type()
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>
+               const int QTreeWidgetItem::Type
+               </h3>
+               \endraw
+
+               The default type for tree widget items.
+
+               See also \l {QTreeWidgetItem::UserType}{UserType} and
+               \l {QTreeWidgetItem::type()}{type()}.
+
+               \raw HTML
+               <h3>
+               const int QTreeWidgetItem::UserType
+               </h3>
+               \endraw
+
+               The minimum value for custom types. Values below
+               UserType are reserved by Qt.
+
+               See also \l {QTreeWidgetItem::Type}{Type} and
+               \l{QTreeWidgetItem::type()}{type()}.
+
+           \endquotation
+
+           in qtreewidget.html.
+    \endtable
+*/
+
+/*!
+    \page 14-qdoc-commands-contextualcommands.html
+    \previouspage Topical Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Navigation Commands
+
+    \title Contextual Commands
+
+    The contextual commands provide QDoc with information, that it
+    wouldn't figure out otherwise, about the documented object. For
+    example whether a class is thread-safe or not.
+
+    These commands can appear anywhere within a QDoc comment.
+
+    \section1 Alphabetical List
+
+    \l {16-qdoc-commands-status.html#compat}{\\compat},
+    \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage},
+    \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage},
+    \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup},
+    \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule},
+    \l {16-qdoc-commands-status.html#internal}{\\internal},
+    \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass},
+    \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage},
+    \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant},
+    \l {16-qdoc-commands-status.html#obsolete}{\\obsolete},
+    \l {18-qdoc-commands-relating.html#overload}{\\overload},
+    \l {16-qdoc-commands-status.html#preliminary}{\\preliminary},
+    \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage},
+    \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant},
+    \l {18-qdoc-commands-relating.html#reimp}{\\reimp},
+    \l {18-qdoc-commands-relating.html#relates}{\\relates},
+    \l {15-qdoc-commands-navigation.html#startpage}{\\startpage},
+    \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe},
+    \l {20-qdoc-commands-title.html#title}{\\title}
+
+    \section1 Categories
+    \list
+    \o \l {Navigation Commands}
+    \o \l {Status Commands}
+    \o \l {Thread Support Commands}
+    \o \l {Relating Commands}
+    \o \l {Grouping Commands}
+    \o \l {Title Commands}
+    \endlist
+*/
+
+/*!
+    \page 15-qdoc-commands-navigation.html
+    \previouspage Contextual Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Status Commands
+
+    \title Navigation Commands
+
+    The navigation commands allow you to link the pages of a multipage
+    document together. They provide the components of a navigation bar
+    at the top and bottom of the document. They also provide browser
+    and search engine support.
+
+    \section1 Alphabetical List
+
+    \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage},
+    \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage},
+    \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage},
+    \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage},
+    \l {15-qdoc-commands-navigation.html#startpage}{\\startpage}
+
+    \section1 General Description
+
+    The QDoc comments below shows a typical example using the
+    navigation commands.
+
+    \code
+    / *!
+        \page basicqt.html
+        \contentspage {Basic Qt}{Contents}
+        \nextpage Getting Started
+
+        \indexpage Index
+        \startpage Basic Qt
+
+        \title Basic Qt
+
+        The Qt toolkit is a C++ class library and a set of tools for
+        building multiplatform GUI programs using a "write once,
+        compile anywhere approach".
+
+        Table of contents:
+
+        \list
+        \o \l {Getting Started}
+        \o \l {Creating Dialogs}
+        \o \l {Creating Main Windows}
+        \endlist
+    * /
+
+    / *!
+        \page gettingstarted.html
+        \previouspage Basic Qt
+        \contentspage {Basic Qt}{Contents}
+        \nextpage Creating Dialogs
+
+        \indexpage Index
+        \startpage Basic Qt
+
+        \title Getting Started
+
+        This chapter shows how to combine basic C++ with the
+        functionality provided by Qt to create a few small graphical
+        interface (GUI) applications.
+    * /
+
+    / *!
+        \page creatingdialogs.html
+        \previouspage Getting Started
+        \contentspage {Basic Qt}{Contents}
+
+        \indexpage Index
+        \startpage Basic Qt
+
+        \title Creating Dialogs
+
+        This chapter will teach you how to create dialog boxes using Qt.
+    * /
+
+    / *!
+        \page index.html
+
+        \indexpage Index
+        \startpage Basic Qt
+
+        \title Index
+
+        \list
+            \o \l {Basic Qt}
+            \o \l {Creating Dialogs}
+            \o \l {Getting Started}
+        \endlist
+    * /
+    \endcode
+
+    The second page of this multipage document, "Getting Started",
+    will be rendered as
+
+    \quotation
+    \raw HTML
+        <table border="0" cellpadding="0" cellspacing="5" width="100%">
+
+        <tr>
+        <p>
+        [Previous: <a href="15-qdoc-commands-navigation.html#deadlink">
+        Basic Qt</a>]
+        [<a href="15-qdoc-commands-navigation.html#deadlink">Contents</a>]
+        [Next: <a href="15-qdoc-commands-navigation.html#deadlink">
+        Creating Dialogs</a>]
+        </p>
+
+        <h1 align="center">Getting Started<br /></h1>
+
+        <p>
+        This chapter shows how to combine basic C++ with the
+        functionality provided by Qt to create a few small graphical
+        interface (GUI) applications.
+        </p>
+
+        <p>
+        [Previous: <a href="15-qdoc-commands-navigation.html#deadlink">
+        Basic Qt</a>]
+        [<a href="15-qdoc-commands-navigation.html#deadlink">Contents</a>]
+        [Next: <a href="15-qdoc-commands-navigation.html#deadlink">
+        Creating Dialogs</a>]
+        </p>
+
+        </table>
+    \endraw
+    \endquotation
+
+    in creatingdialogs.html.
+
+    In addition, the \l {indexpage}{\\indexpage} and \l
+    {startpage}{\\startpage} commands specifies links to the page's
+    index page and start page. These links are used by browsers and
+    search engines.
+
+    The index page is typically an alphabetical list of the document's
+    titles and topics, while the start page is the page considered by
+    the author to be the starting point of a multipage document.
+
+    The links are included in the generated HTML source code but has
+    no visual effect on the documentation:
+
+    \code
+    <head>
+        ...
+        <link rel="index" href="index.html" />
+        <link rel="start" href="basicqt.html" />
+        ...
+    </head>
+    \endcode
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\previouspage \target previouspage
+        \o \bold {The \\previouspage command links the current page
+           to the previous one in an ordered series of documents}.
+
+           The command has two arguments, each enclosed by curly
+           braces: The first is the link target, i.e. the title of the
+           previous page, the second is the link text. If the page's
+           title is equivalent to the link text, the second argument
+           can be omitted.
+
+           The command must stand alone on its own line.
+
+           In the end, the link is rendered at the top and bottom of
+           the current page. For an example, see the \l {General
+           Description} section.
+
+    \row
+        \o \bold \\nextpage \target nextpage
+        \o \bold {The \\nextpage command links the current
+           page to the next page in an ordered series of documents}.
+
+           The command follows the same syntax and argument convention
+           as the \l {previouspage}{\\previouspage} command.
+
+           For an example, see the \l {General Description} section.
+
+    \row
+        \o \bold \\startpage \target startpage
+        \o \bold {The \\startpage command specifies the first document
+           in a collection of documents.}
+
+           The command must stand alone on its own line, and its
+           unique argument is the title of the first document.
+
+           QDoc will generate a link to the specified document which
+           is included in the HTML file but has no visual effect on
+           the documentation. The generated link type tells browsers
+           and search engines which document is considered by the
+           author to be the starting point of the collection.
+
+           For an example, see the \l {General Description} section.
+
+    \row
+        \o \bold \\contentspage \target contentspage
+        \o \bold {The \\contentspage command links the current
+           page to a contents page}.
+
+           The command follows the same syntax and argument convention
+           as the \l {previouspage}{\\previouspage} command.
+
+           For an example, see the \l {General Description} section.
+
+    \row
+        \o \bold \\indexpage \target indexpage
+        \o \bold {The \\indexpage command specifies a document providing
+           an index for the current document}.
+
+           The command must stand alone on its own line, and its
+           unique argument is the title of the index document.
+
+           QDoc will generate a link to the specified document which
+           is included in the HTML file but has no visual effect on
+           the documentation. The generated link type tells browsers
+           and search engines which document is considered by the
+           author to be the index page for the current document.
+
+           For an example, see the \l {General Description} section.
+
+    \endtable
+*/
+
+/*!
+    \page 16-qdoc-commands-status.html
+    \previouspage Navigation Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Thread Support Commands
+
+    \title Status Commands
+
+    The usage commands can indicate whether a documented object is
+    under development, becoming obsolete, provided for compatibility
+    reasons or simply not part of the public interface. They can
+    describe the history of minor versions. And they can also describe
+    a documented object's ability to handle multithreaded programming.
+
+    \section1 Alphabetical List
+
+    \l {16-qdoc-commands-status.html#compat}{\\compat},
+    \l {16-qdoc-commands-status.html#internal}{\\internal},
+    \l {16-qdoc-commands-status.html#obsolete}{\\obsolete},
+    \l {16-qdoc-commands-status.html#preliminary}{\\preliminary},
+    \l {16-qdoc-commands-status.html#since}{\\since}
+
+    \section1 Command Description
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\preliminary \target preliminary
+        \o \bold {The \\preliminary command indicates that the
+           referenced function is under development.}
+
+           The command must stand on its own line.
+
+           The \\preliminary command expands to a notification in the
+           function documentation, and marks the function as
+           preliminary when it appears in lists. For example:
+
+           \code
+           / *!
+               \preliminary
+
+               Returns information about the joining properties of the
+               character (needed for certain languages such as
+               Arabic).
+           * /
+           QChar::Joining QChar::joining() const
+           {
+               return ::joining(*this);
+           }
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>
+               <a href="http://qt.nokia.com/doc/4.0/qchar.html#Joining-enum">Joining</a>
+               QChar::joining () const</h3>
+               \endraw
+
+               \bold {This function is under development and
+               is subject to change.}
+
+               Returns information about the joining properties of the
+               character (needed for certain languages such as
+               Arabic).
+           \endquotation
+
+           And the function's entry in QChar's list of functions will
+           be rendered as
+
+         \quotation
+             \list
+             \o ...
+             \o Joining
+                \l {http://qt.nokia.com/doc/4.0/qchar.html#Joining-enum}
+                   {joining}()
+                const   \c (preliminary)
+             \o ...
+             \endlist
+         \endquotation
+
+    \row
+        \o \bold \\obsolete \target obsolete
+        \o \bold {The \\obsolete command indicates that the referenced
+           function no longer should be used in new code;
+           there is no guarantee for how long it will remain in
+           the library.}
+
+           The command must stand on its own line.
+
+           When generating the reference documentation for a class,
+           QDoc will create and link to a separate page documenting
+           its obsolete functions.  Usually an equivalent function is
+           provided as an alternative.
+
+           For example:
+
+           \code
+           / *!
+               \fn MyClass::MyObsoleteFunction
+               \obsolete
+
+               Use MyNewFunction() instead.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h1>Obsolete Members for MyClass</h1>
+               \endraw
+
+               \bold {The following class members are obsolete.} They
+               are provided to keep old source code working. We
+               strongly advise against using them in new code.
+
+               ...
+
+               \list
+                   \o void MyObsoleteFunction() \c (obsolete)
+                   \o ...
+               \endlist
+
+               \raw HTML
+               <hr />
+               <h2>Member Function Documentation</h2>
+               <h3>void MyObsoleteFunction ()</h3>
+               <p>Use MyNewFunction() instead.</p>
+               \endraw
+
+               ...
+           \endquotation
+
+           in myclass-obsolete.html
+
+
+    \row
+        \o \bold \\compat \target compat
+        \o \bold {The \\compat command indicates that the referenced class
+           or function is part of the support library provided to keep
+           old source code working.}
+
+           The command must stand on its own line.
+
+           Usually an equivalent function or class is provided as an
+           alternative.
+
+           If the command is used within the documentation of a class,
+           the command expands to a warning that the referenced class
+           is part of the support library. The warning is located on
+           top of the associated documentation. For example:
+
+           \code
+           / *!
+               \class MyQt3SupportClass
+               \compat
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \bold {This class is part of the Qt 3 support
+               library.} It is provided to keep old source code
+               working. We strongly advise against using it in new
+               code. See the \l
+               {http://qt.nokia.com/doc/4.0/porting4.html}{Porting
+               Guide} for more information.
+           \endquotation
+
+           on the top of the MyQt3SupportClass class reference.
+
+           If the command is used when documenting a function, QDoc
+           will create and link to a separate page documenting Qt 3
+           support members when generating the reference documentation
+           for the associated class. For example:
+
+           \code
+           / *!
+               \fn MyClass::MyQt3SupportMemberFunction
+               \compat
+
+               Use MyNewFunction() instead.
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h1>Qt 3 Support Members for MyClass</h1>
+               \endraw
+
+               \bold {The following class members are part of the Qt
+               3 support layer.} They are provided to help you port
+               old code to Qt 4. We advise against using them in new
+               code.
+
+               ...
+
+               \list
+                   \o void MyQt3SupportMemberFunction()
+                   \o ...
+               \endlist
+
+               \raw HTML
+               <hr />
+               <h2>Member Function Documentation</h2>
+               <h3>void MyQt3SupportMemberFunction ()</h3>
+               <p>Use MyNewFunction() instead.</p>
+               \endraw
+
+               ...
+           \endquotation
+
+           in myclass-qt3.html
+
+
+    \row
+        \o \bold \\internal \target internal
+        \o \bold {The \\internal command indicates that the referenced
+           function is not part of the public interface.}
+
+           The command must stand on its own line.
+
+           QDoc ignores the documentation as well as the documented
+           item, when generating the associated class reference
+           documenation. For example:
+
+           \code
+           / *!
+               \internal
+
+               Tries to find the decimal separator. If it can't find
+               it and the thousand delimiter is != '.' it will try to
+               find a '.';
+           * /
+           int QDoubleSpinBoxPrivate::findDelimiter
+                   (const QString &str, int index) const
+           {
+               int dotindex = str.indexOf(delimiter, index);
+               if (dotindex == -1 && thousand != dot && delimiter != dot)
+                   dotindex = str.indexOf(dot, index);
+               return dotindex;
+           }
+           \endcode
+
+           in qspinbox.cpp, will not be rendered at all.
+
+    \row
+        \o \bold \\since \target since
+        \o \bold {The \\since command tells in which minor release
+           the associated functionality was added.}
+
+           For example:
+
+           \code
+           / *!
+               \since 4.1
+
+               Returns an icon for \a standardIcon.
+
+               ...
+
+               \sa standardIconImplementation(), standardPixmap()
+           * /
+           QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
+           {
+           }
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3>QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const</h3>
+               \endraw
+
+               This function was introduced in Qt version 4.1
+
+               Returns an icon for \a standardIcon.
+
+               ...
+
+               See also \l
+               {QStyle::standardIconImplementation()}{standardIconImplementation()}
+               and \l {QStyle::standardPixmap()}{standardPixmap()}.
+               \endquotation
+
+           QDoc generates the "Qt" reference from the \l
+           {25-qdoc-configuration-derivedprojects.html#project}{\c
+           project} configuration variable. For that reason this
+           reference will change according to the current
+           documentation project.
+
+           See also \l
+           {25-qdoc-configuration-derivedprojects.html#project}{\c
+           project}.
+
+    \endtable
+*/
+
+/*!
+    \page 17-qdoc-commands-thread.html
+    \previouspage Status Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Relating Commands
+
+    \title Thread Support Commands
+
+    The thread support commands specify the level of support for
+    multithreaded programming of a class or function.
+
+    \section1 Alphabetical List
+
+    \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant},
+    \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant},
+    \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe}
+
+    \section1 General Description
+
+    There are three levels of support for multithreaded programming of
+    a class or function: \c threadsafe, \c reentrant and \c
+    nonreentrant.
+
+    The default is \c nonreentrant which means that the associated
+    class or function cannot be called by multiple threads. \c
+    Reentrant and \c threadsafe are levels primarily used for classes.
+
+    \c Reentrant means that all the functions in the referenced class
+    can be called simultaneously by multiple threads, provided that
+    each invocation of the functions reference unique data. While \c
+    threadsafe means that all the functions in the referenced class
+    can be called simultaneously by multiple threads even when each
+    invocation references shared data.
+
+    When a class is declared \c reentrant or \c threadsafe, using the
+    \l {reentrant}{\\reentrant} and \l {threadsafe}{\\threadsafe}
+    commands respectively, functions in the referenced class can be
+    declared \c nonreentrant, using the \l
+    {nonreentrant}{\\nonreentrant} command, excluding the functions
+    from the general view.
+
+    For example:
+
+    \code
+    / *!
+        \class QLocale
+        \brief The QLocale class converts between numbers and their
+        string representations in various languages.
+
+        \reentrant
+        \ingroup i18n
+        \ingroup text
+        \mainclass
+
+        QLocale is initialized with a language/country pair in its
+        constructor and offers number-to-string and string-to-number
+        conversion functions similar to those in QString.
+
+        ...
+    * /
+
+    / *!
+        \nonreentrant
+
+        Sets the global default locale to \a locale. These values are
+        used when a QLocale object is constructed with no
+        arguments. If this function is not called, the system's locale
+        is used.
+
+        \warning In a multithreaded application, the default locale
+        should be set at application startup, before any non-GUI
+        threads are created.
+
+        \sa system() c()
+    * /
+    void QLocale::setDefault(const QLocale &locale)
+    {
+        default_d = locale.d;
+    }
+    \endcode
+
+    will be rendered as
+
+    \quotation
+        \raw HTML
+            <h1><center>QLocale Class Reference</center></h1>
+        \endraw
+
+        The QLocale class converts between numbers and their string
+        representations in various languages. More...
+
+        \code
+        #include <QLocale>
+        \endcode
+
+        \bold {Note:} All the functions in this class are \l
+        {threads.html#reentrant}{reentrant}, except \l
+        {QLocale::setDefault()}{setDefault()}.
+
+        ...
+
+        \raw HTML
+            <hr />
+            <h2>Member Type Documentation</h2>
+        \endraw
+
+        ...
+
+        \raw HTML
+            <h3>void QLocale::setDefault ( const QLocale & locale ) </h3>
+        \endraw
+
+        Sets the global default locale to locale. These values are
+        used when a QLocale object is constructed with no
+        arguments. If this function is not called, the system's locale
+        is used.
+
+        \warning In a multithreaded application, the default locale
+        should be set at application startup, before any non-GUI
+        threads are created.
+
+        \warning This function is not reentrant.
+
+        See also \l {QLocale::system()}{system()} and \l
+        {QLocale::c()}{c()}.
+
+        ...
+    \endquotation
+
+    As shown above, QDoc generates a notification when a class is
+    declared reentrant, and lists the exceptions (the declared
+    nonreentrant functions). A link to the general documentation on \l
+    {threads.html#reentrant}{reentrancy and thread-safety} is
+    included.  In addition a warning, "\bold Warning: This function is
+    not reentrant.", is generated in the nonreentrant functions'
+    documentation.
+
+    QDoc will generate the same notification and warnings when a class
+    is declared threadsafe.
+
+    For more information see the general documentation on \l
+    {threads.html#reentrant}{reentrancy and thread-safety}.
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\threadsafe \target threadsafe
+        \o \bold {The \\threadsafe command indicates that the
+           associated class or function can be called simultaneously by
+           multiple threads even when each invocation references
+           shared data.}
+
+           The command must stand on its own line.
+
+           The generated documentation resulting from using the
+           \\threadsafe command is similar to the result of using the
+           \l {reentrant}{\\reentrant} command. For an example, see
+           the \l {General Description} section.
+
+           See also \l{reentrant}{\\reentrant} and
+           \l{nonreentrant}{\\nonreentrant}.
+
+    \row
+        \o \bold \\reentrant \target reentrant
+        \o \bold {The \\reentrant command indicates that the associated
+           class or function  can be called simultaneously
+           by multiple threads, provided that each invocation of the
+           functions reference unique data.}
+
+           The command must stand on its own line.
+
+           For an example, see the \l {General Description} section.
+
+           See also \l{nonreentrant}{\\nonreentrant} and
+            \l{threadsafe}{\\threadsafe}.
+
+    \row
+        \o \bold \\nonreentrant \target nonreentrant
+        \o \bold {The \\nonreentrant command indicates that the
+           associated class or function cannot be called by
+           multiple threads.}
+
+           The command must stand on its own line.
+
+           For an example, see the \l {General Description} section.
+
+           See also \l{reentrant}{\\reentrant} and
+           \l{threadsafe}{\\threadsafe}.
+
+    \endtable
+*/
+
+/*!
+    \page 18-qdoc-commands-relating.html
+    \previouspage Thread Support Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Grouping Commands
+
+    \title Relating Commands
+
+    The relation commands discribe how the documented object relates
+    to its context: Whether it is an overloaded function, a
+    reimplemented function or a global function related to a specified
+    class or header file.
+
+    \section1 Alphabetical List
+
+    \l {18-qdoc-commands-relating.html#overload}{\\overload},
+    \l {18-qdoc-commands-relating.html#reimp}{\\reimp},
+    \l {18-qdoc-commands-relating.html#relates}{\\relates},
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\overload \target overload
+        \o \bold {The \\overload command indicates that the 
+           function is a secondary overload of its name.}
+
+           The command must stand on its own line.
+
+           For any overloaded function (except constructors), QDoc
+           expects one primary version of the function and all the 
+	   the overloads marked with the \bold{\\overload command}.
+           The primary version should be fully documented. Each 
+	   overload can have whatever extra documentation you want
+	   to add for just that overload. 
+
+	   From Qt 4.5, you can include the function name plus '()'
+	   as a parameter to the \bold{\\overload} command, which 
+	   will include a standard \i{This function overloads...} 
+	   line of text with a link to the documentation for the 
+	   primary version of the function. 
+
+	   For example:
+
+           \code
+           / *!
+               \overload addAction()
+
+               This convenience function creates a new action with an
+               \a icon and some \a text. The function adds the newly
+               created action to the menu's list of actions, and
+               returns it.
+
+               \sa QWidget::addAction()
+           * /
+           QAction *QMenu::addAction(const QIcon &icon, const QString &text)
+           {
+               QAction *ret = new QAction(icon, text, this);
+               addAction(ret);
+               return ret;
+           }
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+               <h3><a href="http://qt.nokia.com/doc/4.0/qaction.html">QAction</a>
+               * QMenu::addAction ( const QIcon & <i>icon</i>,
+               const QString & <i>text</i> )
+               </h3>
+               \endraw
+
+	       This function overloads \l {http://qt.nokia.com/doc/4.0/qwidget.html#addAction}{addAction()}
+
+               This convenience function creates a new action with an
+               \i icon and some \i text. The function adds the newly
+               created action to the menu's list of actions, and
+               returns it.
+
+               See also
+               \l {http://qt.nokia.com/doc/4.0/qwidget.html#addAction}
+               {QWidget::addAction}().
+           \endquotation
+
+	   If you don't include the function name with the
+	   \bold{\\overlaod} command, then instead of the "This
+	   function overloads..." line with the link to the
+	   documentation for the primary version, you get the old
+	   standard line:
+
+	   \quotation
+               This is an overloaded member function, provided for
+               convenience. 
+	   \endquotation.
+
+    \row
+        \o \bold \\reimp \target reimp
+        \o \bold {The \\reimp command indicates that the
+           referenced function is a reimplementation of a virtual function,
+           where the reimplementation has no effect on the interface.}
+
+           The command must stand on its own line.
+
+           QDoc will omit the reimplemented function from the class
+           reference. For example:
+
+           \code
+           / *!
+               \reimp
+           * /
+           void QToolButton::nextCheckState()
+           {
+               Q_D(QToolButton);
+               if (!d->defaultAction)
+                   QAbstractButton::nextCheckState();
+               else
+                   d->defaultAction->trigger();
+           }
+           \endcode
+
+           will not be rendered at all; only a link to the inherited
+           QAbstractButton::nextCheckState() will appear in the
+           documentation.
+
+    \row
+        \o \bold \\relates \target relates
+        \o \bold {The \\relates command attaches the documentation of
+           a global function to that of a related class or header file.}
+
+           The command's argument is a class name, an the command (and
+           its argument) must stand on its own line.
+
+           \code
+           / *!
+               \relates QChar
+
+               Reads a char from the stream \a in into char \a chr.
+
+               \sa {Format of the QDataStream operators}
+           * /
+           QDataStream &operator>>(QDataStream &in, QChar &chr)
+           {
+               quint16 u;
+               in >> u;
+               chr.unicode() = ushort(u);
+               return in;
+           }
+           \endcode
+
+           will be rendered with the QChar documentation.
+
+    \endtable
+*/
+
+/*!
+    \page 19-qdoc-commands-grouping.html
+    \previouspage Relating Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Title Commands
+
+    \title Grouping Commands
+
+    The grouping commands relate classes to defined groups and
+    modules. The groups are used when generating lists of related
+    classes in the documentation, while the modules are elements of
+    Qt's structure.
+
+    \section1 Alphabetical List
+
+    \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup},
+    \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule},
+    \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass},
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\mainclass \target mainclass
+        \o \bold {The \\mainclass command relates the documented class to
+           a group called mainclasses.}
+
+           The command must stand on its own line.
+
+           For example:
+
+           \code
+           / *!
+               \class QWidget qwidget.h
+               \brief The QWidget class is the base class of
+               all user interface objects.
+
+               \mainclass
+
+               ...
+           * /
+           \endcode
+
+           will ensure that the QWidget class is included in the \c
+           mainclasses group, which means, for example, that the class
+           will appear on the list created by calling the \l
+           {generatelist}{\\generatelist} command with the \c
+           mainclasses argument:
+
+           \l http://qt.nokia.com/doc/4.0/mainclasses.html
+
+           See also \l {generatelist}{\\generatelist}.
+
+    \row
+        \o \bold \\ingroup \target ingroup
+
+        \o \bold {The \\ingroup command indicates that the given
+           overview or documented class belongs to a certain group of
+           related docmentation.}
+
+           A class or overview may belong to many groups.
+
+           The \\ingroup command's argument is a group name, but note
+           that the command considers the rest of the line as part of
+           its argument. Make sure that the group name is followed by
+           a linebreak. For example:
+
+           \code
+           / *!
+               \class QDir
+               \brief The QDir class provides access to directory
+                      structures and their contents.
+
+               \ingroup io
+               ...
+           * /
+           \endcode
+
+           will ensure that the QDir class is included in the \c io
+           group, which means, for example, that QDir will appear on
+           the list created by calling the \l {group}{\\group} command
+           with the \c io argument.
+
+           Note that to list overviews that are related to a given
+           group, you must generate the list exlicitly by using the \l
+           {generatelist}{\\generatelist} command with the \c related
+           argument.
+
+           See also \l {group}{\\group}.
+    \row
+        \o \bold \\inmodule \target inmodule
+        \o \bold {The \\inmodule command relates the documented class
+           to the module specified by the command's argument.}
+
+           For the basic classes in Qt, a class's module is determined
+           by its location, i.e. its directory. However, for
+           extensions, like ActiveQt and Qt Designer, a class needs to
+           be related to a module explicitly.
+
+           The command's argument is a module name, but note that the
+           command considers the rest of the line as part of its
+           argument. Make sure that the module name is followed by a
+           linebreak. For example:
+
+           \code
+           /*!
+               \class QDesignerTaskMenuExtension
+               \inmodule QtDesigner
+           * /
+           \endcode
+
+           will ensure that the QDesignerTaskMenuExtension class is
+           included in the \c QtDesigner module, which means, for
+           example, that the class will appear on the list created by
+           calling the \l {generatelist}{\\generatelist} command with
+           the \c {{classesbymodule QtDesigner}} argument.
+
+           See also \l {module}{\\module} and \l
+           {generatelist}{\\generatelist}.
+    \endtable
+*/
+
+/*!
+    \page 20-qdoc-commands-title.html
+    \previouspage Grouping Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage QDoc Configuration
+
+    \title Title Commands
+
+    In general a title command considers everything that follows it
+    until the first line break as its argument.  If the title needs to
+    be spanned over several lines, make sure to end each line (except
+    the last one) with a backslash.
+
+    \section1 Alphabetical List
+
+    \l {20-qdoc-commands-title.html#title}{\\title},
+    \l {20-qdoc-commands-title.html#subtitle}{\\subtitle}
+
+    \section1 Command Descriptions
+
+    \table
+    \header
+        \o Command
+        \o Description
+
+    \row
+        \o \bold \\title \target title
+        \o \bold {The \\title command sets the title for a
+           documentation page, or allows you to override it.}
+
+           For example:
+
+           \code
+           / *!
+               \page signalandslots.html
+
+               \title Signals and Slots
+
+               Signals and slots are used for communication between
+               objects. The signals and slots mechanism is a central
+               feature of Qt and probably the part that differs most
+               from the features provided by other frameworks.
+
+               ...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+                   <h1><center>Signal and Slots</center></h1>
+               \endraw
+
+               Signals and slots are used for communication between
+               objects. The signals and slots mechanism is a central
+               feature of Qt and probably the part that differs most
+               from the features provided by other frameworks.
+
+               ...
+           \endquotation
+           See also \l {subtitle}{\\subtitle}.
+
+    \row
+        \o \bold \\subtitle \target subtitle
+        \o \bold {The \\subtitle command sets a subtitle for a
+           documentation page.}
+
+           For example:
+
+           \code
+           / *!
+               \page qtopiacore-overview.html
+
+               \title Qtopia Core
+               \subtitle Qt for Embedded Linux
+
+               Qt/Embedded, the embedded Linux port of Qt, is a
+               complete and self-contained C++ GUI and platform
+               development tool for Linux-based embedded development.
+
+               ...
+           * /
+           \endcode
+
+           will be rendered as
+
+           \quotation
+               \raw HTML
+                   <h1><center>Qtopia Core</center></h1>
+                   <h2><center>Qt for Embedded Linux</center></h2>
+               \endraw
+
+               Qt/Embedded, the embedded Linux port of Qt, is a
+               complete and self-contained C++ GUI and platform
+               development tool for Linux-based embedded development.
+
+               ...
+           \endquotation
+
+           See also \l {title}{\\title}.
+    \endtable
+*/
+
+/*!
+    \page 21-0-qdoc-configuration.html
+    \previouspage Title Commands
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage General Configuration Variables
+
+    \title QDoc Configuration
+
+    \tableofcontents
+
+    \list
+    \o \l {Supporting Derived Projects}
+    \o \l {QDoc Compatibility}
+    \endlist
+
+    When running QDoc to generate the documentation, you must specify
+    a configuration file on the command line:
+
+    \quotation
+        \bold {/currentdirectory$ qdoc3 my-documentation.qdocconf}
+    \endquotation
+
+    \section1 General Description
+
+    The configuration file is a list of entries of entries of the form
+    \i {"variable = value"}. Using the configuration variables, you
+    can define where QDoc should find the various source files, images
+    and examples, where to put generated documentation etc. The
+    configuration file can also contain directives like \c
+    include. For an example, see the \l minimum.qdocconf file.
+
+    In addition, you can use some particular configuration variables
+    to make QDoc support derived projects, i.e make the projects, for
+    example Qt Solutions, contain links to the online Qt
+    documentation. These variables are documented in the \l
+    {Supporting Derived projects} section. In this section you can
+    also find out how to use these variables to support your derived
+    projects.
+
+    If some of the variable keys have the same values, they can be set
+    at the same time. For example:
+
+    \code
+    {header, source}dirs = kernel
+    \endcode
+
+    is equivalent to
+
+    \code
+    headerdirs = kernel
+    sourcedirs = kernel
+    \endcode
+
+    A variable's value can be set using either '=' or '+='. The
+    difference is that '=' overrides any previously set value, while
+    '+=' only adds the value to the previously set ones.
+
+    In general, some of the variables accepts a list of strings as
+    their value, while others only accept a single string. If you
+    provide a variable of the latter type with several strings they
+    will simply be concatenated. The quotes around the value string
+    are optional. But applying them allows you to use special
+    characters like '=' and ' \" ' within the string. For example:
+
+    \code
+    HTML.postheader = "<a href=\"index.html\">Home</a>"
+    \endcode
+
+    If an entry spans many lines, use a backslash at the end of every
+    line but the last:
+
+    \code
+    sourcedirs = kernel \
+                 tools \
+                 widgets
+    \endcode
+
+    \section1 Configuration Variables
+
+    \section2 Alphabetical List
+
+    \l {22-qdoc-configuration-generalvariables.html#alias}{alias},
+    \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives}
+       {Cpp.ignoredirectives},
+    \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretoken}
+       {Cpp.ignoretokens},
+    \l {22-qdoc-configuration-generalvariables.html#definesvariable}{defines},
+    \l {22-qdoc-configuration-generalvariables.html#edition}{edition},
+    \l {22-qdoc-configuration-generalvariables.html#exampledirs}{exampledirs},
+    \l {22-qdoc-configuration-generalvariables.html#examples}{examples},
+    \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions}
+       {examples.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#extraimages}{extraimages},
+    \l {22-qdoc-configuration-generalvariables.html#falsehoods}{falsehoods},
+    \l {22-qdoc-configuration-generalvariables.html#headerdirs}{headerdirs},
+    \l {22-qdoc-configuration-generalvariables.html#headers}{headers},
+    \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions}
+       {headers.fileextensions},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.footer}{HTML.footer},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader}
+       {HTML.postheader},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.style}{HTML.style},
+    \l {22-qdoc-configuration-generalvariables.html#imagedirs}{imagedirs},
+    \l {22-qdoc-configuration-generalvariables.html#images}{images},
+    \l {22-qdoc-configuration-generalvariables.html#images.fileextensions}
+       {images.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#language}{language},
+    \l {22-qdoc-configuration-generalvariables.html#macro}{macro},
+    \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir},
+    \l {22-qdoc-configuration-generalvariables.html#outputformats}
+       {outputformats},
+    \l {22-qdoc-configuration-generalvariables.html#slow}{slow},
+    \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs},
+    \l {22-qdoc-configuration-generalvariables.html#sources}{sources},
+    \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions}
+       {sources.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#spurious}{spurious},
+    \l {22-qdoc-configuration-generalvariables.html#tabsize}{tabsize},
+    \l {22-qdoc-configuration-generalvariables.html#version}{version},
+    \l {22-qdoc-configuration-generalvariables.html#versionsym}{versionsym}
+
+    \section2 Categories
+
+    \list
+    \o \l {General Configuration Variables}
+    \o \l {C++ Specific Configuration Variables}
+    \o \l {HTML Specific Configuration Variables}
+    \endlist
+
+    \section1 Configuration File Examples
+
+    \list
+    \o A minimum configuration file: \l minimum.qdocconf
+    \o The Qt configuration file: \l qt.qdocconf
+    \endlist
+*/
+
+/*!
+    \page 21-1-minimum-qdocconf.html
+    \previouspage QDoc Configuration
+    \contentspage QDoc Manual - Table of Contents
+
+    \title minimum.qdocconf
+
+    \quotefile examples/minimum.qdocconf
+*/
+
+/*!
+    \page 21-2-qt-qdocconf.html
+    \previouspage QDoc Configuration
+    \contentspage QDoc Manual - Table of Contents
+
+    \title qt.qdocconf
+
+    \quotefile files/qt.qdocconf
+*/
+
+/*!
+    \page 22-qdoc-configuration-generalvariables.html
+    \previouspage QDoc Configuration
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Creating Help Project Files
+
+    \title General Configuration Variables
+
+    With the general QDoc configuration variables, you can define
+    where QDoc will find the various source files it needs to generate
+    the documentation, as well as the directory to put the generated
+    documentation. You can also do some minor manipulation of QDoc
+    itself, controlling its output and processing behavior.
+
+    \section1 Alphabetical List
+
+    \l {22-qdoc-configuration-generalvariables.html#alias}{alias},
+    \l {22-qdoc-configuration-generalvariables.html#codeindent}{codeindent},
+    \l {22-qdoc-configuration-generalvariables.html#definesvariable}{defines},
+    \l {22-qdoc-configuration-generalvariables.html#edition}{edition},
+    \l {22-qdoc-configuration-generalvariables.html#exampledirs}{exampledirs},
+    \l {22-qdoc-configuration-generalvariables.html#examples}{examples},
+    \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions}
+       {examples.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#extraimages}{extraimages},
+    \l {22-qdoc-configuration-generalvariables.html#falsehoods}{falsehoods},
+    \l {22-qdoc-configuration-generalvariables.html#generateindex}{generateindex},
+    \l {22-qdoc-configuration-generalvariables.html#headerdirs}{headerdirs},
+    \l {22-qdoc-configuration-generalvariables.html#headers}{headers},
+    \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions}
+       {headers.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#imagedirs}{imagedirs},
+    \l {22-qdoc-configuration-generalvariables.html#images}{images},
+    \l {22-qdoc-configuration-generalvariables.html#images.fileextensions}
+       {images.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#language}{language},
+    \l {22-qdoc-configuration-generalvariables.html#macro}{macro},
+    \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir},
+    \l {22-qdoc-configuration-generalvariables.html#outputformats}
+       {outputformats},
+    \l {22-qdoc-configuration-generalvariables.html#slow}{slow},
+    \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs},
+    \l {22-qdoc-configuration-generalvariables.html#sources}{sources},
+    \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions}
+       {sources.fileextensions},
+    \l {22-qdoc-configuration-generalvariables.html#spurious}{spurious},
+    \l {22-qdoc-configuration-generalvariables.html#tabsize}{tabsize},
+    \l {22-qdoc-configuration-generalvariables.html#tagfile}{tagfile},
+    \l {22-qdoc-configuration-generalvariables.html#version}{version},
+    \l {22-qdoc-configuration-generalvariables.html#versionsym}{versionsym}
+
+    \section1 Variable Descriptions
+
+    \table
+
+    \header
+        \o Variable
+        \o Description
+
+    \row
+        \o \bold alias \target alias
+        \o \bold {The \c alias variable renames a QDoc command.}
+
+           The general syntax is \tt {alias.\i{original-command-name}
+           = \i temporary-command-name}.
+
+           For example:
+
+           \code
+           alias.i = e
+           \endcode
+
+           renames the built-in command \\i (italics) to \\e.
+
+           The \c alias variable is often used for compatibility
+           reasons; for more information see the \l {QDoc
+           Compatibility}{compatibility section}.
+
+           See also \l macro.
+
+    \row
+        \o \bold codeindent \target codeindent
+        \o \bold {The \c codeindent variable specifies the level of
+           indentation that QDoc uses when writing code snippets.}
+
+           QDoc originally used a hard-coded value of four spaces for
+           code indentation to ensure that code snippets could be easily
+           distinguished from surrounding text. Since we can use
+           \l{HTML Specific Configuration Variables#HTML.stylesheets}{stylesheets} to
+           adjust the appearance of certain types of HTML elements, this
+           level of indentation is not always required.
+
+    \row
+        \o \bold defines \target definesvariable
+        \o \bold {The \c defines variable specifies the C++ preprocessor
+           symbols that QDoc will recognize and respond to.}
+
+           When a preprocessor symbol is specified using the \c
+           defines variable, you can also use the \l {if}{\\if}
+           command to enclose documentation that only will be included
+           if the preprocessor symbol is defined.
+
+           The values of the variable are regular expressions (see
+           QRegExp for details). By default, no symbol is defined,
+           meaning that code protected with #ifdef...#endif will be
+           ignored.
+
+           For example:
+
+           \code
+           defines = Q_QDOC \
+                     QT_.*_SUPPORT \
+                     QT_.*_LIB \
+                     QT_COMPAT \
+                     QT3_SUPPORT \
+                     Q_WS_.* \
+                     Q_OS_.* \
+                     Q_BYTE_ORDER \
+                     __cplusplus
+           \endcode
+
+           ensures that QDoc will process the code that requires these
+           symbols to be defined. For example:
+
+           \code
+           #ifdef Q_WS_WIN
+               HDC getDC() const;
+               void releaseDC(HDC) const;
+           #endif
+           \endcode
+
+           Since the Q_WS_.* regular expression (specified using the
+           \c defines variable) matches Q_WS_WIN, QDoc will process
+           the code within #ifdef and #endif in our example.
+
+           You can also define preprocessor symbols manually on the
+           command line using the -D option. For example:
+
+           \code
+               currentdirectory$ qdoc3 -Dconsoleedition qt.qdocconf
+           \endcode
+
+           In this case the -D option ensures that the \c
+           consoleedition preprocessor symbol is defined when QDoc
+           processes the source files defined in the qt.qdocconf file.
+
+           See also \l falsehoods and \l {if}{\\if}.
+
+    \row
+        \o \bold edition \target edition
+        \o \bold {The \c edition variable specifies which modules are
+           included in each edition of a package, and provides QDoc
+           with information to provide class lists for each edition.}
+
+           This feature is mostly used when providing documentation
+           for Qt packages.
+
+           The \c edition variable is always used with a particular
+           edition name to define the modules for that edition:
+
+           \code
+           edition.Console      = QtCore QtNetwork QtSql QtXml
+           edition.Desktop      = QtCore QtGui QtNetwork QtOpenGL QtSql QtXml \
+                                  QtDesigner QtAssistant Qt3Support QAxContainer \
+                                  QAxServer
+           edition.DesktopLight = QtCore QtGui Qt3SupportLight
+           \endcode
+
+           In the above examples, the \c Console edition only includes
+           the contents of four modules. Only the classes from these
+           modules will be used when the
+           \l{Miscellaneous Commands#generatelist}{generatelist} command
+           is used to generate a list of classes for this edition:
+
+           \code
+           \generatelist{classesbyedition Console}
+           \endcode
+
+    \row
+        \o \bold exampledirs \target exampledirs
+        \o \bold {The \c exampledirs variable specifies the directories
+           containing the source code of the example files.}
+
+           The \l {examples}{\c examples} and \c exampledirs variables
+           are used by the \l {quotefromfile}{\\quotefromfile}, \l
+           {quotefile}{\\quotefile} and \l {example}{\\example}
+           commands.  If both the \l {examples}{\c examples} and \c
+           exampledirs variables are defined, QDoc will search in
+           both, first in \l {examples}{\c examples} then in \c
+           exampledirs.
+
+           QDoc will search through the directories in the specified
+           order, and accept the first matching file it finds. It will
+           only search in the specified directories, \i not in
+           subdirectories.
+
+           For example:
+
+           \code
+           exampledirs = $QTDIR/doc/src \
+                         $QTDIR/examples \
+                         $QTDIR \
+                         $QTDIR/qmake/examples
+
+           examples    = $QTDIR/examples/widgets/analogclock/analogclock.cpp
+           \endcode
+
+           When processing
+
+           \code
+           \quotefromfile widgets/calculator/calculator.cpp
+           \endcode
+
+           QDoc will then see if there exists a file called \c
+           calculator.cpp listed as a value in the \l {examples}{\c
+           examples} variable. If it doesn't, it will search in the \c
+           exampledirs variable, and first see if there exists a file
+           called
+
+           \code
+           $QTDIR/doc/src/widgets/calculator/calculator.cpp
+           \endcode
+
+           If it doesn't, QDoc will continue looking for a file
+           called
+
+           \code
+           $QTDIR/examples/widgets/calculator/calculator.cpp
+           \endcode
+
+           and so forth.
+
+           See also \l examples.
+
+    \row
+        \o \bold examples \target examples
+        \o \bold {The \c examples variable allows you to specify individual
+           example files in addition to those located in the directories
+           specified by the \l {exampledirs}{\c exampledirs} variable.}
+
+           The \c examples and \l {exampledirs}{\c exampledirs}
+           variables are used by the \l
+           {quotefromfile}{\\quotefromfile}, \l
+           {quotefile}{\\quotefile} and \l {example}{\\example}
+           commands. If both the \c examples and \l {exampledirs}{\c
+           exampledirs} variables are defined, QDoc will search in
+           both, first in \c examples then in \l {exampledirs}{\c
+           exampledirs}.
+
+           QDoc will search through the values listed for the \c
+           examples variable, in the specified order, and accept
+           the first one it finds.
+
+           For an extensive example, see the \l {exampledirs}{\c
+           exampledirs} command. But note that if you know the file is
+           listed in the \c examples variable, you don't need to
+           specify its path:
+
+           \code
+               \quotefromfile calculator.cpp
+           \endcode
+
+           See also \l exampledirs.
+
+    \row
+        \o \bold examples.fileextensions \target examples.fileextensions
+        \o \bold {The \c examples.fileextensions variable specifies the
+           file extensions that qdoc will look for when collecting example
+           files for display in the documentation.}
+
+           The default extensions are *.cpp, *.h, *.js, *.xq, *.svg, *.xml
+           and *.ui. However, if 
+
+           The extensions are given as standard wildcard expressions.
+           You can add a file extension to the filter using '+='. For
+           example:
+
+           \code
+           examples.fileextensions += *.qrc
+           \endcode
+
+           See also \l{headers.fileextensions}.
+
+    \row
+        \o \bold extraimages \target extraimages
+        \o \bold {The \c extraimages variable tells QDoc to incorporate
+           specific images in the generated documentation.}
+
+           QDoc will not recognize images used within HTML (or any
+           other markup language). If we want the images to be copied
+           from the directories specified by \l {imagedirs}{\c
+           imagedirs} (the images in question must be located in these
+           directories) to the output directory, we must specify the
+           images using the \c extraimages variable.
+
+           The general syntax is \tt {extraimages.\i{format} = \i
+           image}. The file extension is optional.
+
+           For example, in \l qt.qdocconf we use a couple of images
+           within the HTML.postheader variable which value is pure
+           HTML. For that reason, these images are specified using the
+           \c extraimages variable:
+
+           \code
+           extraimages.HTML = qt-logo
+           \endcode
+
+           See also \l images and \l imagedirs.
+
+    \row
+        \o \bold falsehoods \target falsehoods
+        \o \bold {The \c falsehoods variable defines the truth value of
+           specified preprocessor symbols as false.}
+
+           If this variable is not set for a preprocessor symbol, QDoc
+           assumes its truth value is true. The exception is '0',
+           which value always is false.
+
+           QDoc will recognize, and is able to evaluate, the following
+           preprocessor syntax:
+
+           \code
+           #ifdef NOTYET
+               ...
+           #endif
+
+           #if defined (NOTYET)
+               ...
+           #end if
+           \endcode
+
+           However, faced with unknown syntax like
+
+           \code
+           #if NOTYET
+               ...
+           #endif
+           \endcode
+
+           QDoc will evaluate it as true by default, \i unless the
+           preprocessor symbol is specified within the \c falsehoods
+           variable entry:
+
+           \code
+           falsehoods = NOTYET
+           \endcode
+
+           See also \l defines.
+
+    \row
+        \o \bold generateindex \target generateindex
+        \o \bold{The \c generateindex variable contains a boolean value that
+           specifies whether to generate an index file when HTML documentation
+           is generated.}
+
+           By default, an index file is always generated with HTML documentation,
+           so this variable is typically only used when disabling this feature
+           (by setting the value to \c false) or when enabling index generation
+           for the WebXML output (by setting the value to \c true).
+    \row
+        \o \bold headerdirs \target headerdirs
+        \o \bold {The \c headerdirs variable specifies the directories
+           containing the header files associated with the \c .cpp source
+           files used in the documentation.}
+
+           For example:
+
+           \code
+           headerdirs = $QTDIR/src \
+                        $QTDIR/extensions/activeqt \
+                        $QTDIR/extensions/motif \
+                        $QTDIR/tools/designer/src/lib/extension \
+                        $QTDIR/tools/designer/src/lib/sdk \
+                        $QTDIR/tools/designer/src/lib/uilib
+           \endcode
+
+           When executed, the first QDoc will do is to read through
+           the headers specified in the \l {headers}{\c headers}
+           variable, and the ones located in the directories specified
+           in the \c headerdir variable (including all
+           subdirectories), building an internal structure of the
+           classes and their functions.
+
+           Then it will read through the sources specified in the \l
+           {sources}{\c sources}, and the ones located in the
+           directories specified in the \l {sourcedirs}{\c sourcedirs}
+           varible (including all subdirectories), merging the
+           documentation with the structure it retrieved from the
+           header files.
+
+           If both the \c headers and \c headerdirs variables are
+           defined, QDoc will read through both, first \l {headers}{\c
+           headers} then \c headerdirs.
+
+           In the specified directories, QDoc will only read the files
+           with the fileextensions specified in the \l
+           {headers.fileextensions}{\c headers.fileextensions}
+           variable. The default extensions are *.ch, *.h, *.h++,
+           *.hh, *.hpp and *.hxx". The files specified by \l
+           {headers}{\c headers} will be read independent of their
+           fileextensions.
+
+           See also \l headers and \l headers.fileextensions.
+
+    \row
+        \o \bold headers \target headers
+        \o \bold {The \c headers variable allows you to specify individual
+           header files in addition to those located in the directories
+           specified by the \l {headerdirs}{\c headerdirs} variable.}
+
+           For example:
+
+           \code
+           headers = $QTDIR/src/gui/widgets/qlineedit.h \
+                     $QTDIR/src/gui/widgets/qpushbutton.h
+           \endcode
+
+           When processing the \c headers variable, QDoc behaves in the
+           same way as it does when processing the \l {headerdirs}{\c
+           headerdirs} variable. For more information, see the \l
+           {headerdirs}{\c headerdirs} variable.
+
+           See also \l headerdirs.
+
+    \row
+        \o \bold headers.fileextensions \target headers.fileextensions
+        \o \bold {The \c headers.fileextensions variable specify the
+           extension used by the headers.}
+
+           When processing the header files specified in the \l
+           {headerdirs}{\c headerdirs} variable, QDoc will only read
+           the files with the fileextensions specified in the \c
+           headers.fileextensions variable. In this way QDoc avoid
+           spending time reading irrelevant files.
+
+           The default extensions are *.ch, *.h, *.h++, *.hh, *.hpp
+           and *.hxx.
+
+           The extensions are given as standard wildcard expressions.
+           You can add a file extension to the filter using '+='. For
+           example:
+
+           \code
+           header.fileextensions += *.H
+           \endcode
+
+           \warning The above assignment may not work as described.
+
+           See also \l headerdirs.
+
+    \row
+        \o \bold imagedirs \target imagedirs
+        \o \bold {The \c imagedirs variable specifies the directories
+           containing the images used in the documentation.}
+
+           The \l {images}{\c images} and \c imagedirs variables are
+           used by the \l {image}{\\image} and \l
+           {inlineimage}{\\inlineimage} commands.  If both the \l
+           {images}{\c images} and \c imagedirs variables are defined,
+           QDoc will search in both, first in \l {images}{\c images}
+           then in \c imagedirs.
+
+           QDoc will search through the directories in the specified
+           order, and accept the first matching file it finds. It will
+           only search in the specified directories, \i not in
+           subdirectories.
+
+           For example:
+
+           \code
+           imagedirs = $QTDIR/doc/src/images \
+                       $QTDIR/examples
+
+           images    = $QTDIR/doc/src/images/calculator-example.png
+           \endcode
+
+           When processing
+
+           \code
+               \image calculator-example.png
+           \endcode
+
+           QDoc will then see if there exists a file called
+           calculator-example.png listed as a value in the \c images
+           variable. If it doesn't, it will search in the \c imagedirs
+           variable, and first see if there exists a file called
+
+           \code
+               $QTDIR/doc/src/images/calculator-example.png
+           \endcode
+
+           If it doesn't, QDoc will look for a file called
+
+           \code
+               $QTDIR/examples/calculator-example.png
+           \endcode
+
+           You can filter the images in an image directory using the
+           \l {images.fileextensions}{\c images.fileextensions}
+           variable.  The general idea behind the \l
+           {images.fileextensions}{\c images.fileextensions} variable
+           is to enable different image format for different output
+           format.
+
+           \warning The \l {images.fileextensions}{\c
+           images.fileextensions} variable's functionality is
+           preliminay since QDoc at this point only support HTML.
+
+           See also \l images and \l images.fileextensions.
+
+    \row
+        \o \bold images \target images
+        \o \bold {The \c images variable allows you to specify individual
+           image files in addition to those located in the directories
+           specified by the \l {imagedirs}{\c imagedirs} variable.}
+
+           For example:
+
+           \code
+               images = $QTDIR/doc/src/images/calculator-example.png
+           \endcode
+
+           When processing the \c images variable, QDoc behaves in the
+           same way as it does when processing the \l {imagedirs}{\c
+           imagedirs} variable. For more information, see the \l
+           {imagedirs}{\c imagedirs} variable.
+
+           See also \l imagedirs and \l images.fileextensions.
+
+    \row
+        \o \bold images.fileextensions \target images.fileextensions
+        \o \bold {The images.fileextensions variable filters the files within
+           an image directory.}
+
+           The variable's values (the extensions) are given as
+           standard wildcard expressions.  The general syntax is: \tt
+           {images.fileextensions.\i{format} = *.\i{extension}}.
+
+           The idea is to enable different image format for different
+           output format. For example:
+
+           \code
+               images.fileextensions.HTML = *.png
+               images.fileextensions.LOUT = *.eps
+           \endcode
+
+           Then, when processing the \l {image}{\\image} and \l
+           {inlineimage}{\\inlineimage} commands, QDoc will only
+           search for files with extensions specified in the output
+           format's associated image extension variable.
+
+           \warning This is preliminary functionality since QDoc at
+           this point only support HTML.
+
+           The default extensions for HTML are *.png, *.jpg, *.jpeg
+           and *.gif.
+
+           You can add a file extension to the filter using '+='. For
+           example:
+
+           \code
+               images.fileextensions.HTML += *.eps
+           \endcode
+
+           See also \l imagedirs and \l images.
+
+    \row
+        \o \bold language \target language
+        \o \bold {The \c language variable specifies the language of the
+           source code that is used in the documentation.}
+
+           Currently, C++ is the only language that QDoc
+           understands. It is also the default language, and doesn't
+           really need to be specified. But for example in \l
+           qt.qdocconf:
+
+           \code
+           language = Cpp
+           \endcode
+
+           identifies the language of the Qt source code as C++.
+
+    \row
+        \o \bold macro \target macro
+        \o \bold {The \c macro variable can be used to create your
+           own QDoc commands.}
+
+           The general syntax is \tt {macro.\i{command} =
+           "\i{definition}}". The definition can be described using
+           QDoc syntax. In addition it is possible to provide an HTML
+           definition by appending .HTML to the variable.
+
+           For example in \l qt.qdocconf:
+
+           \code
+           macro.gui              = "\\bold"
+           macro.raisedaster.HTML = "<sup>*</sup>"
+           \endcode
+
+           makes sure that the \\gui command renders its argument using a
+           bold font, and that \\raisedaster renders a '*'.
+
+    \row
+        \o \bold naturallanguage \target naturallanguage
+        \o \bold {The \c naturallanguage variable specifies the natural
+           language used for the documentation generated by qdoc.}
+
+           For example:
+
+           \code
+           naturallanguage = zh-Hans
+           \endcode
+
+           By default, the natural language is \c en for compatibility
+           with legacy documentation.
+
+           qdoc will add the natural language information to the HTML
+           it generates, using the \c lang and \c xml:lang attributes.
+
+           See also \l sourceencoding, \l outputencoding,
+           \l{http://www.w3.org/TR/xhtml1/#C_7}{C.7. The lang and xml:lang Attributes} and
+           \l{http://www.w3.org/TR/i18n-html-tech-lang/#ri20040429.113217290}{Best Practice 13: Using Hans and Hant codes}.
+
+    \row
+        \o \bold outputdir \target outputdir
+        \o \bold {The \c outputdir variable specifies the directory
+           where QDoc will put the generated documentation.}
+
+           In qt.qdocconf:
+
+           \code
+           outputdir = $QTDIR/doc/html
+           \endcode
+
+           locates the generated Qt reference documentation in
+           $QTDIR/doc/html. For example, the documentation of the
+           QWidget class is located in
+
+           \code
+           $QTDIR/doc/html/qwidget.html
+           \endcode
+
+           The associated images will be put in an \c images subdirectory.
+
+           \warning When running QDoc multiple times using the same output
+           directory, all files from the previous run will be lost.
+
+    \row
+        \o \bold outputencoding \target outputencoding
+        \o \bold {The \c outputencoding variable specifies the encoding
+           used for the documentation generated by qdoc.}
+
+           For example:
+
+           \code
+           outputencoding = UTF-8
+           \endcode
+
+           By default, the output encoding is \c ISO-8859-1 (Latin1) for
+           compatibility with legacy documentation. When generating
+           documentation for some languages, particularly non-European
+           languages, this is not sufficient and an encoding such as UTF-8
+           is required.
+
+           qdoc will encode HTML using this encoding and generate the
+           correct declarations to indicate to browsers which encoding
+           is being used. The \l naturallanguage configuration variable
+           should also be specified to provide browsers with a complete
+           set of character encoding and language information.
+
+           See also \l outputencoding and \l naturallanguage.
+
+    \row
+        \o \bold outputformats \target outputformats
+        \o \bold {The \c outputformats variable specifies the format of
+           the generated documentation.}
+
+           Currently, QDoc only supports the HTML format. It is also
+           the default format, and doesn't need to be specified.
+
+    \row
+        \o \bold qhp \target qhp
+        \o \bold{The \c qhp variable is used to define the information to be
+           written out to Qt Help Project (\c{qhp}) files.}
+
+           See the \l{Creating Help Project Files} chapter for information
+           about this process.
+
+    \row
+        \o \bold slow \target slow
+        \o \bold {The \c slow variable specifies whether QDoc should do
+           time-consuming processing, such as syntax highlighting.}
+
+           By default, this setting is false.
+
+           Example:
+
+           \code
+               slow = true
+           \endcode
+
+           Another way to turn on "slowness" is to invoke QDoc with the
+           \c -slow command-line option.
+
+    \row
+        \o \bold sourcedirs \target sourcedirs
+        \o \bold {The \c sourcedirs variable specifies the directories
+           containing the \c .cpp or \c .qdoc files used in
+           the documentation.}
+
+           For example in \l qt.qdocconf
+
+           \code
+           sourcedirs = $QTDIR/src \
+                        $QTDIR/doc/src \
+                        $QTDIR/extensions/activeqt \
+                        $QTDIR/extensions/motif \
+                        $QTDIR/tools/designer/src/lib/extension \
+                        $QTDIR/tools/designer/src/lib/sdk \
+                        $QTDIR/tools/designer/src/lib/uilib
+           \endcode
+
+           When executed, the first QDoc will do is to read through
+           the headers specified in the \l {header}{\c header}
+           variable, and the ones located in the directories specified
+           in the \c headerdir variable (including all
+           subdirectories), building an internal structure of the
+           classes and their functions.
+
+           Then it will read through the sources specified in the \l
+           {sources}{\c sources}, and the ones located in the
+           directories specified in the \l {sourcedirs}{\c sourcedirs}
+           varible (including all subdirectories), merging the
+           documentation with the structure it retrieved from the
+           header files.
+
+           If both the \c sources and \c sourcedirs variables are
+           defined, QDoc will read through both, first \l {sources}{\c
+           sources} then \c sourcedirs.
+
+           In the specified directories, QDoc will only read the files
+           with the fileextensions specified in the \l
+           {sources.fileextensions}{\c sources.fileextensions}
+           variable. The default extensions are *.c++, *.cc, *.cpp and
+           *.cxx. The files specified by \l {sources}{\c sources} will
+           be read independent of their fileextensions.
+
+           See also \l sources and \l sources.fileextensions.
+
+    \row
+        \o \bold sourceencoding \target sourceencoding
+        \o \bold {The \c sourceencoding variable specifies the encoding
+           used for the source code and documentation.}
+
+           For example:
+
+           \code
+           sourceencoding = UTF-8
+           \endcode
+
+           By default, the source encoding is \c ISO-8859-1 (Latin1) for
+           compatibility with legacy documentation. For some languages,
+           particularly non-European languages, this is not sufficient
+           and an encoding such as UTF-8 is required.
+
+           Although qdoc will use the encoding to read source and
+           documentation files, limitations of C++ compilers may prevent
+           you from using non-ASCII characters in source code comments.
+           In cases like these, it is possible to write API documentation
+           completely in documentation files.
+
+           See also \l naturallanguage and \l outputencoding.
+
+    \row
+        \o \bold sources \target sources
+        \o \bold {The \c sources variable allows you to specify
+           individual source files in addition to those located in the
+           directories specified by the \l {sourcedir}{\c sourcedir}
+           variable.}
+
+           For example:
+
+           \code
+           sources = $QTDIR/src/gui/widgets/qlineedit.cpp \
+                     $QTDIR/src/gui/widgets/qpushbutton.cpp
+           \endcode
+
+           When processing the \c sources variable, QDoc behaves in the
+           same way as it does when processing the \l {sourcedirs}{\c
+           sourcedirs} variable. For more information, see the \l
+           {sourcedirs}{\c sourcedirs} variable.
+
+           See also \l sourcedirs.
+
+    \row
+        \o \bold sources.fileextensions \target sources.fileextensions
+        \o \bold {The \c sources.fileextensions variable filters the
+           files within a source directory.}
+
+           When processing the source files specified in the \l
+           {sourcedirs}{\c sourcedirs} variable, QDoc will only read
+           the files with the fileextensions specified in the \c
+           sources.fileextensions variable. In this way QDoc avoid
+           spending time reading irrelevant files.
+
+           The default extensions are *.c++, *.cc, *.cpp and *.cxx.
+
+           The extensions are given as standard wildcard expressions.
+           You can add a file extension to the filter using '+='. For
+           example:
+
+           \code
+           sources.fileextensions += *.CC
+           \endcode
+
+           \warning The above assignment may not work as described.
+
+           See also \l sourcedirs and \l sources.
+
+    \row
+        \o \bold spurious \target spurious
+        \o \bold {The \c spurious variable excludes specified
+           QDoc warnings from the output.}
+
+           The warnings are specified using standard wildcard
+           expressions. For example:
+
+           \code
+           spurious = "Cannot find .*" \
+                      "Missing .*"
+           \endcode
+
+           makes sure that warnings matching either of these
+           expressions, will not be part of the output when running
+           QDoc. For example would the following warning be omitted
+           from the output:
+
+           \code
+           qt-4.0/src/opengl/qgl_mac.cpp:156: Missing parameter name
+           \endcode
+
+    \row
+        \o \bold tabsize \target tabsize
+        \o \bold {The \c tabsize variable defines the size of a tab
+           character.}
+
+           For example:
+
+           \code
+           tabsize = 4
+           \endcode
+
+           will give the tab character the size of 4 spaces.
+
+           The default value of the variable is 8, and doesn't need to
+           be specified.
+
+    \row
+        \o \bold tagfile \target tagfile
+        \o \bold{The \c tagfile variable specifies the Doxygen tag file to be written
+           when HTML is generated.}
+    \row
+        \o \bold version \target version
+        \o \bold {The \c version variable specifies the version number of the
+           documented software.}
+
+           For example:
+
+           \code
+           version = 4.0.1
+           \endcode
+
+           When a version number is specified (using the \tt{\l
+           version} or \tt {\l versionsym} variables in a \c .qdocconf
+           file), it is accessible through the corresponding \\version
+           command for use in the documentation.
+
+           \warning The \\version command's functionality is not
+           fully implemented; currently it only works within raw HTML
+           code.
+
+           See also \l versionsym.
+
+    \row
+        \o \bold versionsym \target versionsym
+        \o \bold {The \c versionsym variable specifies a C++
+           preprocessor symbol that defines the version number
+           of the documented software.}
+
+           For example in \l qt.qdocconf:
+
+           \code
+           versionsym = QT_VERSION_STR
+           \endcode
+
+           QT_VERSION_STR is defined in qglobal.h as follows
+
+           \code
+           #define QT_VERSION_STR "4.7.2"
+           \endcode
+
+           When a version number is specified (using the \tt{\l
+           version} or \tt {\l versionsym} variables in a \c .qdocconf
+           file), it is accessible through the corresponding \\version
+           command for use in the documentation.
+
+           \warning The \\version command's functionality is not fully
+           implemented; currently it only works within raw HTML code.
+
+           See also \l {version}{\\version}.
+
+    \endtable
+*/
+
+/*!
+    \page 22-creating-help-project-files.html
+    \previouspage General Configuration Variables
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage C++ Specific Configuration Variables
+
+    \title Creating Help Project Files
+
+    \section1 Overview
+    
+    Starting with Qt 4.4, Qt Assistant uses a different system for managing
+    Qt documentation that requires QDoc to generate inventories of files in a
+    format that is similar to the old style DCF format, but with additional
+    features.
+
+    Instead of hard-coding information about the documentation sets for Qt,
+    QDoc allows configuration variables to be used to specify which pages are
+    to be used in each documentation set it generates. These are specified as
+    subvariables of the \c qch variable with each set declared using a unique
+    identifier as a subvariable.
+
+    For example, the configuration file for the Qt documentation defines a
+    \c Qt documentation set by specifying information about the set as
+    subvariables with the \c{qhp.Qt} prefix:
+
+    \code
+    qhp.Qt.file                = qt.qhp
+    qhp.Qt.namespace           = com.trolltech.qt.440
+    qhp.Qt.virtualFolder       = qdoc
+    qhp.Qt.indexTitle          = Qt Reference Documentation
+    qhp.Qt.indexRoot           = 
+    qhp.Qt.extraFiles          = classic.css images/qt-logo.png
+    qhp.Qt.filterAttributes    = qt 4.4.0 qtrefdoc
+    qhp.Qt.customFilters.Qt.name = Qt 4.4.0
+    qhp.Qt.customFilters.Qt.filterAttributes = qt 4.4.0
+    qhp.Qt.subprojects         = classes overviews examples
+    qhp.Qt.subprojects.classes.title = Classes
+    qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
+    qhp.Qt.subprojects.classes.selectors = class
+    qhp.Qt.subprojects.overviews.title = Overviews
+    qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
+    qhp.Qt.subprojects.overviews.selectors = fake:page,group,module
+    qhp.Qt.subprojects.examples.title = Tutorials and Examples
+    qhp.Qt.subprojects.examples.indexTitle = Qt Examples
+    qhp.Qt.subprojects.examples.selectors = fake:example
+    \endcode
+
+    To create a table of contents for a manual, create a subproject with
+    a \c{type} property and set it to \c{manual}. The page in the documentation
+    referred to by the \c{indexTitle} property must contain a list of links
+    that acts as a table of contents for the whole manual. QDoc will take the
+    information in this list and create a table of contents for the subproject.
+
+    For example, the configuration file for Qt Creator defines only one
+    subproject for its documentation, including all the documentation in a
+    single manual:
+
+    \code
+    qhp.QtCreator.subprojects = manual
+    qhp.QtCreator.subprojects.manual.title = Qt Creator Manual
+    qhp.QtCreator.subprojects.manual.indexTitle = Qt Creator Manual
+    qhp.QtCreator.subprojects.manual.type = manual
+    \endcode
+
+    In this example, the page entitled "Qt Creator Manual" contains a nested
+    list of links to pages in the documentation which is duplicated in
+    Qt Assistant's Contents tab.
+*/
+
+/*!
+    \page 23-qdoc-configuration-cppvariables.html
+    \previouspage Creating Help Project Files
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage HTML Specific Configuration Variables
+
+    \title C++ Specific Configuration Variables
+
+    The C++ specific configuration variables are provided to avoid
+    erroneous documentation due to non-standard C++ constructs.
+
+    \section1 Alphabetical List
+
+    \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives}
+       {Cpp.ignoredirectives},
+    \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretoken}
+       {Cpp.ignoretokens}
+
+    \section1 Variable Descriptions
+
+    \table
+
+    \header
+        \o Variable
+        \o Description
+
+    \row
+        \o \bold  Cpp.ignoredirectives \target Cpp.ignoredirectives
+        \o \bold {The \c Cpp.ignoredirectives variable makes QDoc ignore
+           the specified non-standard constructs, within C++ source code.}
+
+           If not specified by the \tt {\l Cpp.ignoretokens} or \tt
+           {\l Cpp.ignoredirectives} variables, non-standard
+           constructs (typically macros) can result in erroneous
+           documentation.
+
+           In \l qt.qdocconf:
+
+           \code
+           Cpp.ignoredirectives = Q_DECLARE_INTERFACE \
+                                  Q_DECLARE_OPERATORS_FOR_FLAGS \
+                                  Q_DECLARE_PRIVATE \
+                                  Q_DECLARE_PUBLIC \
+                                  Q_DISABLE_COPY \
+                                  Q_DUMMY_COMPARISON_OPERATOR \
+                                  Q_ENUMS \
+                                  Q_FLAGS \
+                                  Q_INTERFACES \
+                                  __attribute__
+           \endcode
+
+           makes sure that when processing the code below, for
+           example, QDoc will simply ignore the 'Q_ENUMS' and
+           'Q_FLAGS' expressions:
+
+           \code
+               class Q_CORE_EXPORT Qt {
+                   Q_OBJECT
+                   Q_ENUMS(Orientation TextFormat BackgroundMode
+                           DateFormat ScrollBarPolicy FocusPolicy
+                           ContextMenuPolicy CaseSensitivity
+                           LayoutDirection ArrowType)
+                   Q_ENUMS(ToolButtonStyle)
+                   Q_FLAGS(Alignment)
+                   Q_FLAGS(Orientations)
+                   Q_FLAGS(DockWidgetAreas)
+
+               public:
+                   ...
+           };
+           \endcode
+
+           The Q_OBJECT macro, however, is an exception: QDoc
+           recognizes this particular non-standard construct, so there
+           is no need specifying it using the \tt {\l
+           Cpp.ignoredirectives} variable.
+
+           Regarding the Q_CORE_EXPORT macro; see the documentation of
+           the \tt {\l Cpp.ignoretokens} variable.
+
+           See also \l Cpp.ignoretokens.
+
+    \row
+        \o \bold  Cpp.ignoretokens \target Cpp.ignoretokens
+        \o \bold {The \c Cpp.ignoretokens variable makes QDoc ignore
+           the specified non-standard constructs, within C++ source code.}
+
+           If not specified by the \tt {\l Cpp.ignoretokens} or \tt
+           {\l Cpp.ignoredirectives} variables, non-standard
+           constructs (typically macros) can result in erroneous
+           documentation.
+
+           In \l qt.qdocconf:
+
+           \code
+           Cpp.ignoretokens = QAXFACTORY_EXPORT \
+                              QM_EXPORT_CANVAS \
+                              ...
+                              Q_COMPAT_EXPORT \
+                              Q_CORE_EXPORT \
+                              Q_EXPLICIT \
+                              Q_EXPORT \
+                              ...
+                              Q_TYPENAME        \
+                              Q_XML_EXPORT
+           \endcode
+
+           makes sure that when processing the code below, for
+           example, QDoc will simply ignore the 'Q_CORE_EXPORT'
+           expression:
+
+           \code
+               class Q_CORE_EXPORT Qt {
+                   Q_OBJECT
+                   Q_ENUMS(Orientation TextFormat BackgroundMode
+                           DateFormat ScrollBarPolicy FocusPolicy
+                           ContextMenuPolicy CaseSensitivity
+                           LayoutDirection ArrowType)
+                   Q_ENUMS(ToolButtonStyle)
+                   Q_FLAGS(Alignment)
+                   Q_FLAGS(Orientations)
+                   Q_FLAGS(DockWidgetAreas)
+
+               public:
+                   ...
+           };
+           \endcode
+
+           Regarding the Q_OBJECT, Q_ENUMS and Q_FLAGS macros; see the
+           documentation of the \tt {\l Cpp.ignoredirectives}
+           variable.
+
+           See also \l Cpp.ignoredirectives.
+
+    \endtable
+*/
+
+
+/*!
+    \page 24-qdoc-configuration-htmlvariables.html
+    \previouspage C++ Specific Configuration Variables
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage Supporting Derived Projects
+
+    \title HTML Specific Configuration Variables
+
+    The HTML specific configuration variables define the generated
+    documentation's style, or define the contents of the
+    documentation's footer or postheader. The format of the variable
+    values are raw HTML.
+
+    \section1 Alphabetical List
+
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.footer}{HTML.footer},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader}
+       {HTML.postheader},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.style}{HTML.style},
+    \l {24-qdoc-configuration-htmlvariables.html#HTML.stylesheets}{HTML.stylesheets}
+
+
+    \section1 Variable Descriptions
+
+    \table
+
+    \header
+        \o Variable
+        \o Description
+
+    \row
+        \o \bold HTML.footer \target HTML.footer
+        \o \bold {The \c HTML.footer variable defines the content
+           of the generated HTML documentation's footer.}
+
+           The footer is rendered at the bottom of the generated
+           documentation page.
+
+           The variable's value is given as raw HTML code enclosed by
+           quotation marks. Note that if the value spans several
+           lines, each line needs to be enclosed by quotation marks.
+
+           For example in \l qt.qdocconf:
+
+           \code
+               HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
+                             ...
+                             "</tr></table></div></address>"
+           \endcode
+
+           The complete variable entry in \l qt.qdocconf provides the
+           standard footer of the \l
+           {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference
+           Documentation}.
+
+    \row
+        \o \bold HTML.postheader \target HTML.postheader
+        \o \bold {The \c HTML.postheader variable defines the content
+           of the generated HTML documentation's postheader.}
+
+           The header is rendered at the top of the generated
+           documentation page.
+
+           The variable's value is given as raw HTML enclosed by
+           quotation marks. Note that if the value spans several
+           lines, each line needs to be enclosed by quotation marks.
+
+           For example in \l qt.qdocconf:
+
+           \code
+            HTML.postheader = "<table border=\"0\"..." \
+                              ...
+                              "<img src=\"images/trolltech-logo.png\" \
+                              "align=\"right\" width=\"203\" height=\"32\""\
+                              "border=\"0\" />" \
+                              "</td></tr>" \
+                              "</table>"
+           \endcode
+
+           The complete variable entry in \l qt.qdocconf provides the
+           standard header of the \l
+           {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference
+           Documentation}.
+
+    \row
+        \o \bold HTML.style \target HTML.style
+        \o \bold {The HTML.style variable defines the style for
+           the generated HTML documentation.}
+
+           The variable's value is given as raw HTML enclosed by
+           quotation marks. Note that if the value spans several
+           lines, each line needs to be enclosed by quotation marks.
+
+           For example in \l qt.qdocconf:
+
+           \code
+           HTML.style = "h3.fn,span.fn" \
+                        "{ margin-left: 1cm; text-indent: -1cm; }\n" \
+                        "a:link { color: #004faf; text-decoration: none }\n" \
+                        "a:visited" \
+                        "{ color: #672967; text-decoration: none }\n" \
+                        "td.postheader { font-family: sans-serif }\n" \
+                        "tr.address { font-family: sans-serif }\n" \
+                        "body { background: #ffffff; color: black; }"
+           \endcode
+
+           provides the HTML style for the \l
+           {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference
+           Documentation}.
+
+    \row
+        \o \bold HTML.stylesheets \target HTML.stylesheets
+        \o \bold {The HTML.stylesheets variable defines a list of stylesheets
+           to use for the generated HTML documentation.}
+
+           Using separate stylesheets for the documentation makes it easier to
+           customize and experiment with the style used once the contents has
+           been generated. Typically, it is only necessary to define a single
+           stylesheet for any set of documentation; for example:
+
+           \code
+           HTML.stylesheets = classic.css
+           \endcode
+
+           QDoc expects to find stylesheets in the directory containing the
+           \l qt.qdocconf file, and it will copy those specified to the output
+           directory alongside the HTML pages.
+    \endtable
+*/
+
+/*!
+    \page 25-qdoc-configuration-derivedprojects.html
+    \previouspage HTML Specific Configuration Variables
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage QDoc Compatibility
+
+    \title Supporting Derived Projects
+
+    \tableofcontents
+
+    Some particular configuration variables allow you to use QDoc to
+    support Qt-based projects; i.e to make projects, such as Qt Solutions,
+    contain references to the online Qt documentation. This
+    means that QDoc will be able to create links to the class reference
+    documentation, without any explicit linking command.
+
+    \section1 The Configuration Variables
+
+    \section2 Alphabetical List
+
+    \l{25-qdoc-configuration-derivedprojects.html#description}{description},
+    \l{25-qdoc-configuration-derivedprojects.html#indexes}{indexes},
+    \l{25-qdoc-configuration-derivedprojects.html#project}{project},
+    \l{25-qdoc-configuration-derivedprojects.html#url}{url}
+
+    \section2 Variable Descriptions
+
+    \table
+    \header
+        \o Variable
+        \o Description
+    \row
+        \o \bold description \target description
+        \o \bold {The description variable holds a short description of
+           the associated project.}
+
+           See also \l project.
+
+    \row
+        \o \bold indexes \target indexes
+        \o \bold {The \c indexes variable lists the index files
+           that will be used to generate references.}
+
+           For example. to make a derived Qt project contain links to
+           the Qt Reference documentation, you need to specify the
+           associated index file:
+
+           \code
+               indexes = $QTDIR/doc/html/qt.index
+           \endcode
+
+           See also \l project and \l url.
+
+    \row
+        \o \bold project \target project
+        \o \bold {The \c project variable provides a name for the project
+           associated with the \c .qdocconf file.}
+
+           The project's name is used to form a file name for the
+           associated project's \i index file. For example:
+
+           \code
+               project = QtMotif
+           \endcode
+
+           This will cause an index file called \c qtmotif.index to be
+           created.
+
+           See also \l description and \l indexes.
+    \row
+        \o \bold url \target url
+        \o \bold {The \c url variable holds the base URL for the
+            reference documentation associated with the current project.}
+
+            The URL is stored in the generated index file for the
+            project. When we use the index on its own, QDoc will use
+            this as the base URL when constructing links to classes,
+            functions, and other things listed in the index.
+
+            For example:
+
+            \code
+                 project     = Qt
+                 description = Qt Reference Documentation
+                 url         = http://qt.nokia.com/doc/4.0
+
+                 ...
+            \endcode
+
+            This makes sure that whenever \c qt.index is used to generate
+            references to for example Qt classes, the base URL is
+            \c http://qt.nokia.com/doc/4.0.
+
+            See also \l indexes.
+
+    \endtable
+
+    \target howto
+    \section1 How to Support Derived Projects
+
+    This feature makes use of the comprehensive indexes generated by
+    QDoc when it creates the Qt reference documentation.
+
+    For example, \l qt.qdocconf (the configuration file for Qt)
+    contains the following variable definitions:
+
+    \code
+        project     = Qt
+        description = Qt Reference Documentation
+        url         = http://qt.nokia.com/doc/4.0
+
+        ...
+    \endcode
+
+    The \l project variable name is used to form a file name for the
+    index file; in this case the \c qt.index file is created.  The \l
+    url is stored in the index file. Later, when we use the index on
+    its own, QDoc will use this as the base URL when constructing
+    links to classes, functions, and other things listed in the index.
+
+    In a mini-project, you can use an index file by defining an \l
+    indexes configuration variable in your \c .qdocconf file.
+
+    For example, you can create a \c qtmotif.qdocconf file to help you
+    check the QtMotif documentation (which is part of Qt Solutions):
+
+    \code
+        include($QTDIR/tools/qdoc3/test/compat.qdocconf)
+
+        project                 = QtMotif
+        description             = QtMotif Class Documentation
+        url                     = http://www.trolltech.com/products/solutions/catalog/4/Migration/qtmotifextension
+
+        indexes                 = $QTDIR/doc/html/qt.index
+
+        outputdir               = html
+
+        headerdirs              = src
+        sourcedirs              = src \
+                                  examples
+        sources.fileextensions  = "*.cpp *.qdoc *.doc"
+
+        exampledirs = examples
+    \endcode
+
+    The code above requires that you run QDoc from the directory that
+    contains this file. You need to include the compat.qdocconf
+    file for compatibility reasons; this is further explained in the
+    \l {QDoc Compatibility} section.
+
+    \bold {To resolve the actual links to Qt classes, the
+    mini-project's \c .qdocconf file needs to assign a value to the \l
+    indexes variable; \c $QTDIR/doc/html/qt.index makes sure that you
+    always use the updated index file for the Qt documentation.}
+
+    The only disadvantages with this approach are the extra file that
+    QDoc has to generate and the time it takes to do so. Reading the
+    index back again later isn't instantaneous either, but it's
+    quicker than processing all the Qt classes each time you need to
+    write a new document.
+*/
+
+/*!
+    \page 26-qdoc-commands-compatibility.html
+    \previouspage Supporting Derived Projects
+    \contentspage QDoc Manual - Table of Contents
+    \nextpage QDoc Commands - Alphabetical List
+
+    \title QDoc Compatibility
+
+    \tableofcontents
+
+    \section1 General Description
+
+    \target reason
+
+    QDoc is a tool that constantly evolves to suit our needs, for that
+    reason there are some compatibility issues in the transition
+    between old and new practices.
+
+    To make the transition as smooth and rapid as possible, the
+    general idea is to adopt the new commands and usage in new
+    documentation.  While waiting for the occurrences of the old
+    practices to be eliminated from the old parts of the
+    documentation, you can map the new commands and usage to the old
+    ones using a compat.qdocconf file.
+
+    A compat.qdocconf file is a separate \c .qdocconf file which you
+    can include in your main configuration file. It typically contains
+    the mapping between old and new commands using the \l alias and \l
+    {22-qdoc-configuration-generalvariables.html#macro}{macro}
+    configuration variables.
+
+    \section1 Qt Compatibility
+
+    In Qt's documentation there still exist occurrences of old
+    commands, and the Qt \l {qt.qdocconf}{configuration file} needs to
+    include the compat.qdocconf file tailored for Qt. For more
+    detailed information about the commands creating compatibility
+    issues, see the \l {Command Comments}{command comments}.
+
+    \section2 Qt's current compat.qdocconf file
+
+    \quotefile files/compat.qdocconf
+
+    \section2 Command Comments
+
+    \table
+    \header
+        \o New Command
+        \o Old Command
+        \o Description
+
+    \row
+        \o \\i \target i-versus-e
+        \o \\e
+        \o Earlier we
+           used the \\i command to indicate a list or table item, and
+           the \\e command for rendering in italic. Now we want the
+           \\i command to render in italic discarding the
+           \\e command name.
+
+           \bold {We still need to use the \\e command to render in
+           italic in new documentation for \l {reason}{compatibility
+           reasons}}.
+
+    \row
+        \o \\include \target include-versus-input
+        \o \\input
+        \o The \\include command was previously used to quote the
+           complete contents of a source file, now we want to use the
+           command to include separate documentation.
+           That is the functionality of the old \\input command
+           which name we want to discard.
+
+           \bold {We still need to use the \\input command to include
+           plain text in new documentation for \l
+           {reason}{compatibility reasons}}.
+
+    \row
+        \o \\quotefile \target quotefile-versus-include
+        \o \\include
+        \o Earlier, we have used the \\quotefile command to
+           quote from file, i.e. quote parts from file, and the
+           \\include command to quote the entire file. Since we now want
+           \\include to include separate documentation, we change the use of
+           \\quotefile to quote a complete source file.
+
+           \bold {We still need to use the \\include command to quote
+           the entire contents of a source file in new documentation
+           for \l {reason}{compatibility reasons}}.
+
+    \row
+        \o \\quotefromfile \target quotefromfile-versus-quotefile
+        \o \\quotefile
+        \o Earlier, we have used the \\quotefile command to
+           quote from file, i.e. quote parts from file. Since we now want
+           that command to quote an entire file, we introduce the new
+           \\quotefromfile command to quote from file.
+
+           \bold {Use \l {quotefromfile}{\\quotefromfile} to quote
+           parts from a source file in new documentation}.
+
+    \row
+        \o \\o \target o-versus-i
+        \o \\i
+        \o Earlier we used the \\i command to indicate list items
+           and table items. Since we now want the \\i command to render
+           in italic instead, we introduce the new \\o command for
+           this purpose.
+
+           \bold {Use \l {o}{\\o} to indicate list and table items in
+           new documentation}.
+
+    \row
+        \o \\quotation \target quotation-versus-quote
+        \o \\quote
+        \o These commands are equivalent, and represent a simple name
+          change.
+
+          \bold {Use \l {quotation}{\\quotation} in new
+          documentation}.
+
+    \row
+        \o \\image \target image-versus-img
+        \o \\img
+        \o These commands are equivalent, and represent a simple name
+           change.
+
+           \bold {Use \l {image}{\\image} in new documentation}.
+
+    \endtable
+*/
+
+/*!
+    \page 27-qdoc-commmands-alphabetical.html
+    \previouspage QDoc Compatibility
+    \contentspage QDoc Manual - Table of Contents
+
+    \title QDoc Commands - Alphabetical List
+
+    \list
+
+    \o \l {04-qdoc-commands-textformatting.html#a}{\\a}
+    \o \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract}
+    \o \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode}
+    \o \l {04-qdoc-commands-textformatting.html#bold}{\\bold}
+    \o \l {11-qdoc-commands-documentcontents.html#brief}{\\brief}
+    \o \l {04-qdoc-commands-textformatting.html#c}{\\c}
+    \o \l {09-qdoc-commands-graphic.html#caption}{\\caption}
+    \o \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter}
+    \o \l {13-qdoc-commands-topical.html#class}{\\class}
+    \o \l {06-qdoc-commands-verbatimcode.html#code}{\\code}
+    \o \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline},
+    \o \l {16-qdoc-commands-status.html#compat}{\\compat}
+    \o \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage}
+    \o \l {07-0-qdoc-commands-quoting.html#dots}{\\dots}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif}
+    \o \l {13-qdoc-commands-topical.html#enum}{\\enum}
+    \o \l {13-qdoc-commands-topical.html#example-command}{\\example}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire}
+    \o \l {13-qdoc-commands-topical.html#externalpage}{\\externalpage}
+    \o \l {13-qdoc-commands-topical.html#fn}{\\fn}
+    \o \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist}
+    \o \l {13-qdoc-commands-topical.html#group}{\\group}
+    \o \l {10-qdoc-commands-container.html#header}{\\header}
+    \o \l {13-qdoc-commands-topical.html#headerfile}{\\headerfile}
+    \o \l {04-qdoc-commands-textformatting.html#i}{\\i}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if}
+    \o \l {09-qdoc-commands-graphic.html#image}{\\image}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include}
+    \o \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage}
+    \o \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup}
+    \o \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule}
+    \o \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage}
+    \o \l {16-qdoc-commands-status.html#internal}{\\internal}
+    \o \l {08-qdoc-commands-linking.html#keyword}{\\keyword}
+    \o \l {08-qdoc-commands-linking.html#l}{\\l}
+    \o \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese}
+    \o \l {10-qdoc-commands-container.html#list}{\\list}
+    \o \l {13-qdoc-commands-topical.html#macro}{\\macro}
+    \o \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta}
+    \o \l {13-qdoc-commands-topical.html#module}{\\module}
+    \o \l {13-qdoc-commands-topical.html#namespace}{\\namespace}
+    \o \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage}
+    \o \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode}
+    \o \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant}
+    \o \l {10-qdoc-commands-container.html#o}{\\o}
+    \o \l {16-qdoc-commands-status.html#obsolete}{\\obsolete}
+    \o \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit}
+    \o \l {10-qdoc-commands-container.html#omitvalue}{\\omitvalue}
+    \o \l {18-qdoc-commands-relating.html#overload}{\\overload}
+    \o \l {13-qdoc-commands-topical.html#page}{\\page}
+    \o \l {05-qdoc-commands-documentstructuring.html#part}{\\part}
+    \o \l {16-qdoc-commands-status.html#preliminary}{\\preliminary}
+    \o \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage}
+    \o \l {07-0-qdoc-commands-quoting.html#printline}{\\printline}
+    \o \l {07-0-qdoc-commands-quoting.html#printto}{\\printto}
+    \o \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil}
+    \o \l {13-qdoc-commands-topical.html#property}{\\property}
+    \o \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation}
+    \o \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile}
+    \o \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile}
+    \o \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw}
+    \o \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant}
+    \o \l {18-qdoc-commands-relating.html#reimp}{\\reimp}
+    \o \l {18-qdoc-commands-relating.html#relates}{\\relates}
+    \o \l {10-qdoc-commands-container.html#row}{\\row}
+    \o \l {08-qdoc-commands-linking.html#sa}{\\sa}
+    \o \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1}
+    \o \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2}
+    \o \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3}
+    \o \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4}
+    \o \l {13-qdoc-commands-topical.html#service}{\\service}
+    \o \l {16-qdoc-commands-status.html#since}{\\since}
+    \o \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline}
+    \o \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto}
+    \o \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil}
+    \o \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet},
+    \o \l {15-qdoc-commands-navigation.html#startpage}{\\startpage}
+    \o \l {04-qdoc-commands-textformatting.html#sub}{\\sub}
+    \o \l {20-qdoc-commands-title.html#subtitle}{\\subtitle}
+    \o \l {04-qdoc-commands-textformatting.html#sup}{\\sup}
+    \o \l {10-qdoc-commands-container.html#table}{\\table}
+    \o \l {11-qdoc-commands-documentcontents.html#tableofcontents}
+          {\\tableofcontents}
+    \o \l {08-qdoc-commands-linking.html#target}{\\target}
+    \o \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe}
+    \o \l {20-qdoc-commands-title.html#title}{\\title}
+    \o \l {04-qdoc-commands-textformatting.html#tt}{\\tt}
+    \o \l {13-qdoc-commands-topical.html#typedef}{\\typedef}
+    \o \l {04-qdoc-commands-textformatting.html#underline}{\\underline}
+    \o \l {13-qdoc-commands-topical.html#variable}{\\variable}
+    \o \l {10-qdoc-commands-container.html#value}{\\value}
+    \o \l {11-qdoc-commands-documentcontents.html#warning}{\\warning}
+    \endlist
+*/
+
+/*!
+    \externalpage http://qt.nokia.com/about
+    \title About Qt
+*/
Index: trunk/tools/qdoc3/doc/qdoc-manual.qdocconf
===================================================================
--- trunk/tools/qdoc3/doc/qdoc-manual.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/doc/qdoc-manual.qdocconf	(revision 846)
@@ -0,0 +1,234 @@
+project          = QDoc
+description      = QDoc3 Manual
+
+indexes          = ../../../doc/html/qt.index
+
+outputdir        = html
+
+sources          = qdoc-manual.qdoc
+sourcedirs       = $PWD
+
+exampledirs     += $PWD \
+                   ../../../examples
+
+imagedirs       += images
+
+extraimages.HTML = qt-logo
+
+HTML.stylesheets        =  style/style.css \
+                           style/OfflineStyle.css \
+                           style/style_ie7.css \
+                           style/style_ie8.css \
+                           style/style_ie6.css
+
+HTML.postheader         = " <div class=\"header\" id=\"qtdocheader\">\n" \
+                          "    <div class=\"content\"> \n" \
+                          "    <div id=\"nav-logo\">\n" \
+                          "      <a href=\"index.html\">Home</a></div>\n" \
+                          "    <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
+                          "    <div id=\"narrowsearch\"></div>\n" \
+                          "    <div id=\"nav-topright\">\n" \
+                          "      <ul>\n" \
+                          "        <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \
+                          "        <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \
+                          "        <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \
+                          "        <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \
+                          "          DOC</a></li>\n" \
+                          "        <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \
+                          "      </ul>\n" \
+                          "    </div>\n" \
+                          "    <div id=\"shortCut\">\n" \
+                          "      <ul>\n" \
+                          "        <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \
+                          "        <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \
+                          "        </a></li>\n" \
+                          "      </ul>\n" \
+                          "     </div>\n" \
+                          " <ul class=\"sf-menu\" id=\"narrowmenu\"> \n" \
+                          "                         <li><a href=\"#\">API Lookup</a> \n" \
+                          "                                 <ul> \n" \
+                          "                                         <li><a href=\"classes.html\">Class index</a></li> \n" \
+                          "           <li><a href=\"functions.html\">Function index</a></li> \n" \
+                          "           <li><a href=\"modules.html\">Modules</a></li> \n" \
+                          "           <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
+                          "           <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \
+                          "           <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \
+                          "                     </ul> \n" \
+                          "                         </li> \n" \
+                          "                         <li><a href=\"#\">Qt Topics</a> \n" \
+                          "                                 <ul> \n" \
+                          "                                            <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li>  \n" \
+                          "                                            <li><a href=\"qtquick.html\">Device UIs &amp; Qt Quick</a></li>  \n" \
+                          "                                            <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li>  \n" \
+                          "                                            <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li>  \n" \
+                          "                                            <li><a href=\"platform-specific.html\">Platform-specific info</a></li>  \n" \
+                          "                                            <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li>  \n" \
+                          "                                            <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li>  \n" \
+                          "                      </ul> \n" \
+                          "                                 </li> \n" \
+                          "                                 <li><a href=\"#\">Examples</a> \n" \
+                          "                                         <ul> \n" \
+                          "                               <li><a href=\"all-examples.html\">Examples</a></li> \n" \
+                          "                               <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \
+                          "                               <li><a href=\"demos.html\">Demos</a></li> \n" \
+                          "                               <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \
+                          "                        </ul> \n" \
+                          "                                         </li> \n" \
+                          "                                 </ul> \n" \
+                          "    </div>\n" \
+                          "  </div>\n" \
+                          "  <div class=\"wrapper\">\n" \
+                          "    <div class=\"hd\">\n" \
+                          "      <span></span>\n" \
+                          "    </div>\n" \
+                          "    <div class=\"bd group\">\n" \
+                          "      <div class=\"sidebar\">\n" \
+                          "        <div class=\"searchlabel\">\n" \
+                          "          Search index:</div>\n" \
+                          "        <div class=\"search\" id=\"sidebarsearch\">\n" \
+                          "          <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \
+                          "            <fieldset>\n" \
+                          "              <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \
+                          " <div id=\"resultdialog\"> \n" \
+                          " <a href=\"#\" id=\"resultclose\">Close</a> \n" \
+                          " <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \
+                          " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span>&nbsp;results:</p> \n" \
+                          " <ul id=\"resultlist\" class=\"all\"> \n" \
+                          " </ul> \n" \
+                          " </div> \n" \
+                          "            </fieldset>\n" \
+                          "          </form>\n" \
+                          "        </div>\n" \
+                          "        <div class=\"box first bottombar\" id=\"lookup\">\n" \
+                          "          <h2 title=\"API Lookup\"><span></span>\n" \
+                          "            API Lookup</h2>\n" \
+                          "          <div  id=\"list001\" class=\"list\">\n" \
+                          "          <ul id=\"ul001\" >\n" \
+                          "              <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \
+                          "            </ul> \n" \
+                          "          </div>\n" \
+                          "        </div>\n" \
+                          "        <div class=\"box bottombar\" id=\"topics\">\n" \
+                          "          <h2 title=\"Qt Topics\"><span></span>\n" \
+                          "            Qt Topics</h2>\n" \
+                          "          <div id=\"list002\" class=\"list\">\n" \
+                          "            <ul id=\"ul002\" >\n" \
+                          "                           <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UIs &amp; Qt Quick</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \
+                          "                           <li class=\"defaultLink\"><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \
+                          "            </ul>  \n" \
+                          "          </div>\n" \
+                          "        </div>\n" \
+                          "        <div class=\"box\" id=\"examples\">\n" \
+                          "          <h2 title=\"Examples\"><span></span>\n" \
+                          "            Examples</h2>\n" \
+                          "          <div id=\"list003\" class=\"list\">\n" \
+                          "        <ul id=\"ul003\">\n" \
+                          "              <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \
+                          "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \
+                          "            </ul> \n" \
+                          "          </div>\n" \
+                          "        </div>\n" \
+                          "      </div>\n" \
+                          "      <div class=\"wrap\">\n" \
+                          "        <div class=\"toolbar\">\n" \
+                          "          <div class=\"breadcrumb toolblock\">\n" \
+                          "            <ul>\n" \
+                          "              <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
+                          "              <!--  Bread crumbs goes here -->\n"
+
+HTML.postpostheader     = "            </ul>\n" \
+                          "          </div>\n" \
+                          "          <div class=\"toolbuttons toolblock\">\n" \
+                          "            <ul>\n" \
+                          "              <li id=\"smallA\" class=\"t_button\">A</li>\n" \
+                          "              <li id=\"medA\" class=\"t_button active\">A</li>\n" \
+                          "              <li id=\"bigA\" class=\"t_button\">A</li>\n" \
+                          "              <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \
+                          "                <span>Print</span></a></li>\n" \
+                          "            </ul>\n" \
+                          "        </div>\n" \
+                          "        </div>\n" \
+                          "        <div class=\"content mainContent\">\n"
+
+HTML.footer             = "" \
+                          "        <div class=\"feedback t_button\">\n" \
+                          "          [+] Documentation Feedback</div>\n" \
+                          "      </div>\n" \
+                          "    </div>\n" \
+                          "    </div> \n" \
+                          "    <div class=\"ft\">\n" \
+                          "      <span></span>\n" \
+                          "    </div>\n" \
+                          "  </div> \n" \
+                          "  <div class=\"footer\">\n" \
+                          "    <p>\n" \
+                          "      <acronym title=\"Copyright\">&copy;</acronym> 2008-2010 Nokia Corporation and/or its\n" \
+                          "      subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
+                          "      in Finland and/or other countries worldwide.</p>\n" \
+                          "    <p>\n" \
+                          "      All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
+                          "        href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
+                          "    <br />\n" \
+                          "    <p>\n" \
+                          "      Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
+                          "      Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
+                          "      with the terms contained in a written agreement between you and Nokia.</p>\n" \
+                          "    <p>\n" \
+                          "      Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
+                          "      Free Documentation License version 1.3</a>\n" \
+                          "      as published by the Free Software Foundation.</p>\n" \
+                          "  </div>\n" \
+                          "  <div id=\"feedbackBox\">\n" \
+                          "      <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
+                          "    <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
+                          "      <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \
+                          "      requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \
+                          "      <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
+                          "      <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
+                          "    </form>\n" \
+                          "  </div>\n" \
+                          "  <div id=\"blurpage\">\n" \
+                          "  </div>\n" 
+
+# This stuff is used by the Qt 4.7 doc format.
+scriptdirs              = ../../../doc/src/template/scripts
+styledirs               = ../../../doc/src/template/style
+
+scripts.HTML		= functions.js \
+			  narrow.js \
+			  superfish.js \
+			  jquery.js
+
+styles.HTML		= style.css \
+			  narrow.css \
+			  superfish.css \
+			  superfish_skin.css \
+			  style_ie6.css \
+			  style_ie7.css \
+			  style_ie8.css
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
Index: trunk/tools/qdoc3/editdistance.cpp
===================================================================
--- trunk/tools/qdoc3/editdistance.cpp	(revision 769)
+++ trunk/tools/qdoc3/editdistance.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/editdistance.h
===================================================================
--- trunk/tools/qdoc3/editdistance.h	(revision 769)
+++ trunk/tools/qdoc3/editdistance.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/generator.cpp
===================================================================
--- trunk/tools/qdoc3/generator.cpp	(revision 769)
+++ trunk/tools/qdoc3/generator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,5 +43,4 @@
   generator.cpp
 */
-#include <QtCore>
 #include <qdir.h>
 #include <qdebug.h>
@@ -68,4 +67,8 @@
 QStringList Generator::exampleDirs;
 QStringList Generator::exampleImgExts;
+QStringList Generator::scriptFiles;
+QStringList Generator::scriptDirs;
+QStringList Generator::styleFiles;
+QStringList Generator::styleDirs;
 QString Generator::outDir;
 QString Generator::project;
@@ -126,8 +129,18 @@
             config.lastLocation().fatal(tr("Cannot create output directory '%1'")
                                         .arg(outDir + "/images/used-in-examples"));
+        if (!dirInfo.mkdir(outDir + "/scripts"))
+            config.lastLocation().fatal(tr("Cannot create output directory '%1'")
+                                        .arg(outDir + "/scripts"));
+        if (!dirInfo.mkdir(outDir + "/style"))
+            config.lastLocation().fatal(tr("Cannot create output directory '%1'")
+                                        .arg(outDir + "/style"));
     }
 
     imageFiles = config.getStringList(CONFIG_IMAGES);
     imageDirs = config.getStringList(CONFIG_IMAGEDIRS);
+    scriptFiles = config.getStringList(CONFIG_SCRIPTS);
+    scriptDirs = config.getStringList(CONFIG_SCRIPTDIRS);
+    styleFiles = config.getStringList(CONFIG_STYLES);
+    styleDirs = config.getStringList(CONFIG_STYLEDIRS);
     exampleDirs = config.getStringList(CONFIG_EXAMPLEDIRS);
     exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot +
@@ -167,4 +180,45 @@
                 ++e;
             }
+
+            QStringList noExts;
+            QStringList scripts =
+                config.getStringList(CONFIG_SCRIPTS+Config::dot+(*g)->format());
+            e = scripts.begin();
+            while (e != scripts.end()) {
+                QString userFriendlyFilePath;
+                QString filePath = Config::findFile(config.lastLocation(),
+                                                    scriptFiles,
+                                                    scriptDirs,
+                                                    *e,
+                                                    noExts,
+                                                    userFriendlyFilePath);
+                if (!filePath.isEmpty())
+                    Config::copyFile(config.lastLocation(),
+                                     filePath,
+                                     userFriendlyFilePath,
+                                     (*g)->outputDir() +
+                                     "/scripts");
+                ++e;
+            }
+
+            QStringList styles =
+                config.getStringList(CONFIG_STYLES+Config::dot+(*g)->format());
+            e = styles.begin();
+            while (e != styles.end()) {
+                QString userFriendlyFilePath;
+                QString filePath = Config::findFile(config.lastLocation(),
+                                                    styleFiles,
+                                                    styleDirs,
+                                                    *e,
+                                                    noExts,
+                                                    userFriendlyFilePath);
+                if (!filePath.isEmpty())
+                    Config::copyFile(config.lastLocation(),
+                                     filePath,
+                                     userFriendlyFilePath,
+                                     (*g)->outputDir() +
+                                     "/style");
+                ++e;
+            }
         }
         ++g;
@@ -228,4 +282,5 @@
     imageDirs.clear();
     outDir = "";
+    QmlClassNode::clear();
 }
 
@@ -323,9 +378,9 @@
 
     if (node->type() == Node::Function) {
-#if 0        
+#if 0
         const FunctionNode *func = (const FunctionNode *) node;
         if (func->isOverload() && func->metaness() != FunctionNode::Ctor)
             generateOverload(node, marker);
-#endif        
+#endif
     }
     else if (node->type() == Node::Fake) {
@@ -348,5 +403,5 @@
                 generateReimplementedFrom(func, marker);
         }
-        
+
         if (!generateText(node->doc().body(), node, marker))
             if (node->isReimp())
@@ -453,5 +508,5 @@
             if (func->reimplementedFrom() != 0)
                 generateReimplementedFrom(func, marker);
-#endif            
+#endif
         }
     }
@@ -545,5 +600,5 @@
   files comprising the example, and the list of images used
   by the example. The images are copied into a subtree of
-  \c{...doc/html/images/used-in-examples/...} 
+  \c{...doc/html/images/used-in-examples/...}
  */
 void Generator::generateFileList(const FakeNode* fake,
@@ -641,31 +696,4 @@
     }
 #endif
-
-void Generator::generateModuleWarning(const ClassNode *classe,
-                                      CodeMarker *marker)
-{
-    QString module = classe->moduleName();
-    if (!module.isEmpty()) {
-        Text text;
-        if (!editionModuleMap["DesktopLight"].contains(module)) {
-            text << Atom::ParaLeft
-                 << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
-                 << "This class is not part of the Qt GUI Framework Edition."
-                 << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
-                 << Atom::ParaRight;
-        }
-        else if (module == "Qt3Support") {
-            text << Atom::ParaLeft
-                 << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
-                 << "Note to Qt GUI Framework Edition users:"
-                 << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
-                 << " This class is only available in the "
-                 << Atom(Atom::AutoLink, "Qt Full Framework Edition")
-                 << "." << Atom::ParaRight;
-        }
-
-        generateText(text, classe, marker);
-    }
-}
 
 QString Generator::indent(int level, const QString& markedCode)
@@ -954,25 +982,28 @@
             NodeList::ConstIterator c = innerNode->childNodes().begin();
             while (c != innerNode->childNodes().end()) {
-                switch ((*c)->threadSafeness()) {
-                case Node::Reentrant:
-                    reentrant.append(*c);
-                    if (threadSafeness == Node::ThreadSafe)
+                
+                if ((*c)->status() != Node::Obsolete){
+                    switch ((*c)->threadSafeness()) {
+                    case Node::Reentrant:
+                        reentrant.append(*c);
+                        if (threadSafeness == Node::ThreadSafe)
+                            exceptions = true;
+                        break;
+                    case Node::ThreadSafe:
+                        threadsafe.append(*c);
+                        if (threadSafeness == Node::Reentrant)
+                            exceptions = true;
+                        break;
+                    case Node::NonReentrant:
+                        nonreentrant.append(*c);
                         exceptions = true;
-                    break;
-                case Node::ThreadSafe:
-                    threadsafe.append(*c);
-                    if (threadSafeness == Node::Reentrant)
-                        exceptions = true;
-                    break;
-                case Node::NonReentrant:
-                    nonreentrant.append(*c);
-                    exceptions = true;
-                    break;
-                default:
-                    break;
+                        break;
+                    default:
+                        break;
+                    }
                 }
                 ++c;
             }
-            if (!exceptions) 
+            if (!exceptions)
                 text << ".";
             else if (threadSafeness == Node::Reentrant) {
@@ -1041,6 +1072,9 @@
         text << Atom::ParaLeft
              << "This "
-             << typeString(node)
-             << " was introduced in ";
+             << typeString(node);
+        if (node->type() == Node::Enum)
+            text << " was introduced or modified in ";
+        else
+            text << " was introduced in ";
         if (project.isEmpty())
              text << "version";
@@ -1061,5 +1095,5 @@
          << "This function overloads ";
     QString t = node->name() + "()";
-    text << Atom::AutoLink << t 
+    text << Atom::AutoLink << t
          << Atom::ParaRight;
     generateText(text, node, marker);
@@ -1214,4 +1248,33 @@
 }
 
+void Generator::appendSortedQmlNames(Text& text,
+                                     const Node* base,
+                                     const NodeList& subs,
+                                     CodeMarker *marker)
+{
+    QMap<QString,Text> classMap;
+    int index = 0;
+
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
+    qDebug() << "Generator::appendSortedQmlNames():" << base->name() << "is inherited by...";
+#endif
+    for (int i = 0; i < subs.size(); ++i) {
+        Text t;
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
+        qDebug() << "    " << subs[i]->name();
+#endif
+        appendFullName(t, subs[i], base, marker);
+        classMap[t.toString().toLower()] = t;
+    }
+
+    QStringList names = classMap.keys();
+    names.sort();
+
+    foreach (const QString &name, names) {
+        text << classMap[name];
+        text << separator(index++, names.count());
+    }
+}
+
 int Generator::skipAtoms(const Atom *atom, Atom::Type type) const
 {
Index: trunk/tools/qdoc3/generator.h
===================================================================
--- trunk/tools/qdoc3/generator.h	(revision 769)
+++ trunk/tools/qdoc3/generator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -125,5 +125,4 @@
                           const QString& tag);
     void generateExampleFiles(const FakeNode *fake, CodeMarker *marker);
-    void generateModuleWarning(const ClassNode *classe, CodeMarker *marker);
 
     virtual int skipAtoms(const Atom *atom, Atom::Type type) const;
@@ -171,4 +170,11 @@
                            CodeMarker *marker);
 
+ protected:
+    void appendSortedQmlNames(Text& text,
+                              const Node* base,
+                              const NodeList& subs,
+                              CodeMarker *marker);
+
+ private:
     QString amp;
     QString lt;
@@ -186,4 +192,8 @@
     static QStringList exampleDirs;
     static QStringList exampleImgExts;
+    static QStringList scriptFiles;
+    static QStringList scriptDirs;
+    static QStringList styleFiles;
+    static QStringList styleDirs;
     static QString outDir;
     static QString project;
Index: trunk/tools/qdoc3/helpprojectwriter.cpp
===================================================================
--- trunk/tools/qdoc3/helpprojectwriter.cpp	(revision 769)
+++ trunk/tools/qdoc3/helpprojectwriter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,7 +40,7 @@
 ****************************************************************************/
 
-#include <QtXml>
 #include <QHash>
 #include <QMap>
+//#include <qdebug.h>
 
 #include "atom.h"
@@ -50,4 +50,5 @@
 #include "node.h"
 #include "tree.h"
+#include <qdebug.h>
 
 QT_BEGIN_NAMESPACE
@@ -92,4 +93,5 @@
             subproject.indexTitle = config.getString(subprefix + "indexTitle");
             subproject.sortPages = config.getBool(subprefix + "sortPages");
+            subproject.type = config.getString(subprefix + "type");
             readSelectors(subproject, config.getStringList(subprefix + "selectors"));
             project.subprojects[name] = subproject;
@@ -118,4 +120,9 @@
     typeHash["variable"] = Node::Variable;
     typeHash["target"] = Node::Target;
+#ifdef QDOC_QML
+    typeHash["qmlproperty"] = Node::QmlProperty;
+    typeHash["qmlsignal"] = Node::QmlSignal;
+    typeHash["qmlmethod"] = Node::QmlMethod;
+#endif
 
     QHash<QString, Node::SubType> subTypeHash;
@@ -129,4 +136,6 @@
 #ifdef QDOC_QML
     subTypeHash["qmlclass"] = Node::QmlClass;
+    subTypeHash["qmlpropertygroup"] = Node::QmlPropertyGroup;
+    subTypeHash["qmlbasictype"] = Node::QmlBasicType;
 #endif
 
@@ -178,5 +187,11 @@
     QStringList details;
 
-    if (node->parent() && !node->parent()->name().isEmpty()) {
+    if (node->type() == Node::QmlProperty) {
+        // "name"
+        details << node->name();
+        // "id"
+        details << node->parent()->parent()->name()+"::"+node->name();
+    }
+    else if (node->parent() && !node->parent()->name().isEmpty()) {
         // "name"
         if (node->type() == Node::Enum || node->type() == Node::Typedef)
@@ -186,27 +201,27 @@
         // "id"
         details << node->parent()->name()+"::"+node->name();
-    } else if (node->type() == Node::Fake) {
+    }
+    else if (node->type() == Node::Fake) {
         const FakeNode *fake = static_cast<const FakeNode *>(node);
-#ifdef QDOC_QML
         if (fake->subType() == Node::QmlClass) {
             details << (QmlClassNode::qmlOnly ? fake->name() : fake->fullTitle());
             details << "QML." + fake->name();
-        } else
-#endif
-        {
+        }
+        else {
             details << fake->fullTitle();
             details << fake->fullTitle();
         }
-    } else {
+    }
+    else {
         details << node->name();
         details << node->name();
     }
     details << tree->fullDocumentLocation(node);
-
     return details;
 }
 
 bool HelpProjectWriter::generateSection(HelpProject &project,
-                        QXmlStreamWriter & /* writer */, const Node *node)
+                                        QXmlStreamWriter & /* writer */,
+                                        const Node *node)
 {
     if (!node->url().isEmpty())
@@ -227,7 +242,8 @@
         const FakeNode *fake = static_cast<const FakeNode *>(node);
         objName = fake->fullTitle();
-    } else
+    }
+    else
         objName = tree->fullDocumentName(node);
-
+    
     // Only add nodes to the set for each subproject if they match a selector.
     // Those that match will be listed in the table of contents.
@@ -236,6 +252,7 @@
         SubProject subproject = project.subprojects[name];
         // No selectors: accept all nodes.
-        if (subproject.selectors.isEmpty())
+        if (subproject.selectors.isEmpty()) {
             project.subprojects[name].nodes[objName] = node;
+        }
         else if (subproject.selectors.contains(node->type())) {
             // Accept only the node types in the selectors hash.
@@ -248,7 +265,8 @@
                 if (subproject.selectors[node->type()].contains(fakeNode->subType()) &&
                     fakeNode->subType() != Node::ExternalPage &&
-                    !fakeNode->fullTitle().isEmpty())
+                    !fakeNode->fullTitle().isEmpty()) {
 
                     project.subprojects[name].nodes[objName] = node;
+                }
             }
         }
@@ -291,4 +309,7 @@
 
         case Node::Property:
+        case Node::QmlProperty:
+        case Node::QmlSignal:
+        case Node::QmlMethod:
             project.keywords.append(keywordDetails(node));
             break;
@@ -401,5 +422,5 @@
     if (!generateSection(project, writer, node))
         return;
-
+    
     if (node->isInnerNode()) {
         const InnerNode *inner = static_cast<const InnerNode *>(node);
@@ -410,6 +431,21 @@
             if (node->access() == Node::Private)
                 continue;
-            if (node->type() == Node::Fake)
-                childMap[static_cast<const FakeNode *>(node)->fullTitle()] = node;
+            if (node->type() == Node::Fake) {
+                /*
+                  Don't visit QML property group nodes,
+                  but visit their children, which are all
+                  QML property nodes.
+                 */
+                if (node->subType() == Node::QmlPropertyGroup) {
+                    const InnerNode* inner = static_cast<const InnerNode*>(node);
+                    foreach (const Node* n, inner->childNodes()) {
+                        if (n->access() == Node::Private)
+                            continue;
+                        childMap[tree->fullDocumentName(n)] = n;
+                    }
+                }
+                else
+                    childMap[static_cast<const FakeNode *>(node)->fullTitle()] = node;
+            }
             else {
                 if (node->type() == Node::Function) {
@@ -495,11 +531,9 @@
             writer.writeAttribute("ref", href);
             writer.writeAttribute("title", fakeNode->fullTitle());
-            //            qDebug() << "Title:" << fakeNode->fullTitle();
             
-            if (fakeNode->subType() == Node::HeaderFile) {
-
+            if ((fakeNode->subType() == Node::HeaderFile) || (fakeNode->subType() == Node::QmlClass)) {
                 // Write subsections for all members, obsolete members and Qt 3
                 // members.
-                if (!project.memberStatus[node].isEmpty()) {
+                if (!project.memberStatus[node].isEmpty() || (fakeNode->subType() == Node::QmlClass)) {
                     QString membersPath = href.left(href.size()-5) + "-members.html";
                     writer.writeStartElement("section");
@@ -594,42 +628,98 @@
         SubProject subproject = project.subprojects[name];
 
-        if (!name.isEmpty()) {
-            writer.writeStartElement("section");
-            QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle));
-            writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
-            writer.writeAttribute("title", subproject.title);
-            project.files.insert(indexPath);
-        }
-        if (subproject.sortPages) {
-            QStringList titles = subproject.nodes.keys();
-            titles.sort();
-            foreach (const QString &title, titles)
-                writeNode(project, writer, subproject.nodes[title]);
+        if (subproject.type == QLatin1String("manual")) {
+
+            const FakeNode *indexPage = tree->findFakeNodeByTitle(subproject.indexTitle);
+            if (indexPage) {
+                Text indexBody = indexPage->doc().body();
+                const Atom *atom = indexBody.firstAtom();
+                QStack<int> sectionStack;
+                bool inItem = false;
+
+                while (atom) {
+                    switch (atom->type()) {
+                    case Atom::ListLeft:
+                        sectionStack.push(0);
+                        break;
+                    case Atom::ListRight:
+                        if (sectionStack.pop() > 0)
+                            writer.writeEndElement(); // section
+                        break;
+                    case Atom::ListItemLeft:
+                        inItem = true;
+                        break;
+                    case Atom::ListItemRight:
+                        inItem = false;
+                        break;
+                    case Atom::Link:
+                        if (inItem) {
+                            if (sectionStack.top() > 0)
+                                writer.writeEndElement(); // section
+
+                            const FakeNode *page = tree->findFakeNodeByTitle(atom->string());
+                            writer.writeStartElement("section");
+                            QString indexPath = tree->fullDocumentLocation(page);
+                            writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
+                            writer.writeAttribute("title", atom->string());
+                            project.files.insert(indexPath);
+
+                            sectionStack.top() += 1;
+                        }
+                        break;
+                    default:
+                        ;
+                    }
+
+                    if (atom == indexBody.lastAtom())
+                        break;
+                    atom = atom->next();
+                }
+            } else
+                rootNode->doc().location().warning(
+                    tr("Failed to find index: %1").arg(subproject.indexTitle)
+                    );
+
         } else {
-            // Find a contents node and navigate from there, using the NextLink values.
-            foreach (const Node *node, subproject.nodes) {
-                QString nextTitle = node->links().value(Node::NextLink).first;
-                if (!nextTitle.isEmpty() &&
-                    node->links().value(Node::ContentsLink).first.isEmpty()) {
-
-                    FakeNode *nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle));
-
-                    // Write the contents node.
-                    writeNode(project, writer, node);
-
-                    while (nextPage) {
-                        writeNode(project, writer, nextPage);
-                        nextTitle = nextPage->links().value(Node::NextLink).first;
-                        if(nextTitle.isEmpty())
-                            break;
-                        nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle));
+
+            if (!name.isEmpty()) {
+                writer.writeStartElement("section");
+                QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle));
+                writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
+                writer.writeAttribute("title", subproject.title);
+                project.files.insert(indexPath);
+            }
+            if (subproject.sortPages) {
+                QStringList titles = subproject.nodes.keys();
+                titles.sort();
+                foreach (const QString &title, titles) {
+                    writeNode(project, writer, subproject.nodes[title]);
+                }
+            } else {
+                // Find a contents node and navigate from there, using the NextLink values.
+                foreach (const Node *node, subproject.nodes) {
+                    QString nextTitle = node->links().value(Node::NextLink).first;
+                    if (!nextTitle.isEmpty() &&
+                        node->links().value(Node::ContentsLink).first.isEmpty()) {
+
+                        FakeNode *nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle));
+
+                        // Write the contents node.
+                        writeNode(project, writer, node);
+
+                        while (nextPage) {
+                            writeNode(project, writer, nextPage);
+                            nextTitle = nextPage->links().value(Node::NextLink).first;
+                            if(nextTitle.isEmpty())
+                                break;
+                            nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle));
+                        }
+                        break;
                     }
-                    break;
-                }
-            }
-        }
-
-        if (!name.isEmpty())
-            writer.writeEndElement(); // section
+                }
+            }
+
+            if (!name.isEmpty())
+                writer.writeEndElement(); // section
+        }
     }
 
Index: trunk/tools/qdoc3/helpprojectwriter.h
===================================================================
--- trunk/tools/qdoc3/helpprojectwriter.h	(revision 769)
+++ trunk/tools/qdoc3/helpprojectwriter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -61,4 +61,5 @@
     QHash<Node::Type, QSet<FakeNode::SubType> > selectors;
     bool sortPages;
+    QString type;
     QHash<QString, const Node *> nodes;
 };
Index: trunk/tools/qdoc3/htmlgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/htmlgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/htmlgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,4 +45,5 @@
 
 #include "codemarker.h"
+#include "codeparser.h"
 #include "helpprojectwriter.h"
 #include "htmlgenerator.h"
@@ -55,8 +56,17 @@
 #include <qlist.h>
 #include <qiterator.h>
+#include <qtextcodec.h>
 
 QT_BEGIN_NAMESPACE
 
 #define COMMAND_VERSION                 Doc::alias("version")
+int HtmlGenerator::id = 0;
+bool HtmlGenerator::debugging_on = false;
+
+#if 0
+QString HtmlGenerator::divNavTop = "<div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>";
+#endif
+
+QString HtmlGenerator::divNavTop = "";
 
 QString HtmlGenerator::sinceTitles[] =
@@ -72,4 +82,5 @@
         "    New Properties",
         "    New Variables",
+        "    New QML Elements",
         "    New Qml Properties",
         "    New Qml Signals",
@@ -202,8 +213,16 @@
 
 HtmlGenerator::HtmlGenerator()
-    : helpProjectWriter(0), inLink(false), inContents(false),
-      inSectionHeading(false), inTableHeader(false), numTableRows(0),
-      threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"),
-      myTree(0), slow(false), obsoleteLinks(false)
+    : helpProjectWriter(0),
+      inLink(false),
+      inContents(false),
+      inSectionHeading(false),
+      inTableHeader(false),
+      numTableRows(0),
+      threeColumnEnumValueTable(true),
+      application(Online),
+      funcLeftParen("\\S(\\()"),
+      myTree(0),
+      slow(false),
+      obsoleteLinks(false)
 {
 }
@@ -249,4 +268,13 @@
                                   Config::dot +
                                   HTMLGENERATOR_POSTHEADER);
+    postPostHeader = config.getString(HtmlGenerator::format() +
+                                      Config::dot +
+                                      HTMLGENERATOR_POSTPOSTHEADER);
+    creatorPostHeader = config.getString(HtmlGenerator::format() +
+                                  Config::dot +
+                                  HTMLGENERATOR_CREATORPOSTHEADER);
+    creatorPostPostHeader = config.getString(HtmlGenerator::format() +
+                                      Config::dot +
+                                      HTMLGENERATOR_CREATORPOSTPOSTHEADER);
     footer = config.getString(HtmlGenerator::format() +
                               Config::dot +
@@ -261,4 +289,12 @@
     project = config.getString(CONFIG_PROJECT);
 
+    QString app = config.getString(CONFIG_APPLICATION);
+    if (app == "online")
+        application = Online;
+    else if (app == "creator")
+        application = Creator;
+    else 
+        application = Creator;
+
     projectDescription = config.getString(CONFIG_DESCRIPTION);
     if (projectDescription.isEmpty() && !project.isEmpty())
@@ -266,4 +302,13 @@
 
     projectUrl = config.getString(CONFIG_URL);
+
+    outputEncoding = config.getString(CONFIG_OUTPUTENCODING);
+    if (outputEncoding.isEmpty())
+        outputEncoding = QLatin1String("ISO-8859-1");
+    outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit());
+
+    naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE);
+    if (naturalLanguage.isEmpty())
+        naturalLanguage = QLatin1String("en");
 
     QSet<QString> editionNames = config.subVars(CONFIG_EDITION);
@@ -322,14 +367,4 @@
 void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
 {
-    // Copy the stylesheets from the directory containing the qdocconf file.
-    // ### This should be changed to use a special directory in doc/src.
-    QStringList::ConstIterator styleIter = stylesheets.begin();
-    QDir configPath = QDir::current();
-    while (styleIter != stylesheets.end()) {
-        QString filePath = configPath.absoluteFilePath(*styleIter);
-        Config::copyFile(Location(), filePath, filePath, outputDir());
-        ++styleIter;
-    }
-
     myTree = tree;
     nonCompatClasses.clear();
@@ -342,11 +377,9 @@
     legaleseTexts.clear();
     serviceClasses.clear();
+    qmlClasses.clear();
     findAllClasses(tree->root());
     findAllFunctions(tree->root());
     findAllLegaleseTexts(tree->root());
     findAllNamespaces(tree->root());
-#ifdef ZZZ_QDOC_QML
-    findAllQmlClasses(tree->root());
-#endif
     findAllSince(tree->root());
 
@@ -390,7 +423,7 @@
                 dcfQmakeRoot);
 
-    generateIndex(project.toLower().simplified().replace(" ", "-"),
-                  projectUrl,
-                  projectDescription);
+    QString fileBase = project.toLower().simplified().replace(" ", "-");
+    generateIndex(fileBase, projectUrl, projectDescription);
+    generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker);
 
     helpProjectWriter->generate(myTree);
@@ -410,4 +443,7 @@
 }
 
+/*!
+  Generate html from an instance of Atom.
+ */
 int HtmlGenerator::generateAtom(const Atom *atom,
                                 const Node *relative,
@@ -432,9 +468,9 @@
             }
             else {
-                out() << protect(atom->string());
+                out() << protectEnc(atom->string());
             }
         }
         else {
-            out() << protect(atom->string());
+            out() << protectEnc(atom->string());
         }
         break;
@@ -484,5 +520,5 @@
         out() << formattingLeftMap()[ATOM_FORMATTING_TELETYPE];
         if (inLink) {
-            out() << protect(plainCode(atom->string()));
+            out() << protectEnc(plainCode(atom->string()));
         }
         else {
@@ -492,20 +528,20 @@
         break;
     case Atom::Code:
-	out() << "<pre>"
+        out() << "<pre class=\"highlightedCode brush: cpp\">"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "</pre>\n";
-	break;
+        break;
 #ifdef QDOC_QML
     case Atom::Qml:
-	out() << "<pre>"
+        out() << "<pre class=\"highlightedCode brush: cpp\">"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "</pre>\n";
-	break;
+        break;
 #endif
     case Atom::CodeNew:
         out() << "<p>you can rewrite it as</p>\n"
-              << "<pre>"
+              << "<pre class=\"highlightedCode brush: cpp\">"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
@@ -516,8 +552,8 @@
         // fallthrough
     case Atom::CodeBad:
-        out() << "<pre><font color=\"#404040\">"
-              << trimmedTrailing(protect(plainCode(indent(codeIndent,atom->string()))))
-              << "</font></pre>\n";
-	break;
+        out() << "<pre class=\"highlightedCode brush: cpp\">"
+              << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))
+              << "</pre>\n";
+        break;
     case Atom::FootnoteLeft:
         // ### For now
@@ -575,5 +611,8 @@
         }
         else if (atom->string() == "classes") {
-            generateCompactList(relative, marker, nonCompatClasses);
+            generateCompactList(relative, marker, nonCompatClasses, true);
+        }
+        else if (atom->string() == "qmlclasses") {
+            generateCompactList(relative, marker, qmlClasses, true);
         }
         else if (atom->string().contains("classesbymodule")) {
@@ -623,8 +662,8 @@
         }
         else if (atom->string() == "compatclasses") {
-            generateCompactList(relative, marker, compatClasses);
+            generateCompactList(relative, marker, compatClasses, false);
         }
         else if (atom->string() == "obsoleteclasses") {
-            generateCompactList(relative, marker, obsoleteClasses);
+            generateCompactList(relative, marker, obsoleteClasses, false);
         }
         else if (atom->string() == "functionindex") {
@@ -635,8 +674,8 @@
         }
         else if (atom->string() == "mainclasses") {
-            generateCompactList(relative, marker, mainClasses);
+            generateCompactList(relative, marker, mainClasses, true);
         }
         else if (atom->string() == "services") {
-            generateCompactList(relative, marker, serviceClasses);
+            generateCompactList(relative, marker, serviceClasses, false);
         }
         else if (atom->string() == "overviews") {
@@ -677,9 +716,11 @@
             NewClassMaps::const_iterator ncmap;
             ncmap = newClassMaps.find(atom->string());
+            NewClassMaps::const_iterator nqcmap;
+            nqcmap = newQmlClassMaps.find(atom->string());
             if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) {
                 QList<Section> sections;
                 QList<Section>::ConstIterator s;
                 for (int i=0; i<LastSinceType; ++i)
-                    sections.append(Section(sinceTitle(i),QString(),QString()));
+                    sections.append(Section(sinceTitle(i),QString(),QString(),QString()));
 
                 NodeMultiMap::const_iterator n = nsmap.value().constBegin();
@@ -687,4 +728,9 @@
                     const Node* node = n.value();
                     switch (node->type()) {
+                      case Node::Fake:
+                          if (node->subType() == Node::QmlClass) {
+                              sections[QmlClass].appendMember((Node*)node);
+                          }
+                          break;
                       case Node::Namespace:
                           sections[Namespace].appendMember((Node*)node);
@@ -769,7 +815,9 @@
                               << Doc::canonicalTitle((*s).name)
                               << "\"></a>\n";
-                        out() << "<h3>" << protect((*s).name) << "</h3>\n";
+                        out() << "<h3>" << protectEnc((*s).name) << "</h3>\n";
                         if (idx == Class)
-                            generateCompactList(0, marker, ncmap.value(), QString("Q"));
+                            generateCompactList(0, marker, ncmap.value(), false, QString("Q"));
+                        else if (idx == QmlClass)
+                            generateCompactList(0, marker, nqcmap.value(), false, QString("Q"));
                         else if (idx == MemberFunction) {
                             ParentMaps parentmaps;
@@ -793,9 +841,9 @@
                                       << "\">";
                                 QStringList pieces = fullName(pmap.key(), 0, marker).split("::");
-                                out() << protect(pieces.last());
+                                out() << protectEnc(pieces.last());
                                 out() << "</a>"  << ":</p>\n";
 
                                 generateSection(nlist, 0, marker, CodeMarker::Summary);
-                                out() << "<br />";
+                                out() << "<br/>";
                                 ++pmap;
                             }
@@ -818,13 +866,13 @@
                 text = atom->next()->string();
             if (atom->type() == Atom::Image)
-                out() << "<p align=\"center\">";
+                out() << "<p class=\"centerAlign\">";
             if (fileName.isEmpty()) {
                 out() << "<font color=\"red\">[Missing image "
-                      << protect(atom->string()) << "]</font>";
+                      << protectEnc(atom->string()) << "]</font>";
             }
             else {
-                out() << "<img src=\"" << protect(fileName) << "\"";
+                out() << "<img src=\"" << protectEnc(fileName) << "\"";
                 if (!text.isEmpty())
-                    out() << " alt=\"" << protect(text) << "\"";
+                    out() << " alt=\"" << protectEnc(text) << "\"";
                 out() << " />";
                 helpProjectWriter->addExtraFile(fileName);
@@ -837,5 +885,5 @@
         break;
     case Atom::LegaleseLeft:
-        out() << "<div style=\"padding: 0.5em; background: #e0e0e0; color: black\">";
+        out() << "<div class=\"LegaleseLeft\">";
         break;
     case Atom::LegaleseRight:
@@ -843,5 +891,5 @@
         break;
     case Atom::LineBreak:
-        out() << "<br />";
+        out() << "<br/>";
         break;
     case Atom::Link:
@@ -879,22 +927,24 @@
             threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom);
             if (threeColumnEnumValueTable) {
-                out() << "<p><table class=\"valuelist\" border=\"1\" cellpadding=\"2\" "
-                      << "cellspacing=\"1\" width=\"100%\">\n"
-                      << "<tr><th width=\"25%\">Constant</th>"
-                      << "<th width=\"15%\">Value</th>"
-                      << "<th width=\"60%\">Description</th></tr>\n";
+                out() << "<table class=\"valuelist\">";
+                if (++numTableRows % 2 == 1)
+                        out() << "<tr class=\"odd\">";
+                else
+                        out() << "<tr class=\"even\">";
+
+                out() << "<th class=\"tblConst\">Constant</th>"
+                      << "<th class=\"tblval\">Value</th>"
+                      << "<th class=\"tbldscr\">Description</th></tr>\n";
             }
             else {
-                out() << "<p><table  class=\"valuelist\" border=\"1\" cellpadding=\"2\" "
-                      << "cellspacing=\"1\" width=\"40%\">\n"
-                      << "<tr><th width=\"60%\">Constant</th><th "
-                      << "width=\"40%\">Value</th></tr>\n";
+                out() << "<table class=\"valuelist\">"
+                      << "<tr><th class=\"tblConst\">Constant</th><th class=\"tblVal\">Value</th></tr>\n";
             }
         }
         else {
-            out() << "<ol type=";
+            out() << "<ol class=";
             if (atom->string() == ATOM_LIST_UPPERALPHA) {
                 out() << "\"A\"";
-            }
+            } /* why type? changed to */
             else if (atom->string() == ATOM_LIST_LOWERALPHA) {
                 out() << "\"a\"";
@@ -923,8 +973,8 @@
             // ### Trenton
 
-            out() << "<tr><td valign=\"top\"><tt>"
-                  << protect(plainCode(marker->markedUpEnumValue(atom->next()->string(),
+            out() << "<tr><td  class=\"topAlign\"><tt>"
+                  << protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(),
                                                                  relative)))
-                  << "</tt></td><td align=\"center\" valign=\"top\">";
+                  << "</tt></td><td class=\" topAlign\">";
 
             QString itemValue;
@@ -937,5 +987,5 @@
                 out() << "?";
             else
-                out() << "<tt>" << protect(itemValue) << "</tt>";
+                out() << "<tt>" << protectEnc(itemValue) << "</tt>";
 
             skipAhead = 1;
@@ -952,5 +1002,5 @@
         else if (atom->string() == ATOM_LIST_VALUE) {
             if (threeColumnEnumValueTable) {
-                out() << "</td><td valign=\"top\">";
+                out() << "</td><td  class=\"topAlign\">";
                 if (matchAhead(atom, Atom::ListItemRight))
                     out() << "&nbsp;";
@@ -982,5 +1032,5 @@
         }
         else if (atom->string() == ATOM_LIST_VALUE) {
-            out() << "</table></p>\n";
+            out() << "</table>\n";
         }
         else {
@@ -1027,9 +1077,9 @@
                 sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1);
             }
-            out() << "<a name=\"sec-" << sectionNumber.join("-") << "\"></a>\n";
+            out() << "<a name=\"sec-" << sectionNumber.join("-") << "\"></a>" << divNavTop << "\n";
         }
 #else
         out() << "<a name=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString())
-              << "\"></a>\n";
+              << "\"></a>" << divNavTop << "\n";
 #endif
         break;
@@ -1053,5 +1103,5 @@
         }
         else {
-            out() << protect(atom->string());
+            out() << protectEnc(atom->string());
         }
         break;
@@ -1063,23 +1113,19 @@
         if (!atom->string().isEmpty()) {
             if (atom->string().contains("%"))
-                out() << "<p><table class=\"generic\" width=\"" << atom->string() << "\" "
-                      << "align=\"center\" cellpadding=\"2\" "
-                      << "cellspacing=\"1\" border=\"0\">\n";
+                out() << "<table class=\"generic\">\n "; // width=\"" << atom->string() << "\">\n ";
             else {
-                out() << "<p><table class=\"generic\" align=\"center\" cellpadding=\"2\" "
-                      << "cellspacing=\"1\" border=\"0\">\n";
+                out() << "<table class=\"generic\">\n";
             }
         }
         else {
-            out() << "<p><table class=\"generic\" align=\"center\" cellpadding=\"2\" "
-                  << "cellspacing=\"1\" border=\"0\">\n";
+            out() << "<table class=\"generic\">\n";
         }
         numTableRows = 0;
         break;
     case Atom::TableRight:
-        out() << "</table></p>\n";
+        out() << "</table>\n";
         break;
     case Atom::TableHeaderLeft:
-        out() << "<thead><tr valign=\"top\" class=\"qt-style\">";
+        out() << "<thead><tr class=\"qt-style topAlign\">";
         inTableHeader = true;
         break;
@@ -1088,5 +1134,5 @@
         if (matchAhead(atom, Atom::TableHeaderLeft)) {
             skipAhead = 1;
-            out() << "\n<tr valign=\"top\" class=\"qt-style\">";
+            out() << "\n<tr class=\"qt-style topAlign\">";
         }
         else {
@@ -1097,7 +1143,7 @@
     case Atom::TableRowLeft:
         if (++numTableRows % 2 == 1)
-            out() << "<tr valign=\"top\" class=\"odd\">";
+            out() << "<tr class=\"odd topAlign\">";
         else
-            out() << "<tr valign=\"top\" class=\"even\">";
+            out() << "<tr class=\"even topAlign\">";
         break;
     case Atom::TableRowRight:
@@ -1107,7 +1153,7 @@
         {
             if (inTableHeader)
-                out() << "<th";
+                out() << "<th ";
             else
-                out() << "<td";
+                out() << "<td ";
 
             QStringList spans = atom->string().split(",");
@@ -1117,5 +1163,8 @@
                 if (spans.at(1) != "1")
                     out() << " rowspan=\"" << spans.at(1) << "\"";
+            if (inTableHeader)
                 out() << ">";
+            else
+                out() << "><p>"; 
             }
             if (matchAhead(atom, Atom::ParaLeft))
@@ -1127,5 +1176,5 @@
             out() << "</th>";
         else
-            out() << "</td>";
+            out() << "</p></td>";
         if (matchAhead(atom, Atom::ParaLeft))
             skipAhead = 1;
@@ -1164,9 +1213,9 @@
         break;
     case Atom::UnhandledFormat:
-        out() << "<font color=\"red\"><b>&lt;Missing HTML&gt;</b></font>";
+        out() << "<b class=\"redFont\">&lt;Missing HTML&gt;</b>";
         break;
     case Atom::UnknownCommand:
-        out() << "<font color=\"red\"><b><code>\\" << protect(atom->string())
-              << "</code></b></font>";
+        out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string())
+              << "</code></b>";
         break;
 #ifdef QDOC_QML
@@ -1182,4 +1231,7 @@
 }
 
+/*!
+  Generate a reference page for a C++ class.
+ */
 void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
                                           CodeMarker *marker)
@@ -1198,5 +1250,5 @@
         rawTitle = marker->plainName(inner);
         fullTitle = marker->plainFullName(inner);
-        title = rawTitle + " Namespace Reference";
+        title = rawTitle + " Namespace";
     }
     else if (inner->type() == Node::Class) {
@@ -1217,41 +1269,19 @@
                      << Atom(Atom::LineBreak);
 
-    QString fixedModule = inner->moduleName();
-    if (fixedModule == "Qt3SupportLight")
-        fixedModule = "Qt3Support";
-    if (!fixedModule.isEmpty())
-        subtitleText << "[" << Atom(Atom::AutoLink, fixedModule) << " module]";
-
-    if (fixedModule.isEmpty()) {
-        QMultiMap<QString, QString> publicGroups = myTree->publicGroups();
-        QList<QString> groupNames = publicGroups.values(inner->name());
-        if (!groupNames.isEmpty()) {
-            qSort(groupNames.begin(), groupNames.end());
-            subtitleText << "[";
-            for (int j=0; j<groupNames.count(); j++) {
-                subtitleText <<  Atom(Atom::AutoLink, groupNames[j]);
-                if (j<groupNames.count()-1)
-                    subtitleText <<", ";
-            }
-            subtitleText << "]";
-        }
-    }
-
-    generateHeader(title, inner, marker, true);
-    generateTitle(title, subtitleText, SmallSubTitle, inner, marker);
-
-#ifdef QDOC_QML
-    if (classe && !classe->qmlElement().isEmpty()) {
-        generateInstantiatedBy(classe,marker);
-    }
-#endif
-    
+    generateHeader(title, inner, marker);
+    sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
+    generateTableOfContents(inner,marker,&sections);
+    generateTitle(title, subtitleText, SmallSubTitle, inner, marker);    
     generateBrief(inner, marker);
     generateIncludes(inner, marker);
     generateStatus(inner, marker);
     if (classe) {
-        generateModuleWarning(classe, marker);
         generateInherits(classe, marker);
         generateInheritedBy(classe, marker);
+#ifdef QDOC_QML
+        if (!classe->qmlElement().isEmpty()) {
+            generateInstantiatedBy(classe,marker);
+        }
+#endif
     }
     generateThreadSafeness(inner, marker);
@@ -1283,5 +1313,7 @@
     bool needOtherSection = false;
 
-    sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
+    /*
+      sections is built above for the call to generateTableOfContents().
+     */
     s = sections.begin();
     while (s != sections.end()) {
@@ -1292,18 +1324,18 @@
         else {
             if (!s->members.isEmpty()) {
-                out() << "<hr />\n";
+               // out() << "<hr />\n";
                 out() << "<a name=\""
                       << registerRef((*s).name.toLower())
-                      << "\"></a>\n";
-                out() << "<h2>" << protect((*s).name) << "</h2>\n";
+                      << "\"></a>" << divNavTop << "\n";
+                out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
                 generateSection(s->members, inner, marker, CodeMarker::Summary);
             }
             if (!s->reimpMembers.isEmpty()) {
                 QString name = QString("Reimplemented ") + (*s).name;
-                out() << "<hr />\n";
+              //  out() << "<hr />\n";
                 out() << "<a name=\""
                       << registerRef(name.toLower())
-                      << "\"></a>\n";
-                out() << "<h2>" << protect(name) << "</h2>\n";
+                      << "\"></a>" << divNavTop << "\n";
+                out() << "<h2>" << protectEnc(name) << "</h2>\n";
                 generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary);
             }
@@ -1311,5 +1343,5 @@
             if (!s->inherited.isEmpty()) {
                 out() << "<ul>\n";
-                generateSectionInheritedList(*s, inner, marker, true);
+                generateSectionInheritedList(*s, inner, marker);
                 out() << "</ul>\n";
             }
@@ -1331,11 +1363,15 @@
     }
 
-    out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+    out() << "<a name=\"" << registerRef("details") << "\"></a>" << divNavTop << "\n";
 
     if (!inner->doc().isEmpty()) {
-        out() << "<hr />\n"
+        generateExtractionMark(inner, DetailedDescriptionMark);
+        //out() << "<hr />\n"
+        out() << "<div class=\"descr\">\n" // QTBUG-9504
               << "<h2>" << "Detailed Description" << "</h2>\n";
         generateBody(inner, marker);
+        out() << "</div>\n"; // QTBUG-9504
         generateAlsoList(inner, marker);
+        generateExtractionMark(inner, EndMark);
     }
 
@@ -1343,6 +1379,8 @@
     s = sections.begin();
     while (s != sections.end()) {
-        out() << "<hr />\n";
-        out() << "<h2>" << protect((*s).name) << "</h2>\n";
+        //out() << "<hr />\n";
+        if (!(*s).divClass.isEmpty())
+            out() << "<div class=\"" << (*s).divClass << "\">\n"; // QTBUG-9504
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
 
         NodeList::ConstIterator m = (*s).members.begin();
@@ -1393,4 +1431,6 @@
             ++m;
         }
+        if (!(*s).divClass.isEmpty())
+            out() << "</div>\n"; // QTBUG-9504
         ++s;
     }
@@ -1419,4 +1459,8 @@
 }
 
+/*!
+  Generate the html page for a qdoc file that doesn't map
+  to an underlying c++ file.
+ */
 void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
 {
@@ -1429,12 +1473,31 @@
     QList<Section>::const_iterator s;
 
-    QString htmlTitle = fake->fullTitle();
+    QString fullTitle = fake->fullTitle();
+    QString htmlTitle = fullTitle;
     if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
         subTitleSize = SmallSubTitle;
         htmlTitle += " (" + fake->subTitle() + ")";
     }
-
-    generateHeader(htmlTitle, fake, marker, true);
-    generateTitle(fake->fullTitle(),
+    else if (fake->subType() == Node::QmlBasicType) {
+        fullTitle = "QML Basic Type: " + fullTitle;
+        htmlTitle = fullTitle;
+    }
+
+    generateHeader(htmlTitle, fake, marker);
+        
+    /*
+      Generate the TOC for the new doc format.
+      Don't generate a TOC for the home page.
+    */
+    const QmlClassNode* qml_cn = 0;
+    if (fake->subType() == Node::QmlClass) {
+        qml_cn = static_cast<const QmlClassNode*>(fake);
+        sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0);
+        generateTableOfContents(fake,marker,&sections);
+    }
+    else if (fake->name() != QString("index.html"))
+        generateTableOfContents(fake,marker,0);
+
+    generateTitle(fullTitle,
                   Text() << fake->subTitle(),
                   subTitleSize,
@@ -1448,8 +1511,10 @@
 
         if (moduleNamespaceMap.contains(fake->name())) {
+            out() << "<a name=\"" << registerRef("namespaces") << "\"></a>" << divNavTop << "\n";
             out() << "<h2>Namespaces</h2>\n";
             generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]);
         }
         if (moduleClassMap.contains(fake->name())) {
+            out() << "<a name=\"" << registerRef("classes") << "\"></a>" << divNavTop << "\n";
             out() << "<h2>Classes</h2>\n";
             generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]);
@@ -1505,19 +1570,27 @@
 #ifdef QDOC_QML
     else if (fake->subType() == Node::QmlClass) {
-        const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake);
         const ClassNode* cn = qml_cn->classNode();
+        generateBrief(qml_cn, marker);
         generateQmlInherits(qml_cn, marker);
+        generateQmlInheritedBy(qml_cn, marker);
         generateQmlInstantiates(qml_cn, marker);
-        generateBrief(qml_cn, marker);
-        sections = marker->qmlSections(qml_cn,CodeMarker::Summary);
+
+        QString allQmlMembersLink = generateAllQmlMembersFile(qml_cn, marker);
+        if (!allQmlMembersLink.isEmpty()) {
+            out() << "<li><a href=\"" << allQmlMembersLink << "\">"
+                  << "List of all members, including inherited members</a></li>\n";
+        }
+
         s = sections.begin();
         while (s != sections.end()) {
-            out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n";
-            out() << "<h2>" << protect((*s).name) << "</h2>\n";
+            out() << "<a name=\"" << registerRef((*s).name.toLower())
+                  << "\"></a>" << divNavTop << "\n";
+            out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
             generateQmlSummary(*s,fake,marker);
             ++s;
         }
 
-        out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+        generateExtractionMark(fake, DetailedDescriptionMark);
+        out() << "<a name=\"" << registerRef("details") << "\"></a>" << divNavTop << "\n";
         out() << "<h2>" << "Detailed Description" << "</h2>\n";
         generateBody(fake, marker);
@@ -1525,14 +1598,15 @@
             generateQmlText(cn->doc().body(), cn, marker, fake->name());
         generateAlsoList(fake, marker);
-        out() << "<hr />\n";
-
-        sections = marker->qmlSections(qml_cn,CodeMarker::Detailed);
+        generateExtractionMark(fake, EndMark);
+        //out() << "<hr />\n";
+
+        sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0);
         s = sections.begin();
         while (s != sections.end()) {
-            out() << "<h2>" << protect((*s).name) << "</h2>\n";
+            out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
             NodeList::ConstIterator m = (*s).members.begin();
             while (m != (*s).members.end()) {
                 generateDetailedQmlMember(*m, fake, marker);
-                out() << "<br />\n";
+                out() << "<br/>\n";
                 fakeSection.keywords += qMakePair((*m)->name(),
                                                   linkForNode(*m,0));
@@ -1549,6 +1623,6 @@
     s = sections.begin();
     while (s != sections.end()) {
-        out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n";
-        out() << "<h2>" << protect((*s).name) << "</h2>\n";
+        out() << "<a name=\"" << registerRef((*s).name) << "\"></a>" << divNavTop << "\n";
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
         generateSectionList(*s, fake, marker, CodeMarker::Summary);
         ++s;
@@ -1557,10 +1631,18 @@
     Text brief = fake->doc().briefText();
     if (fake->subType() == Node::Module && !brief.isEmpty()) {
-        out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+        generateExtractionMark(fake, DetailedDescriptionMark);
+        out() << "<a name=\"" << registerRef("details") << "\"></a>" << divNavTop << "\n";
+        out() << "<div class=\"descr\">\n"; // QTBUG-9504
         out() << "<h2>" << "Detailed Description" << "</h2>\n";
     }
+    else {
+        generateExtractionMark(fake, DetailedDescriptionMark);
+        out() << "<div class=\"descr\"> <a name=\"" << registerRef("details") << "\"></a>\n"; // QTBUG-9504
+    }
 
     generateBody(fake, marker);
+    out() << "</div>\n"; // QTBUG-9504
     generateAlsoList(fake, marker);
+    generateExtractionMark(fake, EndMark);
 
     if (!fake->groupMembers().isEmpty()) {
@@ -1578,6 +1660,6 @@
     s = sections.begin();
     while (s != sections.end()) {
-        out() << "<hr />\n";
-        out() << "<h2>" << protect((*s).name) << "</h2>\n";
+        //out() << "<hr />\n";
+        out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
 
         NodeList::ConstIterator m = (*s).members.begin();
@@ -1615,53 +1697,183 @@
 }
 
-QString HtmlGenerator::fileExtension(const Node * /* node */)
+/*!
+  Returns "html" for this subclass of Generator.
+ */
+QString HtmlGenerator::fileExtension(const Node * /* node */) const
 {
     return "html";
+}
+
+/*!
+  Output breadcrumb list in the html file.
+ */
+void HtmlGenerator::generateBreadCrumbs(const QString& title,
+                                        const Node *node,
+                                        CodeMarker *marker)
+{
+    Text breadcrumb;
+    if (node->type() == Node::Class) {
+        const ClassNode* cn = static_cast<const ClassNode*>(node);
+        QString name =  node->moduleName();
+        out() << "              <li><a href=\"modules.html\">Modules</a></li>";
+        if (!name.isEmpty()) {
+            out() << "              <li>";
+            breadcrumb << Atom(Atom::AutoLink,name);
+            generateText(breadcrumb, node, marker);
+            out() << "</li>\n";
+        }
+        if (!cn->name().isEmpty())
+            out() << "              <li>" << protectEnc(cn->name()) << "</li>\n";
+    }
+    else if (node->type() == Node::Fake) {
+        const FakeNode* fn = static_cast<const FakeNode*>(node);
+        if (node->subType() == Node::Module) {
+            out() << "              <li><a href=\"modules.html\">Modules</a></li>";
+            QString name =  node->name();
+            if (!name.isEmpty())
+                out() << "              <li>" << protectEnc(name) << "</li>\n";
+        }
+        else if (node->subType() == Node::Group) {
+            if (fn->name() == QString("modules"))
+                out() << "              <li>Modules</li>";
+            else {
+                out() << "              <li>" << protectEnc(title) << "</li>";
+            }
+        }
+        else if (node->subType() == Node::Page) {
+            if (fn->name() == QString("qdeclarativeexamples.html")) {
+                out() << "              <li><a href=\"all-examples.html\">Examples</a></li>";
+                out() << "              <li>QML Examples &amp; Demos</li>";
+            }
+            else if (fn->name().startsWith("examples-")) {
+                out() << "              <li><a href=\"all-examples.html\">Examples</a></li>";
+                out() << "              <li>" << protectEnc(title) << "</li>";
+            }
+            else if (fn->name() == QString("namespaces.html")) {
+                out() << "              <li>Namespaces</li>";
+            }
+            else {
+                out() << "              <li>" << protectEnc(title) << "</li>";
+            }
+        }
+        else if (node->subType() == Node::QmlClass) {
+            out() << "              <li><a href=\"qdeclarativeelements.html\">QML Elements</a></li>";
+            out() << "              <li>" << protectEnc(title) << "</li>";
+        }
+        else if (node->subType() == Node::Example) {
+            out() << "              <li><a href=\"all-examples.html\">Examples</a></li>";
+            QStringList sl = fn->name().split('/');
+            if (sl.contains("declarative"))
+                out() << "              <li><a href=\"qdeclarativeexamples.html\">QML Examples &amp; Demos</a></li>";
+            else {
+                QString name = protectEnc("examples-" + sl.at(0) + ".html"); // this generates an empty link
+                QString t = CodeParser::titleFromName(name);
+            }
+            out() << "              <li>" << protectEnc(title) << "</li>";
+        }
+    }
+    else if (node->type() == Node::Namespace) {
+        out() << "              <li><a href=\"namespaces.html\">Namespaces</a></li>";
+        out() << "              <li>" << protectEnc(title) << "</li>";
+    }
 }
 
 void HtmlGenerator::generateHeader(const QString& title,
                                    const Node *node,
-                                   CodeMarker *marker,
-                                   bool mainPage)
-{
-    out() << "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
-
-    out() << "<!DOCTYPE html\n"
-             "    PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"
-             "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
-
+                                   CodeMarker *marker)
+{
+    out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding);
+    out() << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
+    out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage);
+    out() << "<head>\n";
+    out() << "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
     QString shortVersion;
-    if ((project != "Qtopia") && (project != "Qt Extended")) {
-        shortVersion = project + " " + shortVersion + ": ";
-        if (node && !node->doc().location().isEmpty())
-            out() << "<!-- " << node->doc().location().fileName() << " -->\n";
-
-        shortVersion = myTree->version();
-        if (shortVersion.count(QChar('.')) == 2)
-            shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
-        if (!shortVersion.isEmpty()) {
-            if (project == "QSA")
-                shortVersion = "QSA " + shortVersion + ": ";
-            else
-                shortVersion = "Qt " + shortVersion + ": ";
-        }
-    }
-
-    out() << "<head>\n"
-             "  <title>" << shortVersion << protect(title) << "</title>\n";
-    if (!style.isEmpty())
-        out() << "    <style type=\"text/css\">" << style << "</style>\n";
-
-    const QMap<QString, QString> &metaMap = node->doc().metaTagMap();
-    if (!metaMap.isEmpty()) {
-        QMapIterator<QString, QString> i(metaMap);
-        while (i.hasNext()) {
-            i.next();
-            out() << "    <meta name=\"" << protect(i.key()) << "\" contents=\""
-                  << protect(i.value()) << "\" />\n";
-        }
-    }
-
-    navigationLinks.clear();
+    shortVersion = project + " " + shortVersion + ": ";
+    if (node && !node->doc().location().isEmpty())
+        out() << "<!-- " << node->doc().location().fileName() << " -->\n";
+
+    shortVersion = myTree->version();
+    if (shortVersion.count(QChar('.')) == 2)
+        shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
+    if (!shortVersion.isEmpty()) {
+        if (project == "QSA")
+            shortVersion = "QSA " + shortVersion + ": ";
+        else
+            shortVersion = "Qt " + shortVersion + ": ";
+    }
+
+    // Generating page title
+    out() << "  <title>" << shortVersion << protectEnc(title) << "</title>\n";
+    // Adding style sheet
+    out() << "  <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n";
+    // Adding jquery and functions - providing online tools and search features
+    out() << "  <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n";
+    out() << "  <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n";
+
+
+    // Adding syntax highlighter         // future release
+
+    // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator)
+
+    switch (application) {
+    case Online:
+    // Adding style and js for small windows
+        out() << "  <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n";
+        out() << "  <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />";
+        out() << "  <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n";
+        out() << "  <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n";
+        // Browser spec styles
+        out() << "  <!--[if IE]>\n";
+        out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n";
+        out() << "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n";
+        out() << "<![endif]-->\n";
+        out() << "<!--[if lt IE 7]>\n";
+        out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n";
+        out() << "<![endif]-->\n";
+        out() << "<!--[if IE 7]>\n";
+        out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n";
+        out() << "<![endif]-->\n";
+        out() << "<!--[if IE 8]>\n";
+        out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n";
+        out() << "<![endif]-->\n";
+
+        out() << "</head>\n";
+        // CheckEmptyAndLoadList activating search
+        out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n";
+        break;
+    case Creator:
+        out() << "</head>\n";
+        out() << "<body class=\"offline narrow creator\">\n"; // offline narrow
+        break;
+    default:
+        out() << "</head>\n";
+        out() << "<body>\n";
+        break;
+    }
+
+#ifdef GENERATE_MAC_REFS    
+    if (mainPage)
+        generateMacRef(node, marker);
+#endif   
+ 
+    switch (application) {
+    case Online:
+        out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        generateBreadCrumbs(title,node,marker);
+        out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        break;
+    case Creator:
+        out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        generateBreadCrumbs(title,node,marker);
+        out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        break;
+    default: // default -- not used except if one forgets to set any of the above settings to true
+        out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        generateBreadCrumbs(title,node,marker);
+        out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
+        break;
+    }
+
+        navigationLinks.clear();
 
     if (node && !node->links().empty()) {
@@ -1688,22 +1900,4 @@
             navigationLinks += "</a>]\n";
         }
-        if (node->links().contains(Node::ContentsLink)) {
-            linkPair = node->links()[Node::ContentsLink];
-            linkNode = findNodeForTarget(linkPair.first, node, marker);
-            if (!linkNode || linkNode == node)
-                anchorPair = linkPair;
-            else
-                anchorPair = anchorForNode(linkNode);
-
-            out() << "  <link rel=\"contents\" href=\""
-                  << anchorPair.first << "\" />\n";
-
-            navigationLinks += "[<a href=\"" + anchorPair.first + "\">";
-            if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
-                navigationLinks += protect(anchorPair.second);
-            else
-                navigationLinks += protect(linkPair.second);
-            navigationLinks += "</a>]\n";
-        }
         if (node->links().contains(Node::NextLink)) {
             linkPair = node->links()[Node::NextLink];
@@ -1723,14 +1917,4 @@
                 navigationLinks += protect(linkPair.second);
             navigationLinks += "</a>]\n";
-        }
-        if (node->links().contains(Node::IndexLink)) {
-            linkPair = node->links()[Node::IndexLink];
-            linkNode = findNodeForTarget(linkPair.first, node, marker);
-            if (!linkNode || linkNode == node)
-                anchorPair = linkPair;
-            else
-                anchorPair = anchorForNode(linkNode);
-            out() << "  <link rel=\"index\" href=\""
-                  << anchorPair.first << "\" />\n";
         }
         if (node->links().contains(Node::StartLink)) {
@@ -1746,22 +1930,6 @@
     }
 
-    foreach (const QString &stylesheet, stylesheets) {
-        out() << "  <link href=\"" << stylesheet << "\" rel=\"stylesheet\" "
-              << "type=\"text/css\" />\n";
-    }
-
-    foreach (const QString &customHeadElement, customHeadElements) {
-        out() << "  " << customHeadElement << "\n";
-    }
-
-    out() << "</head>\n"
-             "<body>\n";
-    if (mainPage)
-        generateMacRef(node, marker);
-    out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version());
-
-
     if (node && !node->links().empty())
-        out() << "<p>\n" << navigationLinks << "</p>\n";
+        out() << "<p class=\"naviNextPrevious headerNavi\">\n" << navigationLinks << "</p><p/>\n";
 }
 
@@ -1772,15 +1940,15 @@
                                   CodeMarker *marker)
 {
-    out() << "<h1 class=\"title\">" << protect(title);
+    if (!title.isEmpty())
+        out() << "<h1 class=\"title\">" << protectEnc(title) << "</h1>\n";
     if (!subTitle.isEmpty()) {
-        out() << "<br />";
+        out() << "<span";
         if (subTitleSize == SmallSubTitle)
-            out() << "<span class=\"small-subtitle\">";
+            out() << " class=\"small-subtitle\">";
         else
-            out() << "<span class=\"subtitle\">";
+            out() << " class=\"subtitle\">";
         generateText(subTitle, relative, marker);
         out() << "</span>\n";
     }
-    out() << "</h1>\n";
 }
 
@@ -1788,10 +1956,33 @@
 {
     if (node && !node->links().empty())
-        out() << "<p>\n" << navigationLinks << "</p>\n";
+        out() << "<p class=\"naviNextPrevious footerNavi\">\n" << navigationLinks << "</p>\n";
 
     out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version())
-          << QString(address).replace("\\" + COMMAND_VERSION, myTree->version())
-          << "</body>\n"
-             "</html>\n";
+          << QString(address).replace("\\" + COMMAND_VERSION, myTree->version());
+
+    switch (application) {
+    case Online:
+        out() << "  <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n";
+        out() << "  <script type=\"text/javascript\">\n";
+        out() << "  var _gaq = _gaq || [];\n";
+        out() << "  _gaq.push(['_setAccount', 'UA-4457116-5']);\n";
+        out() << "  _gaq.push(['_trackPageview']);\n";
+        out() << "  (function() {\n";
+        out() << "  var ga = document.createElement('script'); ";
+        out() << "ga.type = 'text/javascript'; ga.async = true;\n";
+        out() << "  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + ";
+        out() << "'.google-analytics.com/ga.js';\n";
+        out() << "  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n";
+        out() << "  })();\n";
+        out() << "  </script>\n";
+        out() << "</body>\n";
+        break;
+    case Creator:
+        out() << "</body>\n";
+        break;
+    default:
+        out() << "</body>\n";
+    }
+          out() <<   "</html>\n";
 }
 
@@ -1801,6 +1992,8 @@
     Text brief = node->doc().briefText();
     if (!brief.isEmpty()) {
+        generateExtractionMark(node, BriefMark);
         out() << "<p>";
         generateText(brief, node, marker);
+
         if (!relative || node == relative)
             out() << " <a href=\"#";
@@ -1808,4 +2001,7 @@
             out() << " <a href=\"" << linkForNode(node, relative) << "#";
         out() << registerRef("details") << "\">More...</a></p>\n";
+
+
+        generateExtractionMark(node, EndMark);
     }
 }
@@ -1814,5 +2010,5 @@
 {
     if (!inner->includes().isEmpty()) {
-        out() << "<pre>"
+        out() << "<pre class=\"highlightedCode brush: cpp\">"
               << trimmedTrailing(highlightedCode(indent(codeIndent,
                                                         marker->markedUpIncludes(inner->includes())),
@@ -1822,4 +2018,7 @@
 }
 
+/*!
+  Generates a table of contents beginning at \a node.
+ */
 void HtmlGenerator::generateTableOfContents(const Node *node,
                                             CodeMarker *marker,
@@ -1829,4 +2028,5 @@
 
 {
+    return;
     if (!node->doc().hasTableOfContents())
         return;
@@ -1844,6 +2044,6 @@
     QString tdTag;
     if (numColumns > 1) {
-        tdTag = "<td width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";
-        out() << "<p><table class=\"toc\" width=\"100%\">\n<tr valign=\"top\">"
+        tdTag = "<td>"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/
+        out() << "<table class=\"toc\">\n<tr class=\"topAlign\">"
               << tdTag << "\n";
     }
@@ -1897,6 +2097,123 @@
 
     if (numColumns > 1)
-        out() << "</td></tr></table></p>\n";
-
+        out() << "</td></tr></table>\n";
+
+    inContents = false;
+    inLink = false;
+}
+
+/*!
+  Revised for the new doc format.
+  Generates a table of contents beginning at \a node.
+ */
+void HtmlGenerator::generateTableOfContents(const Node *node,
+                                            CodeMarker *marker,
+                                            QList<Section>* sections)
+{
+    QList<Atom*> toc;
+    if (node->doc().hasTableOfContents()) 
+        toc = node->doc().tableOfContents();
+    if (toc.isEmpty() && !sections && (node->subType() != Node::Module))
+        return;
+
+    QStringList sectionNumber;
+    int detailsBase = 0;
+
+    // disable nested links in table of contents
+    inContents = true;
+    inLink = true;
+
+    out() << "<div class=\"toc\">\n";
+    out() << "<h3><a name=\"toc\">Contents</a></h3>\n";
+    sectionNumber.append("1");
+    out() << "<ul>\n";
+
+    if (node->subType() == Node::Module) {
+        if (moduleNamespaceMap.contains(node->name())) {
+            out() << "<li class=\"level"
+                  << sectionNumber.size()
+                  << "\"><a href=\"#"
+                  << registerRef("namespaces")
+                  << "\">Namespaces</a></li>\n";
+        }
+        if (moduleClassMap.contains(node->name())) {
+            out() << "<li class=\"level"
+                  << sectionNumber.size()
+                  << "\"><a href=\"#"
+                  << registerRef("classes")
+                  << "\">Classes</a></li>\n";
+        }
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\"><a href=\"#"
+              << registerRef("details")
+              << "\">Detailed Description</a></li>\n";
+        for (int i = 0; i < toc.size(); ++i) {
+            if (toc.at(i)->string().toInt() == 1) {
+                detailsBase = 1;
+                break;
+            }
+        }
+    }
+    else if (sections && ((node->type() == Node::Class) ||
+                          (node->type() == Node::Namespace) ||
+                          (node->subType() == Node::QmlClass))) {
+        QList<Section>::ConstIterator s = sections->begin();
+        while (s != sections->end()) {
+            if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) {
+                out() << "<li class=\"level"
+                      << sectionNumber.size()
+                      << "\"><a href=\"#"
+                      << registerRef((*s).pluralMember)
+                      << "\">" << (*s).name
+                      << "</a></li>\n";
+            }
+            ++s;
+        }
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\"><a href=\"#"
+              << registerRef("details")
+              << "\">Detailed Description</a></li>\n";
+        for (int i = 0; i < toc.size(); ++i) {
+            if (toc.at(i)->string().toInt() == 1) {
+                detailsBase = 1;
+                break;
+            }
+        }
+    }
+
+    for (int i = 0; i < toc.size(); ++i) {
+        Atom *atom = toc.at(i);
+        int nextLevel = atom->string().toInt() + detailsBase;
+        if (sectionNumber.size() < nextLevel) {
+            do {
+                sectionNumber.append("1");
+            } while (sectionNumber.size() < nextLevel);
+        }
+        else {
+            while (sectionNumber.size() > nextLevel) {
+                sectionNumber.removeLast();
+            }
+            sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1);
+        }
+        int numAtoms;
+        Text headingText = Text::sectionHeading(atom);
+        QString s = headingText.toString();
+        out() << "<li class=\"level"
+              << sectionNumber.size()
+              << "\">";
+        out() << "<a href=\""
+              << "#"
+              << Doc::canonicalTitle(s)
+              << "\">";
+        generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
+        out() << "</a></li>\n";
+    }
+    while (!sectionNumber.isEmpty()) {
+        sectionNumber.removeLast();
+    }
+    out() << "</ul>\n";
+    out() << "</div>\n";
     inContents = false;
     inLink = false;
@@ -1910,5 +2227,5 @@
     if (bar.prev.begin() != 0 || bar.current.begin() != 0 ||
          bar.next.begin() != 0) {
-        out() << "<p align=\"right\">";
+        out() << "<p class=\"rightAlign\">";
         if (bar.prev.begin() != 0) {
 #if 0
@@ -1919,15 +2236,17 @@
 #endif
         }
-        if (bar.current.begin() != 0) {
-            out() << "[<a href=\"" << "home"
-                  << ".html\">Home</a>]\n";
-        }
-        if (bar.next.begin() != 0) {
-            out() << "[<a href=\"" << fileBase(node, bar.next)
-                  << ".html\">Next: ";
-            generateText(Text::sectionHeading(bar.next.begin()), node, marker);
-            out() << "</a>]\n";
-        }
-        out() << "</p>\n";
+        if (fake->name() != QString("index.html")) {
+            if (bar.current.begin() != 0) {
+                out() << "[<a href=\"" << "home"
+                      << ".html\">Home</a>]\n";
+            }
+            if (bar.next.begin() != 0) {
+                out() << "[<a href=\"" << fileBase(node, bar.next)
+                      << ".html\">Next: ";
+                generateText(Text::sectionHeading(bar.next.begin()), node, marker);
+                out() << "</a>]\n";
+            }
+            out() << "</p>\n";
+        }
     }
 }
@@ -1949,8 +2268,40 @@
     beginSubPage(inner->location(), fileName);
     QString title = "List of All Members for " + inner->name();
-    generateHeader(title, inner, marker, false);
+    generateHeader(title, inner, marker);
     generateTitle(title, Text(), SmallSubTitle, inner, marker);
     out() << "<p>This is the complete list of members for ";
     generateFullName(inner, 0, marker);
+    out() << ", including inherited members.</p>\n";
+
+    Section section = sections.first();
+    generateSectionList(section, 0, marker, CodeMarker::SeparateList);
+
+    generateFooter();
+    endSubPage();
+    return fileName;
+}
+
+/*!
+  This function creates an html page on which are listed all
+  the members of QML class \a qml_cn, including the inherited
+  members. The \a marker is used for formatting stuff.
+ */
+QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn,
+                                                 CodeMarker* marker)
+{
+    QList<Section> sections;
+    QList<Section>::ConstIterator s;
+
+    sections = marker->qmlSections(qml_cn,CodeMarker::SeparateList,myTree);
+    if (sections.isEmpty())
+        return QString();
+
+    QString fileName = fileBase(qml_cn) + "-members." + fileExtension(qml_cn);
+    beginSubPage(qml_cn->location(), fileName);
+    QString title = "List of All Members for " + qml_cn->name();
+    generateHeader(title, qml_cn, marker);
+    generateTitle(title, Text(), SmallSubTitle, qml_cn, marker);
+    out() << "<p>This is the complete list of members for ";
+    generateFullName(qml_cn, 0, marker);
     out() << ", including inherited members.</p>\n";
 
@@ -1993,5 +2344,5 @@
 
     beginSubPage(inner->location(), fileName);
-    generateHeader(title, inner, marker, false);
+    generateHeader(title, inner, marker);
     generateTitle(title, Text(), SmallSubTitle, inner, marker);
 
@@ -2010,9 +2361,9 @@
     out() << "<p><ul><li><a href=\""
           << linkForNode(inner, 0) << "\">"
-          << protect(inner->name())
+          << protectEnc(inner->name())
           << " class reference</a></li></ul></p>\n";
 
     for (i = 0; i < sections.size(); ++i) {
-        out() << "<h2>" << protect(sections.at(i).name) << "</h2>\n";
+        out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n";
         generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary);
     }
@@ -2020,6 +2371,6 @@
     sections = marker->sections(inner, CodeMarker::Detailed, status);
     for (i = 0; i < sections.size(); ++i) {
-        out() << "<hr />\n";
-        out() << "<h2>" << protect(sections.at(i).name) << "</h2>\n";
+        //out() << "<hr />\n";
+        out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n";
 
         NodeList::ConstIterator m = sections.at(i).members.begin();
@@ -2086,6 +2437,5 @@
                                           const NodeMap &nodeMap)
 {
-    out() << "<p><table width=\"100%\" class=\"annotated\" cellpadding=\"2\" "
-          << "cellspacing=\"1\" border=\"0\">\n";
+    out() << "<table class=\"annotated\">\n";
 
     int row = 0;
@@ -2097,27 +2447,27 @@
 
         if (++row % 2 == 1)
-            out() << "<tr valign=\"top\" class=\"odd\">";
+            out() << "<tr class=\"odd topAlign\">";
         else
-            out() << "<tr valign=\"top\" class=\"even\">";
-        out() << "<th>";
+            out() << "<tr class=\"even topAlign\">";
+        out() << "<td class=\"tblName\"><p>";
         generateFullName(node, relative, marker);
-        out() << "</th>";
+        out() << "</p></td>";
 
         if (!(node->type() == Node::Fake)) {
             Text brief = node->doc().trimmedBriefText(name);
             if (!brief.isEmpty()) {
-                out() << "<td>";
+                out() << "<td class=\"tblDescr\"><p>";
                 generateText(brief, node, marker);
-                out() << "</td>";
+                out() << "</p></td>";
             }
         }
         else {
-            out() << "<td>";
-            out() << protect(node->doc().briefText().toString());
-            out() << "</td>";
+            out() << "<td class=\"tblDescr\"><p>";
+            out() << protectEnc(node->doc().briefText().toString());
+            out() << "</p></td>";
         }
         out() << "</tr>\n";
     }
-    out() << "</table></p>\n";
+    out() << "</table>\n";
 }
 
@@ -2134,8 +2484,8 @@
                                         CodeMarker *marker,
                                         const NodeMap &classMap,
+                                        bool includeAlphabet,
                                         QString commonPrefix)
 {
     const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
-    const int NumColumns = 4; // number of columns in the result
 
     if (classMap.isEmpty())
@@ -2206,4 +2556,5 @@
     NodeMap paragraph[NumParagraphs+1];
     QString paragraphName[NumParagraphs+1];
+    QSet<char> usedParagraphNames;
 
     NodeMap::ConstIterator c = classMap.begin();
@@ -2219,15 +2570,16 @@
             key = pieces.last().toLower();
 
-        int paragraphNo = NumParagraphs - 1;
+        int paragraphNr = NumParagraphs - 1;
 
         if (key[0].digitValue() != -1) {
-            paragraphNo = key[0].digitValue();
+            paragraphNr = key[0].digitValue();
         }
         else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
-            paragraphNo = 10 + key[0].unicode() - 'a';
-        }
-
-        paragraphName[paragraphNo] = key[0].toUpper();
-        paragraph[paragraphNo].insert(key, c.value());
+            paragraphNr = 10 + key[0].unicode() - 'a';
+        }
+
+        paragraphName[paragraphNr] = key[0].toUpper();
+        usedParagraphNames.insert(key[0].toLower().cell());
+        paragraph[paragraphNr].insert(key, c.value());
         ++c;
     }
@@ -2242,95 +2594,92 @@
     */
     int paragraphOffset[NumParagraphs + 1];     // 37 + 1
-    int i, j, k;
-
     paragraphOffset[0] = 0;
-    for (j = 0; j < NumParagraphs; j++)         // j = 0..36
-        paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count();
-
-    int firstOffset[NumColumns + 1];            // 4 + 1
-    int currentOffset[NumColumns];              // 4
-    int currentParagraphNo[NumColumns];         // 4
-    int currentOffsetInParagraph[NumColumns];   // 4
-
-    int numRows = (classMap.count() + NumColumns - 1) / NumColumns;
-    int curParagNo = 0;
-
-    for (i = 0; i < NumColumns; i++) {          // i = 0..3
-        firstOffset[i] = qMin(i * numRows, classMap.size());
-        currentOffset[i] = firstOffset[i];
-
-        for (j = curParagNo; j < NumParagraphs; j++) {
-            if (paragraphOffset[j] > firstOffset[i])
-                break;
-            if (paragraphOffset[j] <= firstOffset[i])
-                curParagNo = j;
-        }
-        currentParagraphNo[i] = curParagNo;
-        currentOffsetInParagraph[i] = firstOffset[i] -
-                                      paragraphOffset[curParagNo];
-    }
-    firstOffset[NumColumns] = classMap.count();
-
-    out() << "<p><table class=\"generic\" width=\"100%\">\n";
-    for (k = 0; k < numRows; k++) {
-        out() << "<tr>\n";
-        for (i = 0; i < NumColumns; i++) {
-            if (currentOffset[i] >= firstOffset[i + 1]) {
-                // this column is finished
-                out() << "<td>\n</td>\n";
-            }
-            else {
-                while ((currentParagraphNo[i] < NumParagraphs) &&
-                       (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count())) {
-                    ++currentParagraphNo[i];
-                    currentOffsetInParagraph[i] = 0;
-                }
-#if 0
-                if (currentParagraphNo[i] >= NumParagraphs) {
-                    qDebug() << "### Internal error ###" << __FILE__ << __LINE__
-                             << currentParagraphNo[i] << NumParagraphs;
-                    currentParagraphNo[i] = NumParagraphs - 1;
-                }
-#endif
-                out() << "<td align=\"right\">";
-                if (currentOffsetInParagraph[i] == 0) {
-                    // start a new paragraph
-                    out() << "<b>"
-                          << paragraphName[currentParagraphNo[i]]
-                          << "&nbsp;</b>";
-                }
-                out() << "</td>\n";
-
-                out() << "<td>";
-                if ((currentParagraphNo[i] < NumParagraphs) &&
-                    !paragraphName[currentParagraphNo[i]].isEmpty()) {
-                    NodeMap::Iterator it;
-                    it = paragraph[currentParagraphNo[i]].begin();
-                    for (j = 0; j < currentOffsetInParagraph[i]; j++)
-                        ++it;
-
-                    // Previously, we used generateFullName() for this, but we
-                    // require some special formatting.
-                    out() << "<a href=\""
-                        << linkForNode(it.value(), relative)
-                        << "\">";
-                    QStringList pieces = fullName(it.value(), relative, marker).split("::");
-                    out() << protect(pieces.last());
-                    out() << "</a>";
-                    if (pieces.size() > 1) {
-                        out() << " (";
-                        generateFullName(it.value()->parent(), relative, marker);
-                        out() << ")";
-                    }
-                }
-                out() << "</td>\n";
-
-                currentOffset[i]++;
-                currentOffsetInParagraph[i]++;
-            }
-        }
-        out() << "</tr>\n";
-    }
-    out() << "</table></p>\n";
+    for (int i=0; i<NumParagraphs; i++)         // i = 0..36
+        paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count();
+
+    int curParNr = 0;
+    int curParOffset = 0;
+
+    /*
+      Output the alphabet as a row of links.
+     */
+    if (includeAlphabet) {
+        out() << "<p  class=\"centerAlign functionIndex\"><b>";
+        for (int i = 0; i < 26; i++) {
+            QChar ch('a' + i);
+            if (usedParagraphNames.contains(char('a' + i)))
+                out() << QString("<a href=\"#%1\">%2</a>&nbsp;").arg(ch).arg(ch.toUpper());
+        }
+        out() << "</b></p>\n";
+    }
+
+    /*
+      Output a <div> element to contain all the <dl> elements.
+     */
+    out() << "<div class=\"flowListDiv\">\n";
+
+    for (int i=0; i<classMap.count()-1; i++) {
+        while ((curParNr < NumParagraphs) &&
+               (curParOffset == paragraph[curParNr].count())) {
+            ++curParNr;
+            curParOffset = 0;
+        }
+
+        /*
+          Starting a new paragraph means starting a new <dl>.
+        */
+        if (curParOffset == 0) {
+            if (i > 0)
+                out() << "</dl>\n";
+            if (++numTableRows % 2 == 1)
+                out() << "<dl class=\"flowList odd\">";
+            else
+                out() << "<dl class=\"flowList even\">";
+            out() << "<dt class=\"alphaChar\">";
+            if (includeAlphabet) {
+                QChar c = paragraphName[curParNr][0].toLower();
+                out() << QString("<a name=\"%1\"></a>").arg(c);
+            }
+            out() << "<b>"
+                  << paragraphName[curParNr]
+                  << "</b>";
+            out() << "</dt>\n";
+        }
+
+        /*
+          Output a <dd> for the current offset in the current paragraph.
+         */
+        out() << "<dd>";
+        if ((curParNr < NumParagraphs) &&
+            !paragraphName[curParNr].isEmpty()) {
+            NodeMap::Iterator it;
+            it = paragraph[curParNr].begin();
+            for (int i=0; i<curParOffset; i++)
+                ++it;
+
+            /*
+              Previously, we used generateFullName() for this, but we
+              require some special formatting.
+            */
+            out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">";
+            
+            QStringList pieces;
+            if (it.value()->subType() == Node::QmlClass)
+                pieces << it.value()->name();
+            else
+                pieces = fullName(it.value(), relative, marker).split("::");
+            out() << protectEnc(pieces.last());
+            out() << "</a>";
+            if (pieces.size() > 1) {
+                out() << " (";
+                generateFullName(it.value()->parent(), relative, marker);
+                out() << ")";
+            }
+        }
+        out() << "</dd>\n";
+        curParOffset++;
+    }
+    out() << "</dl>\n";
+    out() << "</div>\n";
 }
 
@@ -2338,10 +2687,10 @@
                                           CodeMarker *marker)
 {
-    out() << "<p align=\"center\"><font size=\"+1\"><b>";
+    out() << "<p  class=\"centerAlign functionIndex\"><b>";
     for (int i = 0; i < 26; i++) {
         QChar ch('a' + i);
         out() << QString("<a href=\"#%1\">%2</a>&nbsp;").arg(ch).arg(ch.toUpper());
     }
-    out() << "</b></font></p>\n";
+    out() << "</b></p>\n";
 
     char nextLetter = 'a';
@@ -2358,5 +2707,5 @@
         out() << "<p>";
 #endif
-        out() << protect(f.key()) << ":";
+        out() << protectEnc(f.key()) << ":";
 
         currentLetter = f.key()[0].unicode();
@@ -2391,5 +2740,5 @@
     while (it != legaleseTexts.end()) {
         Text text = it.key();
-        out() << "<hr />\n";
+        //out() << "<hr />\n";
         generateText(text, relative, marker);
         out() << "<ul>\n";
@@ -2404,42 +2753,4 @@
 }
 
-/*void HtmlGenerator::generateSynopsis(const Node *node,
-                                     const Node *relative,
-                                     CodeMarker *marker,
-                                     CodeMarker::SynopsisStyle style)
-{
-    QString marked = marker->markedUpSynopsis(node, relative, style);
-    QRegExp templateTag("(<[^@>]*>)");
-    if (marked.indexOf(templateTag) != -1) {
-        QString contents = protect(marked.mid(templateTag.pos(1),
-                                              templateTag.cap(1).length()));
-        marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
-                        contents);
-    }
-    marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
-                   "<i>\\1<sub>\\2</sub></i>");
-    marked.replace("<@param>", "<i>");
-    marked.replace("</@param>", "</i>");
-
-    if (style == CodeMarker::Summary)
-        marked.replace("@name>", "b>");
-
-    if (style == CodeMarker::SeparateList) {
-        QRegExp extraRegExp("<@extra>.*</@extra>");
-        extraRegExp.setMinimal(true);
-        marked.replace(extraRegExp, "");
-    }
-    else {
-        marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
-        marked.replace("</@extra>", "</tt>");
-    }
-
-    if (style != CodeMarker::Detailed) {
-        marked.replace("<@type>", "");
-        marked.replace("</@type>", "");
-    }
-    out() << highlightedCode(marked, marker, relative);
-}*/
-
 #ifdef QDOC_QML
 void HtmlGenerator::generateQmlItem(const Node *node,
@@ -2451,5 +2762,5 @@
     QRegExp templateTag("(<[^@>]*>)");
     if (marked.indexOf(templateTag) != -1) {
-        QString contents = protect(marked.mid(templateTag.pos(1),
+        QString contents = protectEnc(marked.mid(templateTag.pos(1),
                                               templateTag.cap(1).length()));
         marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
@@ -2464,5 +2775,5 @@
         marked.replace("@name>", "b>");
 
-    marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
+    marked.replace("<@extra>", "<tt>");
     marked.replace("</@extra>", "</tt>");
 
@@ -2471,5 +2782,5 @@
         marked.replace("</@type>", "");
     }
-    out() << highlightedCode(marked, marker, relative);
+    out() << highlightedCode(marked, marker, relative, false, node);
 }
 #endif
@@ -2557,5 +2868,5 @@
             out() << QString("<h3><a href=\"%1\">%2</a></h3>\n").arg(
                         linkForNode(groupNode, relative)).arg(
-                        protect(groupNode->fullTitle()));
+                        protectEnc(groupNode->fullTitle()));
 
             if (fakeNodeMap[groupNode].count() == 0)
@@ -2569,5 +2880,5 @@
                     title.remove(0, 4);
                 out() << "<li><a href=\"" << linkForNode(fakeNode, relative) << "\">"
-                      << protect(title) << "</a></li>\n";
+                      << protectEnc(title) << "</a></li>\n";
             }
             out() << "</ul>\n";
@@ -2583,5 +2894,5 @@
                 title.remove(0, 4);
             out() << "<li><a href=\"" << linkForNode(fakeNode, relative) << "\">"
-                  << protect(title) << "</a></li>\n";
+                  << protectEnc(title) << "</a></li>\n";
         }
         out() << "</ul>\n";
@@ -2589,5 +2900,4 @@
 }
 
-#ifdef QDOC_NAME_ALIGNMENT
 void HtmlGenerator::generateSection(const NodeList& nl,
                                     const Node *relative,
@@ -2595,25 +2905,22 @@
                                     CodeMarker::SynopsisStyle style)
 {
-    bool name_alignment = true;
+    bool alignNames = true;
     if (!nl.isEmpty()) {
         bool twoColumn = false;
         if (style == CodeMarker::SeparateList) {
-            name_alignment = false;
+            alignNames = false;
             twoColumn = (nl.count() >= 16);
         }
         else if (nl.first()->type() == Node::Property) {
             twoColumn = (nl.count() >= 5);
-            name_alignment = false;
-        }
-        if (name_alignment) {
-            out() << "<table class=\"alignedsummary\" border=\"0\" cellpadding=\"0\" "
-                  << "cellspacing=\"0\" width=\"100%\">\n";
+            alignNames = false;
+        }
+        if (alignNames) {
+            out() << "<table class=\"alignedsummary\">\n";
         }
         else {
             if (twoColumn)
-                out() << "<p><table class=\"propsummary\" width=\"100%\" "
-                      << "border=\"0\" cellpadding=\"0\""
-                      << " cellspacing=\"0\">\n"
-                      << "<tr><td width=\"45%\" valign=\"top\">";
+                out() << "<table class=\"propsummary\">\n"
+                      << "<tr><td  class=\"topAlign\">";
             out() << "<ul>\n";
         }
@@ -2627,28 +2934,27 @@
             }
 
-            if (name_alignment) {
-                out() << "<tr><td class=\"memItemLeft\" "
-                      << "align=\"right\" valign=\"top\">";
+            if (alignNames) {
+                out() << "<tr><td class=\"memItemLeft rightAlign topAlign\"> ";
             }
             else {
                 if (twoColumn && i == (int) (nl.count() + 1) / 2)
-                    out() << "</ul></td><td valign=\"top\"><ul>\n";
-                out() << "<li><div class=\"fn\">";
-            }
-
-            generateSynopsis(*m, relative, marker, style, name_alignment);
-            if (name_alignment)
+                    out() << "</ul></td><td  class=\"topAlign\"><ul>\n";
+                out() << "<li class=\"fn\">";
+            }
+
+            generateSynopsis(*m, relative, marker, style, alignNames);
+            if (alignNames)
                 out() << "</td></tr>\n";
             else
-                out() << "</div></li>\n";
+                out() << "</li>\n";
             i++;
             ++m;
         }
-        if (name_alignment)
+        if (alignNames)
             out() << "</table>\n";
         else {
             out() << "</ul>\n";
             if (twoColumn)
-                out() << "</td></tr>\n</table></p>\n";
+                out() << "</td></tr>\n</table>\n";
         }
     }
@@ -2660,25 +2966,22 @@
                                         CodeMarker::SynopsisStyle style)
 {
-    bool name_alignment = true;
+    bool alignNames = true;
     if (!section.members.isEmpty()) {
         bool twoColumn = false;
         if (style == CodeMarker::SeparateList) {
-            name_alignment = false;
+            alignNames = false;
             twoColumn = (section.members.count() >= 16);
         }
         else if (section.members.first()->type() == Node::Property) {
             twoColumn = (section.members.count() >= 5);
-            name_alignment = false;
-        }
-        if (name_alignment) {
-            out() << "<table class=\"alignedsummary\" border=\"0\" cellpadding=\"0\" "
-                  << "cellspacing=\"0\" width=\"100%\">\n";
+            alignNames = false;
+        }
+        if (alignNames) {
+            out() << "<table class=\"alignedsummary\">\n";
         }
         else {
             if (twoColumn)
-                out() << "<p><table class=\"propsummary\" width=\"100%\" "
-                      << "border=\"0\" cellpadding=\"0\""
-                      << " cellspacing=\"0\">\n"
-                      << "<tr><td width=\"45%\" valign=\"top\">";
+                out() << "<table class=\"propsummary\">\n"
+                      << "<tr><td  class=\"topAlign\">";
             out() << "<ul>\n";
         }
@@ -2692,28 +2995,27 @@
             }
 
-            if (name_alignment) {
-                out() << "<tr><td class=\"memItemLeft\" "
-                      << "align=\"right\" valign=\"top\">";
+            if (alignNames) {
+                out() << "<tr><td class=\"memItemLeft topAlign rightAlign\"> ";
             }
             else {
                 if (twoColumn && i == (int) (section.members.count() + 1) / 2)
-                    out() << "</ul></td><td valign=\"top\"><ul>\n";
-                out() << "<li><div class=\"fn\">";
-            }
-
-            generateSynopsis(*m, relative, marker, style, name_alignment);
-            if (name_alignment)
+                    out() << "</ul></td><td class=\"topAlign\"><ul>\n";
+                out() << "<li class=\"fn\">";
+            }
+
+            generateSynopsis(*m, relative, marker, style, alignNames);
+            if (alignNames)
                 out() << "</td></tr>\n";
             else
-                out() << "</div></li>\n";
+                out() << "</li>\n";
             i++;
             ++m;
         }
-        if (name_alignment)
+        if (alignNames)
             out() << "</table>\n";
         else {
             out() << "</ul>\n";
             if (twoColumn)
-                out() << "</td></tr>\n</table></p>\n";
+                out() << "</td></tr>\n</table>\n";
         }
     }
@@ -2721,5 +3023,5 @@
     if (style == CodeMarker::Summary && !section.inherited.isEmpty()) {
         out() << "<ul>\n";
-        generateSectionInheritedList(section, relative, marker, name_alignment);
+        generateSectionInheritedList(section, relative, marker);
         out() << "</ul>\n";
     }
@@ -2728,13 +3030,9 @@
 void HtmlGenerator::generateSectionInheritedList(const Section& section,
                                                  const Node *relative,
-                                                 CodeMarker *marker,
-                                                 bool nameAlignment)
+                                                 CodeMarker *marker)
 {
     QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin();
     while (p != section.inherited.end()) {
-        if (nameAlignment)
-            out() << "<li><div bar=\"2\" class=\"fn\"></div>";
-        else
-            out() << "<li><div class=\"fn\"></div>";
+        out() << "<li class=\"fn\">";
         out() << (*p).second << " ";
         if ((*p).second == 1) {
@@ -2746,5 +3044,5 @@
         out() << " inherited from <a href=\"" << fileName((*p).first)
               << "#" << HtmlGenerator::cleanRef(section.name.toLower()) << "\">"
-              << protect(marker->plainFullName((*p).first, relative))
+              << protectEnc(marker->plainFullName((*p).first, relative))
               << "</a></li>\n";
         ++p;
@@ -2756,10 +3054,10 @@
                                      CodeMarker *marker,
                                      CodeMarker::SynopsisStyle style,
-                                     bool nameAlignment)
+                                     bool alignNames)
 {
     QString marked = marker->markedUpSynopsis(node, relative, style);
     QRegExp templateTag("(<[^@>]*>)");
     if (marked.indexOf(templateTag) != -1) {
-        QString contents = protect(marked.mid(templateTag.pos(1),
+        QString contents = protectEnc(marked.mid(templateTag.pos(1),
                                               templateTag.cap(1).length()));
         marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
@@ -2781,5 +3079,5 @@
         marked.replace(extraRegExp, "");
     } else {
-        marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
+        marked.replace("<@extra>", "<tt>");
         marked.replace("</@extra>", "</tt>");
     }
@@ -2789,12 +3087,12 @@
         marked.replace("</@type>", "");
     }
-    out() << highlightedCode(marked, marker, relative, style, nameAlignment);
+    out() << highlightedCode(marked, marker, relative, alignNames);
 }
 
 QString HtmlGenerator::highlightedCode(const QString& markedCode,
-                                       CodeMarker *marker,
-                                       const Node *relative,
-                                       CodeMarker::SynopsisStyle ,
-                                       bool nameAlignment)
+                                       CodeMarker* marker,
+                                       const Node* relative,
+                                       bool alignNames,
+                                       const Node* self)
 {
     QString src = markedCode;
@@ -2806,18 +3104,22 @@
     const QChar charAt = '@';
 
+    static const QString typeTag("type");
+    static const QString headerTag("headerfile");
+    static const QString funcTag("func");
+    static const QString linkTag("link");
+    
     // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
-    static const QString linkTag("link");
     bool done = false;
-    for (int i = 0, n = src.size(); i < n;) {
+    for (int i = 0, srcSize = src.size(); i < srcSize;) {
         if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') {
-            if (nameAlignment && !done) {// && (i != 0)) Why was this here?
-                html += "</td><td class=\"memItemRight\" valign=\"bottom\">";
+            if (alignNames && !done) {// && (i != 0)) Why was this here?
+                html += "</td><td class=\"memItemRight bottomAlign\">";
                 done = true;
             }
             i += 2;
-            if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
+            if (parseArg(src, linkTag, &i, srcSize, &arg, &par1)) {
                 html += "<b>";
-                QString link = linkForNode(
-                    CodeMarker::nodeForString(par1.toString()), relative);
+                const Node* n = CodeMarker::nodeForString(par1.toString());
+                QString link = linkForNode(n, relative);
                 addLink(link, arg, &html);
                 html += "</b>";
@@ -2839,14 +3141,12 @@
         src = html;
         html = QString();
-        static const QString funcTag("func");
-        for (int i = 0, n = src.size(); i < n;) {
+        for (int i = 0, srcSize = src.size(); i < srcSize;) {
             if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
                 i += 2;
-                if (parseArg(src, funcTag, &i, n, &arg, &par1)) {
-                    QString link = linkForNode(
-                            marker->resolveTarget(par1.toString(),
-                                                  myTree,
-                                                  relative),
-                            relative);
+                if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+                    const Node* n = marker->resolveTarget(par1.toString(),
+                                                          myTree,
+                                                          relative);
+                    QString link = linkForNode(n, relative);
                     addLink(link, arg, &html);
                     par1 = QStringRef();
@@ -2866,20 +3166,35 @@
     src = html;
     html = QString();
-    static const QString typeTags[] = { "type", "headerfile", "func" };
-    for (int i = 0, n = src.size(); i < n;) {
-        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+
+    for (int i=0, srcSize=src.size(); i<srcSize;) {
+        if (src.at(i) == charLangle && src.at(i+1) == charAt) {
             i += 2;
             bool handled = false;
-            for (int k = 0; k != 3; ++k) {
-                if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) {
-                    par1 = QStringRef();
-                    QString link = linkForNode(
-                            marker->resolveTarget(arg.toString(), myTree, relative),
-                            relative);
-                    addLink(link, arg, &html);
-                    handled = true;
-                    break;
+            if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
+                par1 = QStringRef();
+                const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self);
+                if (n && n->subType() == Node::QmlBasicType) {
+                    if (relative && relative->subType() == Node::QmlClass)
+                        addLink(linkForNode(n,relative), arg, &html);
+                    else 
+                        html += arg.toString();
                 }
-            }
+                else
+                    addLink(linkForNode(n,relative), arg, &html);
+                handled = true;
+            }
+            else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
+                par1 = QStringRef();
+                const Node* n = marker->resolveTarget(arg.toString(), myTree, relative);
+                addLink(linkForNode(n,relative), arg, &html);
+                handled = true;
+            }
+            else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+                par1 = QStringRef();
+                const Node* n = marker->resolveTarget(arg.toString(), myTree, relative);
+                addLink(linkForNode(n,relative), arg, &html);
+                handled = true;
+            }
+
             if (!handled) {
                 html += charLangle;
@@ -2909,20 +3224,4 @@
         "</@string>",      "</span>",
         "</@char>",        "</span>"
-        // "<@char>",      "<font color=blue>",
-        // "</@char>",     "</font>",
-        // "<@func>",      "<font color=green>",
-        // "</@func>",     "</font>",
-        // "<@id>",        "<i>",
-        // "</@id>",       "</i>",
-        // "<@keyword>",   "<b>",
-        // "</@keyword>",  "</b>",
-        // "<@number>",    "<font color=yellow>",
-        // "</@number>",   "</font>",
-        // "<@op>",        "<b>",
-        // "</@op>",       "</b>",
-        // "<@param>",     "<i>",
-        // "</@param>",    "</i>",
-        // "<@string>",    "<font color=green>",
-        // "</@string>",  "</font>",
     };
     for (int i = 0, n = src.size(); i < n;) {
@@ -2962,275 +3261,4 @@
 }
 
-#else
-void HtmlGenerator::generateSectionList(const Section& section,
-                                        const Node *relative,
-                                        CodeMarker *marker,
-                                        CodeMarker::SynopsisStyle style)
-{
-    if (!section.members.isEmpty()) {
-        bool twoColumn = false;
-        if (style == CodeMarker::SeparateList) {
-            twoColumn = (section.members.count() >= 16);
-        }
-        else if (section.members.first()->type() == Node::Property) {
-            twoColumn = (section.members.count() >= 5);
-        }
-        if (twoColumn)
-            out() << "<p><table class=\"generic\" width=\"100%\" border=\"0\" "
-                  << "cellpadding=\"0\" cellspacing=\"0\">\n"
-                  << "<tr><td width=\"45%\" valign=\"top\">";
-        out() << "<ul>\n";
-
-        int i = 0;
-        NodeList::ConstIterator m = section.members.begin();
-        while (m != section.members.end()) {
-            if ((*m)->access() == Node::Private) {
-                ++m;
-                continue;
-            }
-
-            if (twoColumn && i == (int) (section.members.count() + 1) / 2)
-                out() << "</ul></td><td valign=\"top\"><ul>\n";
-
-            out() << "<li><div class=\"fn\"></div>";
-            if (style == CodeMarker::Accessors)
-                out() << "<b>";
-            generateSynopsis(*m, relative, marker, style);
-            if (style == CodeMarker::Accessors)
-                out() << "</b>";
-            out() << "</li>\n";
-            i++;
-            ++m;
-        }
-        out() << "</ul>\n";
-        if (twoColumn)
-            out() << "</td></tr>\n</table></p>\n";
-    }
-
-    if (style == CodeMarker::Summary && !section.inherited.isEmpty()) {
-        out() << "<ul>\n";
-        generateSectionInheritedList(section, relative, marker);
-        out() << "</ul>\n";
-    }
-}
-
-void HtmlGenerator::generateSectionInheritedList(const Section& section,
-                                                 const Node *relative,
-                                                 CodeMarker *marker)
-{
-    QList<QPair<ClassNode *, int> >::ConstIterator p = section.inherited.begin();
-    while (p != section.inherited.end()) {
-        out() << "<li><div bar=\"2\" class=\"fn\"></div>";
-        out() << (*p).second << " ";
-        if ((*p).second == 1) {
-            out() << section.singularMember;
-        } else {
-            out() << section.pluralMember;
-        }
-        out() << " inherited from <a href=\"" << fileName((*p).first)
-              << "#" << HtmlGenerator::cleanRef(section.name.toLower()) << "\">"
-              << protect(marker->plainFullName((*p).first, relative))
-              << "</a></li>\n";
-        ++p;
-    }
-}
-
-void HtmlGenerator::generateSynopsis(const Node *node,
-                                     const Node *relative,
-                                     CodeMarker *marker,
-                                     CodeMarker::SynopsisStyle style)
-{
-    QString marked = marker->markedUpSynopsis(node, relative, style);
-    QRegExp templateTag("(<[^@>]*>)");
-    if (marked.indexOf(templateTag) != -1) {
-        QString contents = protect(marked.mid(templateTag.pos(1),
-                                              templateTag.cap(1).length()));
-        marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
-                        contents);
-    }
-    marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>");
-    marked.replace("<@param>", "<i>");
-    marked.replace("</@param>", "</i>");
-
-    if (style == CodeMarker::Summary)
-        marked.replace("@name>", "b>");
-
-    if (style == CodeMarker::SeparateList) {
-        QRegExp extraRegExp("<@extra>.*</@extra>");
-        extraRegExp.setMinimal(true);
-        marked.replace(extraRegExp, "");
-    } else {
-        marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
-        marked.replace("</@extra>", "</tt>");
-    }
-
-    if (style != CodeMarker::Detailed) {
-        marked.replace("<@type>", "");
-        marked.replace("</@type>", "");
-    }
-    out() << highlightedCode(marked, marker, relative);
-}
-
-QString HtmlGenerator::highlightedCode(const QString& markedCode,
-                                       CodeMarker *marker,
-                                       const Node *relative)
-{
-    QString src = markedCode;
-    QString html;
-    QStringRef arg;
-    QStringRef par1;
-
-    const QChar charLangle = '<';
-    const QChar charAt = '@';
-
-    // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
-    static const QString linkTag("link");
-    for (int i = 0, n = src.size(); i < n;) {
-        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
-            i += 2;
-            if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
-                const Node* node = CodeMarker::nodeForString(par1.toString());
-                QString link = linkForNode(node, relative);
-                addLink(link, arg, &html);
-            }
-            else {
-                html += charLangle;
-                html += charAt;
-            }
-        }
-        else {
-            html += src.at(i++);
-        }
-    }
-
-    if (slow) {
-        // is this block ever used at all?
-        // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)"
-        src = html;
-        html = QString();
-        static const QString funcTag("func");
-        for (int i = 0, n = src.size(); i < n;) {
-            if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
-                i += 2;
-                if (parseArg(src, funcTag, &i, n, &arg, &par1)) {
-                    QString link = linkForNode(
-                            marker->resolveTarget(par1.toString(),
-                                                  myTree,
-                                                  relative),
-                            relative);
-                    addLink(link, arg, &html);
-                    par1 = QStringRef();
-                }
-                else {
-                    html += charLangle;
-                    html += charAt;
-                }
-            }
-            else {
-                html += src.at(i++);
-            }
-        }
-    }
-
-    // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags
-    src = html;
-    html = QString();
-    static const QString typeTags[] = { "type", "headerfile", "func" };
-    for (int i = 0, n = src.size(); i < n;) {
-        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
-            i += 2;
-            bool handled = false;
-            for (int k = 0; k != 3; ++k) {
-                if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) {
-                    par1 = QStringRef();
-                    QString link = linkForNode(
-                            marker->resolveTarget(arg.toString(), myTree, relative),
-                            relative);
-                    addLink(link, arg, &html);
-                    handled = true;
-                    break;
-                }
-            }
-            if (!handled) {
-                html += charLangle;
-                html += charAt;
-            }
-        }
-        else {
-            html += src.at(i++);
-        }
-    }
-
-    // replace all
-    // "<@comment>" -> "<span class=\"comment\">";
-    // "<@preprocessor>" -> "<span class=\"preprocessor\">";
-    // "<@string>" -> "<span class=\"string\">";
-    // "<@char>" -> "<span class=\"char\">";
-    // "</@(?:comment|preprocessor|string|char)>" -> "</span>"
-    src = html;
-    html = QString();
-    static const QString spanTags[] = {
-        "<@comment>",      "<span class=\"comment\">",
-        "<@preprocessor>", "<span class=\"preprocessor\">",
-        "<@string>",       "<span class=\"string\">",
-        "<@char>",         "<span class=\"char\">",
-        "</@comment>",     "</span>",
-        "</@preprocessor>","</span>",
-        "</@string>",      "</span>",
-        "</@char>",        "</span>"
-        // "<@char>",      "<font color=blue>",
-        // "</@char>",     "</font>",
-        // "<@func>",      "<font color=green>",
-        // "</@func>",     "</font>",
-        // "<@id>",        "<i>",
-        // "</@id>",       "</i>",
-        // "<@keyword>",   "<b>",
-        // "</@keyword>",  "</b>",
-        // "<@number>",    "<font color=yellow>",
-        // "</@number>",   "</font>",
-        // "<@op>",        "<b>",
-        // "</@op>",       "</b>",
-        // "<@param>",     "<i>",
-        // "</@param>",    "</i>",
-        // "<@string>",    "<font color=green>",
-        // "</@string>",  "</font>",
-    };
-    for (int i = 0, n = src.size(); i < n;) {
-        if (src.at(i) == charLangle) {
-            bool handled = false;
-            for (int k = 0; k != 8; ++k) {
-                const QString & tag = spanTags[2 * k];
-                if (tag == QStringRef(&src, i, tag.length())) {
-                    html += spanTags[2 * k + 1];
-                    i += tag.length();
-                    handled = true;
-                    break;
-                }
-            }
-            if (!handled) {
-                ++i;
-                if (src.at(i) == charAt ||
-                    (src.at(i) == QLatin1Char('/') && src.at(i + 1) == charAt)) {
-                    // drop 'our' unknown tags (the ones still containing '@')
-                    while (i < n && src.at(i) != QLatin1Char('>'))
-                        ++i;
-                    ++i;
-                }
-                else {
-                    // retain all others
-                    html += charLangle;
-                }
-            }
-        }
-        else {
-            html += src.at(i);
-            ++i;
-        }
-    }
-
-    return html;
-}
-#endif
-
 void HtmlGenerator::generateLink(const Atom* atom,
                                  const Node* /* relative */,
@@ -3242,5 +3270,5 @@
         // hack for C++: move () outside of link
         int k = funcLeftParen.pos(1);
-        out() << protect(atom->string().left(k));
+        out() << protectEnc(atom->string().left(k));
         if (link.isEmpty()) {
             if (showBrokenLinks)
@@ -3250,7 +3278,7 @@
         }
         inLink = false;
-        out() << protect(atom->string().mid(k));
+        out() << protectEnc(atom->string().mid(k));
     } else if (marker->recognizeLanguage("Java")) {
-	// hack for Java: remove () and use <tt> when appropriate
+        // hack for Java: remove () and use <tt> when appropriate
         bool func = atom->string().endsWith("()");
         bool tt = (func || atom->string().contains(camelCase));
@@ -3258,11 +3286,11 @@
             out() << "<tt>";
         if (func) {
-            out() << protect(atom->string().left(atom->string().length() - 2));
+            out() << protectEnc(atom->string().left(atom->string().length() - 2));
         } else {
-            out() << protect(atom->string());
+            out() << protectEnc(atom->string());
         }
         out() << "</tt>";
     } else {
-        out() << protect(atom->string());
+        out() << protectEnc(atom->string());
     }
 }
@@ -3338,5 +3366,10 @@
 }
 
-QString HtmlGenerator::protect(const QString& string)
+QString HtmlGenerator::protectEnc(const QString &string)
+{
+    return protect(string, outputEncoding);
+}
+
+QString HtmlGenerator::protect(const QString &string, const QString &outputEncoding)
 {
 #define APPEND(x) \
@@ -3361,5 +3394,5 @@
         } else if (ch == QLatin1Char('"')) {
             APPEND("&quot;");
-        } else if (ch.unicode() > 0x007F
+        } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F)
                    || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/'))
                    || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) {
@@ -3381,5 +3414,5 @@
 }
 
-QString HtmlGenerator::fileBase(const Node *node)
+QString HtmlGenerator::fileBase(const Node *node) const
 {
     QString result;
@@ -3491,5 +3524,5 @@
         break;
     case Node::Target:
-        return protect(node->name());
+        return protectEnc(node->name());
     }
     return registerRef(ref);
@@ -3510,8 +3543,11 @@
     if (node->access() == Node::Private)
         return QString();
-
+ 
     fn = fileName(node);
-/*    if (!node->url().isEmpty())
-        return fn;*/
+#if 0
+    if (!node->url().isEmpty())
+        return fn;
+#endif    
+
 #if 0
     // ### reintroduce this test, without breaking .dcf files
@@ -3565,5 +3601,5 @@
     }
     out() << "\">";
-    out() << protect(fullName(apparentNode, relative, marker));
+    out() << protectEnc(fullName(apparentNode, relative, marker));
     out() << "</a>";
 }
@@ -3575,12 +3611,17 @@
     const EnumNode *enume;
 
+#ifdef GENERATE_MAC_REFS    
     generateMacRef(node, marker);
+#endif    
+    generateExtractionMark(node, MemberMark);
     if (node->type() == Node::Enum
             && (enume = static_cast<const EnumNode *>(node))->flagsType()) {
+#ifdef GENERATE_MAC_REFS    
         generateMacRef(enume->flagsType(), marker);
+#endif        
         out() << "<h3 class=\"flags\">";
         out() << "<a name=\"" + refForNode(node) + "\"></a>";
         generateSynopsis(enume, relative, marker, CodeMarker::Detailed);
-        out() << "<br />";
+        out() << "<br/>";
         generateSynopsis(enume->flagsType(),
                          relative,
@@ -3593,5 +3634,5 @@
         out() << "<a name=\"" + refForNode(node) + "\"></a>";
         generateSynopsis(node, relative, marker, CodeMarker::Detailed);
-        out() << "</h3>\n";
+        out() << "</h3>" << divNavTop << "\n";
     }
 
@@ -3626,14 +3667,15 @@
         const EnumNode *enume = static_cast<const EnumNode *>(node);
         if (enume->flagsType()) {
-            out() << "<p>The " << protect(enume->flagsType()->name())
+            out() << "<p>The " << protectEnc(enume->flagsType()->name())
                   << " type is a typedef for "
                   << "<a href=\"qflags.html\">QFlags</a>&lt;"
-                  << protect(enume->name())
+                  << protectEnc(enume->name())
                   << "&gt;. It stores an OR combination of "
-                  << protect(enume->name())
+                  << protectEnc(enume->name())
                   << " values.</p>\n";
         }
     }
     generateAlsoList(node, marker);
+    generateExtractionMark(node, EndMark);
 }
 
@@ -3677,4 +3719,14 @@
                     serviceClasses.insert(serviceName, *c);
             }
+            else if ((*c)->type() == Node::Fake &&
+                     (*c)->subType() == Node::QmlClass &&
+                     !(*c)->doc().isEmpty()) {
+                QString qmlClassName = (*c)->name();
+                // Remove the "QML:" prefix if present.
+                if (qmlClassName.startsWith(QLatin1String("QML:")))
+                    qmlClasses.insert(qmlClassName.mid(4),*c);
+                else
+                    qmlClasses.insert(qmlClassName,*c);
+            }
             else if ((*c)->isInnerNode()) {
                 findAllClasses(static_cast<InnerNode *>(*c));
@@ -3701,4 +3753,7 @@
             if (ncmap == newClassMaps.end())
                 ncmap = newClassMaps.insert(sinceVersion,NodeMap());
+            NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion);
+            if (nqcmap == newQmlClassMaps.end())
+                nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap());
  
             if ((*child)->type() == Node::Function) {
@@ -3720,4 +3775,13 @@
                     ncmap.value().insert(className,(*child));
                 }
+                else if ((*child)->subType() == Node::QmlClass) {
+                    QString className = (*child)->name();
+                    if ((*child)->parent() &&
+                        (*child)->parent()->type() == Node::Namespace &&
+                        !(*child)->parent()->name().isEmpty())
+                        className = (*child)->parent()->name()+"::"+className;
+                    nsmap.value().insert(className,(*child));
+                    nqcmap.value().insert(className,(*child));
+                }
             }
             else {
@@ -3736,11 +3800,4 @@
     }
 }
-
-#if 0
-    const QRegExp versionSeparator("[\\-\\.]");
-    const int minorIndex = version.indexOf(versionSeparator);
-    const int patchIndex = version.indexOf(versionSeparator, minorIndex+1);
-    version = version.left(patchIndex);
-#endif
 
 void HtmlGenerator::findAllFunctions(const InnerNode *node)
@@ -3807,27 +3864,4 @@
 }
 
-#ifdef ZZZ_QDOC_QML
-/*!
-  This function finds all the qml element nodes and
-  stores them in a map for later use.
- */
-void HtmlGenerator::findAllQmlClasses(const InnerNode *node)
-{
-    NodeList::const_iterator c = node->childNodes().constBegin();
-    while (c != node->childNodes().constEnd()) {
-        if ((*c)->type() == Node::Fake) {
-            const FakeNode* fakeNode = static_cast<const FakeNode *>(*c);
-            if (fakeNode->subType() == Node::QmlClass) {
-                const QmlClassNode* qmlNode =
-                    static_cast<const QmlClassNode*>(fakeNode);
-                const Node* n = qmlNode->classNode();
-            }
-            qmlClasses.insert(fakeNode->name(),*c);
-        }
-        ++c;
-    }
-}
-#endif
-
 int HtmlGenerator::hOffset(const Node *node)
 {
@@ -3837,8 +3871,5 @@
         return 2;
     case Node::Fake:
-        if (node->doc().briefText().isEmpty())
-            return 1;
-        else
-            return 2;
+        return 1;
     case Node::Enum:
     case Node::Typedef:
@@ -3940,8 +3971,10 @@
         else {
             *node = marker->resolveTarget(first, myTree, relative);
-            if (!*node)
+            if (!*node) {
                 *node = myTree->findFakeNodeByTitle(first);
-            if (!*node)
+            }
+            if (!*node) {
                 *node = myTree->findUnambiguousTarget(first, targetAtom);
+            }
         }
 
@@ -4036,5 +4069,5 @@
     case Node::Obsolete:
         if (node->isInnerNode())
-	    Generator::generateStatus(node, marker);
+            Generator::generateStatus(node, marker);
         break;
     case Node::Compat:
@@ -4078,4 +4111,8 @@
 }
 
+#ifdef GENERATE_MAC_REFS    
+/*
+  No longer valid.
+ */
 void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker)
 {
@@ -4087,4 +4124,5 @@
         out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n";
 }
+#endif
 
 void HtmlGenerator::beginLink(const QString &link,
@@ -4138,10 +4176,8 @@
 }
 
-QT_END_NAMESPACE
-
 #ifdef QDOC_QML
 
 /*!
-  Generates the summary for for the \a section. Only used for
+  Generates the summary for the \a section. Only used for
   sections of QML element documentation.
 
@@ -4153,30 +4189,14 @@
 {
     if (!section.members.isEmpty()) {
+        out() << "<ul>\n";
         NodeList::ConstIterator m;
-        int count = section.members.size();
-        bool twoColumn = false;
-        if (section.members.first()->type() == Node::QmlProperty) {
-            twoColumn = (count >= 5);
-        }
-        if (twoColumn)
-            out() << "<p><table width=\"100%\" border=\"0\" cellpadding=\"0\""
-                     " cellspacing=\"0\">\n"
-                  << "<tr><td width=\"45%\" valign=\"top\">";
-        out() << "<ul>\n";
-
-        int row = 0;
         m = section.members.begin();
         while (m != section.members.end()) {
-            if (twoColumn && row == (int) (count + 1) / 2)
-                out() << "</ul></td><td valign=\"top\"><ul>\n";
-            out() << "<li><div class=\"fn\"></div>";
+            out() << "<li class=\"fn\">";
             generateQmlItem(*m,relative,marker,true);
             out() << "</li>\n";
-            row++;
             ++m;
         }
         out() << "</ul>\n";
-        if (twoColumn)
-            out() << "</td></tr>\n</table></p>\n";
     }
 }
@@ -4191,5 +4211,8 @@
 {
     const QmlPropertyNode* qpn = 0;
+#ifdef GENERATE_MAC_REFS    
     generateMacRef(node, marker);
+#endif    
+    generateExtractionMark(node, MemberMark);
     out() << "<div class=\"qmlitem\">";
     if (node->subType() == Node::QmlPropertyGroup) {
@@ -4197,24 +4220,25 @@
         NodeList::ConstIterator p = qpgn->childNodes().begin();
         out() << "<div class=\"qmlproto\">";
-        out() << "<table width=\"100%\" class=\"qmlname\">";
+        out() << "<table class=\"qmlname\">";
 
         while (p != qpgn->childNodes().end()) {
             if ((*p)->type() == Node::QmlProperty) {
                 qpn = static_cast<const QmlPropertyNode*>(*p);
-                out() << "<tr><td>";
+                if (++numTableRows % 2 == 1)
+                    out() << "<tr class=\"odd\">";
+                else
+                    out() << "<tr class=\"even\">";
+
+                out() << "<td class=\"tblQmlPropNode\"><p>";
+
                 out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
-                if (!qpn->isWritable())
+
+                if (!qpn->isWritable(myTree)) {
                     out() << "<span class=\"qmlreadonly\">read-only</span>";
+                }
+                if (qpgn->isDefault())
+                    out() << "<span class=\"qmldefault\">default</span>";
                 generateQmlItem(qpn, relative, marker, false);
-                out() << "</td></tr>";
-                if (qpgn->isDefault()) {
-                    out() << "</table>"
-                          << "</div></div>"
-                          << "<div class=\"qmlitem\">"
-                          << "<div class=\"qmlproto\">"
-                          << "<table class=\"qmlname\">"
-                          << "<tr><td><font color=\"green\">"
-                          << "default</font></td></tr>";
-                }
+                out() << "</p></td></tr>";
             }
             ++p;
@@ -4227,9 +4251,14 @@
         out() << "<div class=\"qmlproto\">";
         out() << "<table class=\"qmlname\">";
-        out() << "<tr><td>";
+        //out() << "<tr>";
+        if (++numTableRows % 2 == 1)
+            out() << "<tr class=\"odd\">";
+        else
+            out() << "<tr class=\"even\">";
+        out() << "<td class=\"tblQmlFuncNode\"><p>";
         out() << "<a name=\"" + refForNode(qsn) + "\"></a>";
         generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false);
         //generateQmlItem(qsn,relative,marker,false);
-        out() << "</td></tr>";
+        out() << "</p></td></tr>";
         out() << "</table>";
         out() << "</div>";
@@ -4239,8 +4268,13 @@
         out() << "<div class=\"qmlproto\">";
         out() << "<table class=\"qmlname\">";
-        out() << "<tr><td>";
+        //out() << "<tr>";
+        if (++numTableRows % 2 == 1)
+            out() << "<tr class=\"odd\">";
+        else
+            out() << "<tr class=\"even\">";
+        out() << "<td class=\"tblQmlFuncNode\"><p>";
         out() << "<a name=\"" + refForNode(qmn) + "\"></a>";
         generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false);
-        out() << "</td></tr>";
+        out() << "</p></td></tr>";
         out() << "</table>";
         out() << "</div>";
@@ -4254,4 +4288,5 @@
     out() << "</div>";
     out() << "</div>";
+    generateExtractionMark(node, EndMark);
 }
 
@@ -4271,15 +4306,33 @@
             if (n && n->subType() == Node::QmlClass) {
                 const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
-                out() << "<p style=\"text-align: center\">";
                 Text text;
-                text << "[Inherits ";
+                text << Atom::ParaLeft << "Inherits ";
                 text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
                 text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
                 text << Atom(Atom::String, linkPair.second);
                 text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
-                text << "]";
+                text << Atom::ParaRight;
                 generateText(text, cn, marker);
-                out() << "</p>";
-            }
+            }
+        }
+    }
+}
+
+/*!
+  Output the "Inherit by" list for the QML element,
+  if it is inherited by any other elements.
+ */
+void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn,
+                                           CodeMarker* marker)
+{
+    if (cn) {
+        NodeList subs;
+        QmlClassNode::subclasses(cn->name(),subs);
+        if (!subs.isEmpty()) {
+            Text text;
+            text << Atom::ParaLeft << "Inherited by ";
+            appendSortedQmlNames(text,cn,subs,marker);
+            text << Atom::ParaRight;
+            generateText(text, cn, marker);
         }
     }
@@ -4298,10 +4351,12 @@
     const ClassNode* cn = qcn->classNode();
     if (cn && (cn->status() != Node::Internal)) {
-        out() << "<p style=\"text-align: center\">";
         Text text;
-        text << "[";
+        text << Atom::ParaLeft;
         text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
         text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
-        text << Atom(Atom::String, qcn->name());
+        QString name = qcn->name();
+        if (name.startsWith(QLatin1String("QML:")))
+            name = name.mid(4); // remove the "QML:" prefix
+        text << Atom(Atom::String, name);
         text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
         text << " instantiates the C++ class ";
@@ -4310,7 +4365,6 @@
         text << Atom(Atom::String, cn->name());
         text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
-        text << "]";
+        text << Atom::ParaRight;
         generateText(text, qcn, marker);
-        out() << "</p>";
     }
 }
@@ -4329,7 +4383,6 @@
         const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake);
         if (n && n->subType() == Node::QmlClass) {
-            out() << "<p style=\"text-align: center\">";
             Text text;
-            text << "[";
+            text << Atom::ParaLeft;
             text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
             text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
@@ -4341,10 +4394,248 @@
             text << Atom(Atom::String, n->name());
             text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
-            text << "]";
+            text << Atom::ParaRight;
             generateText(text, cn, marker);
-            out() << "</p>";
-        }
+        }
+    }
+}
+
+/*!
+  Generate the <page> element for the given \a node using the \a writer.
+  Return true if a <page> element was written; otherwise return false.
+ */
+bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer,
+                                        const Node* node,
+                                        CodeMarker* marker) const
+{
+    if (node->pageType() == Node::NoPageType)
+        return false;
+    if (node->name().isEmpty())
+        return true;
+    if (node->access() == Node::Private)
+        return false;
+
+    QString guid = QUuid::createUuid().toString();
+    QString url = PageGenerator::fileName(node);
+    QString title;
+    QString rawTitle;
+    QString fullTitle;
+    QStringList pageWords;
+    QXmlStreamAttributes attributes;
+
+    writer.writeStartElement("page");
+
+    if (node->isInnerNode()) {
+        const InnerNode* inner = static_cast<const InnerNode*>(node);
+        if (!inner->pageKeywords().isEmpty())
+            pageWords << inner->pageKeywords();
+
+        switch (node->type()) {
+        case Node::Fake:
+            {
+                const FakeNode* fake = static_cast<const FakeNode*>(node);
+                title = fake->fullTitle();
+                pageWords << title;
+                break;
+            }
+        case Node::Class:
+            {
+                title = node->name() + " Class Reference";
+                pageWords << node->name() << "class" << "reference";
+                break;
+            }
+        case Node::Namespace:
+            {
+                rawTitle = marker->plainName(inner);
+                fullTitle = marker->plainFullName(inner);
+                title = rawTitle + " Namespace Reference";
+                pageWords << rawTitle << "namespace" << "reference";
+                break;
+            }
+        default:
+            title = node->name();
+            pageWords << title;
+            break;
+        }
+    }
+    else {
+        switch (node->type()) {
+        case Node::Enum:
+            {
+                title = node->name() + " Enum Reference";
+                pageWords << node->name() << "enum" << "type";
+                url += "#" + node->name() + "-enum";
+                break;
+            }
+        case Node::Function:
+            {
+                title = node->name() + " Function Reference";
+                pageWords << node->name() << "function";
+                url += "#" + node->name();
+                break;
+            }
+        case Node::Property:
+            {
+                title = node->name() + " Property Reference";
+                pageWords << node->name() << "property";
+                url += "#" + node->name() + "-prop";
+                break;
+            }
+        case Node::Typedef:
+            {
+                title = node->name() + " Type Reference";
+                pageWords << node->name() << "typedef" << "type";
+                url += "#" + node->name();
+                break;
+            }
+        default:
+            title = node->name();
+            pageWords << title;
+            break;
+        }
+
+        Node* parent = node->parent();
+        if (parent && ((parent->type() == Node::Class) ||
+                       (parent->type() == Node::Namespace))) {
+            pageWords << parent->name();
+        }
+    }
+
+    writer.writeAttribute("id",guid);
+    writer.writeStartElement("pageWords");
+    writer.writeCharacters(pageWords.join(" "));
+
+    writer.writeEndElement();
+    writer.writeStartElement("pageTitle");
+    writer.writeCharacters(title);
+    writer.writeEndElement();
+    writer.writeStartElement("pageUrl");
+    writer.writeCharacters(url);
+    writer.writeEndElement();
+    writer.writeStartElement("pageType");
+    switch (node->pageType()) {
+    case Node::ApiPage:
+        writer.writeCharacters("APIPage");
+        break;
+    case Node::ArticlePage:
+        writer.writeCharacters("Article");
+        break;
+    case Node::ExamplePage:
+        writer.writeCharacters("Example");
+        break;
+    default:
+        break;
+    }
+    writer.writeEndElement();
+    writer.writeEndElement();
+
+    if (node->type() == Node::Fake && node->doc().hasTableOfContents()) {
+        QList<Atom*> toc = node->doc().tableOfContents();
+        if (!toc.isEmpty()) {
+            for (int i = 0; i < toc.size(); ++i) {
+                Text headingText = Text::sectionHeading(toc.at(i));
+                QString s = headingText.toString();
+                writer.writeStartElement("page");
+                guid = QUuid::createUuid().toString();
+                QString internalUrl = url + "#" + Doc::canonicalTitle(s);
+                writer.writeAttribute("id",guid);
+                writer.writeStartElement("pageWords");
+                writer.writeCharacters(pageWords.join(" "));
+                writer.writeCharacters(" ");
+                writer.writeCharacters(s);
+                writer.writeEndElement();
+                writer.writeStartElement("pageTitle");
+                writer.writeCharacters(s);
+                writer.writeEndElement();
+                writer.writeStartElement("pageUrl");
+                writer.writeCharacters(internalUrl);
+                writer.writeEndElement();
+                writer.writeStartElement("pageType");
+                writer.writeCharacters("Article");
+                writer.writeEndElement();
+                writer.writeEndElement();
+            }
+        }
+    }
+    return true;
+}
+
+/*!
+  Traverse the tree recursively and generate the <keyword>
+  elements.
+ */
+void HtmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const
+{
+    if (generatePageElement(writer, node, marker)) {
+
+        if (node->isInnerNode()) {
+            const InnerNode *inner = static_cast<const InnerNode *>(node);
+
+            // Recurse to write an element for this child node and all its children.
+            foreach (const Node *child, inner->childNodes())
+                generatePageElements(writer, child, marker);
+        }
+    }
+}
+
+/*!
+  Outputs the file containing the index used for searching the html docs.
+ */
+void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const
+{
+    QFile file(fileName);
+    if (!file.open(QFile::WriteOnly | QFile::Text))
+        return ;
+
+    QXmlStreamWriter writer(&file);
+    writer.setAutoFormatting(true);
+    writer.writeStartDocument();
+    writer.writeStartElement("qtPageIndex");
+
+    generatePageElements(writer, myTree->root(), marker);
+
+    writer.writeEndElement(); // qtPageIndex
+    writer.writeEndDocument();
+    file.close();
+}
+
+void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType markType)
+{
+    if (markType != EndMark) {
+        out() << "<!-- $$$" + node->name();
+        if (markType == MemberMark) {
+            if (node->type() == Node::Function) {
+                const FunctionNode *func = static_cast<const FunctionNode *>(node);
+                if (!func->associatedProperty()) {
+                    if (func->overloadNumber() == 1)
+                        out() << "[overload1]";
+                    out() << "$$$" + func->name() + func->rawParameters().remove(' ');
+                }
+            } else if (node->type() == Node::Property) {
+                out() << "-prop";
+                const PropertyNode *prop = static_cast<const PropertyNode *>(node);
+                const NodeList &list = prop->functions();
+                foreach (const Node *propFuncNode, list) {
+                    if (propFuncNode->type() == Node::Function) {
+                        const FunctionNode *func = static_cast<const FunctionNode *>(propFuncNode);
+                        out() << "$$$" + func->name() + func->rawParameters().remove(' ');
+                    }
+                }
+            } else if (node->type() == Node::Enum) {
+                const EnumNode *enumNode = static_cast<const EnumNode *>(node);
+                foreach (const EnumItem &item, enumNode->items())
+                    out() << "$$$" + item.name();
+            }
+        } else if (markType == BriefMark) {
+            out() << "-brief";
+        } else if (markType == DetailedDescriptionMark) {
+            out() << "-description";
+        }
+        out() << " -->\n";
+    } else {
+        out() << "<!-- @@@" + node->name() + " -->\n";
     }
 }
 
 #endif
+
+ QT_END_NAMESPACE
Index: trunk/tools/qdoc3/htmlgenerator.h
===================================================================
--- trunk/tools/qdoc3/htmlgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/htmlgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -47,8 +47,7 @@
 #define HTMLGENERATOR_H
 
-#define QDOC_NAME_ALIGNMENT
-
 #include <qmap.h>
 #include <qregexp.h>
+#include <QXmlStreamWriter>
 
 #include "codemarker.h"
@@ -90,4 +89,5 @@
         Property,
         Variable, 
+        QmlClass,
         QmlProperty,
         QmlSignal,
@@ -96,4 +96,8 @@
     };
 
+    enum Application {
+        Online,
+        Creator};
+
  public:
     HtmlGenerator();
@@ -105,5 +109,6 @@
     virtual void generateTree(const Tree *tree, CodeMarker *marker);
 
-    static QString protect(const QString& string);
+    QString protectEnc(const QString &string);
+    static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
     static QString cleanRef(const QString& ref);
     static QString sinceTitle(int i) { return sinceTitles[i]; }
@@ -116,5 +121,5 @@
     virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
     virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
-    virtual QString fileExtension(const Node *node);
+    virtual QString fileExtension(const Node *node) const;
     virtual QString refForNode(const Node *node);
     virtual QString linkForNode(const Node *node, const Node *relative);
@@ -123,4 +128,10 @@
  private:
     enum SubTitleSize { SmallSubTitle, LargeSubTitle };
+    enum ExtractionMarkType {
+        BriefMark,
+        DetailedDescriptionMark,
+        MemberMark,
+        EndMark
+    };
 
     const QPair<QString,QString> anchorForNode(const Node *node);
@@ -129,6 +140,10 @@
                                   CodeMarker *marker, 
                                   const Atom *atom = 0);
-    void generateHeader(const QString& title, const Node *node = 0,
-                        CodeMarker *marker = 0, bool mainPage = true);
+    void generateBreadCrumbs(const QString& title,
+                             const Node *node,
+                             CodeMarker *marker);
+    void generateHeader(const QString& title, 
+                        const Node *node = 0,
+                        CodeMarker *marker = 0);
     void generateTitle(const QString& title, 
                        const Text &subTitle, 
@@ -151,5 +166,11 @@
                                  int numColumns, 
                                  const Node *relative = 0);
-    QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker);
+    void generateTableOfContents(const Node *node, 
+                                 CodeMarker *marker, 
+                                 QList<Section>* sections = 0);
+    QString generateListOfAllMemberFile(const InnerNode *inner, 
+                                        CodeMarker *marker);
+    QString generateAllQmlMembersFile(const QmlClassNode* qml_cn, 
+                                      CodeMarker* marker);
     QString generateLowStatusMemberFile(const InnerNode *inner, 
                                         CodeMarker *marker,
@@ -164,4 +185,5 @@
                              CodeMarker *marker,
 			     const NodeMap &classMap,
+                             bool includeAlphabet,
                              QString commonPrefix = QString());
     void generateFunctionIndex(const Node *relative, CodeMarker *marker);
@@ -184,8 +206,9 @@
                                    CodeMarker *marker);
     void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker);
+    void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker);
     void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker);
     void generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker);
 #endif
-#ifdef QDOC_NAME_ALIGNMENT
+
     void generateSection(const NodeList& nl,
                          const Node *relative,
@@ -196,26 +219,14 @@
                           CodeMarker *marker,
 			  CodeMarker::SynopsisStyle style,
-                          bool nameAlignment = false);
-    void generateSectionInheritedList(const Section& section, 
-                                      const Node *relative,
-                                      CodeMarker *marker,
-                                      bool nameAlignment = false);
-    QString highlightedCode(const QString& markedCode, 
-                            CodeMarker *marker, 
-                            const Node *relative,
-                            CodeMarker::SynopsisStyle style = CodeMarker::Accessors,
-                            bool nameAlignment = false);
-#else
-    void generateSynopsis(const Node *node, 
-                          const Node *relative, 
-                          CodeMarker *marker,
-			  CodeMarker::SynopsisStyle style);
+                          bool alignNames = false);
     void generateSectionInheritedList(const Section& section, 
                                       const Node *relative,
                                       CodeMarker *marker);
     QString highlightedCode(const QString& markedCode, 
-                            CodeMarker *marker, 
-                            const Node *relative);
-#endif
+                            CodeMarker* marker, 
+                            const Node* relative,
+                            bool alignNames = false,
+                            const Node* self = 0);
+
     void generateFullName(const Node *apparentNode, 
                           const Node *relative, 
@@ -231,5 +242,5 @@
     
     QString registerRef(const QString& ref);
-    QString fileBase(const Node *node);
+    virtual QString fileBase(const Node *node) const;
 #if 0
     QString fileBase(const Node *node, const SectionIterator& section);
@@ -240,7 +251,4 @@
     void findAllLegaleseTexts(const InnerNode *node);
     void findAllNamespaces(const InnerNode *node);
-#ifdef ZZZ_QDOC_QML    
-    void findAllQmlClasses(const InnerNode *node);
-#endif
     void findAllSince(const InnerNode *node);
     static int hOffset(const Node *node);
@@ -256,5 +264,7 @@
                                const QString &url,
                                const QString &title);
+#ifdef GENERATE_MAC_REFS    
     void generateMacRef(const Node *node, CodeMarker *marker);
+#endif
     void beginLink(const QString &link, 
                    const Node *node, 
@@ -262,4 +272,13 @@
                    CodeMarker *marker);
     void endLink();
+    bool generatePageElement(QXmlStreamWriter& writer, 
+                             const Node* node, 
+                             CodeMarker* marker) const;
+    void generatePageElements(QXmlStreamWriter& writer, 
+                              const Node* node, 
+                              CodeMarker* marker) const;
+    void generatePageIndex(const QString& fileName, 
+                           CodeMarker* marker) const;
+    void generateExtractionMark(const Node *node, ExtractionMarkType markType);
 
 #if 0
@@ -283,4 +302,5 @@
     int numTableRows;
     bool threeColumnEnumValueTable;
+    Application application;
     QString link;
     QStringList sectionNumber;
@@ -288,4 +308,7 @@
     QString style;
     QString postHeader;
+    QString postPostHeader;
+    QString creatorPostHeader;
+    QString creatorPostPostHeader;
     QString footer;
     QString address;
@@ -308,7 +331,5 @@
     NodeMap namespaceIndex;
     NodeMap serviceClasses;
-#ifdef QDOC_QML    
     NodeMap qmlClasses;
-#endif
     QMap<QString, NodeMap > funcIndex;
     QMap<Text, const Node *> legaleseTexts;
@@ -316,10 +337,18 @@
     static QString sinceTitles[];
     NewClassMaps newClassMaps;
+    NewClassMaps newQmlClassMaps;
+    static int id;
+ public:
+    static bool debugging_on;
+    static QString divNavTop;
 };
 
 #define HTMLGENERATOR_ADDRESS           "address"
 #define HTMLGENERATOR_FOOTER            "footer"
-#define HTMLGENERATOR_GENERATEMACREFS    "generatemacrefs" // ### document me
+#define HTMLGENERATOR_GENERATEMACREFS   "generatemacrefs" // ### document me
 #define HTMLGENERATOR_POSTHEADER        "postheader"
+#define HTMLGENERATOR_POSTPOSTHEADER    "postpostheader"
+#define HTMLGENERATOR_CREATORPOSTHEADER        "postheader"
+#define HTMLGENERATOR_CREATORPOSTPOSTHEADER    "postpostheader"
 #define HTMLGENERATOR_STYLE             "style"
 #define HTMLGENERATOR_STYLESHEETS       "stylesheets"
Index: trunk/tools/qdoc3/jambiapiparser.cpp
===================================================================
--- trunk/tools/qdoc3/jambiapiparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/jambiapiparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,6 +43,4 @@
     jambiapiparser.cpp
 */
-
-#include <QtXml>
 
 #include "cppcodeparser.h"
Index: trunk/tools/qdoc3/jambiapiparser.h
===================================================================
--- trunk/tools/qdoc3/jambiapiparser.h	(revision 769)
+++ trunk/tools/qdoc3/jambiapiparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/javacodemarker.cpp
===================================================================
--- trunk/tools/qdoc3/javacodemarker.cpp	(revision 769)
+++ trunk/tools/qdoc3/javacodemarker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -156,6 +156,8 @@
 }
 
-const Node *JavaCodeMarker::resolveTarget(const QString &target, const Tree *tree,
-					  const Node *relative)
+const Node *JavaCodeMarker::resolveTarget(const QString &target,
+                                          const Tree *tree,
+					  const Node *relative,
+                                          const Node* /* self */)
 {
     if (target.endsWith("()")) {
Index: trunk/tools/qdoc3/javacodemarker.h
===================================================================
--- trunk/tools/qdoc3/javacodemarker.h	(revision 769)
+++ trunk/tools/qdoc3/javacodemarker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -73,5 +73,8 @@
     QString functionBeginRegExp( const QString& funcName );
     QString functionEndRegExp( const QString& funcName );
-    const Node *resolveTarget( const QString& target, const Tree *tree, const Node *relative );
+    const Node* resolveTarget( const QString& target, 
+                               const Tree* tree, 
+                               const Node* relative,
+                               const Node* self = 0 );
 };
 
Index: trunk/tools/qdoc3/javadocgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/javadocgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/javadocgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -146,5 +146,5 @@
 }
 
-QString JavadocGenerator::fileExtension(const Node *node)
+QString JavadocGenerator::fileExtension(const Node *node) const
 {
     if (node->type() == Node::Fake) {
Index: trunk/tools/qdoc3/javadocgenerator.h
===================================================================
--- trunk/tools/qdoc3/javadocgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/javadocgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -62,5 +62,5 @@
 
 protected:
-    QString fileExtension(const Node *node);
+    QString fileExtension(const Node *node) const;
     void startText( const Node *relative, CodeMarker *marker );
     void endText( const Node *relative, CodeMarker *marker );
Index: trunk/tools/qdoc3/linguistgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/linguistgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/linguistgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -83,5 +83,5 @@
 }
 
-QString LinguistGenerator::fileExtension(const Node * /* node */)
+QString LinguistGenerator::fileExtension(const Node * /* node */) const
 {
     return "ts";
@@ -90,5 +90,5 @@
 void LinguistGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker)
 {
-    out().setCodec("utf-8");
+    out().setCodec("UTF-8");
 
     QDomDocument document("TS");
@@ -101,5 +101,5 @@
 
     QDomProcessingInstruction process = document.createProcessingInstruction(
-        "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("utf-8"));
+        "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("UTF-8"));
     document.appendChild(process);
     document.appendChild(documentElement);
Index: trunk/tools/qdoc3/linguistgenerator.h
===================================================================
--- trunk/tools/qdoc3/linguistgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/linguistgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -71,5 +71,5 @@
                                        CodeMarker *marker);
     virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker );
-    virtual QString fileExtension(const Node *node);
+    virtual QString fileExtension(const Node *node) const;
 
     QList<QDomElement> generateIndexSections(QDomDocument &document,
Index: trunk/tools/qdoc3/location.cpp
===================================================================
--- trunk/tools/qdoc3/location.cpp	(revision 769)
+++ trunk/tools/qdoc3/location.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -266,4 +266,6 @@
 {
     emitMessage(Error, message, details);
+    information(message);
+    information(details);
     information("Aborting");
     exit(EXIT_FAILURE);
Index: trunk/tools/qdoc3/location.h
===================================================================
--- trunk/tools/qdoc3/location.h	(revision 769)
+++ trunk/tools/qdoc3/location.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/loutgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/loutgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/loutgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/loutgenerator.h
===================================================================
--- trunk/tools/qdoc3/loutgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/loutgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/main.cpp
===================================================================
--- trunk/tools/qdoc3/main.cpp	(revision 769)
+++ trunk/tools/qdoc3/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,5 +45,4 @@
 
 #include <qglobal.h>
-#include <QtCore>
 #include <stdlib.h>
 #include "apigenerator.h"
@@ -70,6 +69,13 @@
 #include "sgmlgenerator.h"
 #include "webxmlgenerator.h"
+#include "ditaxmlgenerator.h"
 #include "tokenizer.h"
 #include "tree.h"
+#include <qdebug.h>
+
+#include "qtranslator.h"
+#ifndef QT_BOOTSTRAPPED
+#  include "qcoreapplication.h"
+#endif
 
 QT_BEGIN_NAMESPACE
@@ -100,4 +106,5 @@
 static QStringList defines;
 static QHash<QString, Tree *> trees;
+static QString appArg; // application
 
 /*!
@@ -142,5 +149,5 @@
 static void printVersion()
 {
-    QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR);
+    QString s = tr("qdoc version %1").arg(QT_VERSION_STR);
     Location::information(s);
 }
@@ -152,5 +159,7 @@
 static void processQdocconfFile(const QString &fileName)
 {
+#ifndef QT_NO_TRANSLATION
     QList<QTranslator *> translators;
+#endif
 
     /*
@@ -183,4 +192,22 @@
     Location::initialize(config);
     config.load(fileName);
+
+    /*
+      Set the application to which qdoc will create the output.
+      The two applications are:
+
+      creator: additional formatting for viewing in
+      the Creator application.
+
+      online: full-featured online version with search and
+      links to Qt topics
+    */
+    if (appArg.isEmpty()) {
+        qDebug() << "Warning: Application flag not specified on"
+                 << "command line. Options are -creator (default)"
+                 << "and -online.";
+        appArg = "creator";
+    }
+    config.setStringList(CONFIG_APPLICATION, QStringList(appArg));
 
     /*
@@ -208,4 +235,5 @@
     Generator::initialize(config);
 
+#ifndef QT_NO_TRANSLATION
     /*
       Load the language translators, if the configuration specifies any.
@@ -222,4 +250,5 @@
 	++fn;
     }
+#endif
 
     //QSet<QString> outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES);
@@ -338,6 +367,7 @@
      */
     QString tagFile = config.getString(CONFIG_TAGFILE);
-    if (!tagFile.isEmpty())
+    if (!tagFile.isEmpty()) {
         tree->generateTagFile(tagFile);
+    }
 
     tree->setVersion("");
@@ -351,7 +381,14 @@
     QDir::setCurrent(prevCurrentDir);
 
-    foreach (QTranslator *translator, translators)
-        delete translator;
+#ifndef QT_NO_TRANSLATION
+    qDeleteAll(translators);
+#endif
+#ifdef DEBUG_SHUTDOWN_CRASH    
+    qDebug() << "main(): Delete tree";
+#endif    
     delete tree;
+#ifdef DEBUG_SHUTDOWN_CRASH    
+    qDebug() << "main(): Tree deleted";
+#endif
 }
 
@@ -362,5 +399,7 @@
     QT_USE_NAMESPACE
 
+#ifndef QT_BOOTSTRAPPED
     QCoreApplication app(argc, argv);
+#endif
     QString cf = "qsauncompress \1 \2";
     PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf);
@@ -409,4 +448,5 @@
     SgmlGenerator smglGenerator;
     WebXMLGenerator webxmlGenerator;
+    DitaXmlGenerator ditaxmlGenerator;
 
     QStringList qdocFiles;
@@ -442,4 +482,8 @@
             obsoleteLinks = true;
         }
+	else if (opt == "-creator")
+		appArg = "creator";
+	else if (opt == "-online")
+		appArg = "online";
         else {
 	    qdocFiles.append(opt);
@@ -447,5 +491,5 @@
     }
 
-    if (qdocFiles.isEmpty()) {
+	if (qdocFiles.isEmpty()) {
         printHelp();
         return EXIT_FAILURE;
@@ -455,6 +499,8 @@
       Main loop.
      */
-    foreach (QString qf, qdocFiles)
+    foreach (QString qf, qdocFiles) {
+        //qDebug() << "PROCESSING:" << qf;
 	processQdocconfFile(qf);
+    }
 
     qDeleteAll(trees);
Index: trunk/tools/qdoc3/mangenerator.cpp
===================================================================
--- trunk/tools/qdoc3/mangenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/mangenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -188,5 +188,5 @@
 }
 
-QString ManGenerator::fileExtension(const Node * /* node */)
+QString ManGenerator::fileExtension(const Node * /* node */) const
 {
     return "3qt";
Index: trunk/tools/qdoc3/mangenerator.h
===================================================================
--- trunk/tools/qdoc3/mangenerator.h	(revision 769)
+++ trunk/tools/qdoc3/mangenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -64,5 +64,5 @@
     virtual void generateClassLikeNode(const InnerNode *node, CodeMarker *marker);
     virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker );
-    virtual QString fileExtension(const Node *node);
+    virtual QString fileExtension(const Node *node) const;
 
 private:
Index: trunk/tools/qdoc3/node.cpp
===================================================================
--- trunk/tools/qdoc3/node.cpp	(revision 769)
+++ trunk/tools/qdoc3/node.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,6 +44,8 @@
 */
 
-#include <QtCore>
 #include "node.h"
+#include "tree.h"
+#include "codemarker.h"
+#include <qdebug.h>
 
 QT_BEGIN_NAMESPACE
@@ -86,10 +88,14 @@
 
 /*!
+  Construct a node with the given \a type and having the
+  given \a parent and \a name. The new node is added to the
+  parent's child list.
  */
 Node::Node(Type type, InnerNode *parent, const QString& name)
     : typ(type),
       acc(Public),
+      saf(UnspecifiedSafeness),
+      pageTyp(NoPageType),
       sta(Commendable),
-      saf(UnspecifiedSafeness),
       par(parent),
       rel(0),
@@ -98,7 +104,9 @@
     if (par)
         par->addChild(this);
-}
-
-/*!
+    //uuid = QUuid::createUuid();
+}
+
+/*!
+  Returns the node's URL.
  */
 QString Node::url() const
@@ -108,4 +116,5 @@
 
 /*!
+  Sets the node's URL to \a url
  */
 void Node::setUrl(const QString &url)
@@ -114,5 +123,16 @@
 }
 
-/*!
+void Node::setPageType(const QString& t)
+{
+    if ((t == "API") || (t == "api"))
+        pageTyp = ApiPage;
+    else if (t == "article")
+        pageTyp = ArticlePage;
+    else if (t == "example")
+        pageTyp = ExamplePage;
+}
+
+/*!
+  Sets the pointer to the node that this node relates to.
  */
 void Node::setRelates(InnerNode *pseudoParent)
@@ -138,4 +158,65 @@
 
 /*!
+  Returns a string representing the access specifier.
+ */
+QString Node::accessString() const
+{
+    switch (acc) {
+    case Protected:
+        return "protected";
+    case Private:
+        return "private";
+    case Public:
+    default:
+        break;
+    }
+    return "public";
+}
+
+/*!
+  Extract a class name from the type \a string and return it.
+ */
+QString Node::extractClassName(const QString &string) const
+{
+    QString result;
+    for (int i=0; i<=string.size(); ++i) {
+        QChar ch;
+        if (i != string.size())
+            ch = string.at(i);
+
+        QChar lower = ch.toLower();
+        if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z')) ||
+            ch.digitValue() >= 0 ||
+            ch == QLatin1Char('_') ||
+            ch == QLatin1Char(':')) {
+            result += ch;
+        }
+        else if (!result.isEmpty()) {
+            if (result != QLatin1String("const"))
+                return result;
+            result.clear();
+        }
+    }
+    return result;
+}
+
+/*!
+  Returns a string representing the access specifier.
+ */
+QString RelatedClass::accessString() const
+{
+    switch (access) {
+    case Node::Protected:
+        return "protected";
+    case Node::Private:
+        return "private";
+    case Node::Public:
+    default:
+        break;
+    }
+    return "public";
+}
+
+/*!
  */
 Node::Status Node::inheritedStatus() const
@@ -148,4 +229,9 @@
 
 /*!
+  Returns the thread safeness value for whatever this node
+  represents. But if this node has a parent and the thread
+  safeness value of the parent is the same as the thread
+  safeness value of this node, what is returned is the
+  value \c{UnspecifiedSafeness}. Why?
  */
 Node::ThreadSafeness Node::threadSafeness() const
@@ -157,4 +243,7 @@
 
 /*!
+  If this node has a parent, the parent's thread safeness
+  value is returned. Otherwise, this node's thread safeness
+  value is returned. Why?
  */
 Node::ThreadSafeness Node::inheritedThreadSafeness() const
@@ -166,4 +255,7 @@
 
 /*!
+  Returns the sanitized file name without the path.
+  If the the file is an html file, the html suffix
+  is removed. Why?
  */
 QString Node::fileBase() const
@@ -179,8 +271,45 @@
 
 /*!
+  Returns this node's Universally Unique IDentifier.
+  If its UUID has not yet been created, it is created
+  first.
+ */
+QUuid Node::guid() const
+{
+    if (uuid.isNull())
+        uuid = QUuid::createUuid();
+    return uuid;
+}
+
+/*!
+  Composes a string to be used as an href attribute in DITA
+  XML. It is composed of the file name and the UUID separated
+  by a '#'. If this node is a class node, the file name is
+  taken from this node; if this node is a function node, the
+  file name is taken from the parent node of this node.
+ */
+QString Node::ditaXmlHref()
+{
+    QString href;
+    if ((type() == Function) ||
+        (type() == Property) ||
+        (type() == Variable)) {
+        href = parent()->fileBase();
+    }
+    else {
+        href = fileBase();
+    }
+    if (!href.endsWith(".xml"))
+        href += ".xml";
+    return href + "#" + guid();
+}
+
+/*!
   \class InnerNode
  */
 
 /*!
+  The inner node destructor deletes the children and removes
+  this node from its related nodes.
  */
 InnerNode::~InnerNode()
@@ -191,14 +320,31 @@
 
 /*!
+  Find the node in this node's children that has the
+  given \a name. If this node is a QML class node, be
+  sure to also look in the children of its property
+  group nodes. Return the matching node or 0.
  */
 Node *InnerNode::findNode(const QString& name)
 {
     Node *node = childMap.value(name);
-    if (node)
+    if (node && node->subType() != QmlPropertyGroup)
         return node;
+    if ((type() == Fake) && (subType() == QmlClass)) {
+        for (int i=0; i<children.size(); ++i) {
+            Node* n = children.at(i);
+            if (n->subType() == QmlPropertyGroup) {
+                node = static_cast<InnerNode*>(n)->findNode(name);
+                if (node)
+                    return node;
+            }
+        }
+    }
     return primaryFunctionMap.value(name);
 }
 
 /*!
+  Same as the other findNode(), but if the node with the
+  specified \a name is not of the specified \a type, return
+  0.
  */
 Node *InnerNode::findNode(const QString& name, Type type)
@@ -309,4 +455,7 @@
 
 /*!
+  Mark all child nodes that have no documentation as having
+  private access and internal status. qdoc will then ignore
+  them for documentation purposes.
  */
 void InnerNode::makeUndocumentedChildrenInternal()
@@ -382,5 +531,5 @@
 /*!
  */
-void InnerNode::removeFromRelated() 
+void InnerNode::removeFromRelated()
 {
     while (!related.isEmpty()) {
@@ -399,5 +548,5 @@
 
 /*!
-  Returns true.
+  Returns true because this is an inner node.
  */
 bool InnerNode::isInnerNode() const
@@ -423,5 +572,5 @@
 
 /*!
-  Find the function node in this node that has the given \a name. 
+  Find the function node in this node that has the given \a name.
  */
 const FunctionNode *InnerNode::findFunctionNode(const QString& name) const
@@ -453,4 +602,7 @@
 
 /*!
+  Returnds the sequence number of the function node \a func
+  in the list of overloaded functions for a class, such that
+  all the functions have the same name as the \a func.
  */
 int InnerNode::overloadNumber(const FunctionNode *func) const
@@ -466,4 +618,6 @@
 
 /*!
+  Returns the number of member functions of a class such that
+  the functions are all named \a funcName.
  */
 int InnerNode::numOverloads(const QString& funcName) const
@@ -478,4 +632,6 @@
 
 /*!
+  Returns a node list containing all the member functions of
+  some class such that the functions overload the name \a funcName.
  */
 NodeList InnerNode::overloads(const QString &funcName) const
@@ -491,11 +647,22 @@
 
 /*!
+  Construct an inner node (i.e., not a leaf node) of the
+  given \a type and having the given \a parent and \a name.
  */
 InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
     : Node(type, parent, name)
 {
-}
-
-/*!
+    switch (type) {
+    case Class:
+    case Namespace:
+        setPageType(ApiPage);
+        break;
+    default:
+        break;
+    }
+}
+
+/*!
+  Appends an \a include file to the list of include files.
  */
 void InnerNode::addInclude(const QString& include)
@@ -505,4 +672,5 @@
 
 /*!
+  Sets the list of include files to \a includes.
  */
 void InnerNode::setIncludes(const QStringList& includes)
@@ -548,4 +716,5 @@
 
 /*!
+  Adds the \a child to this node's child list.
  */
 void InnerNode::addChild(Node *child)
@@ -565,5 +734,5 @@
         if (child->type() == Enum)
             enumChildren.append(child);
-	childMap.insert(child->name(), child);
+        childMap.insert(child->name(), child);
     }
 }
@@ -579,5 +748,5 @@
 		primaryFunctionMap.find(child->name());
 	NodeList& secs = secondaryFunctionMap[child->name()];
-	if (*prim == child) {
+	if (prim != primaryFunctionMap.end() && *prim == child) {
 	    if (secs.isEmpty()) {
 		primaryFunctionMap.remove(child->name());
@@ -591,10 +760,10 @@
 	}
         QMap<QString, Node *>::Iterator ent = childMap.find( child->name() );
-        if ( *ent == child )
+        if (ent != childMap.end() && *ent == child)
             childMap.erase( ent );
     }
     else {
 	QMap<QString, Node *>::Iterator ent = childMap.find(child->name());
-	if (*ent == child)
+	if (ent != childMap.end() && *ent == child)
 	    childMap.erase(ent);
     }
@@ -677,8 +846,23 @@
 
 /*!
+  Constructs a leaf node named \a name of the specified
+  \a type. The new leaf node becomes a child of \a parent.
  */
 LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
     : Node(type, parent, name)
 {
+    switch (type) {
+    case Enum:
+    case Function:
+    case Typedef:
+    case Variable:
+    case QmlProperty:
+    case QmlSignal:
+    case QmlMethod:
+        setPageType(ApiPage);
+        break;
+    default:
+        break;
+    }
 }
 
@@ -688,15 +872,19 @@
 
 /*!
+  Constructs a namespace node.
  */
 NamespaceNode::NamespaceNode(InnerNode *parent, const QString& name)
     : InnerNode(Namespace, parent, name)
 {
+    setPageType(ApiPage);
 }
 
 /*!
   \class ClassNode
- */
-
-/*!
+  \brief This class represents a C++ class.
+ */
+
+/*!
+  Constructs a class node. A class node will generate an API page.
  */
 ClassNode::ClassNode(InnerNode *parent, const QString& name)
@@ -704,4 +892,6 @@
 {
     hidden = false;
+    abstract = false;
+    setPageType(ApiPage);
 }
 
@@ -712,6 +902,6 @@
                              const QString &dataTypeWithTemplateArgs)
 {
-    bas.append(RelatedClass(access, node, dataTypeWithTemplateArgs));
-    node->der.append(RelatedClass(access, this));
+    bases.append(RelatedClass(access, node, dataTypeWithTemplateArgs));
+    node->derived.append(RelatedClass(access, this));
 }
 
@@ -721,14 +911,14 @@
 {
     int i;
-
     i = 0;
-    while (i < bas.size()) {
-        ClassNode *baseClass = bas.at(i).node;
-        if (baseClass->access() == Node::Private) {
-            bas.removeAt(i);
-
-            const QList<RelatedClass> &basesBases = baseClass->baseClasses();
-            for (int j = basesBases.size() - 1; j >= 0; --j)
-                bas.insert(i, basesBases.at(j));
+    while (i < bases.size()) {
+        ClassNode* bc = bases.at(i).node;
+        if (bc->access() == Node::Private) {
+            RelatedClass rc = bases.at(i);
+            bases.removeAt(i);
+            ignoredBases.append(rc);
+            const QList<RelatedClass> &bb = bc->baseClasses();
+            for (int j = bb.size() - 1; j >= 0; --j)
+                bases.insert(i, bb.at(j));
         }
         else {
@@ -738,13 +928,11 @@
 
     i = 0;
-    while (i < der.size()) {
-        ClassNode *derivedClass = der.at(i).node;
-        if (derivedClass->access() == Node::Private) {
-            der.removeAt(i);
-
-            const QList<RelatedClass> &dersDers =
-                derivedClass->derivedClasses();
-            for (int j = dersDers.size() - 1; j >= 0; --j)
-                der.insert(i, dersDers.at(j));
+    while (i < derived.size()) {
+        ClassNode* dc = derived.at(i).node;
+        if (dc->access() == Node::Private) {
+            derived.removeAt(i);
+            const QList<RelatedClass> &dd = dc->derivedClasses();
+            for (int j = dd.size() - 1; j >= 0; --j)
+                derived.insert(i, dd.at(j));
         }
         else {
@@ -755,4 +943,14 @@
 
 /*!
+  Search the child list to find the property node with the
+  specified \a name.
+ */
+const PropertyNode* ClassNode::findPropertyNode(const QString& name) const
+{
+    const Node* n = findNode(name,Node::Property);
+    return (n ? static_cast<const PropertyNode*>(n) : 0);
+}
+
+/*!
   \class FakeNode
  */
@@ -760,9 +958,34 @@
 /*!
   The type of a FakeNode is Fake, and it has a \a subtype,
-  which specifies the type of FakeNode.
+  which specifies the type of FakeNode. The page type for
+  the page index is set here.
  */
 FakeNode::FakeNode(InnerNode *parent, const QString& name, SubType subtype)
     : InnerNode(Fake, parent, name), sub(subtype)
 {
+    switch (subtype) {
+    case Module:
+    case Page:
+    case Group:
+        setPageType(ArticlePage);
+        break;
+    case QmlClass:
+    case QmlBasicType:
+        setPageType(ApiPage);
+        break;
+    case Example:
+        setPageType(ExamplePage);
+        break;
+    default:
+        break;
+    }
+}
+
+/*!
+  Returns the fake node's title. This is used for the page title.
+*/
+QString FakeNode::title() const
+{
+    return tle;
 }
 
@@ -817,4 +1040,6 @@
 
 /*!
+  The constructor for the node representing an enum type
+  has a \a parent class and an enum type \a name.
  */
 EnumNode::EnumNode(InnerNode *parent, const QString& name)
@@ -824,4 +1049,5 @@
 
 /*!
+  Add \a item to the enum type's item list.
  */
 void EnumNode::addItem(const EnumItem& item)
@@ -832,13 +1058,13 @@
 
 /*!
+  Returns the access level of the enumeration item named \a name.
+  Apparently it is private if it has been omitted by qdoc's
+  omitvalue command. Otherwise it is public.
  */
 Node::Access EnumNode::itemAccess(const QString &name) const
 {
-    if (doc().omitEnumItemNames().contains(name)) {
+    if (doc().omitEnumItemNames().contains(name))
         return Private;
-    }
-    else {
-        return Public;
-    }
+    return Public;
 }
 
@@ -905,5 +1131,5 @@
 /*!
   Assigning Parameter \a p to this Parameter copies the
-  strings across. 
+  strings across.
  */
 Parameter& Parameter::operator=(const Parameter& p)
@@ -975,4 +1201,17 @@
 
 /*!
+  Sets the \a virtualness of this function. If the \a virtualness
+  is PureVirtual, and if the parent() is a ClassNode, set the parent's
+  \e abstract flag to true.
+ */
+void FunctionNode::setVirtualness(Virtualness virtualness)
+{
+    vir = virtualness;
+    if ((virtualness == PureVirtual) && parent() &&
+        (parent()->type() == Node::Class))
+        parent()->setAbstract(true);
+}
+
+/*!
  */
 void FunctionNode::setOverload(bool overlode)
@@ -1064,4 +1303,22 @@
     }
     return names;
+}
+
+/*!
+  Returns a raw list of parameters. If \a names is true, the
+  names are included. If \a values is true, the default values
+  are included, if any are present.
+ */
+QString FunctionNode::rawParameters(bool names, bool values) const
+{
+    QString raw;
+    foreach (const Parameter &parameter, parameters()) {
+        raw += parameter.leftType() + parameter.rightType();
+        if (names)
+            raw += parameter.name();
+        if (values)
+            raw += parameter.defaultValue();
+    }
+    return raw;
 }
 
@@ -1110,12 +1367,17 @@
 void FunctionNode::debug() const
 {
-    qDebug() << "QML METHOD" << name() << "rt" << rt << "pp" << pp;
+    qDebug("QML METHOD %s rt %s pp %s",
+            qPrintable(name()), qPrintable(rt), qPrintable(pp.join(" ")));
 }
 
 /*!
   \class PropertyNode
- */
-
-/*!
+
+  This class describes one instance of using the Q_PROPERTY macro.
+ */
+
+/*!
+  The constructor sets the \a parent and the \a name, but
+  everything else is set to default values.
  */
 PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
@@ -1123,11 +1385,25 @@
       sto(Trool_Default),
       des(Trool_Default),
+      scr(Trool_Default),
+      wri(Trool_Default),
+      usr(Trool_Default),
+      cst(false),
+      fnl(false),
       overrides(0)
 {
-}
-
-/*!
- */
-void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
+    // nothing.
+}
+
+/*!
+  Sets this property's \e {overridden from} property to
+  \a baseProperty, which indicates that this property
+  overrides \a baseProperty. To begin with, all the values
+  in this property are set to the corresponding values in
+  \a baseProperty.
+
+  We probably should ensure that the constant and final
+  attributes are not being overridden improperly.
+ */
+void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
 {
     for (int i = 0; i < NumFunctionRoles; ++i) {
@@ -1139,4 +1415,10 @@
     if (des == Trool_Default)
         des = baseProperty->des;
+    if (scr == Trool_Default)
+        scr = baseProperty->scr;
+    if (wri == Trool_Default)
+        wri = baseProperty->wri;
+    if (usr == Trool_Default)
+        usr = baseProperty->usr;
     overrides = baseProperty;
 }
@@ -1164,5 +1446,7 @@
 }
 
-/*!
+/*! Converts the \a boolean value to an enum representation
+  of the boolean type, which includes an enum  value for the
+  \e {default value} of the item, i.e. true, false, or default.
  */
 PropertyNode::Trool PropertyNode::toTrool(bool boolean)
@@ -1172,4 +1456,13 @@
 
 /*!
+  Converts the enum \a troolean back to a boolean value.
+  If \a troolean is neither the true enum value nor the
+  false enum value, the boolean value returned is
+  \a defaultValue.
+
+  Note that runtimeDesignabilityFunction() should be called
+  first. If that function returns the name of a function, it
+  means the function must be called at runtime to determine
+  whether the property is Designable.
  */
 bool PropertyNode::fromTrool(Trool troolean, bool defaultValue)
@@ -1206,7 +1499,12 @@
 #ifdef QDOC_QML
 bool QmlClassNode::qmlOnly = false;
-
-/*!
-  Constructor for the Qml class node.
+QMultiMap<QString,Node*> QmlClassNode::inheritedBy;
+
+/*!
+  Constructs a Qml class node (i.e. a Fake node with the
+  subtype QmlClass. The new node has the given \a parent
+  and \a name and is associated with the C++ class node
+  specified by \a cn which may be null if the the Qml
+  class node is not associated with a C++ class node.
  */
 QmlClassNode::QmlClassNode(InnerNode *parent,
@@ -1215,5 +1513,27 @@
     : FakeNode(parent, name, QmlClass), cnode(cn)
 {
-    setTitle((qmlOnly ? "" : "QML ") + name + " Element Reference");
+    if (name.startsWith(QLatin1String("QML:")))
+        setTitle((qmlOnly ? QLatin1String("") : QLatin1String("QML ")) + name.mid(4) + QLatin1String(" Element"));
+    else
+        setTitle((qmlOnly ? QLatin1String("") : QLatin1String("QML ")) + name + QLatin1String(" Element"));
+}
+
+/*!
+  I made this so I could print a debug message here.
+ */
+QmlClassNode::~QmlClassNode()
+{
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
+    qDebug() << "Deleting QmlClassNode:" << name();
+#endif
+}
+
+/*!
+  Clear the multimap so that subsequent runs don't try to use
+  nodes from a previous run.
+ */
+void QmlClassNode::clear()
+{
+    inheritedBy.clear();
 }
 
@@ -1226,5 +1546,5 @@
 QString QmlClassNode::fileBase() const
 {
-#if 0    
+#if 0
     if (Node::fileBase() == "item")
         qDebug() << "FILEBASE: qmlitem" << name();
@@ -1235,6 +1555,45 @@
 
 /*!
+  Record the fact that QML class \a base is inherited by
+  QML class \a sub.
+ */
+void QmlClassNode::addInheritedBy(const QString& base, Node* sub)
+{
+    inheritedBy.insert(base,sub);
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
+    qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size();
+#endif
+}
+
+/*!
+  Loads the list \a subs with the nodes of all the subclasses of \a base.
+ */
+void QmlClassNode::subclasses(const QString& base, NodeList& subs)
+{
+    subs.clear();
+    if (inheritedBy.count(base) > 0) {
+        subs = inheritedBy.values(base);
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
+        qDebug() << "QmlClassNode::subclasses():" <<  inheritedBy.count(base) << base
+                 << "subs:" << subs.size() << "total size:" << inheritedBy.size();
+#endif
+    }
+}
+
+/*!
+  Constructs a Qml basic type node (i.e. a Fake node with
+  the subtype QmlBasicType. The new node has the given
+  \a parent and \a name.
+ */
+QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
+                                   const QString& name)
+    : FakeNode(parent, name, QmlBasicType)
+{
+    setTitle(name);
+}
+
+/*!
   Constructor for the Qml property group node. \a parent is
-  always a QmlClassNode. 
+  always a QmlClassNode.
  */
 QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent,
@@ -1261,5 +1620,5 @@
       att(attached)
 {
-    // nothing.
+    setPageType(ApiPage);
 }
 
@@ -1286,4 +1645,142 @@
     }
 }
+
+static QString valueType(const QString& n)
+{
+    if (n == "QPoint")
+        return "QDeclarativePointValueType";
+    if (n == "QPointF")
+        return "QDeclarativePointFValueType";
+    if (n == "QSize")
+        return "QDeclarativeSizeValueType";
+    if (n == "QSizeF")
+        return "QDeclarativeSizeFValueType";
+    if (n == "QRect")
+        return "QDeclarativeRectValueType";
+    if (n == "QRectF")
+        return "QDeclarativeRectFValueType";
+    if (n == "QVector2D")
+        return "QDeclarativeVector2DValueType";
+    if (n == "QVector3D")
+        return "QDeclarativeVector3DValueType";
+    if (n == "QVector4D")
+        return "QDeclarativeVector4DValueType";
+    if (n == "QQuaternion")
+        return "QDeclarativeQuaternionValueType";
+    if (n == "QMatrix4x4")
+        return "QDeclarativeMatrix4x4ValueType";
+    if (n == "QEasingCurve")
+        return "QDeclarativeEasingValueType";
+    if (n == "QFont")
+        return "QDeclarativeFontValueType";
+    return QString();
+}
+
+/*!
+  Returns true if a QML property or attached property is
+  read-only. The algorithm for figuring this out is long
+  amd tedious and almost certainly will break. It currently
+  doesn't work for qmlproperty bool PropertyChanges::explicit,
+  because the tokenized gets confused on "explicit" .
+ */
+bool QmlPropertyNode::isWritable(const Tree* tree) const
+{
+    Node* n = parent();
+    while (n && n->subType() != Node::QmlClass)
+        n = n->parent();
+    if (n) {
+        const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
+        const ClassNode* cn = qcn->classNode();
+        if (cn) {
+            QStringList dotSplit = name().split(QChar('.'));
+            const PropertyNode* pn = cn->findPropertyNode(dotSplit[0]);
+            if (pn) {
+                if (dotSplit.size() > 1) {
+                    QStringList path(extractClassName(pn->qualifiedDataType()));
+                    const Node* nn = tree->findNode(path,Class);
+                    if (nn) {
+                        const ClassNode* cn = static_cast<const ClassNode*>(nn);
+                        pn = cn->findPropertyNode(dotSplit[1]);
+                        if (pn) {
+                            return pn->isWritable();
+                        }
+                        else {
+                            const QList<RelatedClass>& bases = cn->baseClasses();
+                            if (!bases.isEmpty()) {
+                                for (int i=0; i<bases.size(); ++i) {
+                                    const ClassNode* cn = bases[i].node;
+                                    pn = cn->findPropertyNode(dotSplit[1]);
+                                    if (pn) {
+                                        return pn->isWritable();
+                                    }
+                                }
+                            }
+                            const QList<RelatedClass>& ignoredBases = cn->ignoredBaseClasses();
+                            if (!ignoredBases.isEmpty()) {
+                                for (int i=0; i<ignoredBases.size(); ++i) {
+                                    const ClassNode* cn = ignoredBases[i].node;
+                                    pn = cn->findPropertyNode(dotSplit[1]);
+                                    if (pn) {
+                                        return pn->isWritable();
+                                    }
+                                }
+                            }
+                            QString vt = valueType(cn->name());
+                            if (!vt.isEmpty()) {
+                                QStringList path(vt);
+                                const Node* vtn = tree->findNode(path,Class);
+                                if (vtn) {
+                                    const ClassNode* cn = static_cast<const ClassNode*>(vtn);
+                                    pn = cn->findPropertyNode(dotSplit[1]);
+                                    if (pn) {
+                                        return pn->isWritable();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                else {
+                    return pn->isWritable();
+                }
+            }
+            else {
+                const QList<RelatedClass>& bases = cn->baseClasses();
+                if (!bases.isEmpty()) {
+                    for (int i=0; i<bases.size(); ++i) {
+                        const ClassNode* cn = bases[i].node;
+                        pn = cn->findPropertyNode(dotSplit[0]);
+                        if (pn) {
+                            return pn->isWritable();
+                        }
+                    }
+                }
+                const QList<RelatedClass>& ignoredBases = cn->ignoredBaseClasses();
+                if (!ignoredBases.isEmpty()) {
+                    for (int i=0; i<ignoredBases.size(); ++i) {
+                        const ClassNode* cn = ignoredBases[i].node;
+                        pn = cn->findPropertyNode(dotSplit[0]);
+                        if (pn) {
+                            return pn->isWritable();
+                        }
+                    }
+                }
+                if (isAttached()) {
+                    QString classNameAttached = cn->name() + "Attached";
+                    QStringList path(classNameAttached);
+                    const Node* nn = tree->findNode(path,Class);
+                    const ClassNode* acn = static_cast<const ClassNode*>(nn);
+                    pn = acn->findPropertyNode(dotSplit[0]);
+                    if (pn) {
+                        return pn->isWritable();
+                    }
+                }
+            }
+        }
+    }
+    location().warning(tr("Can't determine read-only status of QML property %1; writable assumed.").arg(name()));
+    return true;
+}
+
 #endif
 
Index: trunk/tools/qdoc3/node.h
===================================================================
--- trunk/tools/qdoc3/node.h	(revision 769)
+++ trunk/tools/qdoc3/node.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,4 +56,5 @@
 #include "location.h"
 #include "text.h"
+#include <QUuid>
 
 QT_BEGIN_NAMESPACE
@@ -97,5 +98,6 @@
         ExternalPage,
         QmlClass,
-        QmlPropertyGroup
+        QmlPropertyGroup,
+        QmlBasicType
 #else
         ExternalPage
@@ -137,4 +139,11 @@
     };
 
+    enum PageType {
+        NoPageType,
+        ApiPage,
+        ArticlePage,
+        ExamplePage
+    };
+
     virtual ~Node();
 
@@ -145,17 +154,20 @@
     void setThreadSafeness(ThreadSafeness safeness) { saf = safeness; }
     void setSince(const QString &since) { sinc = since; }
-    void setRelates(InnerNode *pseudoParent);
+    void setRelates(InnerNode* pseudoParent);
     void setModuleName(const QString &module) { mod = module; }
     void setLink(LinkType linkType, const QString &link, const QString &desc);
     void setUrl(const QString &url);
     void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; }
+    void setPageType(PageType t) { pageTyp = t; }
+    void setPageType(const QString& t);
 
     virtual bool isInnerNode() const = 0;
     virtual bool isReimp() const { return false; }
     virtual bool isFunction() const { return false; }
+    virtual bool isQmlNode() const { return false; }
     Type type() const { return typ; }
     virtual SubType subType() const { return NoSubType; }
-    InnerNode *parent() const { return par; }
-    InnerNode *relates() const { return rel; }
+    InnerNode* parent() const { return par; }
+    InnerNode* relates() const { return rel; }
     const QString& name() const { return nam; }
     QMap<LinkType, QPair<QString,QString> > links() const { return linkMap; }
@@ -165,4 +177,5 @@
 
     Access access() const { return acc; }
+    QString accessString() const;
     const Location& location() const { return loc; }
     const Doc& doc() const { return d; }
@@ -173,11 +186,16 @@
     QString since() const { return sinc; }
     QString templateStuff() const { return tpl; }
+    PageType pageType() const { return pageTyp; }
+    virtual void addPageKeywords(const QString& ) { }
 
     void clearRelated() { rel = 0; }
 
     virtual QString fileBase() const;
+    QUuid guid() const;
+    QString ditaXmlHref();
+    QString extractClassName(const QString &string) const;
 
  protected:
-    Node(Type type, InnerNode *parent, const QString& name);
+    Node(Type type, InnerNode* parent, const QString& name);
 
  private:
@@ -186,14 +204,16 @@
     Type typ;
     Access acc;
+    ThreadSafeness saf;
+    PageType pageTyp;
     Status sta;
-    ThreadSafeness saf;
 #else
     Type typ : 4;
     Access acc : 2;
+    ThreadSafeness saf : 2;
+    PageType pageTyp : 4;
     Status sta : 3;
-    ThreadSafeness saf : 2;
 #endif
-    InnerNode *par;
-    InnerNode *rel;
+    InnerNode* par;
+    InnerNode* rel;
     QString nam;
     Location loc;
@@ -204,4 +224,5 @@
     QString sinc;
     QString tpl;
+    mutable QUuid uuid;
 };
 
@@ -209,5 +230,5 @@
 class EnumNode;
 
-typedef QList<Node *> NodeList;
+typedef QList<Node*> NodeList;
 
 class InnerNode : public Node
@@ -216,11 +237,11 @@
     virtual ~InnerNode();
 
-    Node *findNode(const QString& name);
-    Node *findNode(const QString& name, Type type);
-    FunctionNode *findFunctionNode(const QString& name);
-    FunctionNode *findFunctionNode(const FunctionNode *clone);
+    Node* findNode(const QString& name);
+    Node* findNode(const QString& name, Type type);
+    FunctionNode* findFunctionNode(const QString& name);
+    FunctionNode* findFunctionNode(const FunctionNode* clone);
     void addInclude(const QString &include);
     void setIncludes(const QStringList &includes);
-    void setOverload(const FunctionNode *func, bool overlode);
+    void setOverload(const FunctionNode* func, bool overlode);
     void normalizeOverloads();
     void makeUndocumentedChildrenInternal();
@@ -229,13 +250,13 @@
 
     virtual bool isInnerNode() const;
-    const Node *findNode(const QString& name) const;
-    const Node *findNode(const QString& name, Type type) const;
-    const FunctionNode *findFunctionNode(const QString& name) const;
-    const FunctionNode *findFunctionNode(const FunctionNode *clone) const;
-    const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
+    const Node* findNode(const QString& name) const;
+    const Node* findNode(const QString& name, Type type) const;
+    const FunctionNode* findFunctionNode(const QString& name) const;
+    const FunctionNode* findFunctionNode(const FunctionNode* clone) const;
+    const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
     const NodeList & childNodes() const { return children; }
     const NodeList & relatedNodes() const { return related; }
     int count() const { return children.size(); }
-    int overloadNumber(const FunctionNode *func) const;
+    int overloadNumber(const FunctionNode* func) const;
     int numOverloads(const QString& funcName) const;
     NodeList overloads(const QString &funcName) const;
@@ -244,22 +265,27 @@
     QStringList primaryKeys();
     QStringList secondaryKeys();
+    const QStringList& pageKeywords() const { return pageKeywds; }
+    virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
+    virtual bool isAbstract() const { return false; }
+    virtual void setAbstract(bool ) { }
 
  protected:
-    InnerNode(Type type, InnerNode *parent, const QString& name);
+    InnerNode(Type type, InnerNode* parent, const QString& name);
 
  private:
     friend class Node;
 
-    static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
-    void addChild(Node *child);
-    void removeChild(Node *child);
-    void removeRelated(Node *pseudoChild);
-
+    static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2);
+    void addChild(Node* child);
+    void removeChild(Node* child);
+    void removeRelated(Node* pseudoChild);
+
+    QStringList pageKeywds;
     QStringList inc;
     NodeList children;
     NodeList enumChildren;
     NodeList related;
-    QMap<QString, Node *> childMap;
-    QMap<QString, Node *> primaryFunctionMap;
+    QMap<QString, Node*> childMap;
+    QMap<QString, Node*> primaryFunctionMap;
     QMap<QString, NodeList> secondaryFunctionMap;
 };
@@ -280,5 +306,5 @@
 {
  public:
-    NamespaceNode(InnerNode *parent, const QString& name);
+    NamespaceNode(InnerNode* parent, const QString& name);
     virtual ~NamespaceNode() { }
 };
@@ -295,4 +321,5 @@
         node(node0),
         dataTypeWithTemplateArgs(dataTypeWithTemplateArgs0) { }
+    QString accessString() const;
 
     Node::Access        access;
@@ -301,17 +328,20 @@
 };
 
+class PropertyNode;
+
 class ClassNode : public InnerNode
 {
  public:
-    ClassNode(InnerNode *parent, const QString& name);
+    ClassNode(InnerNode* parent, const QString& name);
     virtual ~ClassNode() { }
 
     void addBaseClass(Access access, 
-                      ClassNode *node, 
+                      ClassNode* node, 
                       const QString &dataTypeWithTemplateArgs = "");
     void fixBaseClasses();
 
-    const QList<RelatedClass> &baseClasses() const { return bas; }
-    const QList<RelatedClass> &derivedClasses() const { return der; }
+    const QList<RelatedClass> &baseClasses() const { return bases; }
+    const QList<RelatedClass> &derivedClasses() const { return derived; }
+    const QList<RelatedClass> &ignoredBaseClasses() const { return ignoredBases; }
 
     bool hideFromMainList() const { return hidden; }
@@ -322,9 +352,14 @@
     QString qmlElement() const { return qmlelement; }
     void setQmlElement(const QString& value) { qmlelement = value; }
-
- private:
-    QList<RelatedClass> bas;
-    QList<RelatedClass> der;
+    virtual bool isAbstract() const { return abstract; }
+    virtual void setAbstract(bool b) { abstract = b; }
+    const PropertyNode* findPropertyNode(const QString& name) const;
+
+ private:
+    QList<RelatedClass> bases;
+    QList<RelatedClass> derived;
+    QList<RelatedClass> ignoredBases;
     bool hidden;
+    bool abstract;
     QString sname;
     QString qmlelement;
@@ -335,15 +370,15 @@
  public:
 
-    FakeNode(InnerNode *parent, const QString& name, SubType subType);
+    FakeNode(InnerNode* parent, const QString& name, SubType subType);
     virtual ~FakeNode() { }
 
     void setTitle(const QString &title) { tle = title; }
     void setSubTitle(const QString &subTitle) { stle = subTitle; }
-    void addGroupMember(Node *node) { gr.append(node); }
+    void addGroupMember(Node* node) { gr.append(node); }
 
     SubType subType() const { return sub; }
-    QString title() const { return tle; }
-    QString fullTitle() const;
-    QString subTitle() const;
+    virtual QString title() const;
+    virtual QString fullTitle() const;
+    virtual QString subTitle() const;
     const NodeList &groupMembers() const { return gr; }
     virtual QString nameForLists() const { return title(); }
@@ -360,16 +395,31 @@
 {
  public:
-    QmlClassNode(InnerNode *parent, 
+    QmlClassNode(InnerNode* parent, 
                  const QString& name, 
                  const ClassNode* cn);
-    virtual ~QmlClassNode() { }
+    virtual ~QmlClassNode();
+    virtual bool isQmlNode() const { return true; }
 
     const ClassNode* classNode() const { return cnode; }
     virtual QString fileBase() const;
-
+    static void addInheritedBy(const QString& base, Node* sub);
+    static void subclasses(const QString& base, NodeList& subs);
+    static void clear();
+
+ public:
     static bool qmlOnly;
-
- private:
-    const ClassNode* cnode;
+    static QMultiMap<QString,Node*> inheritedBy;
+
+ private:
+    const ClassNode*    cnode;
+};
+
+class QmlBasicTypeNode : public FakeNode
+{
+ public:
+    QmlBasicTypeNode(InnerNode* parent, 
+                     const QString& name);
+    virtual ~QmlBasicTypeNode() { }
+    virtual bool isQmlNode() const { return true; }
 };
 
@@ -381,4 +431,5 @@
                      bool attached);
     virtual ~QmlPropGroupNode() { }
+    virtual bool isQmlNode() const { return true; }
 
     const QString& element() const { return parent()->name(); }
@@ -391,4 +442,6 @@
     bool    att;
 };
+
+class Tree;
 
 class QmlPropertyNode : public LeafNode
@@ -410,6 +463,7 @@
     bool isStored() const { return fromTrool(sto,true); }
     bool isDesignable() const { return fromTrool(des,false); }
-    bool isWritable() const { return fromTrool(wri,true); }
+    bool isWritable(const Tree* tree) const;
     bool isAttached() const { return att; }
+    virtual bool isQmlNode() const { return true; }
 
     const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
@@ -453,14 +507,14 @@
 {
  public:
-    EnumNode(InnerNode *parent, const QString& name);
+    EnumNode(InnerNode* parent, const QString& name);
     virtual ~EnumNode() { }
 
     void addItem(const EnumItem& item);
-    void setFlagsType(TypedefNode *typedeff);
+    void setFlagsType(TypedefNode* typedeff);
     bool hasItem(const QString &name) const { return names.contains(name); }
 
     const QList<EnumItem>& items() const { return itms; }
     Access itemAccess(const QString& name) const;
-    const TypedefNode *flagsType() const { return ft; }
+    const TypedefNode* flagsType() const { return ft; }
     QString itemValue(const QString &name) const;
 
@@ -468,5 +522,5 @@
     QList<EnumItem> itms;
     QSet<QString> names;
-    const TypedefNode *ft;
+    const TypedefNode* ft;
 };
 
@@ -474,18 +528,18 @@
 {
  public:
-    TypedefNode(InnerNode *parent, const QString& name);
+    TypedefNode(InnerNode* parent, const QString& name);
     virtual ~TypedefNode() { }
 
-    const EnumNode *associatedEnum() const { return ae; }
-
- private:
-    void setAssociatedEnum(const EnumNode *enume);
+    const EnumNode* associatedEnum() const { return ae; }
+
+ private:
+    void setAssociatedEnum(const EnumNode* enume);
 
     friend class EnumNode;
 
-    const EnumNode *ae;
-};
-
-inline void EnumNode::setFlagsType(TypedefNode *typedeff)
+    const EnumNode* ae;
+};
+
+inline void EnumNode::setFlagsType(TypedefNode* typedeff)
 {
     ft = typedeff;
@@ -539,6 +593,6 @@
     enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual };
 
-    FunctionNode(InnerNode *parent, const QString &name);
-    FunctionNode(Type type, InnerNode *parent, const QString &name, bool attached);
+    FunctionNode(InnerNode* parent, const QString &name);
+    FunctionNode(Type type, InnerNode* parent, const QString &name, bool attached);
     virtual ~FunctionNode() { }
 
@@ -546,5 +600,5 @@
     void setParentPath(const QStringList& parentPath) { pp = parentPath; }
     void setMetaness(Metaness metaness) { met = metaness; }
-    void setVirtualness(Virtualness virtualness) { vir = virtualness; }
+    void setVirtualness(Virtualness virtualness);
     void setConst(bool conste) { con = conste; }
     void setStatic(bool statique) { sta = statique; }
@@ -553,6 +607,6 @@
     void addParameter(const Parameter& parameter);
     inline void setParameters(const QList<Parameter>& parameters);
-    void borrowParameterNames(const FunctionNode *source);
-    void setReimplementedFrom(FunctionNode *from);
+    void borrowParameterNames(const FunctionNode* source);
+    void setReimplementedFrom(FunctionNode* from);
 
     const QString& returnType() const { return rt; }
@@ -571,7 +625,8 @@
     const QList<Parameter>& parameters() const { return params; }
     QStringList parameterNames() const;
-    const FunctionNode *reimplementedFrom() const { return rf; }
-    const QList<FunctionNode *> &reimplementedBy() const { return rb; }
-    const PropertyNode *associatedProperty() const { return ap; }
+    QString rawParameters(bool names = false, bool values = false) const;
+    const FunctionNode* reimplementedFrom() const { return rf; }
+    const QList<FunctionNode*> &reimplementedBy() const { return rb; }
+    const PropertyNode* associatedProperty() const { return ap; }
     const QStringList& parentPath() const { return pp; }
 
@@ -580,9 +635,12 @@
     const QString& element() const { return parent()->name(); }
     bool isAttached() const { return att; }
+    virtual bool isQmlNode() const { 
+        return ((type() == QmlSignal) || (type() == QmlMethod)); 
+    }
 
     void debug() const;
 
  private:
-    void setAssociatedProperty(PropertyNode *property);
+    void setAssociatedProperty(PropertyNode* property);
 
     friend class InnerNode;
@@ -604,7 +662,7 @@
     bool att: 1;
     QList<Parameter> params;
-    const FunctionNode *rf;
-    const PropertyNode *ap;
-    QList<FunctionNode *> rb;
+    const FunctionNode* rf;
+    const PropertyNode* ap;
+    QList<FunctionNode*> rb;
 };
 
@@ -615,14 +673,20 @@
     enum { NumFunctionRoles = Notifier + 1 };
 
-    PropertyNode(InnerNode *parent, const QString& name);
+    PropertyNode(InnerNode* parent, const QString& name);
     virtual ~PropertyNode() { }
 
     void setDataType(const QString& dataType) { dt = dataType; }
-    void addFunction(FunctionNode *function, FunctionRole role);
-    void addSignal(FunctionNode *function, FunctionRole role);
+    void addFunction(FunctionNode* function, FunctionRole role);
+    void addSignal(FunctionNode* function, FunctionRole role);
     void setStored(bool stored) { sto = toTrool(stored); }
     void setDesignable(bool designable) { des = toTrool(designable); }
+    void setScriptable(bool scriptable) { scr = toTrool(scriptable); }
     void setWritable(bool writable) { wri = toTrool(writable); }
-    void setOverriddenFrom(const PropertyNode *baseProperty);
+    void setUser(bool user) { usr = toTrool(user); }
+    void setOverriddenFrom(const PropertyNode* baseProperty);
+    void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; }
+    void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; }
+    void setConstant() { cst = true; }
+    void setFinal() { fnl = true; }
 
     const QString &dataType() const { return dt; }
@@ -636,6 +700,18 @@
     bool isStored() const { return fromTrool(sto, storedDefault()); }
     bool isDesignable() const { return fromTrool(des, designableDefault()); }
+    bool isScriptable() const { return fromTrool(scr, scriptableDefault()); }
+    const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; }
+    const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; }
     bool isWritable() const { return fromTrool(wri, writableDefault()); }
-    const PropertyNode *overriddenFrom() const { return overrides; }
+    bool isUser() const { return fromTrool(usr, userDefault()); }
+    bool isConstant() const { return cst; }
+    bool isFinal() const { return fnl; }
+    const PropertyNode* overriddenFrom() const { return overrides; }
+
+    bool storedDefault() const { return true; }
+    bool userDefault() const { return false; }
+    bool designableDefault() const { return !setters().isEmpty(); }
+    bool scriptableDefault() const { return true; }
+    bool writableDefault() const { return !setters().isEmpty(); }
 
  private:
@@ -645,14 +721,16 @@
     static bool fromTrool(Trool troolean, bool defaultValue);
 
-    bool storedDefault() const { return true; }
-    bool designableDefault() const { return !setters().isEmpty(); }
-    bool writableDefault() const { return !setters().isEmpty(); }
-
     QString dt;
+    QString runtimeDesFunc;
+    QString runtimeScrFunc;
     NodeList funcs[NumFunctionRoles];
     Trool sto;
     Trool des;
+    Trool scr;
     Trool wri;
-    const PropertyNode *overrides;
+    Trool usr;
+    bool cst;
+    bool fnl;
+    const PropertyNode* overrides;
 };
 
@@ -662,5 +740,5 @@
 }
 
-inline void PropertyNode::addFunction(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
 {
     funcs[(int)role].append(function);
@@ -668,5 +746,5 @@
 }
 
-inline void PropertyNode::addSignal(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
 {
     funcs[(int)role].append(function);
@@ -684,5 +762,5 @@
 {
  public:
-    VariableNode(InnerNode *parent, const QString &name);
+    VariableNode(InnerNode* parent, const QString &name);
     virtual ~VariableNode() { }
 
@@ -702,7 +780,8 @@
 };
 
-inline VariableNode::VariableNode(InnerNode *parent, const QString &name)
+inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
     : LeafNode(Variable, parent, name), sta(false)
 {
+    // nothing.
 }
 
@@ -710,5 +789,5 @@
 {
  public:
-    TargetNode(InnerNode *parent, const QString& name);
+    TargetNode(InnerNode* parent, const QString& name);
     virtual ~TargetNode() { }
 
Index: trunk/tools/qdoc3/openedlist.cpp
===================================================================
--- trunk/tools/qdoc3/openedlist.cpp	(revision 769)
+++ trunk/tools/qdoc3/openedlist.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/openedlist.h
===================================================================
--- trunk/tools/qdoc3/openedlist.h	(revision 769)
+++ trunk/tools/qdoc3/openedlist.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/pagegenerator.cpp
===================================================================
--- trunk/tools/qdoc3/pagegenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/pagegenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,8 +44,7 @@
 */
 
-#include <QtCore>
 #include <qfile.h>
 #include <qfileinfo.h>
-
+#include <qdebug.h>
 #include "pagegenerator.h"
 #include "tree.h"
@@ -70,4 +69,108 @@
 }
 
+static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)");
+static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)");
+static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)");
+static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>");
+static QRegExp unknownTag("</?@[^>]*>");
+
+bool PageGenerator::parseArg(const QString& src,
+                             const QString& tag,
+                             int* pos,
+                             int n,
+                             QStringRef* contents,
+                             QStringRef* par1,
+                             bool debug)
+{
+#define SKIP_CHAR(c) \
+    if (debug) \
+        qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \
+    if (i >= n || src[i] != c) { \
+        if (debug) \
+            qDebug() << " char '" << c << "' not found"; \
+        return false; \
+    } \
+    ++i;
+
+
+#define SKIP_SPACE \
+    while (i < n && src[i] == ' ') \
+        ++i;
+
+    int i = *pos;
+    int j = i;
+
+    // assume "<@" has been parsed outside
+    //SKIP_CHAR('<');
+    //SKIP_CHAR('@');
+
+    if (tag != QStringRef(&src, i, tag.length())) {
+        if (0 && debug)
+            qDebug() << "tag " << tag << " not found at " << i;
+        return false;
+    }
+
+    if (debug)
+        qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i;
+
+    // skip tag
+    i += tag.length();
+
+    // parse stuff like:  linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)");
+    if (par1) {
+        SKIP_SPACE;
+        // read parameter name
+        j = i;
+        while (i < n && src[i].isLetter())
+            ++i;
+        if (src[i] == '=') {
+            if (debug)
+                qDebug() << "read parameter" << QString(src.data() + j, i - j);
+            SKIP_CHAR('=');
+            SKIP_CHAR('"');
+            // skip parameter name
+            j = i;
+            while (i < n && src[i] != '"')
+                ++i;
+            *par1 = QStringRef(&src, j, i - j);
+            SKIP_CHAR('"');
+            SKIP_SPACE;
+        } else {
+            if (debug)
+                qDebug() << "no optional parameter found";
+        }
+    }
+    SKIP_SPACE;
+    SKIP_CHAR('>');
+
+    // find contents up to closing "</@tag>
+    j = i;
+    for (; true; ++i) {
+        if (i + 4 + tag.length() > n)
+            return false;
+        if (src[i] != '<')
+            continue;
+        if (src[i + 1] != '/')
+            continue;
+        if (src[i + 2] != '@')
+            continue;
+        if (tag != QStringRef(&src, i + 3, tag.length()))
+            continue;
+        if (src[i + 3 + tag.length()] != '>')
+            continue;
+        break;
+    }
+
+    *contents = QStringRef(&src, j, i - j);
+
+    i += tag.length() + 4;
+
+    *pos = i;
+    if (debug)
+        qDebug() << " tag " << tag << " found: pos now: " << i;
+    return true;
+#undef SKIP_CHAR
+}
+
 /*!
   This function is recursive.
@@ -78,5 +181,5 @@
 }
 
-QString PageGenerator::fileBase(const Node *node)
+QString PageGenerator::fileBase(const Node *node) const
 {
     if (node->relates())
@@ -105,6 +208,8 @@
           files.
          */
-        if (p->subType() == Node::QmlClass) {
-            base.prepend("qml-");
+        if ((p->subType() == Node::QmlClass) ||
+            (p->subType() == Node::QmlBasicType)) {
+            if (!base.startsWith(QLatin1String("QML:")))
+                base.prepend("qml-");
         }
 #endif        
@@ -153,5 +258,5 @@
 }
 
-QString PageGenerator::fileName(const Node *node)
+QString PageGenerator::fileName(const Node *node) const
 {
     if (!node->url().isEmpty())
@@ -177,5 +282,5 @@
 			.arg(outFile->fileName()));
     QTextStream *out = new QTextStream(outFile);
-    out->setCodec("ISO-8859-1");
+    out->setCodec(outputCodec);
     outStreamStack.push(out);
 }
@@ -196,6 +301,6 @@
   Recursive writing of html files from the root \a node.
  */
-void PageGenerator::generateInnerNode(const InnerNode *node,
-                                      CodeMarker *marker)
+void
+PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker)
 {
     if (!node->url().isNull())
@@ -206,8 +311,12 @@
         if (fakeNode->subType() == Node::ExternalPage)
             return;
-#ifdef QDOC_QML            
+        if (fakeNode->subType() == Node::Image)
+            return;
         if (fakeNode->subType() == Node::QmlPropertyGroup)
             return;
-#endif            
+        if (fakeNode->subType() == Node::Page) {
+            if (node->count() > 0)
+                qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title()));
+        }
     }
 
Index: trunk/tools/qdoc3/pagegenerator.h
===================================================================
--- trunk/tools/qdoc3/pagegenerator.h	(revision 769)
+++ trunk/tools/qdoc3/pagegenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -55,4 +55,6 @@
 QT_BEGIN_NAMESPACE
 
+class QTextCodec;
+
 class ClassNode;
 class InnerNode;
@@ -68,7 +70,7 @@
 
  protected:
-    virtual QString fileBase(const Node *node);
-    virtual QString fileExtension(const Node *node) = 0;
-    QString fileName(const Node *node);
+    virtual QString fileBase(const Node *node) const;
+    virtual QString fileExtension(const Node *node) const = 0;
+    QString fileName(const Node *node) const;
     QString outFileName();
     void beginSubPage(const Location& location, const QString& fileName);
@@ -77,6 +79,17 @@
     QTextStream& out();
 
+    QString naturalLanguage;
+    QString outputEncoding;
+    QTextCodec* outputCodec;
+    bool parseArg(const QString& src,
+                  const QString& tag,
+                  int* pos,
+                  int n,
+                  QStringRef* contents,
+                  QStringRef* par1 = 0,
+                  bool debug = false);
+
  private:
-    QStack<QTextStream *> outStreamStack;
+    QStack<QTextStream*> outStreamStack;
 };
 
Index: trunk/tools/qdoc3/plaincodemarker.cpp
===================================================================
--- trunk/tools/qdoc3/plaincodemarker.cpp	(revision 769)
+++ trunk/tools/qdoc3/plaincodemarker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -130,10 +130,3 @@
 }
 
-const Node *PlainCodeMarker::resolveTarget( const QString& /* target */,
-                                            const Tree * /* tree */,
-					    const Node * /* relative */ )
-{
-    return 0;
-}
-
 QT_END_NAMESPACE
Index: trunk/tools/qdoc3/plaincodemarker.h
===================================================================
--- trunk/tools/qdoc3/plaincodemarker.h	(revision 769)
+++ trunk/tools/qdoc3/plaincodemarker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -72,5 +72,4 @@
     QString functionEndRegExp( const QString& funcName );
     QList<Section> sections(const InnerNode *innerNode, SynopsisStyle style, Status status);
-    const Node *resolveTarget(const QString &target, const Tree *tree, const Node *relative);
 };
 
Index: trunk/tools/qdoc3/polyarchiveextractor.cpp
===================================================================
--- trunk/tools/qdoc3/polyarchiveextractor.cpp	(revision 769)
+++ trunk/tools/qdoc3/polyarchiveextractor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/polyarchiveextractor.h
===================================================================
--- trunk/tools/qdoc3/polyarchiveextractor.h	(revision 769)
+++ trunk/tools/qdoc3/polyarchiveextractor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/polyuncompressor.cpp
===================================================================
--- trunk/tools/qdoc3/polyuncompressor.cpp	(revision 769)
+++ trunk/tools/qdoc3/polyuncompressor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/polyuncompressor.h
===================================================================
--- trunk/tools/qdoc3/polyuncompressor.h	(revision 769)
+++ trunk/tools/qdoc3/polyuncompressor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/qdoc3.pro
===================================================================
--- trunk/tools/qdoc3/qdoc3.pro	(revision 769)
+++ trunk/tools/qdoc3/qdoc3.pro	(revision 846)
@@ -5,7 +5,15 @@
 #DEFINES += QT_USE_FAST_CONCATENATION
 
-QT = core xml
-CONFIG += console
-CONFIG -= debug_and_release_target
+qdoc_bootstrapped {
+    include(../../src/tools/bootstrap/bootstrap.pri)
+    SOURCES += ../../src/corelib/plugin/quuid.cpp
+    DEFINES -= QT_NO_CAST_FROM_ASCII
+    DEFINES += QT_NO_TRANSLATION
+} else {
+    QT = core xml
+    CONFIG += console
+    CONFIG -= debug_and_release_target
+}
+
 !isEmpty(QT_BUILD_TREE):DESTDIR = $$QT_BUILD_TREE/bin
 #CONFIG += debug
@@ -15,5 +23,6 @@
 #    CONFIG += debug
 }
-mac:CONFIG -= app_bundle
+
+CONFIG -= app_bundle
 HEADERS += apigenerator.h \
            archiveextractor.h \
@@ -30,4 +39,5 @@
 	   cpptoqsconverter.h \
 	   dcfsection.h \
+	   ditaxmlgenerator.h \
            doc.h \
 	   editdistance.h \
@@ -74,4 +84,5 @@
 	   cpptoqsconverter.cpp \
 	   dcfsection.cpp \
+	   ditaxmlgenerator.cpp \
            doc.cpp \
 	   editdistance.cpp \
@@ -106,4 +117,12 @@
 	   yyindent.cpp
 
+### Documentation for qdoc3 ###
+
+qtPrepareTool(QDOC, qdoc3)
+
+html-docs.commands = cd \"$$PWD/doc\" && $$QDOC qdoc-manual.qdocconf
+
+QMAKE_EXTRA_TARGETS += html-docs
+
 target.path = $$[QT_INSTALL_BINS]
 INSTALLS += target
Index: trunk/tools/qdoc3/qsakernelparser.cpp
===================================================================
--- trunk/tools/qdoc3/qsakernelparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/qsakernelparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -71,6 +71,6 @@
 				       Tree * /* tree */ )
 {
-    FILE *in = fopen( QFile::encodeName(filePath), "r" );
-    if ( in == 0 ) {
+    QFile in(filePath);
+    if (!in.open(QIODevice::ReadOnly)) {
         location.error( tr("Cannot open QSA kernel file '%1'").arg(filePath) );
         return;
@@ -172,5 +172,5 @@
 	}
     }
-    fclose( in );
+    in.close();
 }
 
Index: trunk/tools/qdoc3/qsakernelparser.h
===================================================================
--- trunk/tools/qdoc3/qsakernelparser.h	(revision 769)
+++ trunk/tools/qdoc3/qsakernelparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/qscodemarker.cpp
===================================================================
--- trunk/tools/qdoc3/qscodemarker.cpp	(revision 769)
+++ trunk/tools/qdoc3/qscodemarker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -280,9 +280,9 @@
 
     if ( style == Summary ) {
-	FastSection enums(classe, "Enums", "enum", "enums");
-	FastSection functions(classe, "Functions", "function", "functions");
-	FastSection readOnlyProperties(classe, "Read-Only Properties", "property", "properties");
-	FastSection signalz(classe, "Signals", "signal", "signals");
-	FastSection writableProperties(classe, "Writable Properties", "property", "properties");
+	FastSection enums(classe, "Enums", "", "enum", "enums");
+	FastSection functions(classe, "Functions", "", "function", "functions");
+	FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties");
+	FastSection signalz(classe, "Signals", "", "signal", "signals");
+	FastSection writableProperties(classe, "", "Writable Properties", "property", "properties");
 
 	QStack<const ClassNode *> stack;
@@ -329,7 +329,7 @@
 	append( sections, signalz );
     } else if ( style == Detailed ) {
-	FastSection enums( classe, "Enum Documentation" );
-	FastSection functionsAndSignals( classe, "Function and Signal Documentation" );
-	FastSection properties( classe, "Property Documentation" );
+	FastSection enums( classe, "Enum Documentation", "", "member", "members");
+	FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members");
+	FastSection properties( classe, "Property Documentation", "", "member", "members");
 
 	NodeList::ConstIterator c = classe->childNodes().begin();
@@ -350,5 +350,5 @@
 	append( sections, functionsAndSignals );
     } else { // ( style == SeparateList )
-	FastSection all( classe );
+	FastSection all(classe, "", "", "member", "members");
 
 	QStack<const ClassNode *> stack;
@@ -376,10 +376,3 @@
 }
 
-const Node *QsCodeMarker::resolveTarget( const QString& /* target */,
-                                         const Tree * /* tree */,
-					 const Node * /* relative */ )
-{
-    return 0;
-}
-
 QT_END_NAMESPACE
Index: trunk/tools/qdoc3/qscodemarker.h
===================================================================
--- trunk/tools/qdoc3/qscodemarker.h	(revision 769)
+++ trunk/tools/qdoc3/qscodemarker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -73,5 +73,4 @@
     QString functionBeginRegExp( const QString& funcName );
     QString functionEndRegExp( const QString& funcName );
-    const Node *resolveTarget( const QString& target, const Tree *tree, const Node *relative );
 };
 
Index: trunk/tools/qdoc3/qscodeparser.cpp
===================================================================
--- trunk/tools/qdoc3/qscodeparser.cpp	(revision 769)
+++ trunk/tools/qdoc3/qscodeparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -152,6 +152,6 @@
     qsTre = tree;
 
-    FILE *in = fopen(QFile::encodeName(filePath), "r");
-    if (in == 0) {
+    QFile in(filePath);
+    if (!in.open(QIODevice::ReadOnly)) {
 	location.error(tr("Cannot open Qt Script class list '%1'")
 			.arg(filePath));
@@ -176,5 +176,5 @@
 	tok = fileTokenizer.getToken();
     }
-    fclose(in);
+    in.close();
 }
 
Index: trunk/tools/qdoc3/qscodeparser.h
===================================================================
--- trunk/tools/qdoc3/qscodeparser.h	(revision 769)
+++ trunk/tools/qdoc3/qscodeparser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/quoter.cpp
===================================================================
--- trunk/tools/qdoc3/quoter.cpp	(revision 769)
+++ trunk/tools/qdoc3/quoter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/quoter.h
===================================================================
--- trunk/tools/qdoc3/quoter.h	(revision 769)
+++ trunk/tools/qdoc3/quoter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/separator.cpp
===================================================================
--- trunk/tools/qdoc3/separator.cpp	(revision 769)
+++ trunk/tools/qdoc3/separator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/separator.h
===================================================================
--- trunk/tools/qdoc3/separator.h	(revision 769)
+++ trunk/tools/qdoc3/separator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/sgmlgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/sgmlgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/sgmlgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/sgmlgenerator.h
===================================================================
--- trunk/tools/qdoc3/sgmlgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/sgmlgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/test/assistant.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/assistant.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/assistant.qdocconf	(revision 846)
@@ -7,5 +7,5 @@
 project                 = Qt Assistant
 description             = Qt Assistant Manual
-url                     = http://qt.nokia.com/doc/4.6
+url                     = http://doc.qt.nokia.com/4.7/
 
 indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
@@ -14,9 +14,42 @@
 
 qhp.Assistant.file                = assistant.qhp
-qhp.Assistant.namespace           = com.trolltech.assistant.460
+qhp.Assistant.namespace           = com.trolltech.assistant.472
 qhp.Assistant.virtualFolder       = qdoc
 qhp.Assistant.indexTitle          = Qt Assistant Manual
-qhp.Assistant.extraFiles          = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Assistant.filterAttributes    = qt 4.6.3 tools assistant
+qhp.Assistant.extraFiles          = images/bg_l.png \
+				    images/bg_l_blank.png \
+		     		    images/bg_ll_blank.png \
+			     	    images/bg_ul_blank.png \
+			     	    images/header_bg.png \
+                             	    images/bg_r.png \
+				    images/box_bg.png \
+				    images/breadcrumb.png \
+				    images/bullet_gt.png \
+                             	    images/bullet_dn.png \
+				    images/bullet_sq.png \
+                             	    images/bullet_up.png \
+				    images/arrow_down.png \
+                             	    images/feedbackground.png \
+                             	    images/horBar.png \
+				    images/page.png \
+				    images/page_bg.png \
+				    images/sprites-combined.png \
+				    images/spinner.gif \
+                             	    images/stylesheet-coffee-plastique.png \
+                             	    images/taskmenuextension-example.png \
+                             	    images/coloreditorfactoryimage.png \
+                             	    images/dynamiclayouts-example.png \
+			     	    scripts/functions.js \
+			     	    scripts/jquery.js \
+			     	    scripts/narrow.js \
+			     	    scripts/superfish.js \
+			     	    style/narrow.css \
+			     	    style/superfish.css \
+			     	    style/style_ie6.css \
+			     	    style/style_ie7.css \
+			     	    style/style_ie8.css \
+			     	    style/style.css
+
+qhp.Assistant.filterAttributes    = qt 4.7.2 tools assistant
 qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual
 qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant
@@ -41,5 +74,6 @@
                           $QT_SOURCE_TREE/doc/src
 
-imagedirs               = $QT_SOURCE_TREE/doc/src/images
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+			  $QT_SOURCE_TREE/doc/src/template/images
 outputdir               = $QT_BUILD_TREE/doc-build/html-assistant
 base                    = file:$QT_BUILD_TREE/doc-build/html-assistant
Index: trunk/tools/qdoc3/test/designer.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/designer.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/designer.qdocconf	(revision 846)
@@ -7,5 +7,5 @@
 project                 = Qt Designer
 description             = Qt Designer Manual
-url                     = http://qt.nokia.com/doc/4.6
+url                     = http://doc.qt.nokia.com/4.7/
 
 indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
@@ -14,9 +14,42 @@
 
 qhp.Designer.file                = designer.qhp
-qhp.Designer.namespace           = com.trolltech.designer.460
+qhp.Designer.namespace           = com.trolltech.designer.472
 qhp.Designer.virtualFolder       = qdoc
 qhp.Designer.indexTitle          = Qt Designer Manual
-qhp.Designer.extraFiles          = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Designer.filterAttributes    = qt 4.6.3 tools designer
+qhp.Designer.extraFiles          = images/bg_l.png \
+                             	    images/bg_l_blank.png \
+									images/bg_ll_blank.png \
+									images/bg_ul_blank.png \
+									images/header_bg.png \
+                             	    images/bg_r.png \
+									images/box_bg.png \
+									images/breadcrumb.png \
+									images/bullet_gt.png \
+                             	    images/bullet_dn.png \
+									images/bullet_sq.png \
+                             	    images/bullet_up.png \
+									images/arrow_down.png \
+                             	    images/feedbackground.png \
+                             	    images/horBar.png \
+									images/page.png \
+									images/page_bg.png \
+									images/sprites-combined.png \
+									images/spinner.gif \
+                             	    images/stylesheet-coffee-plastique.png \
+                             	    images/taskmenuextension-example.png \
+                             	   images/coloreditorfactoryimage.png \
+                             	   images/dynamiclayouts-example.png \
+									scripts/functions.js \
+									scripts/jquery.js \
+									scripts/narrow.js \
+									scripts/superfish.js \
+									style/narrow.css \
+									style/superfish.css \
+									style/style_ie6.css \
+									style/style_ie7.css \
+									style/style_ie8.css \
+                             	    style/style.css
+
+qhp.Designer.filterAttributes    = qt 4.7.2 tools designer
 qhp.Designer.customFilters.Designer.name = Qt Designer Manual
 qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer
@@ -47,5 +80,6 @@
                           $QT_SOURCE_TREE/doc/src
 
-imagedirs               = $QT_SOURCE_TREE/doc/src/images
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+			  $QT_SOURCE_TREE/doc/src/template/images
 outputdir               = $QT_BUILD_TREE/doc-build/html-designer
 base                    = file:$QT_BUILD_TREE/doc-build/html-designer
Index: trunk/tools/qdoc3/test/jambi.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/jambi.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/jambi.qdocconf	(revision 846)
@@ -17,5 +17,6 @@
                           $QTDIR/examples \
                           $JAMBI/doc/src/images \
-                          ../doc/src/images
+                          ../doc/src/images \
+			  $QTDIR/doc/src/template/images
 
 extraimages.javadoc     = qt-logo \
Index: trunk/tools/qdoc3/test/linguist.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/linguist.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/linguist.qdocconf	(revision 846)
@@ -7,5 +7,5 @@
 project                 = Qt Linguist
 description             = Qt Linguist Manual
-url                     = http://qt.nokia.com/doc/4.6
+url                     =  http://doc.qt.nokia.com/4.7/
 
 indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
@@ -14,9 +14,42 @@
 
 qhp.Linguist.file                = linguist.qhp
-qhp.Linguist.namespace           = com.trolltech.linguist.460
+qhp.Linguist.namespace           = com.trolltech.linguist.472
 qhp.Linguist.virtualFolder       = qdoc
 qhp.Linguist.indexTitle          = Qt Linguist Manual
-qhp.Linguist.extraFiles          = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Linguist.filterAttributes    = qt 4.6.3 tools linguist
+qhp.Linguist.extraFiles          = images/bg_l.png \
+                             	    images/bg_l_blank.png \
+									images/bg_ll_blank.png \
+									images/bg_ul_blank.png \
+									images/header_bg.png \
+                             	    images/bg_r.png \
+									images/box_bg.png \
+									images/breadcrumb.png \
+									images/bullet_gt.png \
+                             	    images/bullet_dn.png \
+									images/bullet_sq.png \
+                             	    images/bullet_up.png \
+									images/arrow_down.png \
+                             	    images/feedbackground.png \
+                             	    images/horBar.png \
+									images/page.png \
+									images/page_bg.png \
+									images/sprites-combined.png \
+									images/spinner.gif \
+                             	    images/stylesheet-coffee-plastique.png \
+                             	    images/taskmenuextension-example.png \
+                             	   images/coloreditorfactoryimage.png \
+                             	   images/dynamiclayouts-example.png \
+									scripts/functions.js \
+									scripts/jquery.js \
+									scripts/narrow.js \
+									scripts/superfish.js \
+									style/narrow.css \
+									style/superfish.css \
+									style/style_ie6.css \
+									style/style_ie7.css \
+									style/style_ie8.css \
+                             	    style/style.css
+
+qhp.Linguist.filterAttributes    = qt 4.7.2 tools linguist
 qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual
 qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist
@@ -43,5 +76,6 @@
                           $QT_SOURCE_TREE/doc/src
 
-imagedirs               = $QT_SOURCE_TREE/doc/src/images
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+			  $QT_SOURCE_TREE/doc/src/template/images
 outputdir               = $QT_BUILD_TREE/doc-build/html-linguist
 base                    = file:$QT_BUILD_TREE/doc-build/html-linguist
Index: trunk/tools/qdoc3/test/macros.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/macros.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/macros.qdocconf	(revision 846)
@@ -19,4 +19,5 @@
 macro.QD                = "\\e{Qt Designer}"
 macro.QL                = "\\e{Qt Linguist}"
+macro.QQV               = "\\e{Qt QML Viewer}"
 macro.param             = "\\e"
 macro.raisedaster.HTML  = "<sup>*</sup>"
Index: trunk/tools/qdoc3/test/qdeclarative.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qdeclarative.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qdeclarative.qdocconf	(revision 846)
@@ -0,0 +1,96 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qml
+description             = Qml Reference Documentation
+url                     = http://qt.nokia.com/doc/4.7/
+qmlonly                 = true
+
+edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \
+                          QtXmlPatterns QtTest
+edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtSql QtSvg \
+                          QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \
+                          QtDesigner QtAssistant QAxContainer Phonon \
+                          QAxServer QtUiTools QtTest QtDBus
+edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest
+edition.DesktopLight.groups       = -graphicsview-api
+
+qhp.projects            = Qml
+
+qhp.Qml.file                = qml.qhp
+qhp.Qml.namespace           = com.trolltech.qml.472
+qhp.Qml.virtualFolder       = qdoc
+qhp.Qml.indexTitle          = Qml Reference
+
+# Files not referenced in any qdoc file
+# See also extraimages.HTML
+qhp.Qml.extraFiles            = images/bg_l.png \
+                             images/bg_l_blank.png \
+							 images/bg_ll_blank.png \
+							 images/bg_ul_blank.png \
+							 images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
+qhp.Qml.filterAttributes    = qt 4.7.2 qtrefdoc
+qhp.Qml.customFilters.Qt.name = Qt 4.7.2
+qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qml.subprojects         = classes
+qhp.Qml.subprojects.classes.title = Elements
+qhp.Qml.subprojects.classes.indexTitle = Qml Elements
+qhp.Qml.subprojects.classes.selectors = fake:qmlclass
+qhp.Qml.subprojects.classes.sortPages = true
+
+language                = Cpp
+
+headerdirs              = $QT_SOURCE_TREE/src/declarative
+sourcedirs              = $QT_SOURCE_TREE/src/declarative \
+                          $QT_SOURCE_TREE/doc/src/declarative
+
+sources += $QT_SOURCE_TREE/doc/src/tutorials/declarative.qdoc
+
+sources.fileextensions  = "*.cpp *.qdoc"
+examples.fileextensions = "*.cpp *.h *.js *.qml"
+
+exampledirs             = $QT_SOURCE_TREE/doc/src \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/examples/tutorials \
+                          $QT_SOURCE_TREE \
+                          $QT_SOURCE_TREE/qmake/examples \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/doc/src/declarative/pics \
+			  $QT_SOURCE_TREE/doc/src/template/images
+outputdir               = $QT_BUILD_TREE/doc-build/html-qml
+tagfile                 = $QT_BUILD_TREE/doc-build/html-qml/qt.tags
+base                    = file:$QT_BUILD_TREE/doc/html-qml
Index: trunk/tools/qdoc3/test/qmake.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qmake.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qmake.qdocconf	(revision 846)
@@ -7,5 +7,5 @@
 project                 = QMake
 description             = QMake Manual
-url                     = http://qt.nokia.com/doc/4.6
+url                     = http://qt.nokia.com/doc/4.7
 
 indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
@@ -14,9 +14,42 @@
 
 qhp.qmake.file                = qmake.qhp
-qhp.qmake.namespace           = com.trolltech.qmake.460
+qhp.qmake.namespace           = com.trolltech.qmake.472
 qhp.qmake.virtualFolder       = qdoc
 qhp.qmake.indexTitle          = QMake Manual
-qhp.qmake.extraFiles          = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.qmake.filterAttributes    = qt 4.6.3 tools qmake
+qhp.qmake.extraFiles          = images/bg_l.png \
+                             images/bg_l_blank.png \
+							 images/bg_ll_blank.png \
+							 images/bg_ul_blank.png \
+							 images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
+qhp.qmake.filterAttributes    = qt 4.7.2 tools qmake
 qhp.qmake.customFilters.qmake.name = qmake Manual
 qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake
@@ -36,5 +69,6 @@
                           $QT_SOURCE_TREE/doc/src
 
-imagedirs               = $QT_SOURCE_TREE/doc/src/images
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+			  $QT_SOURCE_TREE/doc/src/template/images
 outputdir               = $QT_BUILD_TREE/doc-build/html-qmake
 base                    = file:$QT_BUILD_TREE/doc-build/html-qmake
Index: trunk/tools/qdoc3/test/qt-api-only.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-api-only.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-api-only.qdocconf	(revision 846)
@@ -26,4 +26,8 @@
                     $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc
 
+# Remove the QML documentation from the Qt-only documentation.
+
+excludedirs += $QT_SOURCE_TREE/src/imports
+
 outputdir         = $QT_BUILD_TREE/doc-build/html-qt
 tagfile           = $QT_BUILD_TREE/doc-build/html-qt/qt.tags
Index: trunk/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf	(revision 846)
@@ -0,0 +1,37 @@
+include(qt-build-docs_ja_JP.qdocconf)
+
+# Ensures that the generated index contains a URL that can be used by the
+# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf,
+# qmake.qdocconf).
+
+url                     = ./
+
+# Ensures that the documentation for the tools is not included in the generated
+# .qhp file.
+
+qhp.Qt.excluded  += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \
+                    $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \
+                    $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \
+                    $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc
+
+# Remove the QML documentation from the Qt-only documentation.
+
+excludedirs += $QT_SOURCE_TREE/src/declarative \
+               $QT_SOURCE_TREE/src/imports \
+               $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \
+               $QT_SOURCE_TREE/doc/src/declarative
+
+outputdir         = $QT_BUILD_TREE/doc-build/html-qt_ja_JP
+tagfile           = $QT_BUILD_TREE/doc-build/html-qt_ja_JP/qt.tags
+base              = file:$QT_BUILD_TREE/doc-build/html-qt_ja_JP
Index: trunk/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf	(revision 846)
@@ -0,0 +1,37 @@
+include(qt-build-docs_zh_CN.qdocconf)
+
+# Ensures that the generated index contains a URL that can be used by the
+# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf,
+# qmake.qdocconf).
+
+url                     = ./
+
+# Ensures that the documentation for the tools is not included in the generated
+# .qhp file.
+
+qhp.Qt.excluded  += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \
+                    $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \
+                    $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \
+                    $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \
+                    $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc
+
+# Remove the QML documentation from the Qt-only documentation.
+
+excludedirs += $QT_SOURCE_TREE/src/declarative \
+               $QT_SOURCE_TREE/src/imports \
+               $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \
+               $QT_SOURCE_TREE/doc/src/declarative
+
+outputdir         = $QT_BUILD_TREE/doc-build/html-qt_zh_CN
+tagfile           = $QT_BUILD_TREE/doc-build/html-qt_zh_CN/qt.tags
+base              = file:$QT_BUILD_TREE/doc-build/html-qt_zh_CN
Index: trunk/tools/qdoc3/test/qt-build-docs.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-build-docs.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-build-docs.qdocconf	(revision 846)
@@ -7,17 +7,14 @@
 project                 = Qt
 description             = Qt Reference Documentation
-url                     = http://qt.nokia.com/doc/4.6
+url                     = http://qt.nokia.com/doc/4.7
 
-edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \
-                          QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \
-                          QtDesigner QtAssistant QAxContainer Phonon \
-                          QAxServer QtUiTools QtTest QtDBus
-edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest
-edition.DesktopLight.groups       = -graphicsview-api
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = en_US
 
 qhp.projects            = Qt
 
 qhp.Qt.file                = qt.qhp
-qhp.Qt.namespace           = com.trolltech.qt.460
+qhp.Qt.namespace           = com.trolltech.qt.472
 qhp.Qt.virtualFolder       = qdoc
 qhp.Qt.indexTitle          = Qt Reference Documentation
@@ -26,19 +23,53 @@
 # Files not referenced in any qdoc file (last four are needed by qtdemo)
 # See also extraimages.HTML
-qhp.Qt.extraFiles          = classic.css \
-                             images/qt-logo.png \
+qhp.Qt.extraFiles          = index.html \
+                             images/bg_l.png \
+                             images/bg_l_blank.png \
+			     images/bg_ll_blank.png \
+			     images/bg_ul_blank.png \
+			     images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
                              images/taskmenuextension-example.png \
                              images/coloreditorfactoryimage.png \
                              images/dynamiclayouts-example.png \
-                             images/stylesheet-coffee-plastique.png
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
 
-qhp.Qt.filterAttributes    = qt 4.6.3 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.6.3
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.3
-qhp.Qt.subprojects         = classes overviews examples
+
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.subprojects         = classes qmlelements overviews examples
 qhp.Qt.subprojects.classes.title = Classes
-qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
+qhp.Qt.subprojects.classes.indexTitle = All Classes
 qhp.Qt.subprojects.classes.selectors = class fake:headerfile
 qhp.Qt.subprojects.classes.sortPages = true
+qhp.Qt.subprojects.qmlelements.title = QML Elements
+qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements
+qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass
+qhp.Qt.subprojects.qmlelements.sortPages = true
 qhp.Qt.subprojects.overviews.title = Overviews
 qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
@@ -77,4 +108,5 @@
                           $QT_SOURCE_TREE/src/3rdparty/harfbuzz \
                           $QT_SOURCE_TREE/src/3rdparty/kdebase \
+                          $QT_SOURCE_TREE/src/3rdparty/libconninet \
                           $QT_SOURCE_TREE/src/3rdparty/libjpeg \
                           $QT_SOURCE_TREE/src/3rdparty/libmng \
@@ -90,12 +122,15 @@
                           $QT_SOURCE_TREE/src/3rdparty/wintab \
                           $QT_SOURCE_TREE/src/3rdparty/zlib \
-                          $QT_SOURCE_TREE/doc/src/snippets \
                           $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \
                           $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \
                           $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \
-                          $QT_SOURCE_TREE/src/3rdparty/phonon/waveout
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \
+                          $QT_SOURCE_TREE/doc/src/snippets \
+                          $QT_SOURCE_TREE/doc/src/ja_JP \
+                          $QT_SOURCE_TREE/doc/src/zh_CN
 
 sources.fileextensions  = "*.cpp *.qdoc *.mm"
-examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml"
 examples.imageextensions = "*.png"
 
@@ -107,5 +142,7 @@
                           $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs
 imagedirs               = $QT_SOURCE_TREE/doc/src/images \
-                          $QT_SOURCE_TREE/examples
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/doc/src/declarative/pics \
+                          $QT_SOURCE_TREE/doc/src/template/images
 outputdir               = $QT_BUILD_TREE/doc/html
 tagfile                 = $QT_BUILD_TREE/doc/html/qt.tags
Index: trunk/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf	(revision 846)
@@ -0,0 +1,118 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates_ja_JP.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qt
+description             = Qt ãªãã¡ã¬ã³ã¹ãã­ã¥ã¡ã³ã
+url                     = http://qt.nokia.com/doc/ja_JP/4.7
+
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = ja
+
+indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
+
+qhp.projects            = Qt
+
+qhp.Qt.file                = qt.qhp
+qhp.Qt.namespace           = com.trolltech.qt.472
+qhp.Qt.virtualFolder       = qdoc
+qhp.Qt.title               = Qt
+qhp.Qt.indexTitle          = Qt
+qhp.Qt.selectors           = fake:example
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc ja_JP
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = index.html \
+                             images/bg_l.png \
+                             images/bg_l_blank.png \
+                             images/bg_ll_blank.png \
+                             images/bg_ul_blank.png \
+                             images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
+language                = Cpp
+
+sourcedirs              = $QT_SOURCE_TREE/doc/src/ja_JP
+
+excludedirs             = $QT_SOURCE_TREE/src/3rdparty/clucene \
+                          $QT_SOURCE_TREE/src/3rdparty/des \
+                          $QT_SOURCE_TREE/src/3rdparty/freetype \
+                          $QT_SOURCE_TREE/src/3rdparty/harfbuzz \
+                          $QT_SOURCE_TREE/src/3rdparty/kdebase \
+                          $QT_SOURCE_TREE/src/3rdparty/libconninet \
+                          $QT_SOURCE_TREE/src/3rdparty/libjpeg \
+                          $QT_SOURCE_TREE/src/3rdparty/libmng \
+                          $QT_SOURCE_TREE/src/3rdparty/libpng \
+                          $QT_SOURCE_TREE/src/3rdparty/libtiff \
+                          $QT_SOURCE_TREE/src/3rdparty/md4 \
+                          $QT_SOURCE_TREE/src/3rdparty/md5 \
+                          $QT_SOURCE_TREE/src/3rdparty/patches \
+                          $QT_SOURCE_TREE/src/3rdparty/sha1 \
+                          $QT_SOURCE_TREE/src/3rdparty/sqlite \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \
+                          $QT_SOURCE_TREE/src/3rdparty/wintab \
+                          $QT_SOURCE_TREE/src/3rdparty/zlib \
+                          $QT_SOURCE_TREE/doc/src/snippets \
+                          $QT_SOURCE_TREE/doc/src/zh_CN \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/waveout
+
+sources.fileextensions  = "*.cpp *.qdoc *.mm"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.imageextensions = "*.png"
+
+exampledirs             = $QT_SOURCE_TREE/doc/src \
+                          $QT_SOURCE_TREE/examples/ja_JP \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/examples/tutorials \
+                          $QT_SOURCE_TREE \
+                          $QT_SOURCE_TREE/qmake/examples \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QT_SOURCE_TREE/doc/src/ja_JP/images \
+                          $QT_SOURCE_TREE/doc/src/images \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/doc/src/declarative/pics \
+                          $QT_SOURCE_TREE/doc/src/template/images
+outputdir               = $QT_BUILD_TREE/doc/html_ja_JP
+tagfile                 = $QT_BUILD_TREE/doc/html_ja_JP/qt.tags
+base                    = file:$QT_BUILD_TREE/doc/html_ja_JP
+
+HTML.generatemacrefs    = "true"
Index: trunk/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf	(revision 846)
@@ -0,0 +1,116 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates_zh_CN.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qt
+description             = Qt Reference Documentation
+url                     = http://qt.nokia.com/doc/zh_CN/4.7
+
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = zh-Hans
+
+indexes                 = $QT_BUILD_TREE/doc-build/html-qt/qt.index
+
+qhp.projects            = Qt
+
+qhp.Qt.file                = qt.qhp
+qhp.Qt.namespace           = com.trolltech.qt.472
+qhp.Qt.virtualFolder       = qdoc
+qhp.Qt.title               = æçš
+qhp.Qt.indexTitle          = æçš
+qhp.Qt.selectors           = fake:example
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc zh_CN
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = index.html \
+                             images/bg_l.png \
+                             images/bg_l_blank.png \
+                             images/bg_ll_blank.png \
+                             images/bg_ul_blank.png \
+                             images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
+language                = Cpp
+
+sourcedirs              = $QT_SOURCE_TREE/doc/src/zh_CN
+
+excludedirs             = $QT_SOURCE_TREE/src/3rdparty/clucene \
+                          $QT_SOURCE_TREE/src/3rdparty/des \
+                          $QT_SOURCE_TREE/src/3rdparty/freetype \
+                          $QT_SOURCE_TREE/src/3rdparty/harfbuzz \
+                          $QT_SOURCE_TREE/src/3rdparty/kdebase \
+                          $QT_SOURCE_TREE/src/3rdparty/libconninet \
+                          $QT_SOURCE_TREE/src/3rdparty/libjpeg \
+                          $QT_SOURCE_TREE/src/3rdparty/libmng \
+                          $QT_SOURCE_TREE/src/3rdparty/libpng \
+                          $QT_SOURCE_TREE/src/3rdparty/libtiff \
+                          $QT_SOURCE_TREE/src/3rdparty/md4 \
+                          $QT_SOURCE_TREE/src/3rdparty/md5 \
+                          $QT_SOURCE_TREE/src/3rdparty/patches \
+                          $QT_SOURCE_TREE/src/3rdparty/sha1 \
+                          $QT_SOURCE_TREE/src/3rdparty/sqlite \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \
+                          $QT_SOURCE_TREE/src/3rdparty/wintab \
+                          $QT_SOURCE_TREE/src/3rdparty/zlib \
+                          $QT_SOURCE_TREE/doc/src/snippets \
+                          $QT_SOURCE_TREE/doc/src/ja_JP \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \
+                          $QT_SOURCE_TREE/src/3rdparty/phonon/waveout
+
+sources.fileextensions  = "*.cpp *.qdoc *.mm"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.imageextensions = "*.png"
+
+exampledirs             = $QT_SOURCE_TREE/doc/src \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/examples/tutorials \
+                          $QT_SOURCE_TREE \
+                          $QT_SOURCE_TREE/qmake/examples \
+                          $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QT_SOURCE_TREE/doc/src/images \
+                          $QT_SOURCE_TREE/examples \
+                          $QT_SOURCE_TREE/doc/src/declarative/pics \
+                          $QT_SOURCE_TREE/doc/src/template/images
+outputdir               = $QT_BUILD_TREE/doc/html_zh_CN
+tagfile                 = $QT_BUILD_TREE/doc/html_zh_CN/qt.tags
+base                    = file:$QT_BUILD_TREE/doc/html_zh_CN
+
+HTML.generatemacrefs    = "true"
Index: trunk/tools/qdoc3/test/qt-cpp-ignore.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-cpp-ignore.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-cpp-ignore.qdocconf	(revision 846)
@@ -65,4 +65,5 @@
                           Q_XMLPATTERNS_EXPORT \
                           QDBUS_EXPORT \
+                          Q_DBUS_EXPORT \
                           QT_BEGIN_NAMESPACE \
                           QT_BEGIN_INCLUDE_NAMESPACE \
@@ -71,6 +72,7 @@
                           PHONON_EXPORT \
                           Q_DECLARATIVE_EXPORT \
-			  Q_GADGET \
-			  QWEBKIT_EXPORT
+			              Q_GADGET \
+            			  QWEBKIT_EXPORT \
+                          Q_INVOKABLE
 Cpp.ignoredirectives    = Q_DECLARE_HANDLE \
                           Q_DECLARE_INTERFACE \
@@ -91,3 +93,6 @@
                           K_DECLARE_PRIVATE \
                           PHONON_OBJECT \
-                          PHONON_HEIR
+                          PHONON_HEIR \
+			  Q_PRIVATE_PROPERTY \
+			  Q_DECLARE_PRIVATE_D \
+			  Q_CLASSINFO
Index: trunk/tools/qdoc3/test/qt-defines.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-defines.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-defines.qdocconf	(revision 846)
@@ -4,4 +4,5 @@
                           QT_COMPAT \
                           QT_KEYPAD_NAVIGATION \
+			  QT_NO_EGL \
                           QT3_SUPPORT \
                           Q_WS_.* \
@@ -20,7 +21,42 @@
 extraimages.HTML        = qt-logo \
                           trolltech-logo \
+                          bg_l.png \
+                          bg_l_blank.png \
+                          bg_ll_blank.png \
+                          bg_ul_blank.png \
+                          header_bg.png \
+                          bg_r.png \
+                          box_bg.png \
+                          breadcrumb.png \
+                          bullet_gt.png \
+                          bullet_dn.png \
+                          bullet_sq.png \
+                          bullet_up.png \
+                          arrow_down.png \
+                          feedbackground.png \
+                          horBar.png \
+                          page.png \
+                          page_bg.png \
+                          sprites-combined.png \
+                          spinner.gif \
+                          stylesheet-coffee-plastique.png \
                           taskmenuextension-example.png \
                           coloreditorfactoryimage.png \
-                          dynamiclayouts-example.png \
-                          stylesheet-coffee-plastique.png
-                             
+                          dynamiclayouts-example.png
+
+# This stuff is used by the new doc format.
+scriptdirs              = $QT_SOURCE_TREE/doc/src/template/scripts
+styledirs               = $QT_SOURCE_TREE/doc/src/template/style
+
+scripts.HTML		= functions.js \
+			     narrow.js \
+			     superfish.js \
+			  jquery.js
+
+styles.HTML		= style.css \
+			     narrow.css \
+			     superfish.css \
+			     superfish_skin.css \
+			  style_ie6.css \
+			  style_ie7.css \
+			  style_ie8.css
Index: trunk/tools/qdoc3/test/qt-ditaxml.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-ditaxml.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-ditaxml.qdocconf	(revision 846)
@@ -0,0 +1,11 @@
+include(qt.qdocconf)
+
+imagedirs               = $QTDIR/doc/src/images \
+                          $QTDIR/examples \
+			  $QTDIR/doc/src/template/images
+
+outputdir               = $QTDIR/doc/ditaxml
+outputformats           = DITAXML
+
+generateindex           = true
+url                     = .
Index: trunk/tools/qdoc3/test/qt-html-templates.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-html-templates.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-html-templates.qdocconf	(revision 846)
@@ -1,25 +1,186 @@
-HTML.stylesheets        = classic.css
-HTML.postheader         = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
-                          "<tr>\n" \
-                          "<td align=\"left\" valign=\"top\" width=\"32\">" \
-                          "<a href=\"http://qt.nokia.com/\"><img src=\"images/qt-logo.png\" align=\"left\" border=\"0\" /></a>" \
-                          "</td>\n" \
-                          "<td width=\"1\">&nbsp;&nbsp;</td>" \
-                          "<td class=\"postheader\" valign=\"center\">" \
-                          "<a href=\"index.html\">" \
-                          "<font color=\"#004faf\">Home</font></a>&nbsp;&middot;" \
-                          " <a href=\"classes.html\">" \
-                          "<font color=\"#004faf\">All&nbsp;Classes</font></a>&nbsp;&middot;" \
-                          " <a href=\"functions.html\">" \
-                          "<font color=\"#004faf\">All&nbsp;Functions</font></a>&nbsp;&middot;" \
-                          " <a href=\"overviews.html\">" \
-                          "<font color=\"#004faf\">Overviews</font></a>" \
-                          "</td>" \
-                          "</tr></table>"
+HTML.stylesheets        =  style/style.css \
+									style/OfflineStyle.css \
+									style/style_ie7.css \
+									style/style_ie8.css \
+									style/style_ie6.css
 
-HTML.footer             = "<p /><address><hr /><div align=\"center\">\n" \
-                          "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
-                          "<td width=\"40%\" align=\"left\">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
-                          "<td width=\"20%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
-                          "<td width=\"40%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \
-                          "</tr></table></div></address>"
+HTML.postheader         = " <div class=\"header\" id=\"qtdocheader\">\n" \
+			  "    <div class=\"content\"> \n" \
+			  "    <div id=\"nav-logo\">\n" \
+			  "      <a href=\"index.html\">Home</a></div>\n" \
+			  "    <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
+			  "    <div id=\"narrowsearch\"></div>\n" \
+			  "    <div id=\"nav-topright\">\n" \
+			  "      <ul>\n" \
+			  "        <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \
+			  "        <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \
+			  "        <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \
+			  "        <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \
+			  "          DOC</a></li>\n" \
+			  "        <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \
+			  "      </ul>\n" \
+			  "    </div>\n" \
+			  "    <div id=\"shortCut\">\n" \
+			  "      <ul>\n" \
+			  "        <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \
+			  "        <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \
+			  "        </a></li>\n" \
+			  "      </ul>\n" \
+			  "     </div>\n" \
+			" <ul class=\"sf-menu\" id=\"narrowmenu\"> \n" \
+			" 			<li><a href=\"#\">API Lookup</a> \n" \
+			" 				<ul> \n" \
+			" 					<li><a href=\"classes.html\">Class index</a></li> \n" \
+			"           <li><a href=\"functions.html\">Function index</a></li> \n" \
+			"           <li><a href=\"modules.html\">Modules</a></li> \n" \
+			"           <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
+			"           <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \
+			"           <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \
+			" 		    </ul> \n" \
+			" 			</li> \n" \
+			" 			<li><a href=\"#\">Qt Topics</a> \n" \
+			" 				<ul> \n" \
+			" 					   <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li>  \n" \
+			" 					   <li><a href=\"qtquick.html\">Device UIs &amp; Qt Quick</a></li>  \n" \
+			" 					   <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li>  \n" \
+			" 					   <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li>  \n" \
+			" 					   <li><a href=\"platform-specific.html\">Platform-specific info</a></li>  \n" \
+			" 					   <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li>  \n" \
+			" 					   <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li>  \n" \
+			" 		     </ul> \n" \
+			" 				</li> \n" \
+			" 				<li><a href=\"#\">Examples</a> \n" \
+			" 					<ul> \n" \
+			" 		              <li><a href=\"all-examples.html\">Examples</a></li> \n" \
+			" 		              <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \
+			" 		              <li><a href=\"demos.html\">Demos</a></li> \n" \
+			" 		              <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \
+			" 		       </ul> \n" \
+			" 					</li> \n" \
+			" 				</ul> \n" \
+			  "    </div>\n" \
+			  "  </div>\n" \
+			  "  <div class=\"wrapper\">\n" \
+			  "    <div class=\"hd\">\n" \
+			  "      <span></span>\n" \
+			  "    </div>\n" \
+			  "    <div class=\"bd group\">\n" \
+			  "      <div class=\"sidebar\">\n" \
+			  "        <div class=\"searchlabel\">\n" \
+			  "          Search index:</div>\n" \
+			  "        <div class=\"search\" id=\"sidebarsearch\">\n" \
+			  "          <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \
+			  "            <fieldset>\n" \
+			  "              <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \
+			" <div id=\"resultdialog\"> \n" \
+			" <a href=\"#\" id=\"resultclose\">Close</a> \n" \
+			"<!-- <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \
+			" <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span>&nbsp;results:</p> --> \n" \
+			" <ul id=\"resultlist\" class=\"all\"> \n" \
+			" </ul> \n" \
+			" </div> \n" \
+			  "            </fieldset>\n" \
+			  "          </form>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box first bottombar\" id=\"lookup\">\n" \
+			  "          <h2 title=\"API Lookup\"><span></span>\n" \
+			  "            API Lookup</h2>\n" \
+			  "          <div  id=\"list001\" class=\"list\">\n" \
+			  "          <ul id=\"ul001\" >\n" \
+			  "              <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global Declarations</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \
+			  "            </ul> \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box bottombar\" id=\"topics\">\n" \
+			  "          <h2 title=\"Qt Topics\"><span></span>\n" \
+			  "            Qt Topics</h2>\n" \
+			  "          <div id=\"list002\" class=\"list\">\n" \
+			  "            <ul id=\"ul002\" >\n" \
+			  "			   <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UIs &amp; Qt Quick</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \
+			  "			   <li class=\"defaultLink\"><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \
+			  "            </ul>  \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box\" id=\"examples\">\n" \
+			  "          <h2 title=\"Examples\"><span></span>\n" \
+			  "            Examples</h2>\n" \
+			  "          <div id=\"list003\" class=\"list\">\n" \
+			  "        <ul id=\"ul003\">\n" \
+			  "              <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \
+			  "            </ul> \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "      </div>\n" \
+			  "      <div class=\"wrap\">\n" \
+			  "        <div class=\"toolbar\">\n" \
+			  "          <div class=\"breadcrumb toolblock\">\n" \
+			  "            <ul>\n" \
+			  "              <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
+			  "              <!--  Bread crumbs goes here -->\n"
+
+HTML.postpostheader     = "            </ul>\n" \
+			  "          </div>\n" \
+			  "          <div class=\"toolbuttons toolblock\">\n" \
+			  "            <ul>\n" \
+			  "              <li id=\"smallA\" class=\"t_button\">A</li>\n" \
+			  "              <li id=\"medA\" class=\"t_button active\">A</li>\n" \
+			  "              <li id=\"bigA\" class=\"t_button\">A</li>\n" \
+			  "              <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \
+			  "                <span>Print</span></a></li>\n" \
+			  "            </ul>\n" \
+			  "        </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"content mainContent\">\n"
+
+HTML.footer             = "" \
+			  "        <div class=\"feedback t_button\">\n" \
+			  "          [+] Documentation Feedback</div>\n" \
+			  "      </div>\n" \
+			  "    </div>\n" \
+			  "    </div> \n" \
+			  "    <div class=\"ft\">\n" \
+			  "      <span></span>\n" \
+			  "    </div>\n" \
+			  "  </div> \n" \
+			  "  <div class=\"footer\">\n" \
+			  "    <p>\n" \
+			  "      <acronym title=\"Copyright\">&copy;</acronym> 2008-2010 Nokia Corporation and/or its\n" \
+			  "      subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
+			  "      in Finland and/or other countries worldwide.</p>\n" \
+			  "    <p>\n" \
+			  "      All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
+			  "        href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
+              "    <br />\n" \
+              "    <p>\n" \
+              "      Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
+              "      Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
+              "      with the terms contained in a written agreement between you and Nokia.</p>\n" \
+              "    <p>\n" \
+              "      Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
+              "      Free Documentation License version 1.3</a>\n" \
+              "      as published by the Free Software Foundation.</p>\n" \
+			  "  </div>\n" \
+			  "  <div id=\"feedbackBox\">\n" \
+			  "      <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
+			  "    <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
+			  "      <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \
+			  "      requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \
+			  "      <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
+			  "      <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
+			  "    </form>\n" \
+			  "  </div>\n" \
+			  "  <div id=\"blurpage\">\n" \
+			  "  </div>\n"
Index: trunk/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf	(revision 846)
@@ -0,0 +1,177 @@
+HTML.stylesheets        =  style/style.css \
+									style/OfflineStyle.css \
+									style/style_ie7.css \
+									style/style_ie8.css \
+									style/style_ie6.css
+									
+HTML.postheader         = " <div class=\"header\" id=\"qtdocheader\">\n" \
+			  "    <div class=\"content\"> \n" \
+			  "    <div id=\"nav-logo\">\n" \
+			  "      <a href=\"index.html\">Home</a></div>\n" \
+			  "    <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
+			  "		<div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \
+			  "		<fieldset>\n" \
+              "		<input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \
+			  "		 </fieldset>\n" \
+			  "		</form></div>\n" \
+			  "    <div id=\"nav-topright\">\n" \
+			  "      <ul>\n" \
+			  "        <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \
+			  "        <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \
+			  "        <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \
+			  "        <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \
+			  "          DOC</a></li>\n" \
+			  "        <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \
+			  "        <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \
+			  "      </ul>\n" \
+			  "    </div>\n" \
+			  "    <div id=\"shortCut\">\n" \
+			  "      <ul>\n" \
+			  "        <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \
+			  "        <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \
+			  "        </a></li>\n" \
+			  "      </ul>\n" \
+			  "     </div>\n" \
+			 " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \
+			"		 <li><a href=\"#\">API Lookup</a> \n" \
+			"			 <ul id=\"topmenuLook\"> \n" \
+			"			   <li><a href=\"classes.html\">Class index</a></li> \n" \
+			" 			  <li><a href=\"functions.html\">Function index</a></li> \n" \
+			"			   <li><a href=\"modules.html\">Modules</a></li> \n" \
+			"			   <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
+			"			   <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \
+			"			   <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \
+			"			   </ul> \n" \
+			"		 </li> \n" \
+			"		 <li><a href=\"#\">Qt Topics</a> \n" \
+			"			 <ul id=\"topmenuTopic\"> \n" \
+			"			   <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \
+			"			   <li><a href=\"declarativeui.html\">Device UI's &amp; Qt Quick</a></li> \n" \
+			"			   <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \
+			"			   <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+			"			 </ul> \n" \
+			"		</li> \n" \
+			"		 <li><a href=\"#\">Examples</a> \n" \
+			"			 <ul id=\"topmenuexample\"> \n" \
+			"				 <li><a href=\"all-examples.html\">Examples</a></li> \n" \
+			"				 <li><a href=\"tutorials.html\">ãã¥ãŒããªã¢ã«</a></li> \n" \
+			"				 <li><a href=\"demos.html\">Demos</a></li> \n" \
+			"				 <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \
+			"				 <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \
+			"			 </ul> \n" \
+			"		 </li> \n" \
+			" </ul> \n" \
+			  "    </div>\n" \
+			  "  </div>\n" \
+			  "  <div class=\"wrapper\">\n" \
+			  "    <div class=\"hd\">\n" \
+			  "      <span></span>\n" \
+			  "    </div>\n" \
+			  "    <div class=\"bd group\">\n" \
+			  "      <div class=\"sidebar\">\n" \
+			  "        <div class=\"searchlabel\">\n" \
+			  "          Search index:</div>\n" \
+			  "        <div class=\"search\">\n" \
+			  "          <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \
+			  "            <fieldset>\n" \
+			  "              <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \
+			  "            </fieldset>\n" \
+			  "          </form>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box first bottombar\" id=\"lookup\">\n" \
+			  "          <h2 title=\"API Lookup\"><span></span>\n" \
+			  "            API Lookup</h2>\n" \
+			  "          <div  id=\"list001\" class=\"list\">\n" \
+			  "          <ul id=\"ul001\" >\n" \
+			  "              <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \
+			  "            </ul> \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box bottombar\" id=\"topics\">\n" \
+			  "          <h2 title=\"Qt Topics\"><span></span>\n" \
+			  "            Qt Topics</h2>\n" \
+			  "          <div id=\"list002\" class=\"list\">\n" \
+			  "            <ul id=\"ul002\" >\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's &amp; Qt Quick</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \
+			  "            </ul>  \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"box\" id=\"examples\">\n" \
+			  "          <h2 title=\"Examples\"><span></span>\n" \
+			  "            Examples</h2>\n" \
+			  "          <div id=\"list003\" class=\"list\">\n" \
+			  "        <ul id=\"ul003\">\n" \
+			  "              <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"tutorials.html\">ãã¥ãŒããªã¢ã«</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \
+			  "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \
+			  "            </ul> \n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "      </div>\n" \
+			  "      <div class=\"wrap\">\n" \
+			  "        <div class=\"toolbar\">\n" \
+			  "          <div class=\"breadcrumb toolblock\">\n" \
+			  "            <ul>\n" \
+			  "              <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
+			  "              <!--  Bread crumbs goes here -->\n"
+
+HTML.postpostheader     = "            </ul>\n" \
+			  "          </div>\n" \
+			  "          <div class=\"toolbuttons toolblock\">\n" \
+			  "            <ul>\n" \
+			  "              <li id=\"smallA\" class=\"t_button\">A</li>\n" \
+			  "              <li id=\"medA\" class=\"t_button active\">A</li>\n" \
+			  "              <li id=\"bigA\" class=\"t_button\">A</li>\n" \
+			  "              <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \
+			  "                <span>Print</span></a></li>\n" \
+			  "            </ul>\n" \
+			  "          </div>\n" \
+			  "        </div>\n" \
+			  "        <div class=\"content\">\n"
+
+HTML.footer             = "        <!-- /div -->\n" \
+			  "        <div class=\"feedback t_button\">\n" \
+			  "          [+] Documentation Feedback</div>\n" \
+			  "      </div>\n" \
+			  "    </div>\n" \
+			  "    <div class=\"ft\">\n" \
+			  "      <span></span>\n" \
+			  "    </div>\n" \
+			  "  </div> \n" \
+			  "  <div class=\"footer\">\n" \
+			  "    <p>\n" \
+			  "      <acronym title=\"Copyright\">&copy;</acronym> 2008-2010 Nokia Corporation and/or its\n" \
+			  "      subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
+			  "      in Finland and/or other countries worldwide.</p>\n" \
+			  "    <p>\n" \
+			  "      All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
+			  "        href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
+                          "    <br />\n" \
+                          "    <p>\n" \
+                          "      Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
+                          "      Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
+                          "      with the terms contained in a written agreement between you and Nokia.</p>\n" \
+                          "    <p>\n" \
+                          "      Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
+                          "      Free Documentation License version 1.3</a>\n" \
+                          "      as published by the Free Software Foundation.</p>\n" \
+			  "  </div>\n" \
+			  "  <div id=\"feedbackBox\">\n" \
+			  "      <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
+			  "    <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
+			  "      <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \
+			  "      <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
+			  "    </form>\n" \
+			  "  </div>\n" \
+			  "  <div id=\"blurpage\">\n" \
+			  "  </div>\n"
Index: trunk/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf	(revision 846)
@@ -0,0 +1,177 @@
+HTML.stylesheets        =  style/style.css \
+                           style/OfflineStyle.css \
+                           style/style_ie7.css \
+                           style/style_ie8.css \
+                           style/style_ie6.css
+
+HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
+              "    <div class=\"content\"> \n" \
+              "    <div id=\"nav-logo\">\n" \
+              "      <a href=\"index.html\">Home</a></div>\n" \
+              "    <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
+              "     <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \
+              "     <fieldset>\n" \
+              "     <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \
+              "      </fieldset>\n" \
+              "     </form></div>\n" \
+              "    <div id=\"nav-topright\">\n" \
+              "      <ul>\n" \
+              "        <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \
+              "        <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \
+              "        <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \
+              "        <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \
+              "          DOC</a></li>\n" \
+              "        <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \
+              "        <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \
+              "      </ul>\n" \
+              "    </div>\n" \
+              "    <div id=\"shortCut\">\n" \
+              "      <ul>\n" \
+              "        <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \
+              "        <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \
+              "        </a></li>\n" \
+              "      </ul>\n" \
+              "     </div>\n" \
+             " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \
+            "        <li><a href=\"#\">API Lookup</a> \n" \
+            "            <ul id=\"topmenuLook\"> \n" \
+            "              <li><a href=\"classes.html\">ææç±»</a></li> \n" \
+            "             <li><a href=\"functions.html\">ææåœæ°</a></li> \n" \
+            "              <li><a href=\"modules.html\">Modules</a></li> \n" \
+            "              <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
+            "              <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \
+            "              <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \
+            "              </ul> \n" \
+            "        </li> \n" \
+            "        <li><a href=\"#\">Qt Topics</a> \n" \
+            "            <ul id=\"topmenuTopic\"> \n" \
+            "              <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \
+            "              <li><a href=\"declarativeui.html\">Device UI's &amp; Qt Quick</a></li> \n" \
+            "              <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \
+            "              <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
+            "            </ul> \n" \
+            "       </li> \n" \
+            "        <li><a href=\"#\">Examples</a> \n" \
+            "            <ul id=\"topmenuexample\"> \n" \
+            "                <li><a href=\"all-examples.html\">Examples</a></li> \n" \
+            "                <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \
+            "                <li><a href=\"demos.html\">Demos</a></li> \n" \
+            "                <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \
+            "                <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \
+            "            </ul> \n" \
+            "        </li> \n" \
+            " </ul> \n" \
+              "    </div>\n" \
+              "  </div>\n" \
+              "  <div class=\"wrapper\">\n" \
+              "    <div class=\"hd\">\n" \
+              "      <span></span>\n" \
+              "    </div>\n" \
+              "    <div class=\"bd group\">\n" \
+              "      <div class=\"sidebar\">\n" \
+              "        <div class=\"searchlabel\">\n" \
+              "          Search index:</div>\n" \
+              "        <div class=\"search\">\n" \
+              "          <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \
+              "            <fieldset>\n" \
+              "              <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \
+              "            </fieldset>\n" \
+              "          </form>\n" \
+              "        </div>\n" \
+              "        <div class=\"box first bottombar\" id=\"lookup\">\n" \
+              "          <h2 title=\"API Lookup\"><span></span>\n" \
+              "            API Lookup</h2>\n" \
+              "          <div  id=\"list001\" class=\"list\">\n" \
+              "          <ul id=\"ul001\" >\n" \
+              "              <li class=\"defaultLink\"><a href=\"classes.html\">ææç±»</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"functions.html\">ææåœæ°</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \
+              "            </ul> \n" \
+              "          </div>\n" \
+              "        </div>\n" \
+              "        <div class=\"box bottombar\" id=\"topics\">\n" \
+              "          <h2 title=\"Qt Topics\"><span></span>\n" \
+              "            Qt Topics</h2>\n" \
+              "          <div id=\"list002\" class=\"list\">\n" \
+              "            <ul id=\"ul002\" >\n" \
+              "              <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's &amp; Qt Quick</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \
+              "            </ul>  \n" \
+              "          </div>\n" \
+              "        </div>\n" \
+              "        <div class=\"box\" id=\"examples\">\n" \
+              "          <h2 title=\"Examples\"><span></span>\n" \
+              "            Examples</h2>\n" \
+              "          <div id=\"list003\" class=\"list\">\n" \
+              "        <ul id=\"ul003\">\n" \
+              "              <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \
+              "              <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \
+              "            </ul> \n" \
+              "          </div>\n" \
+              "        </div>\n" \
+              "      </div>\n" \
+              "      <div class=\"wrap\">\n" \
+              "        <div class=\"toolbar\">\n" \
+              "          <div class=\"breadcrumb toolblock\">\n" \
+              "            <ul>\n" \
+              "              <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
+              "              <!--  Bread crumbs goes here -->\n"
+
+HTML.postpostheader = "            </ul>\n" \
+              "          </div>\n" \
+              "          <div class=\"toolbuttons toolblock\">\n" \
+              "            <ul>\n" \
+              "              <li id=\"smallA\" class=\"t_button\">A</li>\n" \
+              "              <li id=\"medA\" class=\"t_button active\">A</li>\n" \
+              "              <li id=\"bigA\" class=\"t_button\">A</li>\n" \
+              "              <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \
+              "                <span>Print</span></a></li>\n" \
+              "            </ul>\n" \
+              "          </div>\n" \
+              "        </div>\n" \
+              "        <div class=\"content\">\n"
+
+HTML.footer = "        <!-- /div -->\n" \
+              "        <div class=\"feedback t_button\">\n" \
+              "          [+] Documentation Feedback</div>\n" \
+              "      </div>\n" \
+              "    </div>\n" \
+              "    <div class=\"ft\">\n" \
+              "      <span></span>\n" \
+              "    </div>\n" \
+              "  </div> \n" \
+              "  <div class=\"footer\">\n" \
+              "    <p>\n" \
+              "      <acronym title=\"Copyright\">&copy;</acronym> 2008-2010 Nokia Corporation and/or its\n" \
+              "      subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
+              "      in Finland and/or other countries worldwide.</p>\n" \
+              "    <p>\n" \
+              "      All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
+              "        href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
+              "    <br />\n" \
+              "    <p>\n" \
+              "      Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
+              "      Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
+              "      with the terms contained in a written agreement between you and Nokia.</p>\n" \
+              "    <p>\n" \
+              "      Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
+              "      Free Documentation License version 1.3</a>\n" \
+              "      as published by the Free Software Foundation.</p>\n" \
+              "  </div>\n" \
+              "  <div id=\"feedbackBox\">\n" \
+              "      <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
+              "    <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
+              "      <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \
+              "      <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
+              "    </form>\n" \
+              "  </div>\n" \
+              "  <div id=\"blurpage\">\n" \
+              "  </div>\n"
Index: trunk/tools/qdoc3/test/qt-webxml.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt-webxml.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt-webxml.qdocconf	(revision 846)
@@ -3,5 +3,6 @@
 quotinginformation      = true
 imagedirs               = $QTDIR/doc/src/images \
-                          $QTDIR/examples
+                          $QTDIR/examples \
+			  $QTDIR/doc/src/template/images
 
 outputdir               = $QTDIR/doc/webxml
Index: trunk/tools/qdoc3/test/qt.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt.qdocconf	(revision 769)
+++ trunk/tools/qdoc3/test/qt.qdocconf	(revision 846)
@@ -7,19 +7,16 @@
 project                 = Qt
 versionsym              =
-version                 = 4.6.3
+version                 = 4.7.2
 description             = Qt Reference Documentation
-url                     = http://qt.nokia.com/doc/4.6
+url                     = http://qt.nokia.com/doc/4.7
 
-edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \
-                          QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \
-                          QtDesigner QtAssistant QAxContainer Phonon \
-                          QAxServer QtUiTools QtTest QtDBus
-edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest
-edition.DesktopLight.groups       = -graphicsview-api
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = en_US
 
 qhp.projects            = Qt
 
 qhp.Qt.file                = qt.qhp
-qhp.Qt.namespace           = com.trolltech.qt.460
+qhp.Qt.namespace           = com.trolltech.qt.472
 qhp.Qt.virtualFolder       = qdoc
 qhp.Qt.indexTitle          = Qt Reference Documentation
@@ -28,19 +25,51 @@
 # Files not referenced in any qdoc file (last four are needed by qtdemo)
 # See also extraimages.HTML
-qhp.Qt.extraFiles          = classic.css \
-                             images/qt-logo.png \
-                             images/taskmenuextension-example.png \
-                             images/coloreditorfactoryimage.png \
-                             images/dynamiclayouts-example.png \
-                             images/stylesheet-coffee-plastique.png
+qhp.Qt.extraFiles          = index.html \
+                 images/bg_l.png \
+                 images/bg_l_blank.png \
+                 images/bg_ll_blank.png \
+                 images/bg_ul_blank.png \
+                 images/header_bg.png \
+                 images/bg_r.png \
+                 images/box_bg.png \
+                 images/breadcrumb.png \
+                 images/bullet_gt.png \
+                 images/bullet_dn.png \
+                 images/bullet_sq.png \
+                 images/bullet_up.png \
+                 images/arrow_down.png \
+                 images/feedbackground.png \
+                 images/horBar.png \
+                 images/page.png \
+                 images/page_bg.png \
+                 images/sprites-combined.png \
+                 images/spinner.gif \
+                 images/stylesheet-coffee-plastique.png \
+                 images/taskmenuextension-example.png \
+                 images/coloreditorfactoryimage.png \
+                 images/dynamiclayouts-example.png \
+                 scripts/functions.js \
+                 scripts/jquery.js \
+                 scripts/narrow.js \
+                 scripts/superfish.js \
+                 style/narrow.css \
+                 style/superfish.css \
+                 style/style_ie6.css \
+                 style/style_ie7.css \
+                 style/style_ie8.css \
+                 style/style.css
 
-qhp.Qt.filterAttributes    = qt 4.6.3 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.6.3
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.3
-qhp.Qt.subprojects         = classes overviews examples
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.subprojects         = classes qmlelements overviews examples
 qhp.Qt.subprojects.classes.title = Classes
 qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
 qhp.Qt.subprojects.classes.selectors = class fake:headerfile
 qhp.Qt.subprojects.classes.sortPages = true
+qhp.Qt.subprojects.qmlelements.title = QML Elements
+qhp.Qt.subprojects.qmlelements.indexTitle = QML Elements
+qhp.Qt.subprojects.qmlelements.selectors = fake:qmlclass
+qhp.Qt.subprojects.qmlelements.sortPages = true
 qhp.Qt.subprojects.overviews.title = Overviews
 qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
@@ -79,4 +108,5 @@
                           $QTDIR/src/3rdparty/harfbuzz \
                           $QTDIR/src/3rdparty/kdebase \
+                          $QTDIR/src/3rdparty/libconninet \
                           $QTDIR/src/3rdparty/libjpeg \
                           $QTDIR/src/3rdparty/libmng \
@@ -92,13 +122,15 @@
                           $QTDIR/src/3rdparty/wintab \
                           $QTDIR/src/3rdparty/zlib \
-                          $QTDIR/doc/src/snippets \
                           $QTDIR/src/3rdparty/phonon/gstreamer \
                           $QTDIR/src/3rdparty/phonon/ds9 \
                           $QTDIR/src/3rdparty/phonon/qt7 \
                           $QTDIR/src/3rdparty/phonon/mmf \
-                          $QTDIR/src/3rdparty/phonon/waveout
+                          $QTDIR/src/3rdparty/phonon/waveout \
+                          $QTDIR/doc/src/snippets \
+                          $QTDIR/doc/src/ja_JP \
+                          $QTDIR/doc/src/zh_CN
 
 sources.fileextensions  = "*.cpp *.qdoc *.mm"
-examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml"
 examples.imageextensions = "*.png"
 
@@ -110,5 +142,7 @@
                           $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
 imagedirs               = $QTDIR/doc/src/images \
-                          $QTDIR/examples
+                          $QTDIR/examples \
+                          $QTDIR/doc/src/declarative/pics \
+                          $QTDIR/doc/src/template/images
 outputdir               = $QTDIR/doc/html
 tagfile                 = $QTDIR/doc/html/qt.tags
Index: trunk/tools/qdoc3/test/qt_ja_JP.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt_ja_JP.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt_ja_JP.qdocconf	(revision 846)
@@ -0,0 +1,118 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates_ja_JP.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qt
+versionsym              =
+version                 = 4.7.2
+description             = Qt ãªãã¡ã¬ã³ã¹ãã­ã¥ã¡ã³ã
+url                     = http://qt.nokia.com/doc/ja_JP/4.7
+
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = ja
+
+indexes                 = $QTDIR/doc/html/qt.index
+
+qhp.projects            = Qt
+
+qhp.Qt.file                = qt.qhp
+qhp.Qt.namespace           = com.trolltech.qt.472
+qhp.Qt.virtualFolder       = qdoc
+qhp.Qt.title               = Qt
+qhp.Qt.indexTitle          = Qt
+qhp.Qt.selectors           = fake:example
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc ja_JP
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = index.html \
+			    images/bg_l.png \
+			    images/bg_l_blank.png \
+			    images/bg_ll_blank.png \
+			    images/bg_ul_blank.png \
+			    images/header_bg.png \
+			    images/bg_r.png \
+			    images/box_bg.png \
+			    images/breadcrumb.png \
+			    images/bullet_gt.png \
+			    images/bullet_dn.png \
+			    images/bullet_sq.png \
+			    images/bullet_up.png \
+			    images/arrow_down.png \
+			    images/feedbackground.png \
+			    images/horBar.png \
+			    images/page.png \
+			    images/page_bg.png \
+			    images/sprites-combined.png \
+			    images/spinner.gif \
+			    images/stylesheet-coffee-plastique.png \
+			    images/taskmenuextension-example.png \
+			    images/coloreditorfactoryimage.png \
+			    images/dynamiclayouts-example.png \
+			    scripts/functions.js \
+			    scripts/jquery.js \
+			    scripts/narrow.js \
+			    scripts/superfish.js \
+			    style/narrow.css \
+			    style/superfish.css \
+			    style/style_ie6.css \
+			    style/style_ie7.css \
+			    style/style_ie8.css \
+			    style/style.css
+
+language                = Cpp
+
+sourcedirs              = $QTDIR/doc/src/ja_JP
+
+excludedirs             = $QTDIR/src/3rdparty/clucene \
+                          $QTDIR/src/3rdparty/des \
+                          $QTDIR/src/3rdparty/freetype \
+                          $QTDIR/src/3rdparty/harfbuzz \
+                          $QTDIR/src/3rdparty/kdebase \
+                          $QTDIR/src/3rdparty/libjpeg \
+                          $QTDIR/src/3rdparty/libmng \
+                          $QTDIR/src/3rdparty/libpng \
+                          $QTDIR/src/3rdparty/libtiff \
+                          $QTDIR/src/3rdparty/md4 \
+                          $QTDIR/src/3rdparty/md5 \
+                          $QTDIR/src/3rdparty/patches \
+                          $QTDIR/src/3rdparty/sha1 \
+                          $QTDIR/src/3rdparty/sqlite \
+                          $QTDIR/src/3rdparty/webkit/JavaScriptCore \
+                          $QTDIR/src/3rdparty/webkit/WebCore \
+                          $QTDIR/src/3rdparty/wintab \
+                          $QTDIR/src/3rdparty/zlib \
+                          $QTDIR/doc/src/snippets \
+                          $QTDIR/doc/src/zh_CN \
+                          $QTDIR/src/3rdparty/phonon/gstreamer \
+                          $QTDIR/src/3rdparty/phonon/ds9 \
+                          $QTDIR/src/3rdparty/phonon/qt7 \
+                          $QTDIR/src/3rdparty/phonon/mmf \
+                          $QTDIR/src/3rdparty/phonon/waveout
+
+sources.fileextensions  = "*.cpp *.qdoc *.mm"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.imageextensions = "*.png"
+
+exampledirs             = $QTDIR/doc/src \
+                          $QTDIR/examples/ja_JP \
+                          $QTDIR/examples \
+                          $QTDIR/examples/tutorials \
+                          $QTDIR \
+                          $QTDIR/qmake/examples \
+                          $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QTDIR/doc/src/ja_JP/images \
+                          $QTDIR/doc/src/images \
+                          $QTDIR/examples \
+			  $QTDIR/doc/src/template/images
+outputdir               = $QTDIR/doc/html_ja_JP
+tagfile                 = $QTDIR/doc/html_ja_JP/qt.tags
+base                    = file:$QTDIR/doc/html_ja_JP
+
+HTML.generatemacrefs    = "true"
Index: trunk/tools/qdoc3/test/qt_zh_CN.qdocconf
===================================================================
--- trunk/tools/qdoc3/test/qt_zh_CN.qdocconf	(revision 846)
+++ trunk/tools/qdoc3/test/qt_zh_CN.qdocconf	(revision 846)
@@ -0,0 +1,116 @@
+include(compat.qdocconf)
+include(macros.qdocconf)
+include(qt-cpp-ignore.qdocconf)
+include(qt-html-templates_zh_CN.qdocconf)
+include(qt-defines.qdocconf)
+
+project                 = Qt
+versionsym              =
+version                 = 4.7.2
+description             = Qt Reference Documentation
+url                     = http://qt.nokia.com/doc/zh_CN/4.7
+
+sourceencoding          = UTF-8
+outputencoding          = UTF-8
+naturallanguage         = zh-Hans
+
+indexes                 = $QTDIR/doc/html/qt.index
+
+qhp.projects            = Qt
+
+qhp.Qt.file                = qt.qhp
+qhp.Qt.namespace           = com.trolltech.qt.472
+qhp.Qt.virtualFolder       = qdoc
+qhp.Qt.title               = æçš
+qhp.Qt.indexTitle          = æçš
+qhp.Qt.selectors           = fake:example
+
+qhp.Qt.filterAttributes    = qt 4.7.2 qtrefdoc zh_CN
+qhp.Qt.customFilters.Qt.name = Qt 4.7.2
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+
+# Files not referenced in any qdoc file (last four are needed by qtdemo)
+# See also extraimages.HTML
+qhp.Qt.extraFiles          = index.html \
+                             images/bg_l.png \
+                             images/bg_l_blank.png \
+							 images/bg_ll_blank.png \
+							 images/bg_ul_blank.png \
+							 images/header_bg.png \
+                             images/bg_r.png \
+                             images/box_bg.png \
+                             images/breadcrumb.png \
+                             images/bullet_gt.png \
+                             images/bullet_dn.png \
+                             images/bullet_sq.png \
+                             images/bullet_up.png \
+                             images/arrow_down.png \
+                             images/feedbackground.png \
+                             images/horBar.png \
+                             images/page.png \
+                             images/page_bg.png \
+                             images/sprites-combined.png \
+                             images/spinner.gif \
+                             images/stylesheet-coffee-plastique.png \
+                             images/taskmenuextension-example.png \
+                             images/coloreditorfactoryimage.png \
+                             images/dynamiclayouts-example.png \
+                             scripts/functions.js \
+                             scripts/jquery.js \
+                             scripts/narrow.js \
+                             scripts/superfish.js \
+                             style/narrow.css \
+                             style/superfish.css \
+                             style/style_ie6.css \
+                             style/style_ie7.css \
+                             style/style_ie8.css \
+                             style/style.css
+
+language                = Cpp
+
+sourcedirs              = $QTDIR/doc/src/zh_CN
+
+excludedirs             = $QTDIR/src/3rdparty/clucene \
+                          $QTDIR/src/3rdparty/des \
+                          $QTDIR/src/3rdparty/freetype \
+                          $QTDIR/src/3rdparty/harfbuzz \
+                          $QTDIR/src/3rdparty/kdebase \
+                          $QTDIR/src/3rdparty/libjpeg \
+                          $QTDIR/src/3rdparty/libmng \
+                          $QTDIR/src/3rdparty/libpng \
+                          $QTDIR/src/3rdparty/libtiff \
+                          $QTDIR/src/3rdparty/md4 \
+                          $QTDIR/src/3rdparty/md5 \
+                          $QTDIR/src/3rdparty/patches \
+                          $QTDIR/src/3rdparty/sha1 \
+                          $QTDIR/src/3rdparty/sqlite \
+                          $QTDIR/src/3rdparty/webkit/JavaScriptCore \
+                          $QTDIR/src/3rdparty/webkit/WebCore \
+                          $QTDIR/src/3rdparty/wintab \
+                          $QTDIR/src/3rdparty/zlib \
+                          $QTDIR/doc/src/snippets \
+                          $QTDIR/doc/src/ja_JP \
+                          $QTDIR/src/3rdparty/phonon/gstreamer \
+                          $QTDIR/src/3rdparty/phonon/ds9 \
+                          $QTDIR/src/3rdparty/phonon/qt7 \
+                          $QTDIR/src/3rdparty/phonon/mmf \
+                          $QTDIR/src/3rdparty/phonon/waveout
+
+sources.fileextensions  = "*.cpp *.qdoc *.mm"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.imageextensions = "*.png"
+
+exampledirs             = $QTDIR/doc/src \
+                          $QTDIR/examples \
+                          $QTDIR/examples/tutorials \
+                          $QTDIR \
+                          $QTDIR/qmake/examples \
+                          $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
+imagedirs               = $QTDIR/doc/src/images \
+                          $QTDIR/examples \
+			  $QTDIR/doc/src/template/images
+outputdir               = $QTDIR/doc/html_zh_CN
+tagfile                 = $QTDIR/doc/html_zh_CN/qt.tags
+base                    = file:$QTDIR/doc/html_zh_CN
+
+HTML.generatemacrefs    = "true"
Index: trunk/tools/qdoc3/test/scripts/functions.js
===================================================================
--- trunk/tools/qdoc3/test/scripts/functions.js	(revision 846)
+++ trunk/tools/qdoc3/test/scripts/functions.js	(revision 846)
@@ -0,0 +1,60 @@
+
+/* START non link areas where cursor should change to pointing hand */
+$('.t_button').mouseover(function() {
+    $('.t_button').css('cursor','pointer');
+		/*document.getElementById(this.id).style.cursor='pointer';*/
+});
+
+/* END non link areas  */
+$('#smallA').click(function() {
+		$('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller');
+		$('.t_button').removeClass('active')
+		$(this).addClass('active')
+});
+
+$('#medA').click(function() {
+		$('.content .heading').css('font','600 16px/1 Arial');
+		$('.content h1').css('font','600 18px/1.2 Arial');
+		$('.content h2').css('font','600 16px/1.2 Arial');
+		$('.content h3').css('font','600 14px/1.2 Arial');
+		$('.content p').css('font','13px/20px Verdana');
+		$('.content li').css('font','400 13px/1 Verdana');
+		$('.content li').css('line-height','14px');
+		$('.content table').css('font','13px/1.2 Verdana');
+		$('.content .heading').css('font','600 16px/1 Arial');
+		$('.content .indexboxcont li').css('font','600 13px/1 Verdana');
+		$('.t_button').removeClass('active')
+		$(this).addClass('active')
+});
+
+$('#bigA').click(function() {
+		$('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','large');
+		$('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('line-height','25px');
+		$('.t_button').removeClass('active')
+		$(this).addClass('active')
+});
+
+function doSearch(str){
+
+if (str.length>3)
+  {
+  alert('start search');
+ // document.getElementById("refWrapper").innerHTML="";
+  return;
+  }
+ else
+  return;
+    
+//    var url="indexSearch.php";
+//    url=url+"?q="+str;
+ //   url=url+"&sid="+Math.random();
+   // var url="http://localhost:8983/solr/select?";
+   // url=url+"&q="+str;
+   // url=url+"&fq=&start=0&rows=10&fl=&qt=&wt=&explainOther=&hl.fl=";
+    
+  //  $.get(url, function(data){ 
+   // alert(data);
+  // document.getElementById("refWrapper").innerHTML=data; 
+ //});
+   
+}
Index: trunk/tools/qdoc3/test/scripts/jquery.js
===================================================================
--- trunk/tools/qdoc3/test/scripts/jquery.js	(revision 846)
+++ trunk/tools/qdoc3/test/scripts/jquery.js	(revision 846)
@@ -0,0 +1,152 @@
+/*!
+ * jQuery JavaScript Library v1.4.1
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon Jan 25 19:43:33 2010 -0500
+ */
+(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n<j;n++)e(a[n],b,f?d.call(a[n],n,e(a[n],b)):d,i);return a}return j?
+e(a[0],b):null}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function ma(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function na(a){var b,d=[],f=[],e=arguments,i,j,n,o,m,s,x=c.extend({},c.data(this,"events").live);if(!(a.button&&a.type==="click")){for(o in x){j=x[o];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f,
+a.currentTarget);m=0;for(s=i.length;m<s;m++)for(o in x){j=x[o];n=i[m].elem;f=null;if(i[m].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==n)d.push({elem:n,fn:j})}}m=0;for(s=d.length;m<s;m++){i=d[m];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}}function oa(a,b){return"live."+(a?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function pa(a){return!a||!a.parentNode||a.parentNode.nodeType===
+11}function qa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ra(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0&&(c.support.checkClone||!sa.test(a[0]))){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r;f=b.createDocumentFragment();
+c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(ta.concat.apply([],ta.slice(0,b)),function(){d[this]=a});return d}function ua(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Na=z.jQuery,Oa=z.$,r=z.document,S,Pa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent,
+va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]],
+[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a,
+this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this,
+a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};
+c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];n=e[i];if(a!==n)if(f&&n&&(c.isPlainObject(n)||c.isArray(n))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(n)?[]:{};a[i]=c.extend(f,j,n)}else if(n!==v)a[i]=n}return a};c.extend({noConflict:function(a){z.$=
+Oa;if(a)z.jQuery=Na;return c},isReady:false,ready:function(){if(!c.isReady){if(!r.body)return setTimeout(c.ready,13);c.isReady=true;if(P){for(var a,b=0;a=P[b++];)a.call(r,c);P=null}c.fn.triggerHandler&&c(r).triggerHandler("ready")}},bindReady:function(){if(!va){va=true;if(r.readyState==="complete")return c.ready();if(r.addEventListener){r.addEventListener("DOMContentLoaded",L,false);z.addEventListener("load",c.ready,false)}else if(r.attachEvent){r.attachEvent("onreadystatechange",L);z.attachEvent("onload",
+c.ready);var a=false;try{a=z.frameElement==null}catch(b){}r.documentElement.doScroll&&a&&la()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===v||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;
+return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
+r.documentElement,d=r.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(r.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===v||c.isFunction(a);if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=
+a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Sa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==
+v;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=v}else if(b&&!c.isFunction(b)){d=b;b=v}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},
+uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});O=c.uaMatch(O);if(O.browser){c.browser[O.browser]=true;c.browser.version=O.version}if(c.browser.webkit)c.browser.safari=true;if(wa)c.inArray=function(a,b){return wa.call(b,a)};S=c(r);if(r.addEventListener)L=function(){r.removeEventListener("DOMContentLoaded",
+L,false);c.ready()};else if(r.attachEvent)L=function(){if(r.readyState==="complete"){r.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=r.documentElement,b=r.createElement("script"),d=r.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support=
+{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};
+b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=r.createDocumentFragment();a.appendChild(d.firstChild);
+c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props=
+{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true,
+{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,
+a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);
+return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||
+a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=
+c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,n=b.length;j<n;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=c(this);m.removeClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(ca),
+d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(ya," "),j=0,n=b.length;j<n;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),n=b,o=
+a.split(ca);e=o[i++];){n=f?n:!j.hasClass(e);j[n?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ya," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||
+{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(za.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Wa,"")}return v}var n=c.isFunction(a);return this.each(function(o){var m=c(this),s=a;if(this.nodeType===1){if(n)s=a.call(this,o,m.val());
+if(typeof s==="number")s+="";if(c.isArray(s)&&za.test(this.type))this.checked=c.inArray(m.val(),s)>=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d);
+f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=
+""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j=
+function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a,
+d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+
+s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a,
+"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,
+b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b,
+d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b=
+0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};
+c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b=
+a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!==
+"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this,
+"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"||
+d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a=
+a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,
+f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a,
+b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+
+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e){var i,j=0;if(c.isFunction(f)){e=f;f=v}for(d=(d||"").split(/\s+/);(i=d[j++])!=null;){i=i==="focus"?"focusin":i==="blur"?"focusout":i==="hover"?d.push("mouseleave")&&"mouseenter":i;b==="live"?c(this.context).bind(oa(i,this.selector),{data:f,selector:this.selector,
+live:i},e):c(this.context).unbind(oa(i,this.selector),e?{guid:e.guid+this.selector+i}:null)}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});z.attachEvent&&!z.addEventListener&&z.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g){for(var h="",k,l=0;g[l];l++){k=g[l];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===k){y=l[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=k;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}l[q]=y}}}function d(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===
+k){y=l[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=k;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(o.filter(h,[t]).length>0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||
+typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u=
+l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&
+y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};o.matches=function(g,h){return o(g,null,null,h)};o.find=function(g,h,k){var l,q;if(!g)return[];for(var p=0,u=m.order.length;p<u;p++){var t=m.order[p];if(q=m.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");l=m.find[t](q,
+h,k);if(l!=null){g=g.replace(m.match[t],"");break}}}}l||(l=h.getElementsByTagName("*"));return{set:l,expr:g}};o.filter=function(g,h,k,l){for(var q=g,p=[],u=h,t,y,R=h&&h[0]&&w(h[0]);g&&h.length;){for(var H in m.filter)if((t=m.leftMatch[H].exec(g))!=null&&t[2]){var M=m.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(u===p)p=[];if(m.preFilter[H])if(t=m.preFilter[H](t,u,k,p,l,R)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=u[U])!=null;U++)if(D){I=M(D,t,U,u);var Da=
+l^!!I;if(k&&I!=null)if(Da)y=true;else u[U]=false;else if(Da){p.push(D);y=true}}if(I!==v){k||(u=p);g=g.replace(m.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)o.error(g);else break;q=g}return u};o.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var m=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var k=typeof h==="string",l=k&&!/\W/.test(h);k=k&&!l;if(l)h=h.toLowerCase();l=0;for(var q=g.length,
+p;l<q;l++)if(p=g[l]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[l]=k||p&&p.nodeName.toLowerCase()===h?p||false:p===h}k&&o.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l<q;l++){var p=g[l];if(p){k=p.parentNode;g[l]=k.nodeName.toLowerCase()===h?k:false}}}else{l=0;for(q=g.length;l<q;l++)if(p=g[l])g[l]=k?p.parentNode:p.parentNode===h;k&&o.filter(h,g,true)}},"":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=
+h=h.toLowerCase();q=b}q("parentNode",h,l,g,p,k)},"~":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,l,g,p,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];h=h.getElementsByName(g[1]);for(var l=0,q=h.length;l<q;l++)h[l].getAttribute("name")===g[1]&&k.push(h[l]);return k.length===0?null:k}},
+TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,l,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var u;(u=h[p])!=null;p++)if(u)if(q^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&
+"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);
+return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===
+g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2===
+0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k<l;k++)if(h[k]===g)return false;return true}else o.error("Syntax error, unrecognized expression: "+
+q)},CHILD:function(g,h){var k=h[1],l=g;switch(k){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(k==="first")return true;l=g;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":k=h[2];var q=h[3];if(k===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var u=0;for(l=p.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++u;p.sizcache=h}g=g.nodeIndex-q;return k===0?g===0:g%k===0&&g/k>=
+0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="?
+k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};
+try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k<l;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var C;if(r.documentElement.compareDocumentPosition)C=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===
+h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in r.documentElement)C=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(r.createRange)C=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),l=h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);l.setStart(h,0);l.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END,
+l);if(g===0)j=true;return g};(function(){var g=r.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id");
+return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href",
+2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
+0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[],
+l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)o(g,h[q],k);return o.filter(l,k)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.getText=a;c.isXMLDoc=w;c.contains=E})();var bb=/Until$/,cb=/^(?:parents|prevUntil|prevAll)/,db=/,/;Q=Array.prototype.slice;var Ea=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a,
+function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Qa.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=
+0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ea(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e<n;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)>
+-1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),
+a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},
+nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):
+e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==
+b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ia=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],
+col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)},
+wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?
+d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,
+false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&
+!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(Ha.exec(a)||
+["",""])[1].toLowerCase()]){a=a.replace(Ga,Ia);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,
+b,f))});else a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(s){return c.nodeName(s,"table")?s.getElementsByTagName("tbody")[0]||s.appendChild(s.ownerDocument.createElement("tbody")):s}var e,i,j=a[0],n=[];if(!c.support.checkClone&&arguments.length===3&&typeof j===
+"string"&&sa.test(j))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(j))return this.each(function(s){var x=c(this);a[0]=j.call(this,s,b?x.html():v);x.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ra(a,this,n);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var o=0,m=this.length;o<m;o++)d.call(b?f(this[o],i):this[o],e.cacheable||this.length>1||o>0?e.fragment.cloneNode(true):e.fragment)}n&&c.each(n,
+Ma)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){c.cleanData(this.getElementsByTagName("*"));c.cleanData([this])}this.parentNode&&
+this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&c.cleanData(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||r;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||r;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j===
+"string"){j=j.replace(Ga,Ia);var n=(Ha.exec(j)||["",""])[1].toLowerCase(),o=F[n]||F._default,m=o[0];i=b.createElement("div");for(i.innerHTML=o[1]+j+o[2];m--;)i=i.lastChild;if(!c.support.tbody){m=fb.test(j);n=n==="table"&&!m?i.firstChild&&i.firstChild.childNodes:o[1]==="<table>"&&!m?i.childNodes:[];for(o=n.length-1;o>=0;--o)c.nodeName(n[o],"tbody")&&!n[o].childNodes.length&&n[o].parentNode.removeChild(n[o])}!c.support.leadingWhitespace&&V.test(j)&&i.insertBefore(b.createTextNode(V.exec(j)[0]),i.firstChild);
+j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()==="text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e},cleanData:function(a){for(var b=0,d;(d=a[b])!=null;b++){c.event.remove(d);c.removeData(d)}}});var hb=/z-?index|font-?weight|opacity|zoom|line-?height/i,
+Ja=/alpha\([^)]*\)/,Ka=/opacity=([^)]*)/,ga=/float/i,ha=/-([a-z])/ig,ib=/([A-Z])/g,jb=/^-?\d+(?:px)?$/i,kb=/^-?\d/,lb={position:"absolute",visibility:"hidden",display:"block"},mb=["Left","Right"],nb=["Top","Bottom"],ob=r.defaultView&&r.defaultView.getComputedStyle,La=c.support.cssFloat?"cssFloat":"styleFloat",ia=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===v)return c.curCSS(d,f);if(typeof e==="number"&&!hb.test(f))e+="px";c.style(d,f,e)})};
+c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(d)<0)d=v;var f=a.style||a,e=d!==v;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ja.test(a)?a.replace(Ja,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ka.exec(f.filter)[1])/100+"":""}if(ga.test(b))b=La;b=b.replace(ha,ia);if(e)f[b]=d;return f[b]},css:function(a,
+b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?mb:nb;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,lb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&
+a.currentStyle){f=Ka.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ga.test(b))b=La;if(!d&&e&&e[b])f=e[b];else if(ob){if(ga.test(b))b="float";b=b.replace(ib,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ha,ia);f=a.currentStyle[b]||a.currentStyle[d];if(!jb.test(f)&&kb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=
+a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var pb=
+J(),qb=/<script(.|\s)*?\/script>/gi,rb=/select|textarea/i,sb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ja=/\?/,tb=/(\?|&)_=.*?(&|$)/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=
+c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(j,n){if(n==="success"||n==="notmodified")i.html(e?c("<div />").append(j.responseText.replace(qb,"")).find(e):j.responseText);d&&i.each(d,[j.responseText,n,j])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&
+(this.checked||rb.test(this.nodeName)||sb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,
+b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:z.XMLHttpRequest&&(z.location.protocol!=="file:"||!z.ActiveXObject)?function(){return new z.XMLHttpRequest}:
+function(){try{return new z.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(o,n,j,w);e.global&&f("ajaxSuccess",[w,e])}function d(){e.complete&&e.complete.call(o,w,j);e.global&&f("ajaxComplete",[w,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}
+function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,n,o=a&&a.context||e,m=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(m==="GET")N.test(e.url)||(e.url+=(ja.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||
+N.test(e.url))){i=e.jsonpCallback||"jsonp"+pb++;if(e.data)e.data=(e.data+"").replace(N,"="+i+"$1");e.url=e.url.replace(N,"="+i+"$1");e.dataType="script";z[i]=z[i]||function(q){n=q;b();d();z[i]=v;try{delete z[i]}catch(p){}A&&A.removeChild(B)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&m==="GET"){var s=J(),x=e.url.replace(tb,"$1_="+s+"$2");e.url=x+(x===e.url?(ja.test(e.url)?"&":"?")+"_="+s:"")}if(e.data&&m==="GET")e.url+=(ja.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&
+c.event.trigger("ajaxStart");s=(s=ub.exec(e.url))&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType==="script"&&m==="GET"&&s){var A=r.getElementsByTagName("head")[0]||r.documentElement,B=r.createElement("script");B.src=e.url;if(e.scriptCharset)B.charset=e.scriptCharset;if(!i){var C=false;B.onload=B.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;b();d();B.onload=B.onreadystatechange=null;A&&B.parentNode&&
+A.removeChild(B)}}}A.insertBefore(B,A.firstChild);return v}var E=false,w=e.xhr();if(w){e.username?w.open(m,e.url,e.async,e.username,e.password):w.open(m,e.url,e.async);try{if(e.data||a&&a.contentType)w.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&w.setRequestHeader("If-None-Match",c.etag[e.url])}s||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",
+e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(fa){}if(e.beforeSend&&e.beforeSend.call(o,w,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");w.abort();return false}e.global&&f("ajaxSend",[w,e]);var g=w.onreadystatechange=function(q){if(!w||w.readyState===0||q==="abort"){E||d();E=true;if(w)w.onreadystatechange=c.noop}else if(!E&&w&&(w.readyState===4||q==="timeout")){E=true;w.onreadystatechange=c.noop;j=q==="timeout"?"timeout":!c.httpSuccess(w)?
+"error":e.ifModified&&c.httpNotModified(w,e.url)?"notmodified":"success";var p;if(j==="success")try{n=c.httpData(w,e.dataType,e)}catch(u){j="parsererror";p=u}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,w,j,p);d();q==="timeout"&&w.abort();if(e.async)w=null}};try{var h=w.abort;w.abort=function(){w&&h.call(w);g("abort")}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){w&&!E&&g("timeout")},e.timeout);try{w.send(m==="POST"||m==="PUT"||m==="DELETE"?e.data:null)}catch(l){c.handleError(e,
+w,null,l);d()}e.async||g();return w}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=
+f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(j,n){if(c.isArray(n))c.each(n,
+function(o,m){b?f(j,m):d(j+"["+(typeof m==="object"||c.isArray(m)?o:"")+"]",m)});else!b&&n!=null&&typeof n==="object"?c.each(n,function(o,m){d(j+"["+o+"]",m)}):f(j,n)}function f(j,n){n=c.isFunction(n)?n():n;e[e.length]=encodeURIComponent(j)+"="+encodeURIComponent(n)}var e=[];if(b===v)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var i in a)d(i,a[i]);return e.join("&").replace(vb,"+")}});var ka={},wb=/toggle|show|hide/,xb=/^([+-]=)?([\d+-.]+)(.*)$/,
+W,ta=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(ka[d])f=ka[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();
+ka[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&
+c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,n=this.nodeType===1&&c(this).is(":hidden"),
+o=this;for(j in a){var m=j.replace(ha,ia);if(j!==m){a[m]=a[j];delete a[j];j=m}if(a[j]==="hide"&&n||a[j]==="show"&&!n)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(s,x){var A=new c.fx(o,i,s);if(wb.test(x))A[x==="toggle"?n?"show":"hide":x](a);
+else{var B=xb.exec(x),C=A.cur(true)||0;if(B){x=parseFloat(B[2]);var E=B[3]||"px";if(E!=="px"){o.style[s]=(x||1)+E;C=(x||1)/A.cur(true)*C;o.style[s]=C+E}if(B[1])x=(B[1]==="-="?-1:1)*x+C;A.custom(C,x,E)}else A.custom(C,x,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",
+1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,
+b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==
+null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop===
+"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=
+this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=
+c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=
+null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),
+f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=
+b,e=b.ownerDocument,i,j=e.documentElement,n=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,m=b.offsetLeft;(b=b.parentNode)&&b!==n&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;m-=b.scrollLeft;if(b===d){o+=b.offsetTop;m+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){o+=parseFloat(i.borderTopWidth)||
+0;m+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){o+=parseFloat(i.borderTopWidth)||0;m+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){o+=n.offsetTop;m+=n.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){o+=Math.max(j.scrollTop,n.scrollTop);m+=Math.max(j.scrollLeft,n.scrollLeft)}return{top:o,left:m}};c.offset={initialize:function(){var a=r.body,b=r.createElement("div"),
+d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);
+d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop},
+bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left-
+e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=
+this.offsetParent||r.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==v)return this.each(function(){if(i=ua(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=ua(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}});
+c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(i){var j=c(this);j[d](f.call(this,i,j[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||
+e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===v?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});z.jQuery=z.$=c})(window);
Index: trunk/tools/qdoc3/test/style/style.css
===================================================================
--- trunk/tools/qdoc3/test/style/style.css	(revision 846)
+++ trunk/tools/qdoc3/test/style/style.css	(revision 846)
@@ -0,0 +1,1051 @@
+@media screen
+{
+    html
+    {
+        color: #000000;
+        background: #FFFFFF;
+    }
+    body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td
+    {
+        margin: 0;
+        padding: 0;
+    }
+    table
+    {
+        border-collapse: collapse;
+        border-spacing: 0;
+    }
+    fieldset, img
+    {
+        border: 0;
+    }
+    address, caption, cite, code, dfn, em, strong, th, var, optgroup
+    {
+        font-style: inherit;
+        font-weight: inherit;
+    }
+    del, ins
+    {
+        text-decoration: none;
+    }
+    li
+    {
+        list-style: none;
+    }
+    caption, th
+    {
+        text-align: left;
+    }
+    h1, h2, h3, h4, h5, h6
+    {
+        font-size: 100%;
+        font-weight: normal;
+    }
+    q:before, q:after
+    {
+        content: '';
+    }
+    abbr, acronym
+    {
+        border: 0;
+        font-variant: normal;
+    }
+    sup
+    {
+        vertical-align: baseline;
+    }
+    sub
+    {
+        vertical-align: baseline;
+    }
+    .heading
+    {
+        font: normal 600 16px/1.0 Arial;
+        padding-bottom: 15px;
+    }
+    .subtitle
+    {
+        font-size: 13px;
+    }
+    .small-subtitle
+    {
+        font-size: 13px;
+    }
+    legend
+    {
+        color: #000000;
+    }
+    input, button, textarea, select, optgroup, option
+    {
+        font-family: inherit;
+        font-size: inherit;
+        font-style: inherit;
+        font-weight: inherit;
+    }
+    input, button, textarea, select
+    {
+        font-size: 100%;
+    }
+    html
+    {
+        background-color: #e5e5e5;
+    }
+    body
+    {
+        background: #e6e7e8 url(../images/page_bg.png) repeat-x 0 0;
+        font: normal 13px/1.2 Verdana;
+        color: #363534;
+    }
+    strong
+    {
+        font-weight: bold;
+    }
+    em
+    {
+        font-style: italic;
+    }
+    a
+    {
+        color: #00732f;
+        text-decoration: none;
+    }
+    .header, .footer, .wrapper
+    {
+        min-width: 600px;
+        max-width: 1500px;
+        margin: 0 30px;
+    }
+    .wrapper
+    {
+        background: url(../images/bg_r.png) repeat-y 100% 0;
+    }
+    .wrapper .hd
+    {
+        padding-left: 216px;
+        height: 15px;
+        background: url(../images/page.png) no-repeat 0 0;
+        overflow: hidden;
+    }
+    .offline .wrapper .hd
+    {
+        background: url(../images/page.png) no-repeat 0 -15px;
+    }
+    .wrapper .hd span
+    {
+        height: 15px;
+        display: block;
+        overflow: hidden;
+        background: url(../images/page.png) no-repeat 100% -30px;
+    }
+    .wrapper .bd
+    {
+        background: url(../images/bg_l.png) repeat-y 0 0;
+        position: relative;
+    }
+    .offline .wrapper .bd
+    {
+        background: url(../images/bg_l_blank.png) repeat-y 0 0;
+    }
+    .wrapper .ft
+    {
+        padding-left: 216px;
+        height: 15px;
+        background: url(../images/page.png) no-repeat 0 -75px;
+        overflow: hidden;
+    }
+    .offline .wrapper .ft
+    {
+        background: url(../images/page.png) no-repeat 0 -90px;
+    }
+    .wrapper .ft span
+    {
+        height: 15px;
+        display: block;
+        background: url(../images/page.png) no-repeat 100% -60px;
+        overflow: hidden;
+    }
+    .header, .footer
+    {
+        display: block;
+        clear: both;
+        overflow: hidden;
+    }
+    .header
+    {
+        height: 115px;
+        position: relative;
+    }
+    .header .icon
+    {
+        position: absolute;
+        top: 13px;
+        left: 0;
+    }
+    .header .qtref
+    {
+        position: absolute;
+        top: 28px;
+        left: 88px;
+        width: 302px;
+        height: 22px;
+    }
+    .header .qtref span
+    {
+        display: block;
+        width: 302px;
+        height: 22px;
+        text-indent: -999em;
+        background: url(../images/sprites-combined.png) no-repeat -78px -235px;
+    }
+
+    .sidebar
+    {
+        float: left;
+        margin-left: 5px;
+        width: 200px;
+        font-size: 11px;
+    }
+
+    .offline .sidebar, .offline .feedback, .offline .t_button
+    {
+        display: none;
+    }
+
+    .sidebar .searchlabel
+    {
+        padding: 0 0 2px 17px;
+        font: normal bold 11px/1.2 Verdana;
+    }
+
+    .sidebar .search
+    {
+        padding: 0 15px 0 16px;
+    }
+
+    .sidebar .search form
+    {
+        background: url(../images/sprites-combined.png) no-repeat -6px -348px;
+		height:21px;
+		padding:2px 0 0 5px;
+		width:167px;
+    }
+
+    .sidebar .search form input#pageType
+    {
+        width: 158px;
+        height: 19px;
+        padding: 0;
+        border: none;
+        outline: none;
+        font: 13px/1.2 Verdana;
+    }
+
+    .sidebar .box
+    {
+        padding: 17px 15px 5px 16px;
+    }
+
+    .sidebar .box .first
+    {
+        background-image: none;
+    }
+
+    .sidebar .box h2
+    {
+        font: normal 18px/1.2 Arial;
+        padding: 0;
+        min-height: 32px;
+    }
+    .sidebar .box h2 span
+    {
+        overflow: hidden;
+        display: inline-block;
+    }
+    .sidebar .box#lookup h2
+    {
+        background-image: none;
+    }
+    .sidebar #lookup.box h2 span
+    {
+        background: url(../images/sprites-combined.png) no-repeat -6px -311px;
+        width: 27px;
+        height: 35px;
+        margin-right: 13px;
+    }
+    .sidebar .box#topics h2
+    {
+        background-image: none;
+    }
+    .sidebar #topics.box h2 span
+    {
+        background: url(../images/sprites-combined.png) no-repeat -94px -311px;
+        width: 27px;
+        height: 32px;
+        margin-right: 13px;
+    }
+    .sidebar .box#examples h2
+    {
+        background-image: none;
+    }
+    .sidebar #examples.box h2 span
+    {
+        background: url(../images/sprites-combined.png) no-repeat -48px -311px;
+        width: 30px;
+        height: 31px;
+        margin-right: 9px;
+    }
+
+    .sidebar .box .list
+    {
+        display: block;
+    }
+    .sidebar .box .live
+    {
+        display: none;
+        height: 100px;
+        overflow: auto;
+    }
+    .list li a:hover, .live li a:hover
+    {
+        text-decoration: underline;
+    }
+    .sidebar .box ul
+    {
+    }
+    .sidebar .box ul li
+    {
+        padding-left: 12px;
+        background: url(../images/bullet_gt.png) no-repeat 0 5px;
+        margin-bottom: 15px;
+    }
+    .sidebar .bottombar
+    {
+        background: url(../images/box_bg.png) repeat-x 0 bottom;
+    }
+    .wrap
+    {
+        margin: 0 5px 0 208px;
+        overflow: visible; 
+    }
+    .offline .wrap
+    {
+        margin: 0 5px 0 5px;
+    }
+    .wrap .toolbar
+    {
+        background-color: #fafafa;
+        border-bottom: 1px solid #d1d1d1;
+        height: 20px; 
+        position: relative;
+    }
+    .wrap .toolbar .toolblock
+    {
+        position: absolute;
+    }
+    .wrap .toolbar .breadcrumb
+    {
+        font-size: 11px;
+        line-height: 1;
+        padding: 0 0 10px 21px;
+        height: 10px;
+    }
+    .wrap .toolbar .toolbuttons
+    {
+        padding: 0 0 10px 21px;
+        right: 5px;
+        vertical-align: middle;
+        overflow: hidden;
+    }
+    .wrap .toolbar .toolbuttons .active
+    {
+        color: #00732F;
+    }
+    .wrap .toolbar .toolbuttons ul
+    {
+        float: right;
+    }
+    .wrap .toolbar .toolbuttons li
+    {
+        float: left;
+        text-indent: -10px;
+        margin-top: -5px;
+        margin-right: 15px;
+        font-weight: bold;
+        color: #B0ADAB;
+    }
+
+    .toolbuttons #print
+    {
+        border-left: 1px solid #c5c4c4;
+        margin-top: 0;
+        padding-left: 7px;
+        text-indent: 0;
+    }
+    .toolbuttons #print a
+    {
+        width: 16px;
+        height: 16px;
+    }
+
+    .toolbuttons #print a span
+    {
+        width: 16px;
+        height: 16px;
+        text-indent: -999em;
+        display: block;
+        overflow: hidden;
+        background: url(../images/sprites-combined.png) no-repeat -137px -311px;
+    }
+
+    .toolbuttons #smallA
+    {
+        font-size: 10pt;
+    }
+    .toolbuttons #medA
+    {
+        font-size: 12pt;
+    }
+    .toolbuttons #bigA
+    {
+        font-size: 14pt;
+        margin-right: 7px;
+    }
+
+    #smallA:hover, #medA:hover, #bigA:hover
+    {
+        color: #00732F;
+    }
+
+    .offline .wrap .breadcrumb
+    {
+    }
+
+    .wrap .breadcrumb ul
+    {
+    }
+    .wrap .breadcrumb ul li
+    {
+        float: left;
+        background: url(../images/breadcrumb.png) no-repeat 0 3px;
+        padding-left: 15px;
+        margin-left: 15px;
+        font-weight: bold;
+    }
+    .wrap .breadcrumb ul li.last
+    {
+        font-weight: normal;
+    }
+    .wrap .breadcrumb ul li a
+    {
+        color: #363534;
+    }
+    .wrap .breadcrumb ul li.first
+    {
+        background-image: none;
+        padding-left: 0;
+        margin-left: 0;
+    }
+    .wrap .content
+    {
+        padding: 30px;
+    }
+
+    .wrap .content li
+    {
+        padding-left: 12px;
+        background: url(../images/bullet_sq.png) no-repeat 0 5px;
+        font: normal 400 10pt/1 Verdana;
+        color: #44a51c;
+        margin-bottom: 10px; 
+    }
+    .content li:hover
+    {
+        text-decoration: underline;
+    }
+
+    .offline .wrap .content
+    {
+        padding-top: 15px;
+    }
+
+    .wrap .content h1
+    {
+        font: 600 18px/1.2 Arial;
+    }
+    .wrap .content h2
+    {
+        font: 600 16px/1.2 Arial;
+    }
+    .wrap .content h3
+    {
+        font: 600 14px/1.2 Arial;
+    }
+    .wrap .content p
+    {
+        line-height: 20px;
+        padding: 10px 5px 10px 5px;
+    }
+    .wrap .content ul
+    {
+        padding-left: 25px;
+    }
+    a:hover
+    {
+        color: #4c0033;
+        text-decoration: underline;
+    }
+    .content a:visited
+    {
+        color: #4c0033;
+        text-decoration: none;
+    }
+    .footer
+    {
+        min-height: 100px;
+        color: #797775;
+        font: normal 9px/1 Verdana;
+        text-align: center;
+        padding-top: 40px;
+        background-color: #E6E7E8;
+        margin: 0;
+    }
+    .feedback
+    {
+        float: none;
+        position: absolute;
+        right: 15px;
+        bottom: 10px;
+        font: normal 8px/1 Verdana;
+        color: #B0ADAB;
+    }
+    .feedback:hover
+    {
+        float: right;
+        font: normal 8px/1 Verdana;
+        color: #00732F;
+        text-decoration: underline;
+    }
+    .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after
+    {
+        content: ".";
+        display: block;
+        height: 0;
+        clear: both;
+        visibility: hidden;
+    }
+    #nav-topright
+    {
+        height: 70px;
+    }
+
+    #nav-topright ul
+    {
+        list-style-type: none;
+        float: right;
+        width: 370px;
+        margin-top: 11px;
+    }
+
+    #nav-topright li
+    {
+        display: inline-block;
+        margin-right: 20px;
+        float: left;
+    }
+
+    #nav-topright li.nav-topright-last
+    {
+        margin-right: 0;
+    }
+
+    #nav-topright li a
+    {
+        background: transparent url(../images/sprites-combined.png) no-repeat;
+        height: 18px;
+        display: block;
+        overflow: hidden;
+        text-indent: -9999px;
+    }
+
+    #nav-topright li.nav-topright-home a
+    {
+        width: 65px;
+        background-position: -2px -91px;
+    }
+
+    #nav-topright li.nav-topright-home a:hover
+    {
+        background-position: -2px -117px;
+    }
+
+
+    #nav-topright li.nav-topright-dev a
+    {
+        width: 30px;
+        background-position: -76px -91px;
+    }
+
+    #nav-topright li.nav-topright-dev a:hover
+    {
+        background-position: -76px -117px;
+    }
+
+
+    #nav-topright li.nav-topright-labs a
+    {
+        width: 40px;
+        background-position: -114px -91px;
+    }
+
+    #nav-topright li.nav-topright-labs a:hover
+    {
+        background-position: -114px -117px;
+    }
+
+    #nav-topright li.nav-topright-doc a
+    {
+        width: 32px;
+        background-position: -162px -91px;
+    }
+
+    #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a
+    {
+        background-position: -162px -117px;
+    }
+
+    #nav-topright li.nav-topright-blog a
+    {
+        width: 40px;
+        background-position: -203px -91px;
+    }
+
+    #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a
+    {
+        background-position: -203px -117px;
+    }
+
+    #nav-topright li.nav-topright-shop a
+    {
+        width: 40px;
+        background-position: -252px -91px;
+    }
+
+    #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a
+    {
+        background-position: -252px -117px;
+    }
+
+    #nav-logo
+    {
+        background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px;
+        left: -3px;
+        position: absolute;
+        width: 75px;
+        height: 75px;
+        top: 13px;
+    }
+    #nav-logo a
+    {
+        width: 75px;
+        height: 75px;
+        display: block;
+        text-indent: -9999px;
+        overflow: hidden;
+    }
+
+
+    .shortCut-topleft-inactive
+    {
+        padding-left: 3px;
+        background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
+        height: 20px;
+        width: 47px;
+    }
+    .shortCut-topleft-inactive span
+    {
+        font-variant: normal;
+    }
+    #shortCut
+    {
+        padding-top: 10px;
+        font-weight: bolder;
+        color: #b0adab;
+    }
+    #shortCut ul
+    {
+        list-style-type: none;
+        float: left;
+        width: 347px;
+        margin-left: 100px;
+    }
+    #shortCut li
+    {
+        display: inline-block;
+        margin-right: 25px;
+        float: left;
+        white-space: nowrap;
+    }
+    #shortCut li a
+    {
+        color: #b0adab;
+    }
+    #shortCut li a:hover
+    {
+        color: #44a51c;
+    }
+
+    hr
+    {
+        background-color: #E6E6E6;
+        border: 1px solid #E6E6E6;
+        height: 1px;
+        width: 100%;
+        text-align: left;
+        margin: 15px 0px 15px 0px;
+    }
+
+    .content .alignedsummary
+    {
+        margin: 15px;
+    }
+    pre
+    {
+        border: 1px solid #DDDDDD;
+        margin: 0 20px 10px 10px;
+        padding: 20px 15px 20px 20px;
+        overflow-x: auto;
+    }
+    table, pre
+    {
+        -moz-border-radius: 7px 7px 7px 7px;
+        background-color: #F6F6F6;
+        border: 1px solid #E6E6E6;
+        border-collapse: separate;
+        font-size: 11px;
+        /*min-width: 395px;*/
+        margin-bottom: 25px;
+        display: inline-block;
+    }
+    thead
+    {
+        margin-top: 5px;
+    }
+    th
+    {
+        padding: 3px 15px 3px 15px;
+    }
+    td
+    {
+        padding: 3px 15px 3px 20px;
+    }
+    table tr.odd
+    {
+        border-left: 1px solid #E6E6E6;
+        background-color: #F6F6F6;
+        color: #66666E;
+    }
+    table tr.even
+    {
+        border-left: 1px solid #E6E6E6;
+        background-color: #ffffff;
+        color: #66666E;
+    }
+    table tr.odd:hover
+    {
+        background-color: #E6E6E6;
+    }
+    table tr.even:hover
+    {
+        background-color: #E6E6E6;
+    }
+
+    span.comment
+    {
+        color: #8B0000;
+        font-style: italic;
+    }
+    span.string, span.char
+    {
+        color: #254117;
+    }
+
+    .qmltype
+    {
+        text-align: center;
+        font-size: 160%;
+    }
+    .qmlreadonly
+    {
+        padding-left: 3px;
+        float: right;
+        color: #254117;
+    }
+
+    .qmldefault
+    {
+        padding-left: 3px;
+        float: right;
+        color: red;
+    }
+
+    .qmldoc
+    {
+    }
+
+    *.qmlitem p
+    {
+    }
+
+    #feedbackBox
+    {
+        display: none;
+        -moz-border-radius: 7px 7px 7px 7px;
+        border: 1px solid #DDDDDD;
+        position: fixed;
+        top: 100px;
+        left: 33%;
+        height: 190px;
+        width: 400px;
+        padding: 5px;
+        background-color: #e6e7e8;
+        z-index: 4;
+    }
+    #feedcloseX a
+    {
+        display: inline;
+        padding: 5px 5px 0 0;
+        margin-bottom: 3px;
+        color: #363534;
+        font-weight: 600;
+        float: right;
+        text-decoration: none;
+    }
+
+    #feedbox
+    {
+        display: inline;
+        width: 370px;
+        height: 120px;
+        margin: 0px 25px 10px 15px;
+    }
+    #feedsubmit
+    {
+        display: inline;
+        float: right;
+        margin: 4px 32px 0 0;
+    }
+    #blurpage
+    {
+        display: none;
+        position: fixed;
+        float: none;
+        top: 0px;
+        left: 0px;
+        right: 0px;
+        bottom: 0px;
+        background: transparent url(../images/feedbackground.png) 0 0;
+        z-index: 3;
+    }
+    .toc
+    {
+        float: right;
+        -moz-border-radius: 7px 7px 7px 7px;
+        background-color: #F6F6F6;
+        border: 1px solid #DDDDDD;
+        margin: 0 20px 10px 10px;
+        padding: 20px 15px 20px 20px;
+        height: auto;
+        width: 200px;
+    }
+
+    .toc h3
+    {
+        font: 600 12px/1.2 Arial;
+    }
+
+    .wrap .content .toc ul
+    {
+        padding-left: 0px;
+    }
+
+
+    .wrap .content .toc .level2
+    {
+        margin-left: 15px;
+    }
+
+    .content .toc li
+    {
+        font: normal 10px/1.2 Verdana;
+        background: url(../images/bullet_dn.png) no-repeat 0 5px;
+    }
+
+    .relpage
+    {
+        -moz-border-radius: 7px 7px 7px 7px;
+        border: 1px solid #DDDDDD;
+        padding: 25px 25px;
+        clear: both;
+    }
+    .relpage ul
+    {
+        float: none;
+        padding: 15px;
+    }
+    .content .relpage li
+    {
+        font: normal 11px/1.2 Verdana;
+    }
+    h3.fn, span.fn
+    {
+        background-color: #F6F6F6;
+        border-width: 1px;
+        border-style: solid;
+        border-color: #E6E6E6;
+        font-weight: bold;
+    }
+
+
+    /* start index box */
+    .indexbox
+    {
+        width: 100%;
+		display:inline-block;
+    }
+
+    .indexboxcont
+    {
+        display: block;
+       /* overflow: hidden;*/
+    }
+
+    .indexboxbar
+    {
+        background: transparent url(../images/horBar.png ) repeat-x left bottom;
+        margin-bottom: 25px;
+     /*   background-image: none;
+        border-bottom: 1px solid #e2e2e2;*/
+    }
+
+    .indexboxcont .section
+    {
+        display: inline-block;
+        width: 49%; 
+        *width:42%;
+        _width:42%;
+        padding:0 2% 0 1%;
+        vertical-align:top;
+
+}
+
+    .indexboxcont .indexIcon
+    {
+        width: 11%; 
+        *width:18%;
+        _width:18%;
+        overflow:hidden;
+
+}
+    .indexboxcont .section p
+    {
+        padding-top: 20px;
+        padding-bottom: 20px;
+    }
+    .indexboxcont .sectionlist
+    {
+        display: inline-block;
+        width: 33%;
+        padding: 0;
+    }
+    .indexboxcont .sectionlist ul
+    {
+        margin-bottom: 20px;
+    }
+
+    .indexboxcont .sectionlist ul li
+    {
+        line-height: 12px;
+    }
+
+    .content .indexboxcont li
+    {
+        font: normal 600 13px/1 Verdana;
+    }
+
+    .indexbox a:hover, .indexbox a:visited:hover
+    {
+        color: #4c0033;
+        text-decoration: underline;
+    }
+
+    .indexbox a:visited
+    {
+        color: #00732f;
+        text-decoration: none;
+    }
+
+    .indexboxcont:after
+    {
+        content: ".";
+        display: block;
+        height: 0;
+        clear: both;
+        visibility: hidden;
+    }
+
+    .indexbox .indexIcon span
+    {
+        display: block;
+    }
+    
+    .indexbox.guide .indexIcon span
+    {
+        width: 96px;
+        height: 137px;
+        background: url(../images/sprites-combined.png) no-repeat -5px -376px;
+        padding: 0;
+    }
+    
+    .indexbox.tools .indexIcon span
+    {
+        width: 115px;
+        height: 137px;
+        background: url(../images/sprites-combined.png) no-repeat -111px -376px;
+        padding: 0;
+    }
+
+    .lastcol
+    {
+        display: inline-block;
+        vertical-align: top;
+        padding: 0;
+        max-width: 25%;
+    }
+
+    .tricol .lastcol
+    {
+        margin-left: -6px;
+    }
+    /* end indexbox */
+}
+/* end of screen media */
+
+/* start of print media */
+
+@media print
+{
+     input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft
+    {
+        display: none;
+        background: none;
+    }
+    .content
+    {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        background: none;
+        display: block;
+    }
+}
+/* end of print media */
Index: trunk/tools/qdoc3/test/style/style_ie6.css
===================================================================
--- trunk/tools/qdoc3/test/style/style_ie6.css	(revision 846)
+++ trunk/tools/qdoc3/test/style/style_ie6.css	(revision 846)
@@ -0,0 +1,54 @@
+.indexbox, .indexboxcont, .group {
+  zoom: 1;
+  height: 1%;
+}
+
+.sidebar {
+  margin-left: 3px;
+  width: 199px;
+  overflow: hidden;
+}
+
+.sidebar .search form {
+  position: relative;
+}
+
+.sidebar .search form fieldset {
+  position: absolute;
+  margin-top: -1px;
+}
+
+.sidebar .search form input#searchstring  {
+  border: 1px solid #fff;
+  height: 18px;
+}
+
+.wrap {
+  zoom: 1;
+}
+
+.content,
+.toolbar {
+  zoom: 1;
+  margin-left: -3px;
+  position: relative;
+}
+
+.indexbox {
+  clear: both;
+}
+
+.indexboxcont .section {
+  zoom: 1;
+  float: left;
+}
+
+.indexboxcont .sectionlist {
+  zoom: 1;
+  float: left;
+}
+
+.wrap .toolbar .toolbuttons li {
+  text-indent: 0;
+  margin-right: 8px;
+}
Index: trunk/tools/qdoc3/test/style/style_ie7.css
===================================================================
--- trunk/tools/qdoc3/test/style/style_ie7.css	(revision 846)
+++ trunk/tools/qdoc3/test/style/style_ie7.css	(revision 846)
@@ -0,0 +1,19 @@
+.indexbox, .indexboxcont, .group {
+  min-height: 1px;
+}
+
+.sidebar .search form input#searchstring  {
+  border: 1px solid #fff;
+  height: 17px;
+}
+
+
+.indexboxcont .section {
+  zoom: 1;
+  float: left;
+}
+
+.indexboxcont .sectionlist {
+  zoom: 1;
+  float: left;
+}
Index: trunk/tools/qdoc3/text.cpp
===================================================================
--- trunk/tools/qdoc3/text.cpp	(revision 769)
+++ trunk/tools/qdoc3/text.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/text.h
===================================================================
--- trunk/tools/qdoc3/text.h	(revision 769)
+++ trunk/tools/qdoc3/text.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -76,4 +76,5 @@
     Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0) const;
     void dump() const;
+    void clear();
 
     static Text subText(const Atom *begin, const Atom *end = 0);
@@ -83,5 +84,4 @@
 
  private:
-    void clear();
 
     Atom *first;
Index: trunk/tools/qdoc3/tokenizer.cpp
===================================================================
--- trunk/tools/qdoc3/tokenizer.cpp	(revision 769)
+++ trunk/tools/qdoc3/tokenizer.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -48,4 +48,5 @@
 #include <qregexp.h>
 #include <qstring.h>
+#include <qtextcodec.h>
 
 #include <ctype.h>
@@ -67,5 +68,9 @@
     "slots", "static", "struct", "template", "typedef", "typename",
     "union", "unsigned", "using", "virtual", "void", "volatile",
-    "__int64", "Q_OBJECT", "Q_OVERRIDE", "Q_PROPERTY",
+    "__int64",
+    "Q_OBJECT",
+    "Q_OVERRIDE",
+    "Q_PROPERTY",
+    "Q_PRIVATE_PROPERTY",
     "Q_DECLARE_SEQUENTIAL_ITERATOR",
     "Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR",
@@ -98,4 +103,6 @@
 static QRegExp *falsehoods = 0;
 
+static QTextCodec *sourceCodec = 0;
+
 /*
   This function is a perfect hash function for the 37 keywords of C99
@@ -119,11 +126,8 @@
 }
 
-Tokenizer::Tokenizer(const Location& loc, FILE *in)
+Tokenizer::Tokenizer(const Location& loc, QFile &in)
 {
     init();
-    QFile file;
-    file.open(in, QIODevice::ReadOnly);
-    yyIn = file.readAll();
-    file.close();
+    yyIn = in.readAll();
     yyPos = 0;
     start(loc);
@@ -483,4 +487,9 @@
 {
     QString versionSym = config.getString(CONFIG_VERSIONSYM);
+
+    QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING);
+    if (sourceEncoding.isEmpty())
+        sourceEncoding = QLatin1String("ISO-8859-1");
+    sourceCodec = QTextCodec::codecForName(sourceEncoding.toLocal8Bit());
 
     comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)");
@@ -751,3 +760,13 @@
 }
 
+QString Tokenizer::lexeme() const
+{
+    return sourceCodec->toUnicode(yyLex);
+}
+
+QString Tokenizer::previousLexeme() const
+{
+    return sourceCodec->toUnicode(yyPrevLex);
+}
+
 QT_END_NAMESPACE
Index: trunk/tools/qdoc3/tokenizer.h
===================================================================
--- trunk/tools/qdoc3/tokenizer.h	(revision 769)
+++ trunk/tools/qdoc3/tokenizer.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -47,8 +47,7 @@
 #define TOKENIZER_H
 
+#include <qfile.h>
 #include <qstack.h>
 #include <qstring.h>
-
-#include <stdio.h>
 
 #include "location.h"
@@ -77,5 +76,5 @@
        Tok_typename, Tok_union, Tok_unsigned, Tok_using, Tok_virtual,
        Tok_void, Tok_volatile, Tok_int64, Tok_Q_OBJECT, Tok_Q_OVERRIDE, 
-       Tok_Q_PROPERTY, Tok_Q_DECLARE_SEQUENTIAL_ITERATOR,
+       Tok_Q_PROPERTY, Tok_Q_PRIVATE_PROPERTY, Tok_Q_DECLARE_SEQUENTIAL_ITERATOR,
        Tok_Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR, 
        Tok_Q_DECLARE_ASSOCIATIVE_ITERATOR,
@@ -100,5 +99,5 @@
  public:
     Tokenizer(const Location& loc, const QByteArray &in);
-    Tokenizer(const Location& loc, FILE *in);
+    Tokenizer(const Location& loc, QFile &file);
 
     ~Tokenizer();
@@ -109,6 +108,6 @@
 
     const Location &location() const { return yyTokLoc; }
-    QString previousLexeme() const { return QString(yyPrevLex); }
-    QString lexeme() const { return QString(yyLex); }
+    QString previousLexeme() const;
+    QString lexeme() const;
     QString version() const { return yyVersion; }
     int braceDepth() const { return yyBraceDepth; }
@@ -147,5 +146,5 @@
         if (ch == EOF)
             return EOF;
-        // cast explicitely to make sure the value of ch 
+        // cast explicitly to make sure the value of ch 
         // is in range [0..255] to avoid assert messages 
         // when using debug CRT that checks its input.
Index: trunk/tools/qdoc3/tr.h
===================================================================
--- trunk/tools/qdoc3/tr.h	(revision 769)
+++ trunk/tools/qdoc3/tr.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/tree.cpp
===================================================================
--- trunk/tools/qdoc3/tree.cpp	(revision 769)
+++ trunk/tools/qdoc3/tree.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,5 +44,4 @@
 */
 
-#include <QtCore>
 #include <QDomDocument>
 
@@ -54,4 +53,7 @@
 #include "text.h"
 #include "tree.h"
+
+#include <limits.h>
+#include <qdebug.h>
 
 QT_BEGIN_NAMESPACE
@@ -124,22 +126,25 @@
 /*!
  */
-Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags)
+Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags, const Node* self)
 {
     return const_cast<Node*>(const_cast<const Tree*>(this)->findNode(path,
                                                                      relative,
-                                                                     findFlags));
-}
-
-/*!
- */
-const Node *Tree::findNode(const QStringList &path,
-                           const Node *relative,
-                           int findFlags) const
-{
-    if (!relative)
-        relative = root();
+                                                                     findFlags,
+                                                                     self));
+}
+
+/*!
+ */
+const Node* Tree::findNode(const QStringList &path,
+                           const Node* start,
+                           int findFlags,
+                           const Node* self) const
+{
+    const Node* current = start;
+    if (!current)
+        current = root();
 
     do {
-        const Node *node = relative;
+        const Node *node = current;
         int i;
 
@@ -150,4 +155,5 @@
             const Node *next =
                 static_cast<const InnerNode*>(node)->findNode(path.at(i));
+            
             if (!next && (findFlags & SearchEnumValues) && i == path.size()-1)
                 next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i));
@@ -168,8 +174,11 @@
         if (node && i == path.size()
                 && (!(findFlags & NonFunction) || node->type() != Node::Function
-                    || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams))
-            return node;
-        relative = relative->parent();
-    } while (relative);
+                    || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) {
+            if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) {
+                return node;
+            }
+        }
+        current = current->parent();
+    } while (current);
 
     return 0;
@@ -461,6 +470,7 @@
         NodeList::ConstIterator c = rootNode->childNodes().begin();
         while (c != rootNode->childNodes().end()) {
-            if ((*c)->type() == Node::Class)
+            if ((*c)->type() == Node::Class) {
                 resolveInheritance(pass, (ClassNode *) *c);
+            }
             else if ((*c)->type() == Node::Namespace) {
                 NamespaceNode *ns = static_cast<NamespaceNode*>(*c);
@@ -534,12 +544,14 @@
 	    ClassNode *baseClass = (ClassNode*)findNode((*b).basePath,
                                                         Node::Class);
-            if (!baseClass && (*b).parent)
+            if (!baseClass && (*b).parent) {
                 baseClass = (ClassNode*)findNode((*b).basePath,
                                                  Node::Class,
                                                  (*b).parent);
-	    if (baseClass)
+            }
+	    if (baseClass) {
 		classe->addBaseClass((*b).access,
                                      baseClass,
                                      (*b).dataTypeWithTemplateArgs);
+            }
 	    ++b;
 	}
@@ -1119,4 +1131,13 @@
             nodeName = "target";
             break;
+        case Node::QmlProperty:
+            nodeName = "qmlproperty";
+            break;
+        case Node::QmlSignal:
+            nodeName = "qmlsignal";
+            break;
+        case Node::QmlMethod:
+            nodeName = "qmlmethod";
+            break;
         default:
             return false;
@@ -1208,5 +1229,5 @@
         writer.writeAttribute("fullname", fullName);
     writer.writeAttribute("href", fullDocumentLocation(node));
-    if (node->type() != Node::Fake)
+    if ((node->type() != Node::Fake) && (!node->isQmlNode()))
         writer.writeAttribute("location", node->location().fileName());
 
@@ -1262,4 +1283,10 @@
                 case Node::ExternalPage:
                     writer.writeAttribute("subtype", "externalpage");
+                    break;
+                case Node::QmlClass:
+                    writer.writeAttribute("subtype", "qmlclass");
+                    break;
+                case Node::QmlBasicType:
+                    writer.writeAttribute("subtype", "qmlbasictype");
                     break;
                 default:
@@ -1335,4 +1362,10 @@
         break;
 
+    case Node::QmlProperty:
+        {
+            const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node);
+            writer.writeAttribute("type", qpn->dataType());
+        }
+        break;
     case Node::Property:
         {
@@ -1522,7 +1555,20 @@
             const InnerNode *inner = static_cast<const InnerNode *>(node);
 
-            // Recurse to write an element for this child node and all its children.
-            foreach (const Node *child, inner->childNodes())
-                generateIndexSections(writer, child, generateInternalNodes);
+            foreach (const Node *child, inner->childNodes()) {
+                /*
+                  Don't generate anything for a QML property group node.
+                  It is just a place holder for a collection of QML property
+                  nodes. Recurse to its children, which are the QML property
+                  nodes.
+                 */
+                if (child->subType() == Node::QmlPropertyGroup) {
+                    const InnerNode *pgn = static_cast<const InnerNode*>(child);
+                    foreach (const Node *c, pgn->childNodes()) {
+                        generateIndexSections(writer, c, generateInternalNodes);
+                    }
+                }
+                else
+                    generateIndexSections(writer, child, generateInternalNodes);
+            }
 
 /*
@@ -1915,7 +1961,12 @@
     else if (node->type() == Node::Fake) {
 #ifdef QDOC_QML
-        if (node->subType() == Node::QmlClass)
-            return "qml-" + node->fileBase() + ".html";
-        else
+        if ((node->subType() == Node::QmlClass) ||
+            (node->subType() == Node::QmlBasicType)) {
+            QString fb = node->fileBase();
+            if (fb.startsWith(QLatin1String("qml-")))
+                return fb + ".html";
+            else
+                return "qml-" + node->fileBase() + ".html";
+        } else
 #endif
         parentName = node->fileBase() + ".html";
@@ -1928,7 +1979,21 @@
     if ((parentNode = node->relates()))
         parentName = fullDocumentLocation(node->relates());
-    else if ((parentNode = node->parent()))
-        parentName = fullDocumentLocation(node->parent());
-
+    else if ((parentNode = node->parent())) {
+        if (parentNode->subType() == Node::QmlPropertyGroup) {
+            parentNode = parentNode->parent();
+            parentName = fullDocumentLocation(parentNode);
+        }
+        else
+            parentName = fullDocumentLocation(node->parent());
+    }
+#if 0
+    if (node->type() == Node::QmlProperty) {
+        qDebug() << "Node::QmlProperty:" << node->name()
+                 << "parentName:" << parentName;
+        if (parentNode)
+            qDebug() << "PARENT NODE" << parentNode->type()
+                     << parentNode->subType() << parentNode->name();
+    }
+#endif
     switch (node->type()) {
         case Node::Class:
@@ -1976,4 +2041,13 @@
         case Node::Property:
             anchorRef = "#" + node->name() + "-prop";
+            break;
+        case Node::QmlProperty:
+            anchorRef = "#" + node->name() + "-prop";
+            break;
+        case Node::QmlSignal:
+            anchorRef = "#" + node->name() + "-signal";
+            break;
+        case Node::QmlMethod:
+            anchorRef = "#" + node->name() + "-method";
             break;
         case Node::Variable:
@@ -2016,4 +2090,6 @@
 
 /*!
+  Construct the full document name for \a node and return the
+  name.
  */
 QString Tree::fullDocumentName(const Node *node) const
@@ -2026,8 +2102,9 @@
 
     do {
-        if (!n->name().isEmpty())
+        if (!n->name().isEmpty() &&
+            ((n->type() != Node::Fake) || (n->subType() != Node::QmlPropertyGroup)))
             pieces.insert(0, n->name());
 
-        if (n->type() == Node::Fake)
+        if ((n->type() == Node::Fake) && (n->subType() != Node::QmlPropertyGroup))
             break;
 
Index: trunk/tools/qdoc3/tree.h
===================================================================
--- trunk/tools/qdoc3/tree.h	(revision 769)
+++ trunk/tools/qdoc3/tree.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -66,8 +66,11 @@
     ~Tree();
 
-    Node *findNode(const QStringList &path, Node *relative=0, int findFlags=0);
-    Node *findNode(const QStringList &path, 
+    Node* findNode(const QStringList &path, 
+                   Node* relative=0, 
+                   int findFlags=0, 
+                   const Node* self=0);
+    Node* findNode(const QStringList &path, 
                    Node::Type type, 
-                   Node *relative = 0,
+                   Node* relative = 0,
                    int findFlags = 0);
     FunctionNode *findFunctionNode(const QStringList &path, 
@@ -99,10 +102,11 @@
 
     QString version() const { return vers; }
-    const Node *findNode(const QStringList &path, 
-                         const Node *relative = 0, 
-                         int findFlags = 0) const;
-    const Node *findNode(const QStringList &path, 
+    const Node* findNode(const QStringList &path, 
+                         const Node* relative = 0, 
+                         int findFlags = 0,
+                         const Node* self=0) const;
+    const Node* findNode(const QStringList &path, 
                          Node::Type type, const 
-                         Node *relative = 0,
+                         Node* relative = 0,
                          int findFlags = 0) const;
     const FunctionNode *findFunctionNode(const QStringList &path, 
Index: trunk/tools/qdoc3/uncompressor.cpp
===================================================================
--- trunk/tools/qdoc3/uncompressor.cpp	(revision 769)
+++ trunk/tools/qdoc3/uncompressor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/uncompressor.h
===================================================================
--- trunk/tools/qdoc3/uncompressor.h	(revision 769)
+++ trunk/tools/qdoc3/uncompressor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qdoc3/webxmlgenerator.cpp
===================================================================
--- trunk/tools/qdoc3/webxmlgenerator.cpp	(revision 769)
+++ trunk/tools/qdoc3/webxmlgenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,6 +44,4 @@
 */
 
-#include <QtXml>
-
 #include "codemarker.h"
 #include "pagegenerator.h"
@@ -53,4 +51,6 @@
 #include "tree.h"
 
+#include <QtCore/qxmlstream.h>
+
 QT_BEGIN_NAMESPACE
 
@@ -91,5 +91,5 @@
 }
 
-QString WebXMLGenerator::fileExtension(const Node * /* node */)
+QString WebXMLGenerator::fileExtension(const Node * /* node */) const
 {
     return "xml";
Index: trunk/tools/qdoc3/webxmlgenerator.h
===================================================================
--- trunk/tools/qdoc3/webxmlgenerator.h	(revision 769)
+++ trunk/tools/qdoc3/webxmlgenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -47,4 +47,6 @@
 #define WEBXMLGENERATOR_H
 
+#include <QtCore/qxmlstream.h>
+
 #include "codemarker.h"
 #include "config.h"
@@ -52,4 +54,7 @@
 
 QT_BEGIN_NAMESPACE
+
+class QXmlStreamReader;
+class QXmlStreamWriter;
 
 class WebXMLGenerator : public PageGenerator
@@ -70,5 +75,5 @@
     virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
     virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
-    virtual QString fileExtension(const Node *node);
+    virtual QString fileExtension(const Node *node) const;
 
     virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom,
Index: trunk/tools/qdoc3/yyindent.cpp
===================================================================
--- trunk/tools/qdoc3/yyindent.cpp	(revision 769)
+++ trunk/tools/qdoc3/yyindent.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qmeegographicssystemhelper/qmeegofencesync.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegofencesync.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegofencesync.cpp	(revision 846)
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegofencesync.h"
+#include "qmeegofencesync_p.h"
+#include "qmeegoruntime.h"
+
+/* QMeeGoFenceSyncPrivate */
+
+QMeeGoFenceSyncPrivate::QMeeGoFenceSyncPrivate() : syncObject(NULL)
+{
+}
+
+QMeeGoFenceSyncPrivate::~QMeeGoFenceSyncPrivate()
+{
+    if (syncObject) {
+        QMeeGoRuntime::destroyFenceSync(syncObject);
+        syncObject = NULL;
+    }
+}
+
+/* QMeeGoFenceSync */
+
+QMeeGoFenceSync::QMeeGoFenceSync(QWidget *parent) : QObject(parent), d_ptr(new QMeeGoFenceSyncPrivate())
+{
+    Q_D(QMeeGoFenceSync);
+    d->q_ptr = this;
+}
+
+QMeeGoFenceSync::~QMeeGoFenceSync()
+{
+}
+
+void QMeeGoFenceSync::setSyncPoint()
+{
+    Q_D(QMeeGoFenceSync);
+    if (d->syncObject)
+        QMeeGoRuntime::destroyFenceSync(d->syncObject);
+
+    d->syncObject = QMeeGoRuntime::createFenceSync();
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegofencesync.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegofencesync.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegofencesync.h	(revision 846)
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOFENCESYNC_H
+#define QMEEGOFENCESYNC_H
+
+#include <QWidget>
+
+class QMeeGoFenceSyncPrivate;
+
+//! A synchronization helper for GL pipeline.
+/*!
+ Fence syncs provide a mechanism for synchronizing access to certain GL primitives
+ and make it possible for the application developer to be sure that a certain point
+ in the GL processing pipeline has been already executed before continuing operation.
+
+ Currently fence syncs are only useful in conjunction with QMeeGoLivePixmaps.
+ \code
+ ...
+ // In your paint/expose event:
+ QImage *image = livePixmap->lock(&someGlobalFenceSync);
+ // Modify the image...
+ livePixmap->release(image);
+
+ painter->drawPixmap(0, 0, *livePixmap);
+ someGlobalFenceSync.setSyncPoint();
+ ...
+ \endcode
+
+ Assuming the paint/expose events come repeatedly, the lock operation
+ will block till the previous event completed painting the livePixmap.
+*/
+
+class Q_DECL_EXPORT QMeeGoFenceSync : public QObject
+{
+public:
+    //! Constructs a new fence sync.
+    /*!
+     The fence sync is created without a sync point. You need to set the sync point manually.
+    */
+    QMeeGoFenceSync(QWidget *parent = 0);
+
+    //! Destructor for the fence sync.
+    virtual ~QMeeGoFenceSync();
+
+    //! Sets the fence sync.
+    /*!
+      The fence sync synchronization point should be set after all drawing has been scheduled.
+      Setting a synchronization point always overrides the previous point -- whetver is was
+      used (waited upon) or not.
+    */
+    void setSyncPoint();
+
+private:
+    Q_DISABLE_COPY(QMeeGoFenceSync)
+    Q_DECLARE_PRIVATE(QMeeGoFenceSync)
+
+protected:
+    QScopedPointer<QMeeGoFenceSyncPrivate> d_ptr; //! Private bits.
+    friend class QMeeGoLivePixmap;
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegofencesync_p.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegofencesync_p.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegofencesync_p.h	(revision 846)
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegofencesync.h"
+
+#ifndef QMEEGOFENCESYNC_P_H
+#define QMEEGOFENCESYNC_P_H
+
+class QMeeGoFenceSyncPrivate
+{
+public:
+    Q_DECLARE_PUBLIC(QMeeGoFenceSync);
+    QMeeGoFenceSyncPrivate();
+
+    virtual ~QMeeGoFenceSyncPrivate();
+
+    void* syncObject;
+
+    QMeeGoFenceSync *q_ptr;
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp	(revision 846)
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define ENSURE_RUNNING_MEEGO {if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo()) { qFatal("Using meego functionality but not running meego graphics system!"); }}
+
+#include "qmeegographicssystemhelper.h"
+#include <private/qapplication_p.h>
+#include <private/qgraphicssystem_runtime_p.h>
+#include <private/qpixmap_raster_p.h>
+#include <private/qwindowsurface_gl_p.h>
+#include "qmeegoruntime.h"
+#include "qmeegoswitchevent.h"
+
+QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName()
+{
+    if (! QApplicationPrivate::instance()) {
+        qWarning("Querying graphics system but application not running yet!");
+        return QString();
+    }
+
+    QString name = QApplicationPrivate::instance()->graphics_system_name;
+    if (name == QLatin1String("runtime")) {
+        QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
+        name = rsystem->graphicsSystemName();
+    }
+
+    return name;
+}
+
+bool QMeeGoGraphicsSystemHelper::isRunningMeeGo()
+{
+    return (runningGraphicsSystemName() == QLatin1String("meego"));
+}
+
+bool QMeeGoGraphicsSystemHelper::isRunningRuntime()
+{
+    return (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime"));
+}
+
+void QMeeGoGraphicsSystemHelper::switchToMeeGo()
+{
+    if (isRunningMeeGo())
+        return;
+
+    if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
+        qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
+    else {
+        QMeeGoSwitchEvent willSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::WillSwitch);
+        foreach (QWidget *widget, QApplication::topLevelWidgets())
+            QCoreApplication::sendEvent(widget, &willSwitchEvent);
+
+        QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
+        app->setGraphicsSystem(QLatin1String("meego"));
+
+        QMeeGoSwitchEvent didSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::DidSwitch);
+        foreach (QWidget *widget, QApplication::topLevelWidgets())
+            QCoreApplication::sendEvent(widget, &didSwitchEvent);
+    }
+}
+
+void QMeeGoGraphicsSystemHelper::switchToRaster()
+{
+    if (runningGraphicsSystemName() == QLatin1String("raster"))
+        return;
+
+    if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
+        qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
+    else {
+        QMeeGoSwitchEvent willSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::WillSwitch);
+        foreach (QWidget *widget, QApplication::topLevelWidgets())
+            QCoreApplication::sendEvent(widget, &willSwitchEvent);
+
+        QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
+        app->setGraphicsSystem(QLatin1String("raster"));
+
+        QMeeGoSwitchEvent didSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::DidSwitch);
+        foreach (QWidget *widget, QApplication::topLevelWidgets())
+            QCoreApplication::sendEvent(widget, &didSwitchEvent);
+    }
+}
+
+Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image)
+{
+    ENSURE_RUNNING_MEEGO;
+    return QMeeGoRuntime::imageToEGLSharedImage(image);
+}
+
+QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+{
+    // This function is supported when not running meego too. A raster-backed
+    // pixmap will be created... but when you switch back to 'meego', it'll 
+    // be replaced with a EGL shared image backing.
+    return QPixmap(QMeeGoRuntime::pixmapDataFromEGLSharedImage(handle, softImage));
+}
+
+QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h)
+{
+    ENSURE_RUNNING_MEEGO;
+    return QPixmap(QMeeGoRuntime::pixmapDataWithGLTexture(w, h));
+}
+
+bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle)
+{
+    ENSURE_RUNNING_MEEGO;
+    return QMeeGoRuntime::destroyEGLSharedImage(handle);
+}
+
+void QMeeGoGraphicsSystemHelper::updateEGLSharedImagePixmap(QPixmap *p)
+{
+    ENSURE_RUNNING_MEEGO;
+    return QMeeGoRuntime::updateEGLSharedImagePixmap(p);
+}
+
+void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent)
+{
+    ENSURE_RUNNING_MEEGO;
+    QMeeGoRuntime::setTranslucent(translucent);
+}
+
+void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode)
+{
+    ENSURE_RUNNING_MEEGO;
+
+    if (mode == AutomaticSwap)
+        QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
+    else if (mode == AlwaysFullSwap)
+        QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysFullSwap;
+    else if (mode == AlwaysPartialSwap)
+        QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysPartialSwap;
+    else if (mode == KillSwap)
+        QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap;
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h	(revision 846)
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOGRAPHICSSYSTEMHELPER_H
+#define QMEEGOGRAPHICSSYSTEMHELPER_H
+
+#include <QPixmap>
+#include <QImage>
+#include "qmeegolivepixmap.h"
+
+class QLibrary;
+
+//! The base class for accressing special meego graphics system features. 
+/*!
+ This class is a helper class with static-only methods for accessing various
+ meego graphics system functionalities. The way it works is that the helper
+ dynamically calls-in to the loaded graphicssystem plugin... therefore, you're 
+ expected to make sure that you're indeed running with 'meego' before using any
+ of the specialized methods. 
+
+ In example:
+
+ \code
+ QPixmap p;
+ if (QMeeGoGraphicsSystemHelper::isRunningMeeGo()) {
+    p = QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(64, 64);
+ } else {
+    p = QPixmap(64, 64);
+ }
+ \endcode
+
+ Calling any of the meego-specific features while not running meego might
+ give unpredictable results. The only functions safe to call at all times are:
+
+ \code
+ QMeeGoGraphicsSystemHelper::isRunningMeeGo();
+ QMeeGoGraphicsSystemHelper::runningGraphicsSystemName(); 
+ QMeeGoGraphicsSystemHelper::switchToMeeGo();
+ QMeeGoGraphicsSystemHelper::switchToRaster();
+ \endcode
+*/
+
+class Q_DECL_EXPORT QMeeGoGraphicsSystemHelper 
+{
+public:
+    //! Returns true if running meego.
+    /*! 
+     Returns true if the currently active (running) system is 'meego' with OpenGL. 
+     This returns both true if the app was started with 'meego' or was started with
+     'runtime' graphics system and the currently active system through the runtime
+     switching is 'meego'.
+    */
+    static bool isRunningMeeGo();
+    
+    //! Returns true if running with a 'runtime' graphicssystem.
+    /*!
+     This function can be used in combination with ::runningGraphicsSystemName to figure out
+     the existing situation. 
+    */
+    static bool isRunningRuntime();
+
+    //! Switches to meego graphics system. 
+    /*!
+     When running with the 'runtime' graphics system, sets the currently active 
+     system to 'meego'. The window surface and all the resources are automatically
+     migrated to OpenGL. Will fail if the active graphics system is not 'runtime'.
+     Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
+     Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
+     and one after the switch (QMeeGoSwitchEvent::DidSwitch).
+    */
+    static void switchToMeeGo();
+
+    //! Switches to raster graphics system
+    /*!
+     When running with the 'runtime' graphics system, sets the currently active
+     system to 'raster'. The window surface and the graphics resources (including the 
+     EGL shared image resources) are automatically migrated back to the CPU. All OpenGL 
+     resources (surface, context, cache, font cache) are automaticall anihilated.
+     Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
+     Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
+     and one after the switch (QMeeGoSwitchEvent::DidSwitch).
+    */
+    static void switchToRaster();
+
+    //! Returns the name of the active graphics system
+    /*!
+     Returns the name of the currently active system. If running with 'runtime' graphics 
+     system, returns the name of the active system inside the runtime graphics system
+    */
+    static QString runningGraphicsSystemName();
+
+    //! Creates a new EGL shared image.
+    /*! 
+     Creates a new EGL shared image from the given image. The EGL shared image wraps
+     a GL texture in the native format and can be easily accessed from other processes.
+    */
+    static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
+
+    //! Creates a QPixmap from an EGL shared image
+    /*!
+     Creates a new QPixmap from the given EGL shared image handle. The QPixmap can be 
+     used for painting like any other pixmap. The softImage should point to an alternative, 
+     software version of the graphical resource -- ie. obtained from theme daemon. The 
+     softImage can be allocated on a QSharedMemory slice for easy sharing across processes
+     too. When the application is migrated ToRaster, this softImage will replace the
+     contents of the sharedImage.
+     
+     It's ok to call this function too when not running 'meego' graphics system. In this
+     case it'll create a QPixmap backed with a raster data (from softImage)... but when 
+     the system is switched back to 'meego', the QPixmap will be migrated to a EGL-shared image
+     backed storage (handle).
+    */
+    static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+
+    //! Destroys an EGL shared image. 
+    /*!
+     Destroys an EGLSharedImage previously created with an ::imageToEGLSharedImage call.
+     Returns true if the image was found and the destruction was successful. Notice that
+     this destroys the image for all processes using it. 
+    */
+    static bool destroyEGLSharedImage(Qt::HANDLE handle);
+    
+    //! Updates the QPixmap backed with an EGLShared image. 
+    /*! 
+     This function re-reads the softImage that was specified when creating the pixmap with
+     ::pixmapFromEGLSharedImage and updates the EGL Shared image contents. It can be used
+     to share cross-proccess mutable EGLShared images. 
+    */
+    static void updateEGLSharedImagePixmap(QPixmap *p);
+
+    //! Create a new QPixmap with a GL texture.
+    /*!
+     Creates a new QPixmap which is backed by an OpenGL local texture. Drawing to this
+     QPixmap will be accelerated by hardware -- unlike the normal (new QPixmap()) pixmaps, 
+     which are backed by a software engine and only migrated to GPU when used. Migrating those
+     GL-backed pixmaps when going ToRaster is expsensive (they need to be downloaded from 
+     GPU to CPU) so use wisely. 
+    */
+    static QPixmap pixmapWithGLTexture(int w, int h);
+    
+    //! Sets translucency (alpha) on the base window surface.
+    /*!
+     This function needs to be called *before* any widget/content is created. 
+     When called with true, the base window surface will be translucent and initialized
+     with QGLFormat.alpha == true.
+
+     This function is *deprecated*. Set Qt::WA_TranslucentBackground attribute
+     on the top-level widget *before* you show it instead.
+    */
+    static void setTranslucent(bool translucent);
+
+    //! Used to specify the mode for swapping buffers in double-buffered GL rendering.
+    enum SwapMode {
+        AutomaticSwap,      /**< Automatically choose netween full and partial updates (25% threshold) */
+        AlwaysFullSwap,     /**< Always do a full swap even if partial updates support present */
+        AlwaysPartialSwap,  /**< Always do a partial swap (if support present) no matter what threshold */
+        KillSwap            /**< Do not perform buffer swapping at all (no picture) */
+    };
+
+    //! Sets the buffer swapping mode.
+    /*!
+     This can be only called when running with the meego graphics system.
+     The KillSwap mode can be specififed to effectively block painting.
+
+     This functionality should be used only by applications counting on a specific behavior.
+     Most applications should use the default automatic behavior.
+    */
+    static void setSwapBehavior(SwapMode mode);
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro	(revision 846)
@@ -0,0 +1,10 @@
+TEMPLATE = lib
+TARGET = QtMeeGoGraphicsSystemHelper
+
+include(../../src/qbase.pri)
+
+QT += gui opengl
+INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
+
+HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegoswitchevent.h
+SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegofencesync.cpp qmeegoswitchevent.cpp qmeegoswitchevent.h
Index: trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp	(revision 846)
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegolivepixmap.h"
+#include "qmeegolivepixmap_p.h"
+#include "qmeegofencesync_p.h"
+#include "qmeegoruntime.h"
+
+/* QMeeGoLivePixmapPrivate */
+
+QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate()
+{
+}
+
+QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
+{
+}
+
+/* QMeeGoLivePixmap */
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format format)
+{
+    QImage::Format qtFormat;
+    if (format == Format_RGB16)
+        qtFormat = QImage::Format_RGB16;
+    else if (format == Format_ARGB32_Premultiplied)
+        qtFormat = QImage::Format_ARGB32_Premultiplied;
+    else {
+        qWarning("Unsupported live pixmap format!");
+            return 0;
+    }
+
+    QPixmapData *pmd = QMeeGoRuntime::pixmapDataWithNewLiveTexture(w, h, qtFormat);
+    if (! pmd) {
+        qWarning("Failed to create a live texture with given size!");
+        return NULL;
+    }
+
+    return new QMeeGoLivePixmap(pmd);
+}
+
+QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate())
+{
+    Q_D(QMeeGoLivePixmap);
+    d->q_ptr = this;
+}
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE liveTextureHandle)
+{
+    QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromLiveTextureHandle(liveTextureHandle);
+    if (! pmd) {
+        qWarning("Failed to create a live texture from given handle!");
+        return NULL;
+    }
+
+    return new QMeeGoLivePixmap(pmd);
+}
+
+Qt::HANDLE QMeeGoLivePixmap::handle()
+{
+    return QMeeGoRuntime::getLiveTextureHandle(this);
+}
+
+QMeeGoLivePixmap::~QMeeGoLivePixmap()
+{
+}
+
+QImage* QMeeGoLivePixmap::lock(QMeeGoFenceSync *fenceSync)
+{
+    if (fenceSync)
+        return QMeeGoRuntime::lockLiveTexture(this, fenceSync->d_func()->syncObject);
+    else
+        return QMeeGoRuntime::lockLiveTexture(this, NULL);
+}
+
+void QMeeGoLivePixmap::release(QImage *img)
+{
+    QMeeGoRuntime::releaseLiveTexture(this, img);
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap.h	(revision 846)
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOLIVEPIXMAP_H
+#define QMEEGOLIVEPIXMAP_H
+
+#include <QPixmap>
+#include "qmeegofencesync.h"
+
+class QMeeGoLivePixmapPrivate;
+class QSharedMemory;
+class QImage;
+
+//! A pixmap representing streamed content.
+/*!
+*/
+
+class Q_DECL_EXPORT QMeeGoLivePixmap : public QPixmap
+{
+public:
+    enum Format {
+        Format_RGB16,               //! 16bit, 5-6-5 RGB format.
+        Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
+    };
+    
+    //! Creates and returns a new live pixmap with the given parameters.
+    /*!
+     The new pixmap is created with the given width w and the given height h. 
+     The format specifies the color format used by the pixmap.
+    */
+    static QMeeGoLivePixmap* livePixmapWithSize(int w, int h, Format format);
+    
+    //! Creates a new QMeeGoLivePixmap from the specified handle.
+    /*! 
+     The handle can be used to share QMeeGoLivePixmap cross-process.
+    */
+    static QMeeGoLivePixmap* fromHandle(Qt::HANDLE handle);
+    
+    //! Returns the handle for this QMeeGoLivePixmap.
+    /*! 
+     The handle can be used to share QMeeGoLivePixmap cross-process.
+    */
+    Qt::HANDLE handle();
+
+    //! Locks the access to the pixmap. 
+    /*! 
+     The returned image can be used for direct access.
+     You can optionally specify a fence sync to wait upon before unlocking. When
+     you specify a fence sync, you can be sure that this function will return only
+     when the previsouly set QMeeGoFenceSync synchronization point has been executed/passed
+     by the GL processing pipeline.
+     */
+    QImage* lock(QMeeGoFenceSync *fenceSync = NULL);
+    
+    //! Unlocks the access to the pixmap. 
+    /*! 
+     */
+    void release(QImage *img);
+    
+    //! Destroys the QMeeGoLivePixmap.
+    /*! 
+    */
+    virtual ~QMeeGoLivePixmap();
+
+private:
+    QMeeGoLivePixmap(QPixmapData *p);
+    Q_DISABLE_COPY(QMeeGoLivePixmap)
+    Q_DECLARE_PRIVATE(QMeeGoLivePixmap)
+
+protected:
+    QScopedPointer<QMeeGoLivePixmapPrivate> d_ptr; //! Private bits.
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h	(revision 846)
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegolivepixmap.h"
+
+#ifndef QMEEGOLIVEPIXMAP_P_H
+#define QMEEGOLIVEPIXMAP_P_H
+
+class QMeeGoLivePixmapPrivate
+{
+public:
+    Q_DECLARE_PUBLIC(QMeeGoLivePixmap);
+    QMeeGoLivePixmapPrivate();
+    virtual ~QMeeGoLivePixmapPrivate();
+
+    QMeeGoLivePixmap *q_ptr;
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.cpp	(revision 846)
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QApplication>
+#include <QDesktopWidget>
+#include "qmeegooverlaywidget.h"
+#include "qmeegographicssystemhelper.h"
+#include "qmeegoruntime.h"
+
+QMeeGoOverlayWidget::QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent) : QWidget(parent, 0), 
+    sw(surfaceWidth), 
+    sh(surfaceHeight)
+{
+    if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo())
+        qFatal("QMeeGoOverlayWidget can only be used when running with 'meego' graphics system!");
+
+    const QRect desktop = QApplication::desktop()->screenGeometry(parent);
+
+    QMeeGoRuntime::setSurfaceFixedSize(surfaceWidth, surfaceHeight);
+
+    scaleW = sw / desktop.width();
+    scaleH = sh / desktop.height();
+    installEventFilter(this);
+}
+
+QPoint QMeeGoOverlayWidget::convertPoint(const QPoint &p)
+{
+    int x = p.x() * scaleW;
+    int y = p.y() * scaleH;
+    return QPoint(x, y);
+}
+
+void QMeeGoOverlayWidget::showEvent(QShowEvent *)
+{
+    QMeeGoRuntime::setSurfaceScaling(0, 0, width(), height());
+}
+
+bool QMeeGoOverlayWidget::eventFilter(QObject *, QEvent *event)
+{
+    if (event->spontaneous() == false)
+        return false;
+
+    switch(event->type()) {
+        case QEvent::MouseButtonPress:
+        case QEvent::MouseButtonRelease:
+        {
+            QMouseEvent *e = static_cast <QMouseEvent *>(event);
+            QMouseEvent newEvent = QMouseEvent(e->type(), 
+                                               convertPoint(e->pos()), 
+                                               convertPoint(e->globalPos()), 
+                                               e->button(), 
+                                               e->buttons(), 
+                                               e->modifiers());
+            QCoreApplication::sendEvent(this, &newEvent);
+            return true;
+        }
+
+        default:
+            return false;
+    }
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegooverlaywidget.h	(revision 846)
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMEEGOOVERLAYWIDGET_H
+#define QMEEGOOVERLAYWIDGET_H
+
+#include <QWidget>
+
+//! A widget automatically scaling it's content.
+/*!
+*/
+
+class Q_DECL_EXPORT QMeeGoOverlayWidget : public QWidget
+{
+public:
+    //! Constructs a new scaling widget.
+    /*!
+     The real surface used for this widget will have the specified
+     width and height.
+    */
+    QMeeGoOverlayWidget(int surfaceWidth, int surfaceHeight, QWidget *parent = 0);
+
+
+    //! Event filtering function. 
+    /*!
+      Converts coordinates for mouse/touch event. Do not
+      call manually.
+    */
+    bool eventFilter(QObject *obj, QEvent *event);
+
+    //! Standard override.
+    /*!
+     The surface scaling on the target paint device is being
+     set when the widget is displayed for the first time.
+    */
+    virtual void showEvent(QShowEvent *event);
+
+private:
+    //! Converts coordinates between real & virtual area of the widget.
+    QPoint convertPoint(const QPoint &p);
+
+    int sw; /// Surface real width.
+    int sh; /// Surface real height.
+    float scaleW; /// Width scaling factor.
+    float scaleH; /// Height scaling factor.
+};
+
+#endif
Index: trunk/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegoruntime.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegoruntime.cpp	(revision 846)
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegoruntime.h"
+
+#include <private/qlibrary_p.h>
+#include <private/qfactoryloader_p.h>
+#include <private/qgraphicssystemplugin_p.h>
+#include <stdio.h>
+
+#define ENSURE_INITIALIZED {if (!initialized) initialize();}
+
+bool QMeeGoRuntime::initialized = false;
+
+typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataWithGLTextureFunc) (int w, int h);
+typedef bool (*QMeeGoDestroyEGLSharedImageFunc) (Qt::HANDLE handle);
+typedef void (*QMeeGoUpdateEglSharedImagePixmapFunc) (QPixmap*);
+typedef void (*QMeeGoSetSurfaceFixedSizeFunc) (int w, int h);
+typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h);
+typedef void (*QMeeGoSetTranslucentFunc) (bool translucent);
+typedef QPixmapData* (*QMeeGoPixmapDataWithNewLiveTextureFunc) (int w, int h, QImage::Format format);
+typedef QPixmapData* (*QMeeGoPixmapDataFromLiveTextureHandleFunc) (Qt::HANDLE h);
+typedef QImage* (*QMeeGoLiveTextureLockFunc) (QPixmap*, void* fenceSync);
+typedef bool (*QMeeGoLiveTextureReleaseFunc) (QPixmap*, QImage *i);
+typedef Qt::HANDLE (*QMeeGoLiveTextureGetHandleFunc) (QPixmap*);
+typedef void* (*QMeeGoCreateFenceSyncFunc) (void);
+typedef void (*QMeeGoDestroyFenceSyncFunc) (void *fs);
+
+static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
+static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL;
+static QMeeGoPixmapDataWithGLTextureFunc qt_meego_pixmapdata_with_gl_texture = NULL;
+static QMeeGoDestroyEGLSharedImageFunc qt_meego_destroy_egl_shared_image = NULL;
+static QMeeGoUpdateEglSharedImagePixmapFunc qt_meego_update_egl_shared_image_pixmap = NULL;
+static QMeeGoSetSurfaceFixedSizeFunc qt_meego_set_surface_fixed_size = NULL;
+static QMeeGoSetSurfaceScalingFunc qt_meego_set_surface_scaling = NULL;
+static QMeeGoSetTranslucentFunc qt_meego_set_translucent = NULL;
+static QMeeGoPixmapDataWithNewLiveTextureFunc qt_meego_pixmapdata_with_new_live_texture = NULL;
+static QMeeGoPixmapDataFromLiveTextureHandleFunc qt_meego_pixmapdata_from_live_texture_handle = NULL;
+static QMeeGoLiveTextureLockFunc qt_meego_live_texture_lock = NULL;
+static QMeeGoLiveTextureReleaseFunc qt_meego_live_texture_release = NULL;
+static QMeeGoLiveTextureGetHandleFunc qt_meego_live_texture_get_handle = NULL;
+static QMeeGoCreateFenceSyncFunc qt_meego_create_fence_sync = NULL;
+static QMeeGoDestroyFenceSyncFunc qt_meego_destroy_fence_sync = NULL;
+
+void QMeeGoRuntime::initialize()
+{
+    QFactoryLoader loader(QGraphicsSystemFactoryInterface_iid, QLatin1String("/graphicssystems"), Qt::CaseInsensitive);
+
+    QLibraryPrivate *libraryPrivate = loader.library(QLatin1String("meego"));
+    Q_ASSERT(libraryPrivate);
+
+    QLibrary library(libraryPrivate->fileName, libraryPrivate->fullVersion);
+
+    bool success = library.load();
+
+    if (success) {
+        qt_meego_image_to_egl_shared_image = (QMeeGoImageToEglSharedImageFunc) library.resolve("qt_meego_image_to_egl_shared_image");
+        qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+        qt_meego_pixmapdata_with_gl_texture = (QMeeGoPixmapDataWithGLTextureFunc) library.resolve("qt_meego_pixmapdata_with_gl_texture");
+        qt_meego_destroy_egl_shared_image = (QMeeGoDestroyEGLSharedImageFunc) library.resolve("qt_meego_destroy_egl_shared_image");
+        qt_meego_update_egl_shared_image_pixmap = (QMeeGoUpdateEglSharedImagePixmapFunc) library.resolve("qt_meego_update_egl_shared_image_pixmap");
+        qt_meego_set_surface_fixed_size = (QMeeGoSetSurfaceFixedSizeFunc) library.resolve("qt_meego_set_surface_fixed_size");
+        qt_meego_set_surface_scaling = (QMeeGoSetSurfaceScalingFunc) library.resolve("qt_meego_set_surface_scaling");
+        qt_meego_set_translucent = (QMeeGoSetTranslucentFunc) library.resolve("qt_meego_set_translucent");
+        qt_meego_pixmapdata_with_new_live_texture = (QMeeGoPixmapDataWithNewLiveTextureFunc) library.resolve("qt_meego_pixmapdata_with_new_live_texture");
+        qt_meego_pixmapdata_from_live_texture_handle = (QMeeGoPixmapDataFromLiveTextureHandleFunc) library.resolve("qt_meego_pixmapdata_from_live_texture_handle");
+        qt_meego_live_texture_lock = (QMeeGoLiveTextureLockFunc) library.resolve("qt_meego_live_texture_lock");
+        qt_meego_live_texture_release = (QMeeGoLiveTextureReleaseFunc) library.resolve("qt_meego_live_texture_release");
+        qt_meego_live_texture_get_handle = (QMeeGoLiveTextureGetHandleFunc) library.resolve("qt_meego_live_texture_get_handle");
+        qt_meego_create_fence_sync = (QMeeGoCreateFenceSyncFunc) library.resolve("qt_meego_create_fence_sync");
+        qt_meego_destroy_fence_sync = (QMeeGoDestroyFenceSyncFunc) library.resolve("qt_meego_destroy_fence_sync");
+
+        if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && 
+            qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && 
+            qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent && 
+            qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle &&
+            qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle &&
+            qt_meego_create_fence_sync && qt_meego_destroy_fence_sync)
+        {
+            qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion));
+        } else {
+            Q_ASSERT(false);
+        }
+    } else {
+        Q_ASSERT(false);
+    }
+
+    initialized = true;
+}
+
+Qt::HANDLE QMeeGoRuntime::imageToEGLSharedImage(const QImage &image)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_image_to_egl_shared_image);
+    return qt_meego_image_to_egl_shared_image(image);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_pixmapdata_from_egl_shared_image);
+    return qt_meego_pixmapdata_from_egl_shared_image(handle, softImage);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataWithGLTexture(int w, int h)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_pixmapdata_with_gl_texture);
+    return qt_meego_pixmapdata_with_gl_texture(w, h);
+}
+
+bool QMeeGoRuntime::destroyEGLSharedImage(Qt::HANDLE handle)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_destroy_egl_shared_image);
+    return qt_meego_destroy_egl_shared_image(handle);
+}
+
+void QMeeGoRuntime::updateEGLSharedImagePixmap(QPixmap *p)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_update_egl_shared_image_pixmap);
+    return qt_meego_update_egl_shared_image_pixmap(p);
+}
+
+void QMeeGoRuntime::setSurfaceFixedSize(int w, int h)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_set_surface_fixed_size);
+    qt_meego_set_surface_fixed_size(w, h);
+}
+
+void QMeeGoRuntime::setSurfaceScaling(int x, int y, int w, int h)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_set_surface_scaling);
+    qt_meego_set_surface_scaling(x, y, w, h);
+}
+
+void QMeeGoRuntime::setTranslucent(bool translucent)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_set_translucent);
+    qt_meego_set_translucent(translucent);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_pixmapdata_with_new_live_texture);
+    return qt_meego_pixmapdata_with_new_live_texture(w, h, format);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromLiveTextureHandle(Qt::HANDLE h)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_pixmapdata_from_live_texture_handle);
+    return qt_meego_pixmapdata_from_live_texture_handle(h);
+}
+
+QImage* QMeeGoRuntime::lockLiveTexture(QPixmap *p, void* fenceSync)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_live_texture_lock);
+    return qt_meego_live_texture_lock(p, fenceSync);
+}
+
+bool QMeeGoRuntime::releaseLiveTexture(QPixmap *p, QImage *i)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_live_texture_release);
+    return qt_meego_live_texture_release(p, i);
+}
+
+Qt::HANDLE QMeeGoRuntime::getLiveTextureHandle(QPixmap *pixmap)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_live_texture_get_handle);
+    return qt_meego_live_texture_get_handle(pixmap);
+}
+
+void* QMeeGoRuntime::createFenceSync()
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_create_fence_sync);
+    return qt_meego_create_fence_sync();
+}
+
+void QMeeGoRuntime::destroyFenceSync(void *fs)
+{
+    ENSURE_INITIALIZED;
+    Q_ASSERT(qt_meego_destroy_fence_sync);
+    qt_meego_destroy_fence_sync(fs);
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegoruntime.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegoruntime.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegoruntime.h	(revision 846)
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QPixmap>
+#include <QImage>
+
+class QMeeGoRuntime
+{
+public:
+    static void initialize();
+
+    static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
+    static QPixmapData* pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+    static QPixmapData* pixmapDataWithGLTexture(int w, int h);
+    static bool destroyEGLSharedImage(Qt::HANDLE handle);
+    static void updateEGLSharedImagePixmap(QPixmap *p);
+    static void setSurfaceFixedSize(int w, int h);
+    static void setSurfaceScaling(int x, int y, int w, int h);
+    static void setTranslucent(bool translucent);
+    static QPixmapData* pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
+    static QPixmapData* pixmapDataFromLiveTextureHandle(Qt::HANDLE h);
+    static QImage* lockLiveTexture(QPixmap *pixmap, void *fenceSync);
+    static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
+    static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
+    static void* createFenceSync();
+    static void destroyFenceSync(void *fs);
+
+private:
+    static bool initialized;
+};
Index: trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp	(revision 846)
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegoswitchevent.h"
+
+static int switchEventNumber = -1;
+
+QMeeGoSwitchEvent::QMeeGoSwitchEvent(const QString &graphicsSystemName, QMeeGoSwitchEvent::State s) : QEvent(QMeeGoSwitchEvent::eventNumber())
+{
+    name = graphicsSystemName;
+    switchState = s;
+}
+
+QString QMeeGoSwitchEvent::graphicsSystemName() const
+{
+    return name;
+}
+
+QMeeGoSwitchEvent::State QMeeGoSwitchEvent::state() const
+{
+    return switchState;
+}
+
+QEvent::Type QMeeGoSwitchEvent::eventNumber()
+{
+    if (switchEventNumber < 0)
+        switchEventNumber = QEvent::registerEventType();
+
+    return (QEvent::Type) switchEventNumber;
+}
Index: trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
===================================================================
--- trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.h	(revision 846)
+++ trunk/tools/qmeegographicssystemhelper/qmeegoswitchevent.h	(revision 846)
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QEvent>
+#include <QString>
+
+//! A custom event representing a graphics system switch.
+/*!
+ This event is sent two times -- before the actual switch and after the switch.
+ The current mode of the event can be detected by looking at the State of the
+ event.
+
+ The end-user application can use the event to drop it's own allocated GL resources
+ when going to software mode.
+*/
+
+class Q_DECL_EXPORT QMeeGoSwitchEvent : public QEvent
+{
+public:
+
+    //! The state represented by this event.
+    enum State {
+        WillSwitch,
+        DidSwitch
+    };
+
+    //! Constructor for the event.
+    /*!
+     Creates a new event with the given name and the given state.
+    */
+    QMeeGoSwitchEvent(const QString &graphicsSystemName, State s);
+
+    //! Returns the name of the target graphics system.
+    /*!
+     Depending on the state, the name represents the system we're about to swtich to,
+     or the system we just switched to.
+    */
+    QString graphicsSystemName() const;
+
+    //! Returns the state represented by this event.
+    State state() const;
+
+    //! Returns the event type/number for QMeeGoSwitchEvent.
+    /*!
+     The type is registered on first access. Use this to detect incoming
+     QMeeGoSwitchEvents.
+    */
+    static QEvent::Type eventNumber();
+
+private:
+    QString name;
+    State switchState;
+};
Index: trunk/tools/qml/Info_mac.plist
===================================================================
--- trunk/tools/qml/Info_mac.plist	(revision 846)
+++ trunk/tools/qml/Info_mac.plist	(revision 846)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.1">
+<dict>
+	<key>CFBundleIconFile</key>
+	<string>@ICON@</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.nokia.qt.qml</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+        <key>CFBundleGetInfoString</key>
+	<string>Created by Qt/QMake</string>
+	<key>CFBundleSignature</key>
+	<string>@TYPEINFO@</string>
+	<key>CFBundleExecutable</key>
+	<string>@EXECUTABLE@</string>
+        <key>UTExportedTypeDeclarations</key>
+          <array>
+            <dict>
+              <key>UTTypeIdentifier</key>
+              <string>com.nokia.qt.qml</string>
+              <key>UTTypeDescription</key>
+              <string>Qt Markup Language</string>
+              <key>UTTypeConformsTo</key>
+              <array>
+                <string>public.plain-text</string>
+              </array>
+              <key>UTTypeTagSpecification</key>
+              <dict>
+                <key>public.filename-extension</key>
+                <array>
+                  <string>qml</string>
+                </array>
+              </dict>
+            </dict>
+          </array>
+        <key>CFBundleDocumentTypes</key>
+          <array>
+            <dict>
+              <key>LSItemContentTypes</key>
+                <array>
+                  <string>com.nokia.qt.qml</string>
+                </array>
+              <key>CFBundleTypeRole</key>
+              <string>Viewer</string>
+            </dict>
+          </array>
+</dict>
+</plist>
Index: trunk/tools/qml/browser/Browser.qml
===================================================================
--- trunk/tools/qml/browser/Browser.qml	(revision 846)
+++ trunk/tools/qml/browser/Browser.qml	(revision 846)
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.folderlistmodel 1.0
+
+Rectangle {
+    id: root
+    property bool showFocusHighlight: false
+    property variant folders: folders1
+    property variant view: view1
+    width: 320
+    height: 480
+    color: palette.window
+
+    FolderListModel {
+        id: folders1
+        nameFilters: [ "*.qml" ]
+        folder: qmlViewerFolder
+    }
+    FolderListModel {
+        id: folders2
+        nameFilters: [ "*.qml" ]
+        folder: qmlViewerFolder
+    }
+
+    SystemPalette { id: palette }
+
+    function down(path) {
+        if (folders == folders1) {
+            view = view2
+            folders = folders2;
+            view1.state = "exitLeft";
+        } else {
+            view = view1
+            folders = folders1;
+            view2.state = "exitLeft";
+        }
+        view.x = root.width;
+        view.state = "current";
+        view.focus = true;
+        folders.folder = path;
+    }
+    function up() {
+        var path = folders.parentFolder;
+        if (folders == folders1) {
+            view = view2
+            folders = folders2;
+            view1.state = "exitRight";
+        } else {
+            view = view1
+            folders = folders1;
+            view2.state = "exitRight";
+        }
+        view.x = -root.width;
+        view.state = "current";
+        view.focus = true;
+        folders.folder = path;
+    }
+    function keyPressed(key) {
+        switch (key) {
+            case Qt.Key_Up:
+            case Qt.Key_Down:
+            case Qt.Key_Left:
+            case Qt.Key_Right:
+                root.showFocusHighlight = true;
+            break;
+            default:
+                // do nothing
+            break;
+        }
+    }
+
+    Component {
+        id: folderDelegate
+        Rectangle {
+            id: wrapper
+            function launch() {
+                if (folders.isFolder(index)) {
+                    down(filePath);
+                } else {
+                    qmlViewer.launch(filePath);
+                }
+            }
+            width: root.width
+            height: 52
+            color: "transparent"
+            Rectangle {
+                id: highlight; visible: false
+                anchors.fill: parent
+                color: palette.highlight
+                gradient: Gradient {
+                    GradientStop { id: t1; position: 0.0; color: palette.highlight }
+                    GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
+                }
+            }
+            Item {
+                width: 48; height: 48
+                Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)}
+            }
+            Text {
+                id: nameText
+                anchors.fill: parent; verticalAlignment: Text.AlignVCenter
+                text: fileName
+                anchors.leftMargin: 54
+                font.pixelSize: 32
+                color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText
+                elide: Text.ElideRight
+            }
+            MouseArea {
+                id: mouseRegion
+                anchors.fill: parent
+                onPressed: {
+                    root.showFocusHighlight = false;
+                    wrapper.ListView.view.currentIndex = index;
+                }
+                onClicked: { if (folders == wrapper.ListView.view.model) launch() }
+            }
+            states: [
+                State {
+                    name: "pressed"
+                    when: mouseRegion.pressed
+                    PropertyChanges { target: highlight; visible: true }
+                    PropertyChanges { target: nameText; color: palette.highlightedText }
+                }
+            ]
+        }
+    }
+
+    ListView {
+        id: view1
+        anchors.top: titleBar.bottom
+        anchors.bottom: parent.bottom
+        x: 0
+        width: parent.width
+        model: folders1
+        delegate: folderDelegate
+        highlight: Rectangle {
+            color: palette.highlight
+            visible: root.showFocusHighlight && view1.count != 0
+            gradient: Gradient {
+                GradientStop { id: t1; position: 0.0; color: palette.highlight }
+                GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
+            }
+            width: view1.currentItem == null ? 0 : view1.currentItem.width
+        }
+        highlightMoveSpeed: 1000
+        pressDelay: 100
+        focus: true
+        state: "current"
+        states: [
+            State {
+                name: "current"
+                PropertyChanges { target: view1; x: 0 }
+            },
+            State {
+                name: "exitLeft"
+                PropertyChanges { target: view1; x: -root.width }
+            },
+            State {
+                name: "exitRight"
+                PropertyChanges { target: view1; x: root.width }
+            }
+        ]
+        transitions: [
+            Transition {
+                to: "current"
+                SequentialAnimation {
+                    NumberAnimation { properties: "x"; duration: 250 }
+                }
+            },
+            Transition {
+                NumberAnimation { properties: "x"; duration: 250 }
+                NumberAnimation { properties: "x"; duration: 250 }
+            }
+        ]
+        Keys.onPressed: root.keyPressed(event.key)
+    }
+
+    ListView {
+        id: view2
+        anchors.top: titleBar.bottom
+        anchors.bottom: parent.bottom
+        x: parent.width
+        width: parent.width
+        model: folders2
+        delegate: folderDelegate
+        highlight: Rectangle {
+            color: palette.highlight
+            visible: root.showFocusHighlight && view2.count != 0
+            gradient: Gradient {
+                GradientStop { id: t1; position: 0.0; color: palette.highlight }
+                GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
+            }
+            width: view1.currentItem == null ? 0 : view1.currentItem.width
+        }
+        highlightMoveSpeed: 1000
+        pressDelay: 100
+        states: [
+            State {
+                name: "current"
+                PropertyChanges { target: view2; x: 0 }
+            },
+            State {
+                name: "exitLeft"
+                PropertyChanges { target: view2; x: -root.width }
+            },
+            State {
+                name: "exitRight"
+                PropertyChanges { target: view2; x: root.width }
+            }
+        ]
+        transitions: [
+            Transition {
+                to: "current"
+                SequentialAnimation {
+                    NumberAnimation { properties: "x"; duration: 250 }
+                }
+            },
+            Transition {
+                NumberAnimation { properties: "x"; duration: 250 }
+            }
+        ]
+        Keys.onPressed: root.keyPressed(event.key)
+    }
+
+    Keys.onPressed: {
+        root.keyPressed(event.key);
+        if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) {
+            view.currentItem.launch();
+            event.accepted = true;
+        } else if (event.key == Qt.Key_Left) {
+            up();
+        }
+    }
+
+    BorderImage {
+        source: "images/titlebar.sci";
+        width: parent.width;
+        height: 52
+        y: -7
+        id: titleBar
+
+        Rectangle {
+            id: upButton
+            width: 48
+            height: titleBar.height - 7
+            color: "transparent"
+
+            Image { anchors.centerIn: parent; source: "images/up.png" }
+            MouseArea { id: upRegion; anchors.centerIn: parent
+                width: 56
+                height: 56
+                onClicked: if (folders.parentFolder != "") up()
+            }
+            states: [
+                State {
+                    name: "pressed"
+                    when: upRegion.pressed
+                    PropertyChanges { target: upButton; color: palette.highlight }
+                }
+            ]
+        }
+        Rectangle {
+            color: "gray"
+            x: 48
+            width: 1
+            height: 44
+        }
+
+        Text {
+            anchors.left: upButton.right; anchors.right: parent.right; height: parent.height
+            anchors.leftMargin: 4; anchors.rightMargin: 4
+            text: folders.folder
+            color: "white"
+            elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
+            font.pixelSize: 32
+        }
+    }
+}
Index: trunk/tools/qml/browser/browser.qrc
===================================================================
--- trunk/tools/qml/browser/browser.qrc	(revision 846)
+++ trunk/tools/qml/browser/browser.qrc	(revision 846)
@@ -0,0 +1,9 @@
+<RCC>
+    <qresource prefix="/browser">
+        <file>Browser.qml</file>
+        <file>images/up.png</file>
+        <file>images/folder.png</file>
+        <file>images/titlebar.sci</file>
+        <file>images/titlebar.png</file>
+    </qresource>
+</RCC>
Index: trunk/tools/qml/browser/images/titlebar.sci
===================================================================
--- trunk/tools/qml/browser/images/titlebar.sci	(revision 846)
+++ trunk/tools/qml/browser/images/titlebar.sci	(revision 846)
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
Index: trunk/tools/qml/deviceorientation.cpp
===================================================================
--- trunk/tools/qml/deviceorientation.cpp	(revision 846)
+++ trunk/tools/qml/deviceorientation.cpp	(revision 846)
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceorientation.h"
+
+QT_USE_NAMESPACE
+
+class DefaultDeviceOrientation : public DeviceOrientation
+{
+    Q_OBJECT
+public:
+    DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {}
+
+    Orientation orientation() const {
+        return m_orientation;
+    }
+
+    void pauseListening() {
+    }
+    void resumeListening() {
+    }
+
+    void setOrientation(Orientation o) {
+        if (o != m_orientation) {
+            m_orientation = o;
+            emit orientationChanged();
+        }
+    }
+
+    Orientation m_orientation;
+};
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+    static DefaultDeviceOrientation *o = 0;
+    if (!o)
+        o = new DefaultDeviceOrientation;
+    return o;
+}
+
+#include "deviceorientation.moc"
+
Index: trunk/tools/qml/deviceorientation.h
===================================================================
--- trunk/tools/qml/deviceorientation.h	(revision 846)
+++ trunk/tools/qml/deviceorientation.h	(revision 846)
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ORIENTATION_H
+#define ORIENTATION_H
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+class DeviceOrientationPrivate;
+class DeviceOrientation : public QObject
+{
+    Q_OBJECT
+    Q_ENUMS(Orientation)
+public:
+    enum Orientation {
+        UnknownOrientation,
+        Portrait,
+        Landscape,
+        PortraitInverted,
+        LandscapeInverted
+    };
+
+    virtual Orientation orientation() const = 0;
+    virtual void setOrientation(Orientation) = 0;
+
+    virtual void pauseListening() = 0;
+    virtual void resumeListening() = 0;
+
+    static DeviceOrientation *instance();
+
+signals:
+    void orientationChanged();
+
+protected:
+    DeviceOrientation() {}
+
+private:
+    DeviceOrientationPrivate *d_ptr;
+    friend class DeviceOrientationPrivate;
+};
+
+QT_END_NAMESPACE
+
+#endif
Index: trunk/tools/qml/deviceorientation_harmattan.cpp
===================================================================
--- trunk/tools/qml/deviceorientation_harmattan.cpp	(revision 846)
+++ trunk/tools/qml/deviceorientation_harmattan.cpp	(revision 846)
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceorientation.h"
+#include <QtDBus>
+#include <QDebug>
+
+#define ORIENTATION_SERVICE "com.nokia.SensorService"
+#define ORIENTATION_PATH "/org/maemo/contextkit/Screen/TopEdge"
+#define CONTEXT_INTERFACE "org.maemo.contextkit.Property"
+#define CONTEXT_CHANGED "ValueChanged"
+#define CONTEXT_SUBSCRIBE "Subscribe"
+#define CONTEXT_UNSUBSCRIBE "Unsubscribe"
+#define CONTEXT_GET "Get"
+
+
+class HarmattanOrientation : public DeviceOrientation
+{
+    Q_OBJECT
+public:
+    HarmattanOrientation()
+        : o(UnknownOrientation), sensorEnabled(false)
+    {
+        resumeListening();
+        // connect to the orientation change signal
+        bool ok = QDBusConnection::systemBus().connect(ORIENTATION_SERVICE, ORIENTATION_PATH,
+                CONTEXT_INTERFACE,
+                CONTEXT_CHANGED,
+                this,
+                SLOT(deviceOrientationChanged(QList<QVariant>,quint64)));
+//        qDebug() << "connection OK" << ok;
+        QDBusMessage reply = QDBusConnection::systemBus().call(
+                QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+                                               CONTEXT_INTERFACE, CONTEXT_GET));
+        if (reply.type() != QDBusMessage::ErrorMessage) {
+            QList<QVariant> args;
+            qvariant_cast<QDBusArgument>(reply.arguments().at(0)) >> args;
+            deviceOrientationChanged(args, 0);
+        }
+    }
+
+    ~HarmattanOrientation()
+    {
+        // unsubscribe from the orientation sensor
+        if (sensorEnabled)
+            QDBusConnection::systemBus().call(
+                QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+                                               CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
+    }
+
+    inline Orientation orientation() const
+    {
+        return o;
+    }
+
+    void setOrientation(Orientation)
+    {
+    }
+
+    void pauseListening() {
+        if (sensorEnabled) {
+            // unsubscribe from the orientation sensor
+            QDBusConnection::systemBus().call(
+                    QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+                                                   CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
+            sensorEnabled = false;
+        }
+    }
+
+    void resumeListening() {
+        if (!sensorEnabled) {
+            // subscribe to the orientation sensor
+            QDBusMessage reply = QDBusConnection::systemBus().call(
+                    QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+                                                   CONTEXT_INTERFACE, CONTEXT_SUBSCRIBE));
+
+            if (reply.type() == QDBusMessage::ErrorMessage) {
+                qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
+            } else {
+                sensorEnabled = true;
+            }
+        }
+    }
+
+private Q_SLOTS:
+    void deviceOrientationChanged(QList<QVariant> args,quint64)
+    {
+        if (args.count() == 0)
+            return;
+        Orientation newOrientation = toOrientation(args.at(0).toString());
+        if (newOrientation != o) {
+            o = newOrientation;
+            emit orientationChanged();
+        }
+//        qDebug() << "orientation" << args.at(0).toString();
+    }
+
+private:
+    static Orientation toOrientation(const QString &nativeOrientation)
+    {
+        if (nativeOrientation == "top")
+            return Landscape;
+        else if (nativeOrientation == "left")
+            return Portrait;
+        else if (nativeOrientation == "bottom")
+            return LandscapeInverted;
+        else if (nativeOrientation == "right")
+            return PortraitInverted;
+        return UnknownOrientation;
+    }
+
+private:
+    Orientation o;
+    bool sensorEnabled;
+};
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+    static HarmattanOrientation *o = new HarmattanOrientation;
+    return o;
+}
+
+#include "deviceorientation_harmattan.moc"
Index: trunk/tools/qml/deviceorientation_maemo5.cpp
===================================================================
--- trunk/tools/qml/deviceorientation_maemo5.cpp	(revision 846)
+++ trunk/tools/qml/deviceorientation_maemo5.cpp	(revision 846)
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceorientation.h"
+#include <QtDBus>
+
+#include <mce/mode-names.h>
+#include <mce/dbus-names.h>
+
+class MaemoOrientation : public DeviceOrientation
+{
+    Q_OBJECT
+public:
+    MaemoOrientation()
+        : o(UnknownOrientation), sensorEnabled(false)
+    {
+        resumeListening();
+        // connect to the orientation change signal
+        QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
+                MCE_DEVICE_ORIENTATION_SIG,
+                this,
+                SLOT(deviceOrientationChanged(QString)));
+    }
+
+    ~MaemoOrientation()
+    {
+        // disable the orientation sensor
+        QDBusConnection::systemBus().call(
+                QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+                                               MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ));
+    }
+
+    inline Orientation orientation() const
+    {
+        return o;
+    }
+
+    void setOrientation(Orientation o)
+    {
+    }
+
+    void pauseListening() {
+        if (sensorEnabled) {
+            // disable the orientation sensor
+            QDBusConnection::systemBus().call(
+                    QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+                                                   MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ));
+            sensorEnabled = false;
+        }
+    }
+
+    void resumeListening() {
+        if (!sensorEnabled) {
+            // enable the orientation sensor
+            QDBusConnection::systemBus().call(
+                    QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+                                                   MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ));
+
+            QDBusMessage reply = QDBusConnection::systemBus().call(
+                    QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH,
+                                                   MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET));
+
+            if (reply.type() == QDBusMessage::ErrorMessage) {
+                qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
+            } else {
+                Orientation orientation = toOrientation(reply.arguments().value(0).toString());
+                if (o != orientation) {
+                    o = orientation;
+                    emit orientationChanged();
+                }
+                sensorEnabled = true;
+            }
+        }
+    }
+
+private Q_SLOTS:
+    void deviceOrientationChanged(const QString &newOrientation)
+    {
+        o = toOrientation(newOrientation);
+
+        emit orientationChanged();
+//        printf("%d\n", o);
+    }
+
+private:
+    static Orientation toOrientation(const QString &nativeOrientation)
+    {
+        if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE)
+            return Landscape;
+        else if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE_INVERTED)
+            return LandscapeInverted;
+        else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT)
+            return Portrait;
+        else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT_INVERTED)
+            return PortraitInverted;
+        return UnknownOrientation;
+    }
+
+private:
+    Orientation o;
+    bool sensorEnabled;
+};
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+    static MaemoOrientation *o = new MaemoOrientation;
+    return o;
+}
+
+#include "deviceorientation_maemo5.moc"
Index: trunk/tools/qml/deviceorientation_symbian.cpp
===================================================================
--- trunk/tools/qml/deviceorientation_symbian.cpp	(revision 846)
+++ trunk/tools/qml/deviceorientation_symbian.cpp	(revision 846)
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceorientation.h"
+
+#include <e32base.h>
+#include <sensrvchannelfinder.h>
+#include <sensrvdatalistener.h>
+#include <sensrvchannel.h>
+#include <sensrvorientationsensor.h>
+
+class SymbianOrientation : public DeviceOrientation, public MSensrvDataListener
+{
+    Q_OBJECT
+public:
+    SymbianOrientation()
+        : DeviceOrientation(), m_current(UnknownOrientation), m_sensorChannel(0), m_channelOpen(false)
+    {
+        TRAP_IGNORE(initL());
+        if (!m_sensorChannel)
+            qWarning("No valid sensors found.");
+    }
+
+    ~SymbianOrientation()
+    {
+        if (m_sensorChannel) {
+            m_sensorChannel->StopDataListening();
+            m_sensorChannel->CloseChannel();
+            delete m_sensorChannel;
+        }
+    }
+
+    void initL()
+    {
+        CSensrvChannelFinder *channelFinder = CSensrvChannelFinder::NewLC();
+        RSensrvChannelInfoList channelInfoList;
+        CleanupClosePushL(channelInfoList);
+
+        TSensrvChannelInfo searchConditions;
+        searchConditions.iChannelType = KSensrvChannelTypeIdOrientationData;
+        channelFinder->FindChannelsL(channelInfoList, searchConditions);
+
+        for (int i = 0; i < channelInfoList.Count(); ++i) {
+            TRAPD(error, m_sensorChannel = CSensrvChannel::NewL(channelInfoList[i]));
+            if (!error)
+                TRAP(error, m_sensorChannel->OpenChannelL());
+            if (!error) {
+                TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0));
+                m_channelOpen = true;
+                break;
+           }
+            if (error) {
+                delete m_sensorChannel;
+                m_sensorChannel = 0;
+            }
+        }
+
+        channelInfoList.Close();
+        CleanupStack::Pop(&channelInfoList);
+        CleanupStack::PopAndDestroy(channelFinder);
+    }
+
+    Orientation orientation() const
+    {
+        return m_current;
+    }
+
+   void setOrientation(Orientation) { }
+
+private:
+    DeviceOrientation::Orientation m_current;
+    CSensrvChannel *m_sensorChannel;
+    bool m_channelOpen;
+    void pauseListening() {
+        if (m_sensorChannel && m_channelOpen) {
+            m_sensorChannel->StopDataListening();
+            m_sensorChannel->CloseChannel();
+            m_channelOpen = false;
+        }
+    }
+
+    void resumeListening() {
+        if (m_sensorChannel && !m_channelOpen) {
+            TRAPD(error, m_sensorChannel->OpenChannelL());
+            if (!error) {
+                TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0));
+                if (!error) {
+                    m_channelOpen = true;
+                }
+            }
+            if (error) {
+                delete m_sensorChannel;
+                m_sensorChannel = 0;
+            }
+        }
+    }
+
+    void DataReceived(CSensrvChannel &channel, TInt count, TInt dataLost)
+    {
+        Q_UNUSED(dataLost)
+        if (channel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData) {
+            TSensrvOrientationData data;
+            for (int i = 0; i < count; ++i) {
+                TPckgBuf<TSensrvOrientationData> dataBuf;
+                channel.GetData(dataBuf);
+                data = dataBuf();
+                Orientation orientation = UnknownOrientation;
+                switch (data.iDeviceOrientation) {
+                case TSensrvOrientationData::EOrientationDisplayUp:
+                    orientation = Portrait;
+                    break;
+                case TSensrvOrientationData::EOrientationDisplayRightUp:
+                    orientation = Landscape;
+                    break;
+                case TSensrvOrientationData::EOrientationDisplayLeftUp:
+                    orientation = LandscapeInverted;
+                    break;
+                case TSensrvOrientationData::EOrientationDisplayDown:
+                    orientation = PortraitInverted;
+                    break;
+                case TSensrvOrientationData::EOrientationUndefined:
+                case TSensrvOrientationData::EOrientationDisplayUpwards:
+                case TSensrvOrientationData::EOrientationDisplayDownwards:
+                default:
+                    break;
+                }
+
+                if (m_current != orientation && orientation != UnknownOrientation) {
+                    m_current = orientation;
+                    emit orientationChanged();
+                }
+           }
+        }
+    }
+
+   void DataError(CSensrvChannel& /* channel */, TSensrvErrorSeverity /* error */)
+   {
+   }
+
+   void GetDataListenerInterfaceL(TUid /* interfaceUid */, TAny*& /* interface */)
+   {
+   }
+};
+
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+    static SymbianOrientation *o = 0;
+    if (!o)
+        o = new SymbianOrientation;
+    return o;
+}
+
+#include "deviceorientation_symbian.moc"
Index: trunk/tools/qml/loggerwidget.cpp
===================================================================
--- trunk/tools/qml/loggerwidget.cpp	(revision 846)
+++ trunk/tools/qml/loggerwidget.cpp	(revision 846)
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qglobal.h>
+#include <QDebug>
+#include <QSettings>
+#include <QActionGroup>
+#include <QMenu>
+#include <QPlainTextEdit>
+#ifdef Q_WS_MAEMO_5
+#  include <QScrollArea>
+#  include <QVBoxLayout>
+#  include "texteditautoresizer_maemo5.h"
+#endif
+
+#include "loggerwidget.h"
+
+QT_BEGIN_NAMESPACE
+
+LoggerWidget::LoggerWidget(QWidget *parent) :
+    QMainWindow(parent),
+    m_visibilityOrigin(SettingsOrigin)
+{
+    setAttribute(Qt::WA_QuitOnClose, false);
+    setWindowTitle(tr("Warnings"));
+
+    m_plainTextEdit = new QPlainTextEdit();
+
+#ifdef Q_WS_MAEMO_5
+    new TextEditAutoResizer(m_plainTextEdit);
+    setAttribute(Qt::WA_Maemo5StackedWindow);
+    QScrollArea *area = new QScrollArea();
+    area->setWidget(m_plainTextEdit);
+    area->setWidgetResizable(true);
+    setCentralWidget(area);
+#else
+    setCentralWidget(m_plainTextEdit);
+#endif
+    readSettings();
+    setupPreferencesMenu();
+}
+
+void LoggerWidget::append(const QString &msg)
+{
+    m_plainTextEdit->appendPlainText(msg);
+
+    if (!isVisible() && (defaultVisibility() == AutoShowWarnings))
+        setVisible(true);
+}
+
+LoggerWidget::Visibility LoggerWidget::defaultVisibility() const
+{
+    return m_visibility;
+}
+
+void LoggerWidget::setDefaultVisibility(LoggerWidget::Visibility visibility)
+{
+    if (m_visibility == visibility)
+        return;
+
+    m_visibility = visibility;
+    m_visibilityOrigin = CommandLineOrigin;
+
+    m_preferencesMenu->setEnabled(m_visibilityOrigin == SettingsOrigin);
+}
+
+QMenu *LoggerWidget::preferencesMenu()
+{
+    return m_preferencesMenu;
+}
+
+QAction *LoggerWidget::showAction()
+{
+    return m_showWidgetAction;
+}
+
+void LoggerWidget::readSettings()
+{
+    QSettings settings;
+    QString warningsPreferences = settings.value("warnings", "hide").toString();
+    if (warningsPreferences == "show") {
+        m_visibility = ShowWarnings;
+    } else if (warningsPreferences == "hide") {
+        m_visibility = HideWarnings;
+    } else {
+        m_visibility = AutoShowWarnings;
+    }
+}
+
+void LoggerWidget::saveSettings()
+{
+    if (m_visibilityOrigin != SettingsOrigin)
+        return;
+
+    QString value = "autoShow";
+    if (defaultVisibility() == ShowWarnings) {
+        value = "show";
+    } else if (defaultVisibility() == HideWarnings) {
+        value = "hide";
+    }
+
+    QSettings settings;
+    settings.setValue("warnings", value);
+}
+
+void LoggerWidget::warningsPreferenceChanged(QAction *action)
+{
+    Visibility newSetting = static_cast<Visibility>(action->data().toInt());
+    m_visibility = newSetting;
+    saveSettings();
+}
+
+void LoggerWidget::showEvent(QShowEvent *event)
+{
+    QWidget::showEvent(event);
+    emit opened();
+}
+
+void LoggerWidget::closeEvent(QCloseEvent *event)
+{
+    QWidget::closeEvent(event);
+    emit closed();
+}
+
+void LoggerWidget::setupPreferencesMenu()
+{
+    m_preferencesMenu = new QMenu(tr("Warnings"));
+    QActionGroup *warnings = new QActionGroup(m_preferencesMenu);
+    warnings->setExclusive(true);
+
+    connect(warnings, SIGNAL(triggered(QAction*)), this, SLOT(warningsPreferenceChanged(QAction*)));
+
+    QAction *showWarningsPreference = new QAction(tr("Show by default"), m_preferencesMenu);
+    showWarningsPreference->setCheckable(true);
+    showWarningsPreference->setData(LoggerWidget::ShowWarnings);
+    warnings->addAction(showWarningsPreference);
+    m_preferencesMenu->addAction(showWarningsPreference);
+
+    QAction *hideWarningsPreference = new QAction(tr("Hide by default"), m_preferencesMenu);
+    hideWarningsPreference->setCheckable(true);
+    hideWarningsPreference->setData(LoggerWidget::HideWarnings);
+    warnings->addAction(hideWarningsPreference);
+    m_preferencesMenu->addAction(hideWarningsPreference);
+
+    QAction *autoWarningsPreference = new QAction(tr("Show for first warning"), m_preferencesMenu);
+    autoWarningsPreference->setCheckable(true);
+    autoWarningsPreference->setData(LoggerWidget::AutoShowWarnings);
+    warnings->addAction(autoWarningsPreference);
+    m_preferencesMenu->addAction(autoWarningsPreference);
+
+    switch (defaultVisibility()) {
+    case LoggerWidget::ShowWarnings:
+        showWarningsPreference->setChecked(true);
+        break;
+    case LoggerWidget::HideWarnings:
+        hideWarningsPreference->setChecked(true);
+        break;
+    default:
+        autoWarningsPreference->setChecked(true);
+    }
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/qml/loggerwidget.h
===================================================================
--- trunk/tools/qml/loggerwidget.h	(revision 846)
+++ trunk/tools/qml/loggerwidget.h	(revision 846)
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef LOGGERWIDGET_H
+#define LOGGERWIDGET_H
+
+#include <QMainWindow>
+#include <QMetaType>
+
+QT_BEGIN_NAMESPACE
+
+class QPlainTextEdit;
+class QMenu;
+class QAction;
+
+class LoggerWidget : public QMainWindow {
+    Q_OBJECT
+public:
+    LoggerWidget(QWidget *parent=0);
+
+    enum Visibility { ShowWarnings, HideWarnings, AutoShowWarnings };
+
+    Visibility defaultVisibility() const;
+    void setDefaultVisibility(Visibility visibility);
+
+    QMenu *preferencesMenu();
+    QAction *showAction();
+
+public slots:
+    void append(const QString &msg);
+
+private slots:
+    void warningsPreferenceChanged(QAction *action);
+    void readSettings();
+    void saveSettings();
+
+protected:
+    void showEvent(QShowEvent *event);
+    void closeEvent(QCloseEvent *event);
+
+signals:
+    void opened();
+    void closed();
+
+private:
+    void setupPreferencesMenu();
+
+    QMenu *m_preferencesMenu;
+    QAction *m_showWidgetAction;
+    QPlainTextEdit *m_plainTextEdit;
+
+    enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
+    ConfigOrigin m_visibilityOrigin;
+    Visibility m_visibility;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(LoggerWidget::Visibility)
+
+#endif // LOGGERWIDGET_H
Index: trunk/tools/qml/main.cpp
===================================================================
--- trunk/tools/qml/main.cpp	(revision 846)
+++ trunk/tools/qml/main.cpp	(revision 846)
@@ -0,0 +1,603 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarative.h"
+#include "qmlruntime.h"
+#include "qdeclarativeengine.h"
+#include "loggerwidget.h"
+#include <QWidget>
+#include <QDir>
+#include <QApplication>
+#include <QTranslator>
+#include <QDebug>
+#include <QMessageBox>
+#include <QAtomicInt>
+#include "qdeclarativetester.h"
+
+QT_USE_NAMESPACE
+
+QtMsgHandler systemMsgOutput = 0;
+
+static QDeclarativeViewer *openFile(const QString &fileName);
+static void showViewer(QDeclarativeViewer *viewer);
+
+QString warnings;
+void exitApp(int i)
+{
+#ifdef Q_OS_WIN
+    // Debugging output is not visible by default on Windows -
+    // therefore show modal dialog with errors instead.
+    if (!warnings.isEmpty()) {
+        QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
+    }
+#endif
+    exit(i);
+}
+
+#if defined (Q_OS_SYMBIAN)
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+void myMessageOutput(QtMsgType type, const char *msg)
+{
+    static int fd = -1;
+    if (fd == -1)
+        fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT);
+
+    ::write(fd, msg, strlen(msg));
+    ::write(fd, "\n", 1);
+    ::fsync(fd);
+
+    switch (type) {
+    case QtFatalMsg:
+        abort();
+    }
+}
+
+#else // !defined (Q_OS_SYMBIAN)
+
+QWeakPointer<LoggerWidget> logger;
+
+static QAtomicInt recursiveLock(0);
+
+void myMessageOutput(QtMsgType type, const char *msg)
+{
+    QString strMsg = QString::fromLatin1(msg);
+
+    if (!QCoreApplication::closingDown()) {
+        if (!logger.isNull()) {
+            if (recursiveLock.testAndSetOrdered(0, 1)) {
+                QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+                recursiveLock = 0;
+            }
+        } else {
+            warnings += strMsg;
+            warnings += QLatin1Char('\n');
+        }
+    }
+    if (systemMsgOutput) { // Windows
+        systemMsgOutput(type, msg);
+    } else { // Unix
+        fprintf(stderr, "%s\n", msg);
+        fflush(stderr);
+    }
+}
+
+#endif
+
+static QDeclarativeViewer* globalViewer = 0;
+
+// The qml file that is shown if the user didn't specify a QML file
+QString initialFile = "qrc:/startup/startup.qml";
+
+void usage()
+{
+    qWarning("Usage: qmlviewer [options] <filename>");
+    qWarning(" ");
+    qWarning(" options:");
+    qWarning("  -v, -version ............................. display version");
+    qWarning("  -frameless ............................... run with no window frame");
+    qWarning("  -maximized................................ run maximized");
+    qWarning("  -fullscreen............................... run fullscreen");
+    qWarning("  -stayontop................................ keep viewer window on top");
+    qWarning("  -sizeviewtorootobject .................... the view resizes to the changes in the content");
+    qWarning("  -sizerootobjecttoview .................... the content resizes to the changes in the view (default)");
+    qWarning("  -qmlbrowser .............................. use a QML-based file browser");
+    qWarning("  -warnings [show|hide]..................... show warnings in a separate log window");
+    qWarning("  -recordfile <output> ..................... set video recording file");
+    qWarning("                                              - ImageMagick 'convert' for GIF)");
+    qWarning("                                              - png file for raw frames");
+    qWarning("                                              - 'ffmpeg' for other formats");
+    qWarning("  -recorddither ordered|threshold|floyd .... set GIF dither recording mode");
+    qWarning("  -recordrate <fps> ........................ set recording frame rate");
+    qWarning("  -record arg .............................. add a recording process argument");
+    qWarning("  -autorecord [from-]<tomilliseconds> ...... set recording to start and stop");
+    qWarning("  -devicekeys .............................. use numeric keys (see F1)");
+    qWarning("  -dragthreshold <size> .................... set mouse drag threshold size");
+    qWarning("  -netcache <size> ......................... set disk cache to size bytes");
+    qWarning("  -translation <translationfile> ........... set the language to run in");
+    qWarning("  -I <directory> ........................... prepend to the module import search path,");
+    qWarning("                                             display path if <directory> is empty");
+    qWarning("  -P <directory> ........................... prepend to the plugin search path");
+#if defined(Q_WS_MAC)
+    qWarning("  -no-opengl ............................... don't use a QGLWidget for the viewport");
+#else
+    qWarning("  -opengl .................................. use a QGLWidget for the viewport");
+#endif
+    qWarning("  -script <path> ........................... set the script to use");
+    qWarning("  -scriptopts <options>|help ............... set the script options to use");
+
+    qWarning(" ");
+    qWarning(" Press F1 for interactive help");
+
+    exitApp(1);
+}
+
+void scriptOptsUsage()
+{
+    qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ...");
+    qWarning(" options:");
+    qWarning("  record ................................... record a new script");
+    qWarning("  play ..................................... playback an existing script");
+    qWarning("  testimages ............................... record images or compare images on playback");
+    qWarning("  testerror ................................ test 'error' property of root item on playback");
+    qWarning("  testskip  ................................ test 'skip' property of root item on playback");
+    qWarning("  snapshot ................................. file being recorded is static,");
+    qWarning("                                             only one frame will be recorded or tested");
+    qWarning("  exitoncomplete ........................... cleanly exit the viewer on script completion");
+    qWarning("  exitonfailure ............................ immediately exit the viewer on script failure");
+    qWarning("  saveonexit ............................... save recording on viewer exit");
+    qWarning(" ");
+    qWarning(" One of record, play or both must be specified.");
+
+    exitApp(1);
+}
+
+enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
+
+struct ViewerOptions
+{
+    ViewerOptions()
+        : frameless(false),
+          fps(0.0),
+          autorecord_from(0),
+          autorecord_to(0),
+          dither("none"),
+          runScript(false),
+          devkeys(false),
+          cache(0),
+          useGL(false),
+          fullScreen(false),
+          stayOnTop(false),
+          maximized(false),
+          useNativeFileBrowser(true),
+          experimentalGestures(false),
+          warningsConfig(DefaultWarnings),
+          sizeToView(true)
+    {
+#if defined(Q_OS_SYMBIAN)
+        maximized = true;
+        useNativeFileBrowser = false;
+#endif
+
+#if defined(Q_WS_MAC)
+        useGL = true;
+#endif
+    }
+
+    bool frameless;
+    double fps;
+    int autorecord_from;
+    int autorecord_to;
+    QString dither;
+    QString recordfile;
+    QStringList recordargs;
+    QStringList imports;
+    QStringList plugins;
+    QString script;
+    QString scriptopts;
+    bool runScript;
+    bool devkeys;
+    int cache;
+    QString translationFile;
+    bool useGL;
+    bool fullScreen;
+    bool stayOnTop;
+    bool maximized;
+    bool useNativeFileBrowser;
+    bool experimentalGestures;
+
+    WarningsConfig warningsConfig;
+    bool sizeToView;
+
+    QDeclarativeViewer::ScriptOptions scriptOptions;
+};
+
+static ViewerOptions opts;
+static QStringList fileNames;
+
+class Application : public QApplication
+{
+    Q_OBJECT
+public:
+    Application(int &argc, char **&argv)
+        : QApplication(argc, argv)
+    {}
+
+protected:
+    bool event(QEvent *ev)
+    {
+        if (ev->type() != QEvent::FileOpen)
+            return QApplication::event(ev);
+
+        QFileOpenEvent *fev = static_cast<QFileOpenEvent *>(ev);
+
+        globalViewer->open(fev->file());
+        if (!globalViewer->isVisible())
+            showViewer(globalViewer);
+
+        return true;
+    }
+
+private Q_SLOTS:
+    void showInitialViewer()
+    {
+        QApplication::processEvents();
+
+        QDeclarativeViewer *viewer = globalViewer;
+        if (!viewer)
+            return;
+        if (viewer->currentFile().isEmpty()) {
+            if(opts.useNativeFileBrowser)
+                viewer->open(initialFile);
+            else
+                viewer->openFile();
+        }
+        if (!viewer->isVisible())
+            showViewer(viewer);
+    }
+};
+
+static void parseScriptOptions()
+{
+    QStringList options =
+        opts.scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);
+
+    QDeclarativeViewer::ScriptOptions scriptOptions = 0;
+    for (int i = 0; i < options.count(); ++i) {
+        const QString &option = options.at(i);
+        if (option == QLatin1String("help")) {
+            scriptOptsUsage();
+        } else if (option == QLatin1String("play")) {
+            scriptOptions |= QDeclarativeViewer::Play;
+        } else if (option == QLatin1String("record")) {
+            scriptOptions |= QDeclarativeViewer::Record;
+        } else if (option == QLatin1String("testimages")) {
+            scriptOptions |= QDeclarativeViewer::TestImages;
+        } else if (option == QLatin1String("testerror")) {
+            scriptOptions |= QDeclarativeViewer::TestErrorProperty;
+        } else if (option == QLatin1String("testskip")) {
+            scriptOptions |= QDeclarativeViewer::TestSkipProperty;
+        } else if (option == QLatin1String("exitoncomplete")) {
+            scriptOptions |= QDeclarativeViewer::ExitOnComplete;
+        } else if (option == QLatin1String("exitonfailure")) {
+            scriptOptions |= QDeclarativeViewer::ExitOnFailure;
+        } else if (option == QLatin1String("saveonexit")) {
+            scriptOptions |= QDeclarativeViewer::SaveOnExit;
+        } else if (option == QLatin1String("snapshot")) {
+            scriptOptions |= QDeclarativeViewer::Snapshot;
+        } else {
+            scriptOptsUsage();
+        }
+    }
+
+    opts.scriptOptions = scriptOptions;
+}
+
+static void parseCommandLineOptions(const QStringList &arguments)
+{
+    for (int i = 1; i < arguments.count(); ++i) {
+        bool lastArg = (i == arguments.count() - 1);
+        QString arg = arguments.at(i);
+        if (arg == "-frameless") {
+            opts.frameless = true;
+        } else if (arg == "-maximized") {
+            opts.maximized = true;
+        } else if (arg == "-fullscreen") {
+            opts.fullScreen = true;
+        } else if (arg == "-stayontop") {
+            opts.stayOnTop = true;
+        } else if (arg == "-netcache") {
+            if (lastArg) usage();
+            opts.cache = arguments.at(++i).toInt();
+        } else if (arg == "-recordrate") {
+            if (lastArg) usage();
+            opts.fps = arguments.at(++i).toDouble();
+        } else if (arg == "-recordfile") {
+            if (lastArg) usage();
+            opts.recordfile = arguments.at(++i);
+        } else if (arg == "-record") {
+            if (lastArg) usage();
+            opts.recordargs << arguments.at(++i);
+        } else if (arg == "-recorddither") {
+            if (lastArg) usage();
+            opts.dither = arguments.at(++i);
+        } else if (arg == "-autorecord") {
+            if (lastArg) usage();
+            QString range = arguments.at(++i);
+            int dash = range.indexOf('-');
+            if (dash > 0)
+                opts.autorecord_from = range.left(dash).toInt();
+            opts.autorecord_to = range.mid(dash+1).toInt();
+        } else if (arg == "-devicekeys") {
+            opts.devkeys = true;
+        } else if (arg == "-dragthreshold") {
+            if (lastArg) usage();
+            qApp->setStartDragDistance(arguments.at(++i).toInt());
+        } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
+            qWarning("Qt QML Viewer version %s", QT_VERSION_STR);
+            exitApp(0);
+        } else if (arg == "-translation") {
+            if (lastArg) usage();
+            opts.translationFile = arguments.at(++i);
+#if defined(Q_WS_MAC)
+        } else if (arg == "-no-opengl") {
+            opts.useGL = false;
+#else
+        } else if (arg == "-opengl") {
+            opts.useGL = true;
+#endif
+        } else if (arg == "-qmlbrowser") {
+            opts.useNativeFileBrowser = false;
+        } else if (arg == "-warnings") {
+            if (lastArg) usage();
+            QString warningsStr = arguments.at(++i);
+            if (warningsStr == QLatin1String("show")) {
+                opts.warningsConfig = ShowWarnings;
+            } else if (warningsStr == QLatin1String("hide")) {
+                opts.warningsConfig = HideWarnings;
+            } else {
+                usage();
+            }
+        } else if (arg == "-I" || arg == "-L") {
+            if (arg == "-L")
+                qWarning("-L option provided for compatibility only, use -I instead");
+            if (lastArg) {
+                QDeclarativeEngine tmpEngine;
+                QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
+                qWarning("Current search path: %s", paths.toLocal8Bit().constData());
+                exitApp(0);
+            }
+            opts.imports << arguments.at(++i);
+        } else if (arg == "-P") {
+            if (lastArg) usage();
+            opts.plugins << arguments.at(++i);
+        } else if (arg == "-script") {
+            if (lastArg) usage();
+            opts.script = arguments.at(++i);
+        } else if (arg == "-scriptopts") {
+            if (lastArg) usage();
+            opts.scriptopts = arguments.at(++i);
+        } else if (arg == "-savescript") {
+            if (lastArg) usage();
+            opts.script = arguments.at(++i);
+            opts.runScript = false;
+        } else if (arg == "-playscript") {
+            if (lastArg) usage();
+            opts.script = arguments.at(++i);
+            opts.runScript = true;
+        } else if (arg == "-sizeviewtorootobject") {
+            opts.sizeToView = false;
+        } else if (arg == "-sizerootobjecttoview") {
+            opts.sizeToView = true;
+        } else if (arg == "-experimentalgestures") {
+            opts.experimentalGestures = true;
+        } else if (!arg.startsWith('-')) {
+            fileNames.append(arg);
+        } else if (true || arg == "-help") {
+            usage();
+        }
+    }
+
+    if (!opts.scriptopts.isEmpty()) {
+
+        parseScriptOptions();
+
+        if (opts.script.isEmpty())
+            usage();
+
+        if (!(opts.scriptOptions & QDeclarativeViewer::Record) && !(opts.scriptOptions & QDeclarativeViewer::Play))
+            scriptOptsUsage();
+    }  else if (!opts.script.isEmpty()) {
+        usage();
+    }
+
+}
+
+static QDeclarativeViewer *createViewer()
+{
+    Qt::WFlags wflags = (opts.frameless ? Qt::FramelessWindowHint : Qt::Widget);
+    if (opts.stayOnTop)
+        wflags |= Qt::WindowStaysOnTopHint;
+
+    QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
+    viewer->setAttribute(Qt::WA_DeleteOnClose, true);
+    viewer->setUseGL(opts.useGL);
+
+    if (!opts.scriptopts.isEmpty()) {
+        viewer->setScriptOptions(opts.scriptOptions);
+        viewer->setScript(opts.script);
+    }
+
+#if !defined(Q_OS_SYMBIAN)
+    logger = viewer->warningsWidget();
+    if (opts.warningsConfig == ShowWarnings) {
+        logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings);
+        logger.data()->show();
+    } else if (opts.warningsConfig == HideWarnings){
+        logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
+    }
+#endif
+
+    if (opts.experimentalGestures)
+        viewer->enableExperimentalGestures();
+
+    foreach (QString lib, opts.imports)
+        viewer->addLibraryPath(lib);
+
+    foreach (QString plugin, opts.plugins)
+        viewer->addPluginPath(plugin);
+
+    viewer->setNetworkCacheSize(opts.cache);
+    viewer->setRecordFile(opts.recordfile);
+    viewer->setSizeToView(opts.sizeToView);
+    if (opts.fps > 0)
+        viewer->setRecordRate(opts.fps);
+    if (opts.autorecord_to)
+        viewer->setAutoRecord(opts.autorecord_from, opts.autorecord_to);
+    if (opts.devkeys)
+        viewer->setDeviceKeys(true);
+    viewer->setRecordDither(opts.dither);
+    if (opts.recordargs.count())
+        viewer->setRecordArgs(opts.recordargs);
+
+    viewer->setUseNativeFileBrowser(opts.useNativeFileBrowser);
+
+    return viewer;
+}
+
+void showViewer(QDeclarativeViewer *viewer)
+{
+    if (opts.fullScreen)
+        viewer->showFullScreen();
+    else if (opts.maximized)
+        viewer->showMaximized();
+    else
+        viewer->show();
+    viewer->raise();
+}
+
+QDeclarativeViewer *openFile(const QString &fileName)
+{
+    QDeclarativeViewer *viewer = globalViewer;
+
+    viewer->open(fileName);
+    showViewer(viewer);
+
+    return viewer;
+}
+
+int main(int argc, char ** argv)
+{
+#if defined (Q_OS_SYMBIAN)
+    qInstallMsgHandler(myMessageOutput);
+#else
+    systemMsgOutput = qInstallMsgHandler(myMessageOutput);
+#endif
+
+#if defined (Q_WS_X11) || defined (Q_WS_MAC)
+    //### default to using raster graphics backend for now
+    bool gsSpecified = false;
+    for (int i = 0; i < argc; ++i) {
+        QString arg = argv[i];
+        if (arg == "-graphicssystem") {
+            gsSpecified = true;
+            break;
+        }
+    }
+
+    if (!gsSpecified)
+        QApplication::setGraphicsSystem("raster");
+#endif
+
+    Application app(argc, argv);
+    app.setApplicationName("QtQmlViewer");
+    app.setOrganizationName("Nokia");
+    app.setOrganizationDomain("nokia.com");
+
+    QDeclarativeViewer::registerTypes();
+    QDeclarativeTester::registerTypes();
+
+    parseCommandLineOptions(app.arguments());
+
+    QTranslator qmlTranslator;
+    if (!opts.translationFile.isEmpty()) {
+        qmlTranslator.load(opts.translationFile);
+        app.installTranslator(&qmlTranslator);
+    }
+
+    if (opts.fullScreen && opts.maximized)
+        qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
+
+    if (fileNames.isEmpty()) {
+        QFile qmlapp(QLatin1String("qmlapp"));
+        if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) {
+            QString content = QString::fromUtf8(qmlapp.readAll());
+            qmlapp.close();
+
+            int newline = content.indexOf(QLatin1Char('\n'));
+            if (newline >= 0)
+                fileNames += content.left(newline);
+            else
+                fileNames += content;
+        }
+    }
+
+    globalViewer = createViewer();
+
+    if (fileNames.isEmpty()) {
+        // show the initial viewer delayed.
+        // This prevents an initial viewer popping up while there
+        // are FileOpen events coming through the event queue
+        QTimer::singleShot(1, &app, SLOT(showInitialViewer()));
+    } else {
+        foreach (const QString &fileName, fileNames)
+            openFile(fileName);
+    }
+
+    QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
+
+    return app.exec();
+}
+
+#include "main.moc"
Index: trunk/tools/qml/proxysettings.cpp
===================================================================
--- trunk/tools/qml/proxysettings.cpp	(revision 846)
+++ trunk/tools/qml/proxysettings.cpp	(revision 846)
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QIntValidator>
+#include <QSettings>
+
+#include "proxysettings.h"
+
+QT_BEGIN_NAMESPACE
+
+ProxySettings::ProxySettings (QWidget * parent)
+    : QDialog (parent), Ui::ProxySettings()
+{
+    setupUi (this);
+
+#if !defined Q_WS_MAEMO_5
+    // the onscreen keyboard can't cope with masks
+    proxyServerEdit->setInputMask ("000.000.000.000;_");
+#endif
+    QIntValidator *validator = new QIntValidator (0, 9999, this);
+    proxyPortEdit->setValidator (validator);
+
+    QSettings settings;
+    proxyCheckBox->setChecked (settings.value ("http_proxy/use", 0).toBool ());
+    proxyServerEdit->insert (settings.value ("http_proxy/hostname", "").toString ());
+    proxyPortEdit->insert (settings.value ("http_proxy/port", "80").toString ());
+    usernameEdit->insert (settings.value ("http_proxy/username", "").toString ());
+    passwordEdit->insert (settings.value ("http_proxy/password", "").toString ());
+}
+
+ProxySettings::~ProxySettings()
+{
+}
+
+void ProxySettings::accept ()
+{
+    QSettings settings;
+
+    settings.setValue ("http_proxy/use", proxyCheckBox->isChecked ());
+    settings.setValue ("http_proxy/hostname", proxyServerEdit->text ());
+    settings.setValue ("http_proxy/port", proxyPortEdit->text ());
+    settings.setValue ("http_proxy/username", usernameEdit->text ());
+    settings.setValue ("http_proxy/password", passwordEdit->text ());
+
+    QDialog::accept ();
+}
+
+QNetworkProxy ProxySettings::httpProxy ()
+{
+    QSettings settings;
+    QNetworkProxy proxy;
+
+    bool proxyInUse = settings.value ("http_proxy/use", 0).toBool ();
+    if (proxyInUse) {
+        proxy.setType (QNetworkProxy::HttpProxy);
+        proxy.setHostName (settings.value ("http_proxy/hostname", "").toString ());// "192.168.220.5"
+        proxy.setPort (settings.value ("http_proxy/port", 80).toInt ());  // 8080
+        proxy.setUser (settings.value ("http_proxy/username", "").toString ());
+        proxy.setPassword (settings.value ("http_proxy/password", "").toString ());
+        //QNetworkProxy::setApplicationProxy (proxy);
+    }
+    else {
+        proxy.setType (QNetworkProxy::NoProxy);
+    }
+    return proxy;
+}
+
+bool ProxySettings::httpProxyInUse()
+{
+    QSettings settings;
+    return settings.value ("http_proxy/use", 0).toBool ();
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/qml/proxysettings.h
===================================================================
--- trunk/tools/qml/proxysettings.h	(revision 846)
+++ trunk/tools/qml/proxysettings.h	(revision 846)
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PROXYSETTINGS_H
+#define PROXYSETTINGS_H
+
+#include <QDialog>
+#include <QNetworkProxy>
+#ifdef Q_WS_MAEMO_5
+#include "ui_proxysettings_maemo5.h"
+#else
+#include "ui_proxysettings.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+/**
+*/
+class ProxySettings : public QDialog, public Ui::ProxySettings
+{
+
+Q_OBJECT
+
+public:
+    ProxySettings(QWidget * parent = 0);
+
+    ~ProxySettings();
+
+    static QNetworkProxy httpProxy ();
+    static bool httpProxyInUse ();
+
+public slots:
+    virtual void accept ();
+};
+
+QT_END_NAMESPACE
+
+#endif // PROXYSETTINGS_H
Index: trunk/tools/qml/proxysettings.ui
===================================================================
--- trunk/tools/qml/proxysettings.ui	(revision 846)
+++ trunk/tools/qml/proxysettings.ui	(revision 846)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProxySettings</class>
+ <widget class="QDialog" name="ProxySettings">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>318</width>
+    <height>199</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="2">
+    <widget class="QCheckBox" name="proxyCheckBox">
+     <property name="text">
+      <string>Use http proxy</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="serverAddressLabel">
+     <property name="text">
+      <string>Server Address:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QLineEdit" name="proxyServerEdit"/>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Port:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QLineEdit" name="proxyPortEdit"/>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="usernameLabel">
+     <property name="text">
+      <string>Username:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QLineEdit" name="usernameEdit"/>
+   </item>
+   <item row="4" column="0">
+    <widget class="QLabel" name="passwordLabel">
+     <property name="text">
+      <string>Password:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <widget class="QLineEdit" name="passwordEdit">
+     <property name="echoMode">
+      <enum>QLineEdit::Password</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ProxySettings</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ProxySettings</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/tools/qml/proxysettings_maemo5.ui
===================================================================
--- trunk/tools/qml/proxysettings_maemo5.ui	(revision 846)
+++ trunk/tools/qml/proxysettings_maemo5.ui	(revision 846)
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProxySettings</class>
+ <widget class="QDialog" name="ProxySettings">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>449</width>
+    <height>164</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>HTTP Proxy</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2">
+   <property name="leftMargin">
+    <number>16</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>16</number>
+   </property>
+   <property name="bottomMargin">
+    <number>8</number>
+   </property>
+   <property name="horizontalSpacing">
+    <number>16</number>
+   </property>
+   <property name="verticalSpacing">
+    <number>0</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QCheckBox" name="proxyCheckBox">
+     <property name="text">
+      <string>Use HTTP Proxy</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1" rowspan="2">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" rowspan="2">
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QGridLayout" name="gridLayout">
+      <property name="horizontalSpacing">
+       <number>16</number>
+      </property>
+      <property name="verticalSpacing">
+       <number>0</number>
+      </property>
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="serverAddressLabel">
+        <property name="text">
+         <string>Server</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="proxyServerEdit">
+        <property name="placeholderText">
+         <string>Name or IP</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Port</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="proxyPortEdit">
+        <property name="text">
+         <string>8080</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="usernameLabel">
+        <property name="text">
+         <string>Username</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QLineEdit" name="usernameEdit"/>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="passwordLabel">
+        <property name="text">
+         <string>Password</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QLineEdit" name="passwordEdit">
+        <property name="echoMode">
+         <enum>QLineEdit::Password</enum>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>proxyCheckBox</tabstop>
+  <tabstop>proxyServerEdit</tabstop>
+  <tabstop>proxyPortEdit</tabstop>
+  <tabstop>usernameEdit</tabstop>
+  <tabstop>passwordEdit</tabstop>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ProxySettings</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>318</x>
+     <y>100</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>116</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ProxySettings</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>318</x>
+     <y>100</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>116</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/tools/qml/qdeclarativetester.cpp
===================================================================
--- trunk/tools/qml/qdeclarativetester.cpp	(revision 846)
+++ trunk/tools/qml/qdeclarativetester.cpp	(revision 846)
@@ -0,0 +1,448 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qdeclarativetester.h>
+#include <QDebug>
+#include <QApplication>
+#include <qdeclarativeview.h>
+#include <QFile>
+#include <QDeclarativeComponent>
+#include <QDir>
+#include <QCryptographicHash>
+#include <private/qabstractanimation_p.h>
+#include <private/qdeclarativeitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
+
+QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
+                     QDeclarativeView *parent)
+: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
+  testscript(0), hasCompleted(false), hasFailed(false)
+{
+    parent->viewport()->installEventFilter(this);
+    parent->installEventFilter(this);
+    QUnifiedTimer::instance()->setConsistentTiming(true);
+
+    //Font antialiasing makes tests system-specific, so disable it
+    QFont noAA = QApplication::font();
+    noAA.setStyleStrategy(QFont::NoAntialias);
+    QApplication::setFont(noAA);
+
+    if (options & QDeclarativeViewer::Play)
+        this->run();
+    start();
+}
+
+QDeclarativeTester::~QDeclarativeTester()
+{
+    if (!hasFailed &&
+        options & QDeclarativeViewer::Record &&
+        options & QDeclarativeViewer::SaveOnExit)
+        save();
+}
+
+int QDeclarativeTester::duration() const
+{
+    return -1;
+}
+
+void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me)
+{
+    MouseEvent e(me);
+    e.destination = dest;
+    m_mouseEvents << e;
+}
+
+void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke)
+{
+    KeyEvent e(ke);
+    e.destination = dest;
+    m_keyEvents << e;
+}
+
+bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e)
+{
+    if (!filterEvents)
+        return false;
+
+    Destination destination;
+    if (o == m_view) {
+        destination = View;
+    } else if (o == m_view->viewport()) {
+        destination = ViewPort;
+    } else {
+        return false;
+    }
+
+    switch (e->type()) {
+        case QEvent::KeyPress:
+        case QEvent::KeyRelease:
+            addKeyEvent(destination, (QKeyEvent *)e);
+            return true;
+        case QEvent::MouseButtonPress:
+        case QEvent::MouseButtonRelease:
+        case QEvent::MouseMove:
+        case QEvent::MouseButtonDblClick:
+            addMouseEvent(destination, (QMouseEvent *)e);
+            return true;
+        default:
+            break;
+    }
+    return false;
+}
+
+void QDeclarativeTester::executefailure()
+{
+    hasFailed = true;
+
+    if (options & QDeclarativeViewer::ExitOnFailure)
+        exit(-1);
+}
+
+void QDeclarativeTester::imagefailure()
+{
+    hasFailed = true;
+
+    if (options & QDeclarativeViewer::ExitOnFailure){
+        testSkip();
+        exit(hasFailed?-1:0);
+    }
+}
+
+void QDeclarativeTester::testSkip()
+{
+    if (options & QDeclarativeViewer::TestSkipProperty){
+        QString e = m_view->rootObject()->property("skip").toString();
+        if (!e.isEmpty()) {
+            if(hasFailed){
+                qWarning() << "Test failed, but skipping it: " << e;
+            }else{
+                qWarning() << "Test skipped: " << e;
+            }
+            hasFailed = 0;
+        }
+    }
+}
+
+void QDeclarativeTester::complete()
+{
+    if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) {
+        QString e = m_view->rootObject()->property("error").toString();
+        if (!e.isEmpty()) {
+            qWarning() << "Test failed:" << e;
+            hasFailed = true;
+        }
+    }
+
+
+    testSkip();
+    if (options & QDeclarativeViewer::ExitOnComplete)
+        QApplication::exit(hasFailed?-1:0);
+
+    if (hasCompleted)
+        return;
+    hasCompleted = true;
+
+    if (options & QDeclarativeViewer::Play)
+        qWarning("Script playback complete");
+}
+
+void QDeclarativeTester::run()
+{
+    QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml"));
+
+    testscript = qobject_cast<QDeclarativeVisualTest *>(c.create());
+    if (testscript) testscript->setParent(this);
+    else { executefailure(); exit(-1); }
+    testscriptidx = 0;
+}
+
+void QDeclarativeTester::save()
+{
+    QString filename = m_script + QLatin1String(".qml");
+    QFileInfo filenameInfo(filename);
+    QDir saveDir = filenameInfo.absoluteDir();
+    saveDir.mkpath(".");
+
+    QFile file(filename);
+    file.open(QIODevice::WriteOnly);
+    QTextStream ts(&file);
+
+    ts << "import Qt.VisualTest 4.7\n\n";
+    ts << "VisualTest {\n";
+
+    int imgCount = 0;
+    QList<KeyEvent> keyevents = m_savedKeyEvents;
+    QList<MouseEvent> mouseevents = m_savedMouseEvents;
+    for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) {
+        const FrameEvent &fe = m_savedFrameEvents.at(ii);
+        ts << "    Frame {\n";
+        ts << "        msec: " << fe.msec << "\n";
+        if (!fe.hash.isEmpty()) {
+            ts << "        hash: \"" << fe.hash.toHex() << "\"\n";
+        } else if (!fe.image.isNull()) {
+            QString filename = filenameInfo.baseName() + "." + QString::number(imgCount) + ".png";
+            fe.image.save(m_script + "." + QString::number(imgCount) + ".png");
+            imgCount++;
+            ts << "        image: \"" << filename << "\"\n";
+        }
+        ts << "    }\n";
+
+        while (!mouseevents.isEmpty() &&
+               mouseevents.first().msec == fe.msec) {
+            MouseEvent me = mouseevents.takeFirst();
+
+            ts << "    Mouse {\n";
+            ts << "        type: " << me.type << "\n";
+            ts << "        button: " << me.button << "\n";
+            ts << "        buttons: " << me.buttons << "\n";
+            ts << "        x: " << me.pos.x() << "; y: " << me.pos.y() << "\n";
+            ts << "        modifiers: " << me.modifiers << "\n";
+            if (me.destination == ViewPort)
+                ts << "        sendToViewport: true\n";
+            ts << "    }\n";
+        }
+
+        while (!keyevents.isEmpty() &&
+               keyevents.first().msec == fe.msec) {
+            KeyEvent ke = keyevents.takeFirst();
+
+            ts << "    Key {\n";
+            ts << "        type: " << ke.type << "\n";
+            ts << "        key: " << ke.key << "\n";
+            ts << "        modifiers: " << ke.modifiers << "\n";
+            ts << "        text: \"" << ke.text.toUtf8().toHex() << "\"\n";
+            ts << "        autorep: " << (ke.autorep?"true":"false") << "\n";
+            ts << "        count: " << ke.count << "\n";
+            if (ke.destination == ViewPort)
+                ts << "        sendToViewport: true\n";
+            ts << "    }\n";
+        }
+    }
+
+    ts << "}\n";
+    file.close();
+}
+
+void QDeclarativeTester::updateCurrentTime(int msec)
+{
+    QDeclarativeItemPrivate::setConsistentTime(msec);
+    if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot)
+        return;
+
+    QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32);
+
+    if (options & QDeclarativeViewer::TestImages) {
+        img.fill(qRgb(255,255,255));
+
+#ifdef Q_WS_MAC
+        bool oldSmooth = qt_applefontsmoothing_enabled;
+        qt_applefontsmoothing_enabled = false;
+#endif
+        QPainter p(&img);
+#ifdef Q_WS_MAC
+        qt_applefontsmoothing_enabled = oldSmooth;
+#endif
+
+        m_view->render(&p);
+    }
+
+    bool snapshot = msec == 16 && (options & QDeclarativeViewer::Snapshot
+                                   || (testscript && testscript->count() == 2));
+
+    FrameEvent fe;
+    fe.msec = msec;
+    if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) {
+        // Skip first frame, skip if not doing images
+    } else if (0 == ((m_savedFrameEvents.count()-1) % 60) || snapshot) {
+        fe.image = img;
+    } else {
+        QCryptographicHash hash(QCryptographicHash::Md5);
+        hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height());
+        fe.hash = hash.result();
+    }
+    m_savedFrameEvents.append(fe);
+
+    // Deliver mouse events
+    filterEvents = false;
+
+    if (!testscript) {
+        for (int ii = 0; ii < m_mouseEvents.count(); ++ii) {
+            MouseEvent &me = m_mouseEvents[ii];
+            me.msec = msec;
+            QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers);
+
+            if (me.destination == View) {
+                QCoreApplication::sendEvent(m_view, &event);
+            } else {
+                QCoreApplication::sendEvent(m_view->viewport(), &event);
+            }
+        }
+
+        for (int ii = 0; ii < m_keyEvents.count(); ++ii) {
+            KeyEvent &ke = m_keyEvents[ii];
+            ke.msec = msec;
+            QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count);
+
+            if (ke.destination == View) {
+                QCoreApplication::sendEvent(m_view, &event);
+            } else {
+                QCoreApplication::sendEvent(m_view->viewport(), &event);
+            }
+        }
+        m_savedMouseEvents.append(m_mouseEvents);
+        m_savedKeyEvents.append(m_keyEvents);
+    }
+
+    m_mouseEvents.clear();
+    m_keyEvents.clear();
+
+    // Advance test script
+    while (testscript && testscript->count() > testscriptidx) {
+
+        QObject *event = testscript->event(testscriptidx);
+
+        if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
+            if (frame->msec() < msec) {
+                if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
+                    qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame.  Seen:"
+                               << msec << "Expected:" << frame->msec();
+                    imagefailure();
+                }
+            } else if (frame->msec() == msec) {
+                if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) {
+                    if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
+                        qWarning() << "QDeclarativeTester(" << m_script << "): Mismatched frame hash at" << msec
+                                   << ".  Seen:" << fe.hash.toHex()
+                                   << "Expected:" << frame->hash().toUtf8();
+                        imagefailure();
+                    }
+                }
+            } else if (frame->msec() > msec) {
+                break;
+            }
+
+            if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) {
+                QImage goodImage(frame->image().toLocalFile());
+                if (frame->msec() == 16 && goodImage.size() != img.size()){
+                    //Also an image mismatch, but this warning is more informative. Only checked at start though.
+                    qWarning() << "QDeclarativeTester(" << m_script << "): Size mismatch. This test must be run at " << goodImage.size();
+                    imagefailure();
+                }
+                if (goodImage != img) {
+                    QString reject(frame->image().toLocalFile() + ".reject.png");
+                    qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch.  Reject saved to:"
+                               << reject;
+                    img.save(reject);
+                    bool doDiff = (goodImage.size() == img.size());
+                    if (doDiff) {
+                        QImage diffimg(m_view->width(), m_view->height(), QImage::Format_RGB32);
+                        diffimg.fill(qRgb(255,255,255));
+                        QPainter p(&diffimg);
+                        int diffCount = 0;
+                        for (int x = 0; x < img.width(); ++x) {
+                            for (int y = 0; y < img.height(); ++y) {
+                                if (goodImage.pixel(x,y) != img.pixel(x,y)) {
+                                    ++diffCount;
+                                    p.drawPoint(x,y);
+                                }
+                            }
+                        }
+                        QString diff(frame->image().toLocalFile() + ".diff.png");
+                        diffimg.save(diff);
+                        qWarning().nospace() << "                    Diff (" << diffCount << " pixels differed) saved to: " << diff;
+                    }
+                    imagefailure();
+                }
+            }
+        } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) {
+            QPoint pos(mouse->x(), mouse->y());
+            QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos;
+            QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers());
+
+            MouseEvent me(&event);
+            me.msec = msec;
+            if (!mouse->sendToViewport()) {
+                QCoreApplication::sendEvent(m_view, &event);
+                me.destination = View;
+            } else {
+                QCoreApplication::sendEvent(m_view->viewport(), &event);
+                me.destination = ViewPort;
+            }
+            m_savedMouseEvents.append(me);
+        } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) {
+
+            QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count());
+
+            KeyEvent ke(&event);
+            ke.msec = msec;
+            if (!key->sendToViewport()) {
+                QCoreApplication::sendEvent(m_view, &event);
+                ke.destination = View;
+            } else {
+                QCoreApplication::sendEvent(m_view->viewport(), &event);
+                ke.destination = ViewPort;
+            }
+            m_savedKeyEvents.append(ke);
+        }
+        testscriptidx++;
+    }
+
+    filterEvents = true;
+
+    if (testscript && testscript->count() <= testscriptidx) {
+        //if (msec == 16) //for a snapshot, leave it up long enough to see
+        //    (void)::sleep(1);
+        complete();
+    }
+}
+
+void QDeclarativeTester::registerTypes()
+{
+    qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,7, "VisualTest");
+    qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,7, "Frame");
+    qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,7, "Mouse");
+    qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,7, "Key");
+}
+
+QT_END_NAMESPACE
Index: trunk/tools/qml/qdeclarativetester.h
===================================================================
--- trunk/tools/qml/qdeclarativetester.h	(revision 846)
+++ trunk/tools/qml/qdeclarativetester.h	(revision 846)
@@ -0,0 +1,290 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVETESTER_H
+#define QDECLARATIVETESTER_H
+
+#include <QEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QImage>
+#include <QUrl>
+#include <qmlruntime.h>
+#include <qdeclarativelist.h>
+#include <qdeclarative.h>
+#include <QAbstractAnimation>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeVisualTest : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(QDeclarativeListProperty<QObject> events READ events CONSTANT)
+    Q_CLASSINFO("DefaultProperty", "events")
+public:
+    QDeclarativeVisualTest() {}
+
+    QDeclarativeListProperty<QObject> events() { return QDeclarativeListProperty<QObject>(this, m_events); }
+
+    int count() const { return m_events.count(); }
+    QObject *event(int idx) { return m_events.at(idx); }
+
+private:
+    QList<QObject *> m_events;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeVisualTest)
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeVisualTestFrame : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(int msec READ msec WRITE setMsec)
+    Q_PROPERTY(QString hash READ hash WRITE setHash)
+    Q_PROPERTY(QUrl image READ image WRITE setImage)
+public:
+    QDeclarativeVisualTestFrame() : m_msec(-1) {}
+
+    int msec() const { return m_msec; }
+    void setMsec(int m) { m_msec = m; }
+
+    QString hash() const { return m_hash; }
+    void setHash(const QString &hash) { m_hash = hash; }
+
+    QUrl image() const { return m_image; }
+    void setImage(const QUrl &image) { m_image = image; }
+
+private:
+    int m_msec;
+    QString m_hash;
+    QUrl m_image;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeVisualTestFrame)
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeVisualTestMouse : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(int type READ type WRITE setType)
+    Q_PROPERTY(int button READ button WRITE setButton)
+    Q_PROPERTY(int buttons READ buttons WRITE setButtons)
+    Q_PROPERTY(int x READ x WRITE setX)
+    Q_PROPERTY(int y READ y WRITE setY)
+    Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers)
+    Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport)
+public:
+    QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {}
+
+    int type() const { return m_type; }
+    void setType(int t) { m_type = t; }
+
+    int button() const { return m_button; }
+    void setButton(int b) { m_button = b; }
+
+    int buttons() const { return m_buttons; }
+    void setButtons(int b) { m_buttons = b; }
+
+    int x() const { return m_x; }
+    void setX(int x) { m_x = x; }
+
+    int y() const { return m_y; }
+    void setY(int y) { m_y = y; }
+
+    int modifiers() const { return m_modifiers; }
+    void setModifiers(int modifiers) { m_modifiers = modifiers; }
+
+    bool sendToViewport() const { return m_viewport; }
+    void setSendToViewport(bool v) { m_viewport = v; }
+private:
+    int m_type;
+    int m_button;
+    int m_buttons;
+    int m_x;
+    int m_y;
+    int m_modifiers;
+    bool m_viewport;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeVisualTestMouse)
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeVisualTestKey : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(int type READ type WRITE setType)
+    Q_PROPERTY(int key READ key WRITE setKey)
+    Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers)
+    Q_PROPERTY(QString text READ text WRITE setText)
+    Q_PROPERTY(bool autorep READ autorep WRITE setAutorep)
+    Q_PROPERTY(int count READ count WRITE setCount)
+    Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport)
+public:
+    QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {}
+
+    int type() const { return m_type; }
+    void setType(int t) { m_type = t; }
+
+    int key() const { return m_key; }
+    void setKey(int k) { m_key = k; }
+
+    int modifiers() const { return m_modifiers; }
+    void setModifiers(int m) { m_modifiers = m; }
+
+    QString text() const { return m_text; }
+    void setText(const QString &t) { m_text = t; }
+
+    bool autorep() const { return m_autorep; }
+    void setAutorep(bool a) { m_autorep = a; }
+
+    int count() const { return m_count; }
+    void setCount(int c) { m_count = c; }
+
+    bool sendToViewport() const { return m_viewport; }
+    void setSendToViewport(bool v) { m_viewport = v; }
+private:
+    int m_type;
+    int m_key;
+    int m_modifiers;
+    QString m_text;
+    bool m_autorep;
+    int m_count;
+    bool m_viewport;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeVisualTestKey)
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeTester : public QAbstractAnimation
+{
+public:
+    QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent);
+    ~QDeclarativeTester();
+
+    static void registerTypes();
+
+    virtual int duration() const;
+
+    void run();
+    void save();
+
+    void executefailure();
+protected:
+    virtual void updateCurrentTime(int msecs);
+    virtual bool eventFilter(QObject *, QEvent *);
+
+private:
+    QString m_script;
+
+    void imagefailure();
+    void complete();
+    void testSkip();
+
+    enum Destination { View, ViewPort };
+    void addKeyEvent(Destination, QKeyEvent *);
+    void addMouseEvent(Destination, QMouseEvent *);
+    QDeclarativeView *m_view;
+
+    struct MouseEvent {
+        MouseEvent(QMouseEvent *e)
+            : type(e->type()), button(e->button()), buttons(e->buttons()),
+              pos(e->pos()), modifiers(e->modifiers()), destination(View) {}
+
+        QEvent::Type type;
+        Qt::MouseButton button;
+        Qt::MouseButtons buttons;
+        QPoint pos;
+        Qt::KeyboardModifiers modifiers;
+        Destination destination;
+
+        int msec;
+    };
+    struct KeyEvent {
+        KeyEvent(QKeyEvent *e)
+            : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()),
+              autorep(e->isAutoRepeat()), count(e->count()), destination(View) {}
+        QEvent::Type type;
+        int key;
+        Qt::KeyboardModifiers modifiers;
+        QString text;
+        bool autorep;
+        ushort count;
+        Destination destination;
+
+        int msec;
+    };
+    struct FrameEvent {
+        QImage image;
+        QByteArray hash;
+        int msec;
+    };
+    QList<MouseEvent> m_mouseEvents;
+    QList<KeyEvent> m_keyEvents;
+
+    QList<MouseEvent> m_savedMouseEvents;
+    QList<KeyEvent> m_savedKeyEvents;
+    QList<FrameEvent> m_savedFrameEvents;
+    bool filterEvents;
+
+    QDeclarativeViewer::ScriptOptions options;
+    int testscriptidx;
+    QDeclarativeVisualTest *testscript;
+
+    bool hasCompleted;
+    bool hasFailed;
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVETESTER_H
Index: trunk/tools/qml/qml.pri
===================================================================
--- trunk/tools/qml/qml.pri	(revision 846)
+++ trunk/tools/qml/qml.pri	(revision 846)
@@ -0,0 +1,54 @@
+QT += declarative script network sql
+contains(QT_CONFIG, opengl) {
+    QT += opengl
+    DEFINES += GL_SUPPORTED
+}
+
+INCLUDEPATH += $$PWD
+
+HEADERS += $$PWD/qmlruntime.h \
+           $$PWD/proxysettings.h \
+           $$PWD/qdeclarativetester.h \
+           $$PWD/deviceorientation.h \
+           $$PWD/loggerwidget.h
+SOURCES += $$PWD/qmlruntime.cpp \
+           $$PWD/proxysettings.cpp \
+           $$PWD/qdeclarativetester.cpp \
+           $$PWD/loggerwidget.cpp
+
+RESOURCES = $$PWD/browser/browser.qrc \
+            $$PWD/startup/startup.qrc
+
+symbian {
+    contains(QT_CONFIG, s60) {
+        LIBS += -lavkon -lcone
+    }
+    !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
+        LIBS += -lsensrvclient -lsensrvutil
+    }
+    !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
+        SOURCES += $$PWD/deviceorientation_symbian.cpp
+        FORMS = $$PWD/recopts.ui \
+                     $$PWD/proxysettings.ui
+    } else {
+        SOURCES += $$PWD/deviceorientation.cpp
+        FORMS = $$PWD/recopts.ui \
+                $$PWD/proxysettings.ui
+    }
+} else:maemo5 {
+    QT += dbus
+    HEADERS += $$PWD/texteditautoresizer_maemo5.h
+    SOURCES += $$PWD/deviceorientation_maemo5.cpp
+    FORMS = $$PWD/recopts_maemo5.ui \
+            $$PWD/proxysettings_maemo5.ui
+} else:linux-g++-maemo {
+    QT += dbus
+    SOURCES += $$PWD/deviceorientation_harmattan.cpp
+    FORMS = $$PWD/recopts.ui \
+            $$PWD/proxysettings.ui
+} else {
+    SOURCES += $$PWD/deviceorientation.cpp
+    FORMS = $$PWD/recopts.ui \
+            $$PWD/proxysettings.ui
+}
+
Index: trunk/tools/qml/qml.pro
===================================================================
--- trunk/tools/qml/qml.pro	(revision 846)
+++ trunk/tools/qml/qml.pro	(revision 846)
@@ -0,0 +1,52 @@
+TEMPLATE = app
+CONFIG += qt uic
+DESTDIR = ../../bin
+
+include(qml.pri)
+
+SOURCES += main.cpp
+
+INCLUDEPATH += ../../include/QtDeclarative
+INCLUDEPATH += ../../src/declarative/util
+INCLUDEPATH += ../../src/declarative/graphicsitems
+
+target.path = $$[QT_INSTALL_BINS]
+INSTALLS += target
+
+wince* {
+    QT += xml
+
+    contains(QT_CONFIG, scripttools) {
+        QT += scripttools
+    }
+    contains(QT_CONFIG, phonon) {
+        QT += phonon
+    }
+    contains(QT_CONFIG, xmlpatterns) {
+        QT += xmlpatterns
+    }
+    contains(QT_CONFIG, webkit) {
+        QT += webkit
+    }
+}
+maemo5 {
+    QT += maemo5
+}
+symbian {
+    TARGET.UID3 = 0x20021317
+    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
+    TARGET.EPOCHEAPSIZE = 0x20000 0x4000000
+    TARGET.CAPABILITY = NetworkServices ReadUserData
+
+    # Deploy plugin for remote debugging
+    qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmltooling/tcpserver$${QT_LIBINFIX}.dll
+    qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmltooling
+    DEPLOYMENT +=  qmldebuggingplugin
+}
+mac {
+    QMAKE_INFO_PLIST=Info_mac.plist
+    TARGET=QMLViewer
+    ICON=qml.icns
+} else {
+    TARGET=qmlviewer
+}
Index: trunk/tools/qml/qmlruntime.cpp
===================================================================
--- trunk/tools/qml/qmlruntime.cpp	(revision 846)
+++ trunk/tools/qml/qmlruntime.cpp	(revision 846)
@@ -0,0 +1,1545 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qdeclarativeview.h>
+
+#ifdef hz
+#undef hz
+#endif
+#ifdef Q_WS_MAEMO_5
+#  include <QMaemo5ValueButton>
+#  include <QMaemo5ListPickSelector>
+#  include <QWidgetAction>
+#  include <QStringListModel>
+#  include "ui_recopts_maemo5.h"
+#else
+#  include "ui_recopts.h"
+#endif
+
+#include "qmlruntime.h"
+#include <qdeclarativecontext.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativenetworkaccessmanagerfactory.h>
+#include "qdeclarative.h"
+#include <QAbstractAnimation>
+#include <private/qabstractanimation_p.h>
+
+#include <QSettings>
+#include <QXmlStreamReader>
+#include <QBuffer>
+#include <QNetworkReply>
+#include <QNetworkCookieJar>
+#include <QNetworkDiskCache>
+#include <QNetworkAccessManager>
+#include <QSignalMapper>
+#include <QDeclarativeComponent>
+#include <QWidget>
+#include <QApplication>
+#include <QTranslator>
+#include <QDir>
+#include <QTextBrowser>
+#include <QFile>
+#include <QFileInfo>
+#include <QVBoxLayout>
+#include <QProgressDialog>
+#include <QProcess>
+#include <QMenuBar>
+#include <QMenu>
+#include <QAction>
+#include <QFileDialog>
+#include <QInputDialog>
+#include <QTimer>
+#include <QGraphicsObject>
+#include <QNetworkProxyFactory>
+#include <QKeyEvent>
+#include <QMutex>
+#include <QMutexLocker>
+#include "proxysettings.h"
+#include "deviceorientation.h"
+
+#ifdef GL_SUPPORTED
+#include <QGLWidget>
+#endif
+
+#if defined(Q_WS_S60)
+#include <aknappui.h> // For locking app orientation
+#endif
+
+#include <qdeclarativetester.h>
+
+QT_BEGIN_NAMESPACE
+
+class DragAndDropView : public QDeclarativeView
+{
+    Q_OBJECT
+public:
+    DragAndDropView(QDeclarativeViewer *parent = 0)
+    : QDeclarativeView(parent)
+    {
+        setAcceptDrops(true);
+    }
+
+    void dragEnterEvent(QDragEnterEvent *event)
+    {
+        const QMimeData *mimeData = event->mimeData();
+        if (mimeData->hasUrls())
+            event->acceptProposedAction();
+    }
+
+    void dragMoveEvent(QDragMoveEvent *event)
+    {
+        event->acceptProposedAction();
+    }
+
+    void dragLeaveEvent(QDragLeaveEvent *event)
+    {
+        event->accept();
+    }
+
+    void dropEvent(QDropEvent *event)
+    {
+        const QMimeData *mimeData = event->mimeData();
+        if (!mimeData->hasUrls())
+            return;
+        const QList<QUrl> urlList = mimeData->urls();
+        foreach (const QUrl &url, urlList) {
+            if (url.scheme() == QLatin1String("file")) {
+                static_cast<QDeclarativeViewer *>(parent())->open(url.toLocalFile());
+                event->accept();
+                return;
+            }
+        }
+    }
+};
+
+class Runtime : public QObject
+{
+    Q_OBJECT
+
+    Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged)
+    Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged)
+
+public:
+    static Runtime* instance()
+    {
+        static Runtime *instance = 0;
+        if (!instance)
+            instance = new Runtime;
+        return instance;
+    }
+
+    bool isActiveWindow() const { return activeWindow; }
+    void setActiveWindow(bool active)
+    {
+        if (active == activeWindow)
+            return;
+        activeWindow = active;
+        emit isActiveWindowChanged();
+    }
+
+    DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); }
+
+Q_SIGNALS:
+    void isActiveWindowChanged();
+    void orientationChanged();
+
+private:
+    Runtime(QObject *parent=0) : QObject(parent), activeWindow(false)
+    {
+        connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()),
+                this, SIGNAL(orientationChanged()));
+    }
+
+    bool activeWindow;
+};
+
+
+
+#if defined(Q_WS_MAEMO_5)
+
+class Maemo5PickerAction : public QWidgetAction {
+    Q_OBJECT
+public:
+    Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent)
+        : QWidgetAction(parent), m_text(text), m_actions(actions)
+    { }
+
+    QWidget *createWidget(QWidget *parent)
+    {
+	QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent);
+	button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered);
+        QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button);
+	button->setPickSelector(pick);
+	if (m_actions) {
+	    QStringList sl;
+	    int curIdx = -1, idx = 0;
+	    foreach (QAction *a, m_actions->actions()) {
+		sl << a->text();
+		if (a->isChecked())
+		    curIdx = idx;
+		idx++;
+            }
+	    pick->setModel(new QStringListModel(sl));
+	    pick->setCurrentIndex(curIdx);
+	} else {
+	    button->setEnabled(false);
+	}
+	connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered()));
+	return button;
+    }
+
+private slots:
+    void emitTriggered()
+    {
+	QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender());
+	if (!pick)
+	    return;
+	int idx = pick->currentIndex();
+
+	if (m_actions && idx >= 0 && idx < m_actions->actions().count())
+	    m_actions->actions().at(idx)->trigger();
+    }
+
+private:
+    QString m_text;
+    QPointer<QActionGroup> m_actions;
+};
+
+#endif // Q_WS_MAEMO_5
+
+static struct { const char *name, *args; } ffmpegprofiles[] = {
+    {"Maximum Quality", "-sameq"},
+    {"High Quality", "-qmax 2"},
+    {"Medium Quality", "-qmax 6"},
+    {"Low Quality", "-qmax 16"},
+    {"Custom ffmpeg arguments", ""},
+    {0,0}
+};
+
+class RecordingDialog : public QDialog, public Ui::RecordingOptions {
+    Q_OBJECT
+
+public:
+    RecordingDialog(QWidget *parent) : QDialog(parent)
+    {
+        setupUi(this);
+#ifndef Q_WS_MAEMO_5
+        hz->setValidator(new QDoubleValidator(hz));
+#endif
+        for (int i=0; ffmpegprofiles[i].name; ++i) {
+            profile->addItem(ffmpegprofiles[i].name);
+        }
+    }
+
+    void setArguments(QString a)
+    {
+        int i;
+        for (i=0; ffmpegprofiles[i].args[0]; ++i) {
+            if (ffmpegprofiles[i].args == a) {
+                profile->setCurrentIndex(i);
+                args->setText(QLatin1String(ffmpegprofiles[i].args));
+                return;
+            }
+        }
+        customargs = a;
+        args->setText(a);
+        profile->setCurrentIndex(i);
+    }
+
+    QString arguments() const
+    {
+        int i = profile->currentIndex();
+        return ffmpegprofiles[i].args[0] ? QLatin1String(ffmpegprofiles[i].args) : customargs;
+    }
+
+    void setOriginalSize(const QSize &s)
+    {
+        QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height());
+
+#ifdef Q_WS_MAEMO_5
+        sizeCombo->setItemText(0, str);
+#else
+        sizeOriginal->setText(str);
+        if (sizeWidth->value()<=1) {
+            sizeWidth->setValue(s.width());
+            sizeHeight->setValue(s.height());
+        }
+#endif
+    }
+
+    void showffmpegOptions(bool b)
+    {
+#ifdef Q_WS_MAEMO_5
+        profileLabel->setVisible(b);
+        profile->setVisible(b);
+        ffmpegHelp->setVisible(b);
+        args->setVisible(b);
+#else
+        ffmpegOptions->setVisible(b);
+#endif
+    }
+
+    void showRateOptions(bool b)
+    {
+#ifdef Q_WS_MAEMO_5
+        rateLabel->setVisible(b);
+        rateCombo->setVisible(b);
+#else
+        rateOptions->setVisible(b);
+#endif
+    }
+
+    void setVideoRate(int rate)
+    {
+#ifdef Q_WS_MAEMO_5
+        int idx;
+        if (rate >= 60)
+            idx = 0;
+        else if (rate >= 50)
+            idx = 2;
+        else if (rate >= 25)
+            idx = 3;
+        else if (rate >= 24)
+            idx = 4;
+        else if (rate >= 20)
+            idx = 5;
+        else if (rate >= 15)
+            idx = 6;
+        else
+            idx = 7;
+        rateCombo->setCurrentIndex(idx);
+#else
+        if (rate == 24)
+            hz24->setChecked(true);
+        else if (rate == 25)
+            hz25->setChecked(true);
+        else if (rate == 50)
+            hz50->setChecked(true);
+        else if (rate == 60)
+            hz60->setChecked(true);
+        else {
+            hzCustom->setChecked(true);
+            hz->setText(QString::number(rate));
+        }
+#endif
+    }
+
+    int videoRate() const
+    {
+#ifdef Q_WS_MAEMO_5
+        switch (rateCombo->currentIndex()) {
+            case 0: return 60;
+            case 1: return 50;
+            case 2: return 25;
+            case 3: return 24;
+            case 4: return 20;
+            case 5: return 15;
+            case 7: return 10;
+            default: return 60;
+        }
+#else
+        if (hz24->isChecked())
+            return 24;
+        else if (hz25->isChecked())
+            return 25;
+        else if (hz50->isChecked())
+            return 50;
+        else if (hz60->isChecked())
+            return 60;
+        else {
+            return hz->text().toInt();
+        }
+#endif
+    }
+
+    QSize videoSize() const
+    {
+#ifdef Q_WS_MAEMO_5
+        switch (sizeCombo->currentIndex()) {
+            case 0: return QSize();
+            case 1: return QSize(640,480);
+            case 2: return QSize(320,240);
+            case 3: return QSize(1280,720);
+            default: return QSize();
+        }
+#else
+        if (sizeOriginal->isChecked())
+            return QSize();
+        else if (size720p->isChecked())
+            return QSize(1280,720);
+        else if (sizeVGA->isChecked())
+            return QSize(640,480);
+        else if (sizeQVGA->isChecked())
+            return QSize(320,240);
+        else
+            return QSize(sizeWidth->value(), sizeHeight->value());
+#endif
+    }
+
+
+
+private slots:
+    void pickProfile(int i)
+    {
+        if (ffmpegprofiles[i].args[0]) {
+            args->setText(QLatin1String(ffmpegprofiles[i].args));
+        } else {
+            args->setText(customargs);
+        }
+    }
+
+    void storeCustomArgs(QString s)
+    {
+        setArguments(s);
+    }
+
+private:
+    QString customargs;
+};
+
+class PersistentCookieJar : public QNetworkCookieJar {
+public:
+    PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { load(); }
+    ~PersistentCookieJar() { save(); }
+
+    virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const
+    {
+        QMutexLocker lock(&mutex);
+        return QNetworkCookieJar::cookiesForUrl(url);
+    }
+
+    virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url)
+    {
+        QMutexLocker lock(&mutex);
+        return QNetworkCookieJar::setCookiesFromUrl(cookieList, url);
+    }
+
+private:
+    void save()
+    {
+        QMutexLocker lock(&mutex);
+        QList<QNetworkCookie> list = allCookies();
+        QByteArray data;
+        foreach (QNetworkCookie cookie, list) {
+            if (!cookie.isSessionCookie()) {
+                data.append(cookie.toRawForm());
+                data.append("\n");
+            }
+        }
+        QSettings settings;
+        settings.setValue("Cookies",data);
+    }
+
+    void load()
+    {
+        QMutexLocker lock(&mutex);
+        QSettings settings;
+        QByteArray data = settings.value("Cookies").toByteArray();
+        setAllCookies(QNetworkCookie::parseCookies(data));
+    }
+
+    mutable QMutex mutex;
+};
+
+class SystemProxyFactory : public QNetworkProxyFactory
+{
+public:
+    SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) {
+    }
+
+    virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
+    {
+        if (proxyDirty)
+            setupProxy();
+        QString protocolTag = query.protocolTag();
+        if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
+            QList<QNetworkProxy> ret;
+            ret << httpProxy;
+            return ret;
+        }
+#ifdef Q_OS_WIN
+        // systemProxyForQuery can take insanely long on Windows (QTBUG-10106)
+        return QNetworkProxyFactory::proxyForQuery(query);
+#else
+        return QNetworkProxyFactory::systemProxyForQuery(query);
+#endif
+    }
+
+    void setupProxy() {
+        // Don't bother locking because we know that the proxy only
+        // changes in response to the settings dialog and that
+        // the view will be reloaded.
+        proxyDirty = false;
+        httpProxyInUse = ProxySettings::httpProxyInUse();
+        if (httpProxyInUse)
+            httpProxy = ProxySettings::httpProxy();
+    }
+
+    void proxyChanged() {
+        proxyDirty = true;
+    }
+
+private:
+    volatile bool proxyDirty;
+    bool httpProxyInUse;
+    QNetworkProxy httpProxy;
+};
+
+class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory
+{
+    Q_OBJECT
+public:
+    NetworkAccessManagerFactory() : cacheSize(0) {}
+    ~NetworkAccessManagerFactory() {}
+
+    QNetworkAccessManager *create(QObject *parent);
+
+    void setCacheSize(int size) {
+        if (size != cacheSize) {
+            cacheSize = size;
+        }
+    }
+
+    void proxyChanged() {
+        foreach (QNetworkAccessManager *nam, namList) {
+            static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged();
+        }
+    }
+
+    static PersistentCookieJar *cookieJar;
+
+private slots:
+    void managerDestroyed(QObject *obj) {
+        namList.removeOne(static_cast<QNetworkAccessManager*>(obj));
+    }
+
+private:
+    QMutex mutex;
+    int cacheSize;
+    QList<QNetworkAccessManager*> namList;
+};
+
+PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
+
+static void cleanup_cookieJar()
+{
+    delete NetworkAccessManagerFactory::cookieJar;
+    NetworkAccessManagerFactory::cookieJar = 0;
+}
+
+QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
+{
+    QMutexLocker lock(&mutex);
+    QNetworkAccessManager *manager = new QNetworkAccessManager(parent);
+    if (!cookieJar) {
+        qAddPostRoutine(cleanup_cookieJar);
+        cookieJar = new PersistentCookieJar(0);
+    }
+    manager->setCookieJar(cookieJar);
+    cookieJar->setParent(0);
+    manager->setProxyFactory(new SystemProxyFactory);
+    if (cacheSize > 0) {
+        QNetworkDiskCache *cache = new QNetworkDiskCache;
+        cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache"));
+        cache->setMaximumCacheSize(cacheSize);
+        manager->setCache(cache);
+    } else {
+        manager->setCache(0);
+    }
+    connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*)));
+    namList.append(manager);
+    qDebug() << "created new network access manager for" << parent;
+    return manager;
+}
+
+QString QDeclarativeViewer::getVideoFileName()
+{
+    QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames");
+    QStringList types;
+    if (ffmpegAvailable) types += tr("Common Video files")+QLatin1String(" (*.avi *.mpeg *.mov)");
+    if (convertAvailable) types += tr("GIF Animation")+QLatin1String(" (*.gif)");
+    types += tr("Individual PNG frames")+QLatin1String(" (*.png)");
+    if (ffmpegAvailable) types += tr("All ffmpeg formats (*.*)");
+    return QFileDialog::getSaveFileName(this, title, "", types.join(";; "));
+}
+
+QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
+    : QMainWindow(parent, flags)
+      , loggerWindow(new LoggerWidget(this))
+      , frame_stream(0)
+      , rotateAction(0)
+      , orientation(0)
+      , showWarningsWindow(0)
+      , m_scriptOptions(0)
+      , tester(0)
+      , useQmlFileBrowser(true)
+      , translator(0)
+{
+    QDeclarativeViewer::registerTypes();
+    setWindowTitle(tr("Qt QML Viewer"));
+#ifdef Q_WS_MAEMO_5
+    setAttribute(Qt::WA_Maemo5StackedWindow);
+//    setPalette(QApplication::palette("QLabel"));
+#endif
+
+    devicemode = false;
+    canvas = 0;
+    record_autotime = 0;
+    record_rate = 50;
+    record_args += QLatin1String("-sameq");
+
+    recdlg = new RecordingDialog(this);
+    connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile()));
+    senseFfmpeg();
+    senseImageMagick();
+    if (!ffmpegAvailable)
+        recdlg->showffmpegOptions(false);
+    if (!ffmpegAvailable && !convertAvailable)
+        recdlg->showRateOptions(false);
+    QString warn;
+    if (!ffmpegAvailable) {
+        if (!convertAvailable)
+            warn = tr("ffmpeg and ImageMagick not available - no video output");
+        else
+            warn = tr("ffmpeg not available - GIF and PNG outputs only");
+        recdlg->warning->setText(warn);
+    } else {
+        recdlg->warning->hide();
+    }
+
+    canvas = new DragAndDropView(this);
+
+    canvas->setAttribute(Qt::WA_OpaquePaintEvent);
+    canvas->setAttribute(Qt::WA_NoSystemBackground);
+
+    canvas->setFocus();
+
+    QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
+    QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
+    QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close()));
+
+    QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
+    QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
+
+    if (!(flags & Qt::FramelessWindowHint)) {
+        createMenu();
+        changeOrientation(orientation->actions().value(0));
+    } else {
+        setMenuBar(0);
+    }
+
+    setCentralWidget(canvas);
+
+    namFactory = new NetworkAccessManagerFactory;
+    canvas->engine()->setNetworkAccessManagerFactory(namFactory);
+
+    connect(&autoStartTimer, SIGNAL(timeout()), this, SLOT(autoStartRecording()));
+    connect(&autoStopTimer, SIGNAL(timeout()), this, SLOT(autoStopRecording()));
+    connect(&recordTimer, SIGNAL(timeout()), this, SLOT(recordFrame()));
+    connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()),
+            this, SLOT(orientationChanged()), Qt::QueuedConnection);
+    autoStartTimer.setSingleShot(true);
+    autoStopTimer.setSingleShot(true);
+    recordTimer.setSingleShot(false);
+
+    QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit()));
+}
+
+QDeclarativeViewer::~QDeclarativeViewer()
+{
+    delete loggerWindow;
+    canvas->engine()->setNetworkAccessManagerFactory(0);
+    delete namFactory;
+}
+
+void QDeclarativeViewer::enableExperimentalGestures()
+{
+#ifndef QT_NO_GESTURES
+    canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
+    canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
+    canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
+    canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
+    canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
+    canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
+#endif
+}
+
+QDeclarativeView *QDeclarativeViewer::view() const
+{
+    return canvas;
+}
+
+LoggerWidget *QDeclarativeViewer::warningsWidget() const
+{
+    return loggerWindow;
+}
+
+void QDeclarativeViewer::createMenu()
+{
+    QAction *openAction = new QAction(tr("&Open..."), this);
+    openAction->setShortcuts(QKeySequence::Open);
+    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
+
+    QAction *openUrlAction = new QAction(tr("Open &URL..."), this);
+    connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl()));
+
+    QAction *reloadAction = new QAction(tr("&Reload"), this);
+    reloadAction->setShortcuts(QKeySequence::Refresh);
+    connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
+
+    QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
+    snapshotAction->setShortcut(QKeySequence("F3"));
+    connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot()));
+
+    recordAction = new QAction(tr("Start Recording &Video"), this);
+    recordAction->setShortcut(QKeySequence("F9"));
+    connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
+
+    QAction *recordOptions = new QAction(tr("Video &Options..."), this);
+    connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
+
+    QAction *slowAction = new QAction(tr("&Slow Down Animations"), this);
+    slowAction->setShortcut(QKeySequence("Ctrl+."));
+    slowAction->setCheckable(true);
+    connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
+
+    showWarningsWindow = new QAction(tr("Show Warnings"), this);
+    showWarningsWindow->setCheckable((true));
+    showWarningsWindow->setChecked(loggerWindow->isVisible());
+    connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
+
+    QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
+    connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
+
+    QAction *fullscreenAction = new QAction(tr("Full Screen"), this);
+    fullscreenAction->setCheckable(true);
+    connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
+
+    rotateAction = new QAction(tr("Rotate orientation"), this);
+    rotateAction->setShortcut(QKeySequence("Ctrl+T"));
+    connect(rotateAction, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
+
+    orientation = new QActionGroup(this);
+    orientation->setExclusive(true);
+    connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
+
+#if defined(Q_OS_SYMBIAN)
+    QAction *autoOrientationAction = new QAction(tr("Auto-orientation"), this);
+    autoOrientationAction->setCheckable(true);
+#endif
+    QAction *portraitAction = new QAction(tr("Portrait"), this);
+    portraitAction->setCheckable(true);
+    QAction *landscapeAction = new QAction(tr("Landscape"), this);
+    landscapeAction->setCheckable(true);
+#if !defined(Q_OS_SYMBIAN)
+    QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
+    portraitInvAction->setCheckable(true);
+    QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
+    landscapeInvAction->setCheckable(true);
+#endif
+
+    QAction *aboutAction = new QAction(tr("&About Qt..."), this);
+    aboutAction->setMenuRole(QAction::AboutQtRole);
+    connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+
+    QAction *closeAction = new QAction(tr("&Close"), this);
+    closeAction->setShortcuts(QKeySequence::Close);
+    connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
+
+    QAction *quitAction = new QAction(tr("&Quit"), this);
+    quitAction->setMenuRole(QAction::QuitRole);
+    quitAction->setShortcuts(QKeySequence::Quit);
+    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+    QMenuBar *menu = menuBar();
+    if (!menu)
+	return;
+
+#if defined(Q_WS_MAEMO_5)
+    menu->addAction(openAction);
+    menu->addAction(openUrlAction);
+    menu->addAction(reloadAction);
+
+    menu->addAction(snapshotAction);
+    menu->addAction(recordAction);
+
+    menu->addAction(recordOptions);
+    menu->addAction(proxyAction);
+
+    menu->addAction(slowAction);
+    menu->addAction(showWarningsWindow);
+
+    orientation->addAction(landscapeAction);
+    orientation->addAction(portraitAction);
+    menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this));
+    menu->addAction(fullscreenAction);
+    return;
+#endif // Q_WS_MAEMO_5
+
+    QMenu *fileMenu = menu->addMenu(tr("&File"));
+    fileMenu->addAction(openAction);
+    fileMenu->addAction(openUrlAction);
+    fileMenu->addAction(reloadAction);
+    fileMenu->addSeparator();
+    fileMenu->addAction(closeAction);
+#if !defined(Q_OS_SYMBIAN)
+    fileMenu->addAction(quitAction);
+
+    QMenu *recordMenu = menu->addMenu(tr("&Recording"));
+    recordMenu->addAction(snapshotAction);
+    recordMenu->addAction(recordAction);
+
+    QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
+    debugMenu->addAction(slowAction);
+    debugMenu->addAction(showWarningsWindow);
+#endif // ! Q_OS_SYMBIAN
+
+    QMenu *settingsMenu = menu->addMenu(tr("&Settings"));
+    settingsMenu->addAction(proxyAction);
+#if defined(Q_OS_SYMBIAN)
+    settingsMenu->addAction(fullscreenAction);
+#else
+    settingsMenu->addAction(recordOptions);
+    settingsMenu->addMenu(loggerWindow->preferencesMenu());
+#endif // !Q_OS_SYMBIAN
+    settingsMenu->addAction(rotateAction);
+
+    QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
+
+#if defined(Q_OS_SYMBIAN)
+    orientation->addAction(autoOrientationAction);
+#endif
+    orientation->addAction(portraitAction);
+    orientation->addAction(landscapeAction);
+#if !defined(Q_OS_SYMBIAN)
+    orientation->addAction(portraitInvAction);
+    orientation->addAction(landscapeInvAction);
+#endif
+    propertiesMenu->addActions(orientation->actions());
+
+    QMenu *helpMenu = menu->addMenu(tr("&Help"));
+    helpMenu->addAction(aboutAction);
+}
+
+void QDeclarativeViewer::showProxySettings()
+{
+    ProxySettings settingsDlg (this);
+
+    connect (&settingsDlg, SIGNAL (accepted()), this, SLOT (proxySettingsChanged ()));
+
+    settingsDlg.exec();
+}
+
+void QDeclarativeViewer::proxySettingsChanged()
+{
+    namFactory->proxyChanged();
+    reload ();
+}
+
+void QDeclarativeViewer::rotateOrientation()
+{
+#if defined(Q_WS_S60)
+    CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
+    if (appUi) {
+        CAknAppUi::TAppUiOrientation oldOrientation = appUi->Orientation();
+        QString newOrientation;
+        if (oldOrientation == CAknAppUi::EAppUiOrientationPortrait) {
+            newOrientation = QLatin1String("Landscape");
+        } else {
+            newOrientation = QLatin1String("Portrait");
+        }
+        foreach (QAction *action, orientation->actions()) {
+            if (action->text() == newOrientation) {
+                changeOrientation(action);
+            }
+        }
+    }
+#else
+    QAction *current = orientation->checkedAction();
+    QList<QAction *> actions = orientation->actions();
+    int index = actions.indexOf(current);
+    if (index < 0)
+        return;
+
+    QAction *newOrientation = actions[(index + 1) % actions.count()];
+    changeOrientation(newOrientation);
+#endif
+}
+
+void QDeclarativeViewer::toggleFullScreen()
+{
+    if (isFullScreen())
+        showMaximized();
+    else
+        showFullScreen();
+}
+
+void QDeclarativeViewer::showWarnings(bool show)
+{
+    loggerWindow->setVisible(show);
+}
+
+void QDeclarativeViewer::warningsWidgetOpened()
+{
+    showWarningsWindow->setChecked(true);
+}
+
+void QDeclarativeViewer::warningsWidgetClosed()
+{
+    showWarningsWindow->setChecked(false);
+}
+
+void QDeclarativeViewer::takeSnapShot()
+{
+    static int snapshotcount = 1;
+    QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount);
+    QPixmap::grabWidget(canvas).save(snapFileName);
+    qDebug() << "Wrote" << snapFileName;
+    ++snapshotcount;
+}
+
+void QDeclarativeViewer::pickRecordingFile()
+{
+    QString fileName = getVideoFileName();
+    if (!fileName.isEmpty())
+        recdlg->file->setText(fileName);
+}
+
+void QDeclarativeViewer::chooseRecordingOptions()
+{
+    // File
+    recdlg->file->setText(record_file);
+
+    // Size
+    recdlg->setOriginalSize(canvas->size());
+
+    // Rate
+    recdlg->setVideoRate(record_rate);
+
+
+    // Profile
+    recdlg->setArguments(record_args.join(" "));
+    if (recdlg->exec()) {
+        // File
+        record_file = recdlg->file->text();
+        // Size
+        record_outsize = recdlg->videoSize();
+        // Rate
+        record_rate = recdlg->videoRate();
+        // Profile
+        record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts);
+    }
+}
+
+void QDeclarativeViewer::toggleRecordingWithSelection()
+{
+    if (!recordTimer.isActive()) {
+        if (record_file.isEmpty()) {
+            QString fileName = getVideoFileName();
+            if (fileName.isEmpty())
+                return;
+            if (!fileName.contains(QRegExp(".[^\\/]*$")))
+                fileName += ".avi";
+            setRecordFile(fileName);
+        }
+    }
+    toggleRecording();
+}
+
+void QDeclarativeViewer::toggleRecording()
+{
+    if (record_file.isEmpty()) {
+        toggleRecordingWithSelection();
+        return;
+    }
+    bool recording = !recordTimer.isActive();
+    recordAction->setText(recording ? tr("&Stop Recording Video\tF9") : tr("&Start Recording Video\tF9"));
+    setRecording(recording);
+}
+
+void QDeclarativeViewer::setSlowMode(bool enable)
+{
+    QUnifiedTimer::instance()->setSlowModeEnabled(enable);
+}
+
+void QDeclarativeViewer::addLibraryPath(const QString& lib)
+{
+    canvas->engine()->addImportPath(lib);
+}
+
+void QDeclarativeViewer::addPluginPath(const QString& plugin)
+{
+    canvas->engine()->addPluginPath(plugin);
+}
+
+void QDeclarativeViewer::reload()
+{
+    launch(currentFileOrUrl);
+}
+
+void QDeclarativeViewer::openFile()
+{
+    QString cur = canvas->source().toLocalFile();
+    if (useQmlFileBrowser) {
+        open("qrc:/browser/Browser.qml");
+    } else {
+        QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)"));
+        if (!fileName.isEmpty()) {
+            QFileInfo fi(fileName);
+            open(fi.absoluteFilePath());
+        }
+    }
+}
+
+void QDeclarativeViewer::openUrl()
+{
+    QString cur = canvas->source().toLocalFile();
+    QString url= QInputDialog::getText(this, tr("Open QML file"), tr("URL of main QML file:"), QLineEdit::Normal, cur);
+    if (!url.isEmpty())
+        open(url);
+}
+
+void QDeclarativeViewer::statusChanged()
+{
+    if (canvas->status() == QDeclarativeView::Error && tester)
+        tester->executefailure();
+
+    if (canvas->status() == QDeclarativeView::Ready) {
+        initialSize = canvas->initialSize();
+        updateSizeHints(true);
+    }
+}
+
+void QDeclarativeViewer::launch(const QString& file_or_url)
+{
+    QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url));
+}
+
+void QDeclarativeViewer::loadTranslationFile(const QString& directory)
+{
+    if (!translator) {
+        translator = new QTranslator(this);
+        QApplication::installTranslator(translator);
+    }
+
+    translator->load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n"));
+}
+
+void QDeclarativeViewer::loadDummyDataFiles(const QString& directory)
+{
+    QDir dir(directory+"/dummydata", "*.qml");
+    QStringList list = dir.entryList();
+    for (int i = 0; i < list.size(); ++i) {
+        QString qml = list.at(i);
+        QDeclarativeComponent comp(canvas->engine(), dir.filePath(qml));
+        QObject *dummyData = comp.create();
+
+        if(comp.isError()) {
+            QList<QDeclarativeError> errors = comp.errors();
+            foreach (const QDeclarativeError &error, errors) {
+                qWarning() << error;
+            }
+            if (tester) tester->executefailure();
+        }
+
+        if (dummyData) {
+            qWarning() << "Loaded dummy data:" << dir.filePath(qml);
+            qml.truncate(qml.length()-4);
+            canvas->rootContext()->setContextProperty(qml, dummyData);
+            dummyData->setParent(this);
+        }
+    }
+}
+
+bool QDeclarativeViewer::open(const QString& file_or_url)
+{
+    currentFileOrUrl = file_or_url;
+
+    QUrl url;
+    QFileInfo fi(file_or_url);
+    if (fi.exists())
+        url = QUrl::fromLocalFile(fi.absoluteFilePath());
+    else
+        url = QUrl(file_or_url);
+    setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url));
+
+    if (!m_script.isEmpty())
+        tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas);
+
+    delete canvas->rootObject();
+    canvas->engine()->clearComponentCache();
+    QDeclarativeContext *ctxt = canvas->rootContext();
+    ctxt->setContextProperty("qmlViewer", this);
+#ifdef Q_OS_SYMBIAN
+    ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone
+#else
+    ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath());
+#endif
+
+    ctxt->setContextProperty("runtime", Runtime::instance());
+
+    QString fileName = url.toLocalFile();
+    if (!fileName.isEmpty()) {
+        fi.setFile(fileName);
+        if (fi.exists()) {
+            if (fi.suffix().toLower() != QLatin1String("qml")) {
+                qWarning() << "qml cannot open non-QML file" << fileName;
+                return false;
+            }
+
+            QFileInfo fi(fileName);
+            loadTranslationFile(fi.path());
+            loadDummyDataFiles(fi.path());
+        } else {
+            qWarning() << "qml cannot find file:" << fileName;
+            return false;
+        }
+    }
+
+    QTime t;
+    t.start();
+
+    canvas->setSource(url);
+
+    return true;
+}
+
+void QDeclarativeViewer::setAutoRecord(int from, int to)
+{
+    if (from==0) from=1; // ensure resized
+    record_autotime = to-from;
+    autoStartTimer.setInterval(from);
+    autoStartTimer.start();
+}
+
+void QDeclarativeViewer::setRecordArgs(const QStringList& a)
+{
+    record_args = a;
+}
+
+void QDeclarativeViewer::setRecordFile(const QString& f)
+{
+    record_file = f;
+}
+
+void QDeclarativeViewer::setRecordRate(int fps)
+{
+    record_rate = fps;
+}
+
+void QDeclarativeViewer::sceneResized(QSize)
+{
+    updateSizeHints();
+}
+
+void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_0 && devicemode)
+        exit(0);
+    else if (event->key() == Qt::Key_F1 || (event->key() == Qt::Key_1 && devicemode)) {
+        qDebug() << "F1 - help\n"
+                 << "F2 - save test script\n"
+                 << "F3 - take PNG snapshot\n"
+                 << "F4 - show items and state\n"
+                 << "F5 - reload QML\n"
+                 << "F6 - show object tree\n"
+                 << "F7 - show timing\n"
+                 << "F9 - toggle video recording\n"
+                 << "F10 - toggle orientation\n"
+                 << "device keys: 0=quit, 1..8=F1..F8"
+                ;
+    } else if (event->key() == Qt::Key_F2 || (event->key() == Qt::Key_2 && devicemode)) {
+        if (tester && m_scriptOptions & Record)
+            tester->save();
+    } else if (event->key() == Qt::Key_F3 || (event->key() == Qt::Key_3 && devicemode)) {
+        takeSnapShot();
+    } else if (event->key() == Qt::Key_F5 || (event->key() == Qt::Key_5 && devicemode)) {
+        reload();
+    } else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) {
+        toggleRecording();
+    } else if (event->key() == Qt::Key_F10) {
+        rotateOrientation();
+    }
+
+    QWidget::keyPressEvent(event);
+}
+
+bool QDeclarativeViewer::event(QEvent *event)
+{
+    if (event->type() == QEvent::WindowActivate) {
+        Runtime::instance()->setActiveWindow(true);
+        DeviceOrientation::instance()->resumeListening();
+    } else if (event->type() == QEvent::WindowDeactivate) {
+        Runtime::instance()->setActiveWindow(false);
+        DeviceOrientation::instance()->pauseListening();
+    }
+    return QWidget::event(event);
+}
+
+void QDeclarativeViewer::senseImageMagick()
+{
+    QProcess proc;
+    proc.start("convert", QStringList() << "-h");
+    proc.waitForFinished(2000);
+    QString help = proc.readAllStandardOutput();
+    convertAvailable = help.contains("ImageMagick");
+}
+
+void QDeclarativeViewer::senseFfmpeg()
+{
+    QProcess proc;
+    proc.start("ffmpeg", QStringList() << "-h");
+    proc.waitForFinished(2000);
+    QString ffmpegHelp = proc.readAllStandardOutput();
+    ffmpegAvailable = ffmpegHelp.contains("-s ");
+    ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp;
+
+    QDialog *d = new QDialog(recdlg);
+    QVBoxLayout *l = new QVBoxLayout(d);
+    QTextBrowser *b = new QTextBrowser(d);
+    QFont f = b->font();
+    f.setFamily("courier");
+    b->setFont(f);
+    b->setText(ffmpegHelp);
+    l->addWidget(b);
+    d->setLayout(l);
+    ffmpegHelpWindow = d;
+    connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show()));
+}
+
+void QDeclarativeViewer::setRecording(bool on)
+{
+    if (on == recordTimer.isActive())
+        return;
+
+    int period = int(1000/record_rate+0.5);
+    QUnifiedTimer::instance()->setTimingInterval(on ? period:16);
+    QUnifiedTimer::instance()->setConsistentTiming(on);
+    if (on) {
+        canvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+        recordTimer.setInterval(period);
+        recordTimer.start();
+        frame_fmt = record_file.right(4).toLower();
+        frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32);
+        if (frame_fmt != ".png" && (!convertAvailable || frame_fmt != ".gif")) {
+            // Stream video to ffmpeg
+
+            QProcess *proc = new QProcess(this);
+            connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int)));
+            frame_stream = proc;
+
+            QStringList args;
+            args << "-y";
+            args << "-r" << QString::number(record_rate);
+            args << "-f" << "rawvideo";
+            args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32");
+            args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height());
+            args << "-i" << "-";
+            if (record_outsize.isValid()) {
+                args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height());
+                args << "-aspect" << QString::number(double(canvas->width())/canvas->height());
+            }
+            args += record_args;
+            args << record_file;
+            proc->start("ffmpeg",args);
+
+        } else {
+            // Store frames, save to GIF/PNG
+            frame_stream = 0;
+        }
+    } else {
+        canvas->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
+        recordTimer.stop();
+        if (frame_stream) {
+            qDebug() << "Saving video...";
+            frame_stream->close();
+            qDebug() << "Wrote" << record_file;
+        } else {
+            QProgressDialog progress(tr("Saving frames..."), tr("Cancel"), 0, frames.count()+10, this);
+            progress.setWindowModality(Qt::WindowModal);
+
+            int frame=0;
+            QStringList inputs;
+            qDebug() << "Saving frames...";
+
+            QString framename;
+            bool png_output = false;
+            if (record_file.right(4).toLower()==".png") {
+                if (record_file.contains('%'))
+                    framename = record_file;
+                else
+                    framename = record_file.left(record_file.length()-4)+"%04d"+record_file.right(4);
+                png_output = true;
+            } else {
+                framename = "tmp-frame%04d.png";
+                png_output = false;
+            }
+            foreach (QImage* img, frames) {
+                progress.setValue(progress.value()+1);
+                if (progress.wasCanceled())
+                    break;
+                QString name;
+                name.sprintf(framename.toLocal8Bit(),frame++);
+                if (record_outsize.isValid())
+                    *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
+                if (record_dither=="ordered")
+                    img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name);
+                else if (record_dither=="threshold")
+                    img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::ThresholdDither).save(name);
+                else if (record_dither=="floyd")
+                    img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither).save(name);
+                else
+                    img->save(name);
+                inputs << name;
+                delete img;
+            }
+
+            if (!progress.wasCanceled()) {
+                if (png_output) {
+                    framename.replace(QRegExp("%\\d*."),"*");
+                    qDebug() << "Wrote frames" << framename;
+                    inputs.clear(); // don't remove them
+                } else {
+                    // ImageMagick and gifsicle for GIF encoding
+                    progress.setLabelText(tr("Converting frames to GIF file..."));
+                    QStringList args;
+                    args << "-delay" << QString::number(period/10);
+                    args << inputs;
+                    args << record_file;
+                    qDebug() << "Converting..." << record_file << "(this may take a while)";
+                    if (0!=QProcess::execute("convert", args)) {
+                        qWarning() << "Cannot run ImageMagick 'convert' - recorded frames not converted";
+                        inputs.clear(); // don't remove them
+                        qDebug() << "Wrote frames tmp-frame*.png";
+                    } else {
+                        if (record_file.right(4).toLower() == ".gif") {
+                            qDebug() << "Compressing..." << record_file;
+                            if (0!=QProcess::execute("gifsicle", QStringList() << "-O2" << "-o" << record_file << record_file))
+                                qWarning() << "Cannot run 'gifsicle' - not compressed";
+                        }
+                        qDebug() << "Wrote" << record_file;
+                    }
+                }
+            }
+
+            progress.setValue(progress.maximum()-1);
+            foreach (QString name, inputs)
+                QFile::remove(name);
+
+            frames.clear();
+        }
+    }
+    qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF");
+}
+
+void QDeclarativeViewer::ffmpegFinished(int code)
+{
+    qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError();
+}
+
+void QDeclarativeViewer::appAboutToQuit()
+{
+    // avoid QGLContext errors about invalid contexts on exit
+    canvas->setViewport(0);
+
+    // avoid crashes if messages are received after app has closed
+    delete loggerWindow;
+    loggerWindow = 0;
+    delete tester;
+    tester = 0;
+}
+
+void QDeclarativeViewer::autoStartRecording()
+{
+    setRecording(true);
+    autoStopTimer.setInterval(record_autotime);
+    autoStopTimer.start();
+}
+
+void QDeclarativeViewer::autoStopRecording()
+{
+    setRecording(false);
+}
+
+void QDeclarativeViewer::recordFrame()
+{
+    canvas->QWidget::render(&frame);
+    if (frame_stream) {
+        if (frame_fmt == ".gif") {
+            // ffmpeg can't do 32bpp with gif
+            QImage rgb24 = frame.convertToFormat(QImage::Format_RGB888);
+            frame_stream->write((char*)rgb24.bits(),rgb24.numBytes());
+        } else {
+            frame_stream->write((char*)frame.bits(),frame.numBytes());
+        }
+    } else {
+        frames.append(new QImage(frame));
+    }
+}
+
+void QDeclarativeViewer::changeOrientation(QAction *action)
+{
+    if (!action)
+        return;
+    QString o = action->text();
+    action->setChecked(true);
+#if defined(Q_WS_S60)
+    CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
+    if (appUi) {
+        CAknAppUi::TAppUiOrientation orientation = appUi->Orientation();
+        if (o == QLatin1String("Auto-orientation")) {
+            appUi->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic);
+            rotateAction->setVisible(false);
+        } else if (o == QLatin1String("Portrait")) {
+            appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
+            rotateAction->setVisible(true);
+        } else if (o == QLatin1String("Landscape")) {
+            appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
+            rotateAction->setVisible(true);
+        }
+    }
+#else
+    if (o == QLatin1String("Portrait"))
+        DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
+    else if (o == QLatin1String("Landscape"))
+        DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape);
+    else if (o == QLatin1String("Portrait (inverted)"))
+        DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
+    else if (o == QLatin1String("Landscape (inverted)"))
+        DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
+#endif
+}
+
+void QDeclarativeViewer::orientationChanged()
+{
+    updateSizeHints();
+}
+
+void QDeclarativeViewer::setDeviceKeys(bool on)
+{
+    devicemode = on;
+}
+
+void QDeclarativeViewer::setNetworkCacheSize(int size)
+{
+    namFactory->setCacheSize(size);
+}
+
+void QDeclarativeViewer::setUseGL(bool useGL)
+{
+#ifdef GL_SUPPORTED
+    if (useGL) {
+        QGLFormat format = QGLFormat::defaultFormat();
+#ifdef Q_WS_MAC
+        format.setSampleBuffers(true);
+#else
+        format.setSampleBuffers(false);
+#endif
+
+        QGLWidget *glWidget = new QGLWidget(format);
+        //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle
+        //glWidget->setAutoFillBackground(false);
+
+        canvas->setViewport(glWidget);
+    }
+#else
+    Q_UNUSED(useGL)
+#endif
+}
+
+void QDeclarativeViewer::setUseNativeFileBrowser(bool use)
+{
+    useQmlFileBrowser = !use;
+}
+
+void QDeclarativeViewer::setSizeToView(bool sizeToView)
+{
+    QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject;
+    if (resizeMode != canvas->resizeMode()) {
+        canvas->setResizeMode(resizeMode);
+        updateSizeHints();
+    }
+}
+
+void QDeclarativeViewer::updateSizeHints(bool initial)
+{
+    static bool isRecursive = false;
+
+    if (isRecursive)
+        return;
+    isRecursive = true;
+
+    if (initial || (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject)) {
+        QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
+        //qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
+        if (!isFullScreen() && !isMaximized()) {
+            canvas->setFixedSize(newWindowSize);
+            resize(1, 1);
+            layout()->setSizeConstraint(QLayout::SetFixedSize);
+            layout()->activate();
+        }
+    }
+    //qWarning() << "USH: R2V: setting free size ";
+    layout()->setSizeConstraint(QLayout::SetNoConstraint);
+    layout()->activate();
+    setMinimumSize(minimumSizeHint());
+    setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+    canvas->setMinimumSize(QSize(0,0));
+    canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+
+    isRecursive = false;
+}
+
+void QDeclarativeViewer::registerTypes()
+{
+    static bool registered = false;
+
+    if (!registered) {
+        // registering only for exposing the DeviceOrientation::Orientation enum
+        qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation","");
+        qmlRegisterUncreatableType<DeviceOrientation>("QtQuick",1,0,"Orientation","");
+        registered = true;
+    }
+}
+
+QT_END_NAMESPACE
+
+#include "qmlruntime.moc"
Index: trunk/tools/qml/qmlruntime.h
===================================================================
--- trunk/tools/qml/qmlruntime.h	(revision 846)
+++ trunk/tools/qml/qmlruntime.h	(revision 846)
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVEVIEWER_H
+#define QDECLARATIVEVIEWER_H
+
+#include <QMainWindow>
+#include <QTimer>
+#include <QTime>
+#include <QList>
+
+#include "loggerwidget.h"
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeView;
+class PreviewDeviceSkin;
+class QDeclarativeTestEngine;
+class QProcess;
+class RecordingDialog;
+class QDeclarativeTester;
+class QNetworkReply;
+class QNetworkCookieJar;
+class NetworkAccessManagerFactory;
+class QTranslator;
+class QActionGroup;
+class QMenuBar;
+
+class QDeclarativeViewer
+    : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
+    ~QDeclarativeViewer();
+
+    static void registerTypes();
+
+    enum ScriptOption {
+        Play = 0x00000001,
+        Record = 0x00000002,
+        TestImages = 0x00000004,
+        TestErrorProperty = 0x00000008,
+        SaveOnExit = 0x00000010,
+        ExitOnComplete = 0x00000020,
+        ExitOnFailure = 0x00000040,
+        Snapshot = 0x00000080,
+        TestSkipProperty = 0x00000100
+    };
+    Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
+    void setScript(const QString &s) { m_script = s; }
+    void setScriptOptions(ScriptOptions opt) { m_scriptOptions = opt; }
+    void setRecordDither(const QString& s) { record_dither = s; }
+    void setRecordRate(int fps);
+    void setRecordFile(const QString&);
+    void setRecordArgs(const QStringList&);
+    void setRecording(bool on);
+    bool isRecording() const { return recordTimer.isActive(); }
+    void setAutoRecord(int from, int to);
+    void setDeviceKeys(bool);
+    void setNetworkCacheSize(int size);
+    void addLibraryPath(const QString& lib);
+    void addPluginPath(const QString& plugin);
+    void setUseGL(bool use);
+    void setUseNativeFileBrowser(bool);
+    void setSizeToView(bool sizeToView);
+
+    QDeclarativeView *view() const;
+    LoggerWidget *warningsWidget() const;
+    QString currentFile() const { return currentFileOrUrl; }
+
+    void enableExperimentalGestures();
+
+public slots:
+    void sceneResized(QSize size);
+    bool open(const QString&);
+    void openFile();
+    void openUrl();
+    void reload();
+    void takeSnapShot();
+    void toggleRecording();
+    void toggleRecordingWithSelection();
+    void ffmpegFinished(int code);
+    void showProxySettings ();
+    void proxySettingsChanged ();
+    void rotateOrientation();
+    void statusChanged();
+    void setSlowMode(bool);
+    void launch(const QString &);
+
+protected:
+    virtual void keyPressEvent(QKeyEvent *);
+    virtual bool event(QEvent *);
+    void createMenu();
+
+private slots:
+    void appAboutToQuit();
+
+    void autoStartRecording();
+    void autoStopRecording();
+    void recordFrame();
+    void chooseRecordingOptions();
+    void pickRecordingFile();
+    void toggleFullScreen();
+    void changeOrientation(QAction*);
+    void orientationChanged();
+
+    void showWarnings(bool show);
+    void warningsWidgetOpened();
+    void warningsWidgetClosed();
+
+private:
+    void updateSizeHints(bool initial = false);
+
+    QString getVideoFileName();
+
+    LoggerWidget *loggerWindow;
+    QDeclarativeView *canvas;
+    QSize initialSize;
+    QString currentFileOrUrl;
+    QTimer recordTimer;
+    QString frame_fmt;
+    QImage frame;
+    QList<QImage*> frames;
+    QProcess* frame_stream;
+    QTimer autoStartTimer;
+    QTimer autoStopTimer;
+    QString record_dither;
+    QString record_file;
+    QSize record_outsize;
+    QStringList record_args;
+    int record_rate;
+    int record_autotime;
+    bool devicemode;
+    QAction *recordAction;
+    RecordingDialog *recdlg;
+
+    void senseImageMagick();
+    void senseFfmpeg();
+    QWidget *ffmpegHelpWindow;
+    bool ffmpegAvailable;
+    bool convertAvailable;
+
+    QAction *rotateAction;
+    QActionGroup *orientation;
+    QAction *showWarningsWindow;
+
+    QString m_script;
+    ScriptOptions m_scriptOptions;
+    QDeclarativeTester *tester;
+
+    NetworkAccessManagerFactory *namFactory;
+
+    bool useQmlFileBrowser;
+
+    QTranslator *translator;
+    void loadTranslationFile(const QString& directory);
+
+    void loadDummyDataFiles(const QString& directory);
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions)
+
+QT_END_NAMESPACE
+
+#endif
Index: trunk/tools/qml/recopts.ui
===================================================================
--- trunk/tools/qml/recopts.ui	(revision 846)
+++ trunk/tools/qml/recopts.ui	(revision 846)
@@ -0,0 +1,513 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RecordingOptions</class>
+ <widget class="QDialog" name="RecordingOptions">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>316</width>
+    <height>436</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Video options</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>File:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="file"/>
+     </item>
+     <item>
+      <widget class="QToolButton" name="pickfile">
+       <property name="text">
+        <string>...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Size</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
+       <widget class="QRadioButton" name="sizeOriginal">
+        <property name="text">
+         <string/>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QRadioButton" name="sizeVGA">
+        <property name="text">
+         <string>VGA</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QRadioButton" name="size720p">
+        <property name="text">
+         <string>720p</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QRadioButton" name="sizeQVGA">
+        <property name="text">
+         <string>QVGA</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" colspan="3">
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QRadioButton" name="sizeCustom">
+          <property name="text">
+           <string>Width:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="sizeWidth">
+          <property name="minimum">
+           <number>1</number>
+          </property>
+          <property name="maximum">
+           <number>9999</number>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_2">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text">
+           <string>Height:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="sizeHeight">
+          <property name="minimum">
+           <number>1</number>
+          </property>
+          <property name="maximum">
+           <number>9999</number>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::MinimumExpanding</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="2">
+       <spacer name="horizontalSpacer_4">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::MinimumExpanding</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="rateOptions">
+     <property name="title">
+      <string>Rate</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_4">
+      <item row="0" column="0">
+       <widget class="QRadioButton" name="hz60">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>60Hz</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QRadioButton" name="hz50">
+        <property name="text">
+         <string>50Hz</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2">
+       <widget class="QRadioButton" name="hz25">
+        <property name="text">
+         <string>25Hz</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" colspan="4">
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <property name="spacing">
+         <number>0</number>
+        </property>
+        <item>
+         <widget class="QRadioButton" name="hzCustom">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="hz">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize">
+           <size>
+            <width>60</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>100</width>
+            <height>16777215</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>Hz</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::MinimumExpanding</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item row="1" column="2">
+       <widget class="QRadioButton" name="hz24">
+        <property name="text">
+         <string>24Hz</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="3">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::MinimumExpanding</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="0" column="1">
+       <spacer name="horizontalSpacer_5">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Fixed</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="ffmpegOptions">
+     <property name="title">
+      <string>Profile</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0" colspan="3">
+       <widget class="QComboBox" name="profile"/>
+      </item>
+      <item row="1" column="0" colspan="2">
+       <widget class="QLineEdit" name="args"/>
+      </item>
+      <item row="1" column="2">
+       <widget class="QToolButton" name="ffmpegHelp">
+        <property name="text">
+         <string>Help</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="warning">
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>file</tabstop>
+  <tabstop>pickfile</tabstop>
+  <tabstop>sizeOriginal</tabstop>
+  <tabstop>sizeVGA</tabstop>
+  <tabstop>size720p</tabstop>
+  <tabstop>sizeQVGA</tabstop>
+  <tabstop>sizeCustom</tabstop>
+  <tabstop>sizeWidth</tabstop>
+  <tabstop>sizeHeight</tabstop>
+  <tabstop>hz60</tabstop>
+  <tabstop>hz25</tabstop>
+  <tabstop>hz50</tabstop>
+  <tabstop>hz24</tabstop>
+  <tabstop>hzCustom</tabstop>
+  <tabstop>hz</tabstop>
+  <tabstop>profile</tabstop>
+  <tabstop>args</tabstop>
+  <tabstop>ffmpegHelp</tabstop>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>hzCustom</sender>
+   <signal>clicked()</signal>
+   <receiver>hz</receiver>
+   <slot>setFocus()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>43</x>
+     <y>257</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>129</x>
+     <y>262</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>hz</sender>
+   <signal>textChanged(QString)</signal>
+   <receiver>hzCustom</receiver>
+   <slot>toggle()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>143</x>
+     <y>262</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>43</x>
+     <y>257</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>hz</sender>
+   <signal>selectionChanged()</signal>
+   <receiver>hzCustom</receiver>
+   <slot>toggle()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>143</x>
+     <y>262</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>43</x>
+     <y>257</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>258</x>
+     <y>424</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>60</x>
+     <y>219</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>258</x>
+     <y>424</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>92</x>
+     <y>219</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>profile</sender>
+   <signal>activated(int)</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>pickProfile(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>92</x>
+     <y>329</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>48</x>
+     <y>194</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>args</sender>
+   <signal>textEdited(QString)</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>storeCustomArgs(QString)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>128</x>
+     <y>357</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>102</x>
+     <y>189</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>sizeWidth</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>sizeCustom</receiver>
+   <slot>toggle()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>108</x>
+     <y>133</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>48</x>
+     <y>133</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>sizeHeight</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>sizeCustom</receiver>
+   <slot>toggle()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>212</x>
+     <y>133</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>64</x>
+     <y>129</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <signal>filePicked(QString)</signal>
+  <signal>argumentsPicked(QString)</signal>
+  <slot>pickFile()</slot>
+  <slot>pickProfile(int)</slot>
+  <slot>storeCustomArgs(QString)</slot>
+ </slots>
+</ui>
Index: trunk/tools/qml/recopts_maemo5.ui
===================================================================
--- trunk/tools/qml/recopts_maemo5.ui	(revision 846)
+++ trunk/tools/qml/recopts_maemo5.ui	(revision 846)
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RecordingOptions</class>
+ <widget class="QDialog" name="RecordingOptions">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>469</width>
+    <height>142</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Video options</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetMinAndMaxSize</enum>
+   </property>
+   <property name="leftMargin">
+    <number>16</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>16</number>
+   </property>
+   <property name="bottomMargin">
+    <number>8</number>
+   </property>
+   <property name="horizontalSpacing">
+    <number>16</number>
+   </property>
+   <property name="verticalSpacing">
+    <number>0</number>
+   </property>
+   <item row="0" column="1">
+    <widget class="QLineEdit" name="file"/>
+   </item>
+   <item row="0" column="2" rowspan="3">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>72</width>
+       <height>56</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>Size</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QComboBox" name="sizeCombo">
+     <item>
+      <property name="text">
+       <string/>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>VGA</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>QVGA</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>720p</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="2" column="0" rowspan="2">
+    <widget class="QLabel" name="rateLabel">
+     <property name="text">
+      <string>Rate</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" rowspan="2">
+    <widget class="QComboBox" name="rateCombo">
+     <item>
+      <property name="text">
+       <string>60 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>50 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>25 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>24 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>20 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>15 Hz</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>10 Hz</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="5" column="1">
+    <widget class="QLineEdit" name="args"/>
+   </item>
+   <item row="4" column="1">
+    <widget class="QComboBox" name="profile"/>
+   </item>
+   <item row="4" column="0">
+    <widget class="QLabel" name="profileLabel">
+     <property name="text">
+      <string>Profile</string>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0" colspan="2">
+    <widget class="QLabel" name="warning">
+     <property name="text">
+      <string notr="true">warning</string>
+     </property>
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="2" rowspan="3">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QPushButton" name="pickfile">
+     <property name="text">
+      <string>File</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0">
+    <widget class="QPushButton" name="ffmpegHelp">
+     <property name="text">
+      <string>Options</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>258</x>
+     <y>424</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>60</x>
+     <y>219</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>258</x>
+     <y>424</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>92</x>
+     <y>219</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>profile</sender>
+   <signal>activated(int)</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>pickProfile(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>92</x>
+     <y>329</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>48</x>
+     <y>194</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>args</sender>
+   <signal>textEdited(QString)</signal>
+   <receiver>RecordingOptions</receiver>
+   <slot>storeCustomArgs(QString)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>128</x>
+     <y>357</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>102</x>
+     <y>189</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <signal>filePicked(QString)</signal>
+  <signal>argumentsPicked(QString)</signal>
+  <slot>pickFile()</slot>
+  <slot>pickProfile(int)</slot>
+  <slot>storeCustomArgs(QString)</slot>
+ </slots>
+</ui>
Index: trunk/tools/qml/startup/Logo.qml
===================================================================
--- trunk/tools/qml/startup/Logo.qml	(revision 846)
+++ trunk/tools/qml/startup/Logo.qml	(revision 846)
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+    id: myApp
+    width: 411
+    height: 411
+    color: "transparent"
+    property alias logoState : myApp.state
+    signal animationFinished
+
+    Item {
+        id: sketchBlueHolder
+        width: sketchLogo.width
+        height: sketchLogo.height
+        Image {
+            id: image1
+            x: -44
+            y: -45
+            smooth: true
+            source: "shadow.png"
+        }
+        Item {
+            clip: true
+            width: sketchLogo.width
+            height: sketchLogo.height
+            Image {
+                id: sketchLogo
+                smooth: true
+                source: "qt-sketch.jpg"
+            }
+            Image {
+                id: blueLogo
+                y: -420
+                smooth: true
+                source: "qt-blue.jpg"
+            }
+        }
+    }
+
+    states: [
+        State {
+            name: "showBlueprint"
+            PropertyChanges {
+                target: blueLogo
+                y: 0
+            }
+            PropertyChanges {
+                target: sketchLogo
+                opacity: 0
+            }
+        },
+        State {
+            extend: "showBlueprint"
+            name: "finale"
+            PropertyChanges {
+                target: fullLogo
+                opacity: 1
+            }
+            PropertyChanges {
+                target: backLogo
+                opacity: 1
+                scale: 1
+            }
+            PropertyChanges {
+                target: frontLogo
+                opacity: 1
+                scale: 1
+            }
+            PropertyChanges {
+                target: qtText
+                opacity: 1
+                scale: 1
+            }
+            PropertyChanges {
+                target: sketchBlueHolder
+                opacity: 0
+                scale: 1.4
+            }
+        }
+    ]
+
+    transitions: [
+        Transition {
+            to: "showBlueprint"
+            SequentialAnimation {
+                NumberAnimation { property: "y"; duration: 600; easing.type: "OutBounce" }
+                PropertyAction { target: sketchLogo; property: "opacity" }
+            }
+        },
+        Transition {
+            to: "finale"
+            PropertyAction { target: fullLogo; property: "opacity" }
+            SequentialAnimation {
+                NumberAnimation { target: backLogo; properties: "scale, opacity"; duration: 300 }
+                NumberAnimation { target: frontLogo; properties: "scale, opacity"; duration: 300 }
+                ParallelAnimation {
+                    NumberAnimation { target: qtText; properties: "opacity, scale"; duration: 400; easing.type: "OutQuad" }
+                    NumberAnimation { target: sketchBlueHolder; property: "opacity"; duration: 300; easing.type: "OutQuad" }
+                    NumberAnimation { target: sketchBlueHolder; property: "scale"; duration: 320; easing.type: "OutQuad" }
+                }
+                PauseAnimation { duration: 1000 }
+                ScriptAction { script: myApp.animationFinished() }
+            }
+        }
+    ]
+
+    Item {
+        id: fullLogo
+        opacity: 0
+        Image {
+            id: backLogo
+            x: -16
+            y: -41
+            opacity: 0
+            scale: 0.7
+            smooth: true
+            source: "qt-back.png"
+        }
+        Image {
+            id: frontLogo
+            x: -17
+            y: -41
+            opacity: 0
+            scale: 1.2
+            smooth: true
+            source: "qt-front.png"
+        }
+        Image {
+            id: qtText
+            x: -10
+            y: -41
+            opacity: 0
+            scale: 1.2
+            smooth: true
+            source: "qt-text.png"
+        }
+    }
+}
Index: trunk/tools/qml/startup/startup.qml
===================================================================
--- trunk/tools/qml/startup/startup.qml	(revision 846)
+++ trunk/tools/qml/startup/startup.qml	(revision 846)
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+Rectangle {
+    id: treatsApp
+    width: 800
+    height: 480
+    color: "darkgrey"
+    Component.onCompleted: treatsApp.state = "part1"
+    signal animationFinished
+
+    Item {
+        width: 800
+        height: 480
+        anchors.centerIn: parent
+        clip: true
+
+        Logo {
+            id: logo
+            x: 165
+            y: 35
+            rotation: -15
+            scale: 0.6
+            opacity: 0
+            onAnimationFinished: treatsApp.animationFinished();
+        }
+
+        Item {
+            id: quickblur
+            x: 800//325
+            y: 344
+            Image {
+                id: blurText
+                source: "quick-blur.png"
+            }
+            Image {
+                id: quickregular
+                x: -1
+                y: 0
+                opacity: 0
+                source: "quick-regular.png"
+            }
+            Image {
+                id: star
+                x: -1
+                y: 0
+                opacity: 0
+                source: "white-star.png"
+                smooth: true
+                NumberAnimation on rotation {
+                    from: 0
+                    to: 360
+                    loops: NumberAnimation.Infinite
+                    running: true
+                    duration: 2000
+                }
+            }
+        }
+    }
+
+    states: [
+        State {
+            name: "part1"
+            PropertyChanges {
+                target: logo
+                scale: 0.8
+                opacity: 1
+                rotation: 0
+            }
+            PropertyChanges {
+                target: treatsApp
+                color: "black"
+            }
+            PropertyChanges {
+                target: logo
+                y: 10
+            }
+            PropertyChanges {
+                target: quickblur
+                x: logo.x + 145
+            }
+            PropertyChanges {
+                target: blurText
+                opacity: 0
+            }
+            PropertyChanges {
+                target: quickregular
+                opacity: 1
+            }
+            PropertyChanges {
+                target: star
+                x: -7
+                y: -37
+            }
+        }
+    ]
+
+    transitions: [
+        Transition {
+            ParallelAnimation {
+                NumberAnimation { target: logo; property: "opacity"; duration: 500 }
+                NumberAnimation { target: logo; property: "scale"; duration: 4000; }
+                NumberAnimation { target: logo; property: "rotation"; duration: 2000; easing.type: "OutBack"}
+                ColorAnimation { duration: 3000}
+                SequentialAnimation {
+                    PauseAnimation { duration: 1000 }
+                    ScriptAction { script: logo.logoState = "showBlueprint" }
+                    PauseAnimation { duration: 800 }
+                    ScriptAction { script: logo.logoState = "finale" }
+                    PauseAnimation { duration: 800 }
+                    ParallelAnimation {
+                        NumberAnimation { target: quickblur; property: "x"; duration: 200;}
+                        SequentialAnimation {
+                            PauseAnimation { duration: 200}
+                            ParallelAnimation {
+                                NumberAnimation { target: blurText; property: "opacity"; duration: 300;}
+                                NumberAnimation { target: quickregular; property: "opacity"; duration: 300;}
+                            }
+                            NumberAnimation { target: star; property: "opacity"; from: 0; to: 1; duration: 500 }
+                            PauseAnimation { duration: 200 }
+                            NumberAnimation { target: star; property: "opacity"; from: 1; to: 0; duration: 500 }
+                        }
+                        SequentialAnimation {
+                            PauseAnimation { duration: 150}
+                            NumberAnimation { target: logo; property: "y"; duration: 300; easing.type: "OutBounce" }
+                        }
+                    }
+                }
+            }
+        }
+    ]
+
+} // treatsApp
Index: trunk/tools/qml/startup/startup.qrc
===================================================================
--- trunk/tools/qml/startup/startup.qrc	(revision 846)
+++ trunk/tools/qml/startup/startup.qrc	(revision 846)
@@ -0,0 +1,16 @@
+<RCC>
+    <qresource prefix="/startup">
+        <file>Logo.qml</file>
+        <file>qt-back.png</file>
+        <file>qt-blue.jpg</file>
+        <file>qt-front.png</file>
+        <file>qt-sketch.jpg</file>
+        <file>qt-text.png</file>
+        <file>quick-blur.png</file>
+        <file>quick-regular.png</file>
+        <file>shadow.png</file>
+        <file>startup.qml</file>
+        <file>startup.qrc</file>
+        <file>white-star.png</file>
+    </qresource>
+</RCC>
Index: trunk/tools/qml/texteditautoresizer_maemo5.h
===================================================================
--- trunk/tools/qml/texteditautoresizer_maemo5.h	(revision 846)
+++ trunk/tools/qml/texteditautoresizer_maemo5.h	(revision 846)
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qplaintextedit.h>
+#include <QtGui/qtextedit.h>
+#include <QtGui/qabstractkineticscroller.h>
+#include <QtGui/qscrollarea.h>
+#include <QtDebug>
+
+#ifndef TEXTEDITAUTORESIZER_H
+#define TEXTEDITAUTORESIZER_H
+
+class TextEditAutoResizer : public QObject
+{
+    Q_OBJECT
+public:
+    TextEditAutoResizer(QWidget *parent)
+        : QObject(parent), plainTextEdit(qobject_cast<QPlainTextEdit *>(parent)),
+          textEdit(qobject_cast<QTextEdit *>(parent)), edit(qobject_cast<QFrame *>(parent))
+    {
+        // parent must either inherit QPlainTextEdit or  QTextEdit!
+        Q_ASSERT(plainTextEdit || textEdit);
+
+        connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged()));
+        connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged()));
+
+        textEditChanged();
+    }
+
+private Q_SLOTS:
+    inline void textEditChanged();
+
+private:
+    QPlainTextEdit *plainTextEdit;
+    QTextEdit *textEdit;
+    QFrame *edit;
+};
+
+void TextEditAutoResizer::textEditChanged()
+{
+    QTextDocument *doc = textEdit ? textEdit->document() : plainTextEdit->document();
+    QRect cursor = textEdit ? textEdit->cursorRect() : plainTextEdit->cursorRect();
+
+    QSize s = doc->size().toSize();
+    if (plainTextEdit)
+        s.setHeight((s.height() + 2) * edit->fontMetrics().lineSpacing());
+
+    const QRect fr = edit->frameRect();
+    const QRect cr = edit->contentsRect();
+
+    edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1)));
+
+    // make sure the cursor is visible in case we have a QAbstractScrollArea parent
+    QPoint pos = edit->pos();
+    QWidget *pw = edit->parentWidget();
+    while (pw) {
+        if (qobject_cast<QScrollArea *>(pw))
+            break;
+        pw = pw->parentWidget();
+    }
+
+    if (pw) {
+        QScrollArea *area = static_cast<QScrollArea *>(pw);
+        QPoint scrollto = area->widget()->mapFrom(edit, cursor.center());
+        QPoint margin(10 + cursor.width(), 2 * cursor.height());
+
+        if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value<QAbstractKineticScroller *>()) {
+            scroller->ensureVisible(scrollto, margin.x(), margin.y());
+        } else {
+            area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y());
+        }
+    }
+}
+
+#endif
Index: trunk/tools/qtconcurrent/codegenerator/example/main.cpp
===================================================================
--- trunk/tools/qtconcurrent/codegenerator/example/main.cpp	(revision 769)
+++ trunk/tools/qtconcurrent/codegenerator/example/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconcurrent/codegenerator/src/codegenerator.cpp
===================================================================
--- trunk/tools/qtconcurrent/codegenerator/src/codegenerator.cpp	(revision 769)
+++ trunk/tools/qtconcurrent/codegenerator/src/codegenerator.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconcurrent/codegenerator/src/codegenerator.h
===================================================================
--- trunk/tools/qtconcurrent/codegenerator/src/codegenerator.h	(revision 769)
+++ trunk/tools/qtconcurrent/codegenerator/src/codegenerator.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconcurrent/generaterun/main.cpp
===================================================================
--- trunk/tools/qtconcurrent/generaterun/main.cpp	(revision 769)
+++ trunk/tools/qtconcurrent/generaterun/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -326,5 +326,5 @@
                        Line("/****************************************************************************") +
                        Line("**") +
-                       Line("** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).") +
+                       Line("** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).") +
                        Line("** Contact: Nokia Corporation (qt-info@nokia.com)") +
                        Line("**") +
@@ -376,5 +376,5 @@
                                      Line("/****************************************************************************") +
                                      Line("**") +
-                                     Line("** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).") +
+                                     Line("** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).") +
                                      Line("** Contact: Nokia Corporation (qt-info@nokia.com)") +
                                      Line("**") +
Index: trunk/tools/qtconfig/colorbutton.cpp
===================================================================
--- trunk/tools/qtconfig/colorbutton.cpp	(revision 769)
+++ trunk/tools/qtconfig/colorbutton.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/colorbutton.h
===================================================================
--- trunk/tools/qtconfig/colorbutton.h	(revision 769)
+++ trunk/tools/qtconfig/colorbutton.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/main.cpp
===================================================================
--- trunk/tools/qtconfig/main.cpp	(revision 769)
+++ trunk/tools/qtconfig/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,4 +43,7 @@
 #include "mainwindow.h"
 #include <QApplication>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QTranslator>
 
 QT_USE_NAMESPACE
@@ -51,4 +54,15 @@
 
     QApplication app(argc, argv);
+
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("qtconfig_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+    }
+
     MainWindow mw;
     mw.show();
Index: trunk/tools/qtconfig/mainwindow.cpp
===================================================================
--- trunk/tools/qtconfig/mainwindow.cpp	(revision 769)
+++ trunk/tools/qtconfig/mainwindow.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -69,4 +69,6 @@
 #ifndef QT_NO_GSTREAMER
 #include <gst/gst.h>
+#endif
+#ifdef HAVE_PHONON
 #include <phonon/phononnamespace.h>
 #endif
@@ -80,5 +82,5 @@
 // extern bool Q_CORE_EXPORT qt_resolve_symlinks;
 
-static const char *appearance_text =
+static const char *appearance_text = QT_TRANSLATE_NOOP("MainWindow",
 "<p><b><font size+=2>Appearance</font></b></p>"
 "<hr>"
@@ -94,7 +96,7 @@
 "the advanced palette editor."
 "<p>The Preview Window shows what the selected Style and colors look "
-"like.";
-
-static const char *font_text =
+"like.");
+
+static const char *font_text = QT_TRANSLATE_NOOP("MainWindow",
 "<p><b><font size+=2>Fonts</font></b></p>"
 "<hr>"
@@ -113,7 +115,7 @@
 "from the Mincho font.  Because the font substitutions are "
 "lists, you can also select multiple families, such as Song Ti (for "
-"use with Chinese text).";
-
-static const char *interface_text =
+"use with Chinese text).");
+
+static const char *interface_text = QT_TRANSLATE_NOOP("MainWindow",
 "<p><b><font size+=2>Interface</font></b></p>"
 "<hr>"
@@ -130,8 +132,8 @@
 "<p>XIM (Extended Input Methods) are used for entering characters in "
 "languages that have large character sets, for example, Chinese and "
-"Japanese.";
+"Japanese.");
 // ### What does the 'Enhanced support for languages written R2L do?
 
-static const char *printer_text =
+static const char *printer_text = QT_TRANSLATE_NOOP("MainWindow",
 "<p><b><font size+=2>Printer</font></b></p>"
 "<hr>"
@@ -144,12 +146,12 @@
 "<p>When using font embedding you can select additional directories where "
 "Qt should search for embeddable font files.  By default, the X "
-"server font path is used.";
-
-static const char *phonon_text =
+"server font path is used.");
+
+static const char *phonon_text = QT_TRANSLATE_NOOP("MainWindow",
 "<p><b><font size+=2>Phonon</font></b></p>"
 "<hr>"
 "<p>Use this tab to configure the Phonon GStreamer multimedia backend. "
 "<p>It is reccommended to leave all settings on \"Auto\" to let "
-"Phonon determine your settings automatically.";
+"Phonon determine your settings automatically.");
 
 static QColorGroup::ColorRole centralFromItem( int item )
@@ -388,6 +390,8 @@
     audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")),
                                 tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole);
+#ifdef HAVE_PHONON
+    phononVersionLabel->setText(QLatin1String(Phonon::phononVersion()));
+#endif
 #ifndef QT_NO_GSTREAMER
-    phononVersionLabel->setText(QLatin1String(Phonon::phononVersion()));
     if (gst_init_check(0, 0, 0)) {
         gchar *versionString = gst_version_string();
@@ -429,5 +433,5 @@
 #ifndef QT_NO_OPENGL
     videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL"));
-    videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if avaiable"), Qt::ToolTipRole);
+    videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if available"), Qt::ToolTipRole);
 #endif
     videomodeCombo->addItem(tr("Software"), QLatin1String("Software"));
@@ -1000,5 +1004,5 @@
     box.setText(tr("<h3>%1</h3>"
                    "<br/>Version %2"
-                   "<br/><br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).")
+                   "<br/><br/>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).")
                    .arg(tr("Qt Configuration")).arg(QLatin1String(QT_VERSION_STR)));
     box.setWindowTitle(tr("Qt Configuration"));
Index: trunk/tools/qtconfig/mainwindow.h
===================================================================
--- trunk/tools/qtconfig/mainwindow.h	(revision 769)
+++ trunk/tools/qtconfig/mainwindow.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/mainwindowbase.cpp
===================================================================
--- trunk/tools/qtconfig/mainwindowbase.cpp	(revision 769)
+++ trunk/tools/qtconfig/mainwindowbase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/mainwindowbase.h
===================================================================
--- trunk/tools/qtconfig/mainwindowbase.h	(revision 769)
+++ trunk/tools/qtconfig/mainwindowbase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/mainwindowbase.ui
===================================================================
--- trunk/tools/qtconfig/mainwindowbase.ui	(revision 769)
+++ trunk/tools/qtconfig/mainwindowbase.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/paletteeditoradvanced.cpp
===================================================================
--- trunk/tools/qtconfig/paletteeditoradvanced.cpp	(revision 769)
+++ trunk/tools/qtconfig/paletteeditoradvanced.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -183,4 +183,5 @@
 
 QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item )
+
 {
     switch( item ) {
Index: trunk/tools/qtconfig/paletteeditoradvanced.h
===================================================================
--- trunk/tools/qtconfig/paletteeditoradvanced.h	(revision 769)
+++ trunk/tools/qtconfig/paletteeditoradvanced.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/paletteeditoradvancedbase.cpp
===================================================================
--- trunk/tools/qtconfig/paletteeditoradvancedbase.cpp	(revision 769)
+++ trunk/tools/qtconfig/paletteeditoradvancedbase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/paletteeditoradvancedbase.h
===================================================================
--- trunk/tools/qtconfig/paletteeditoradvancedbase.h	(revision 769)
+++ trunk/tools/qtconfig/paletteeditoradvancedbase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/paletteeditoradvancedbase.ui
===================================================================
--- trunk/tools/qtconfig/paletteeditoradvancedbase.ui	(revision 769)
+++ trunk/tools/qtconfig/paletteeditoradvancedbase.ui	(revision 846)
@@ -3,5 +3,5 @@
   <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewframe.cpp
===================================================================
--- trunk/tools/qtconfig/previewframe.cpp	(revision 769)
+++ trunk/tools/qtconfig/previewframe.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewframe.h
===================================================================
--- trunk/tools/qtconfig/previewframe.h	(revision 769)
+++ trunk/tools/qtconfig/previewframe.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewwidget.cpp
===================================================================
--- trunk/tools/qtconfig/previewwidget.cpp	(revision 769)
+++ trunk/tools/qtconfig/previewwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewwidget.h
===================================================================
--- trunk/tools/qtconfig/previewwidget.h	(revision 769)
+++ trunk/tools/qtconfig/previewwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewwidgetbase.cpp
===================================================================
--- trunk/tools/qtconfig/previewwidgetbase.cpp	(revision 769)
+++ trunk/tools/qtconfig/previewwidgetbase.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewwidgetbase.h
===================================================================
--- trunk/tools/qtconfig/previewwidgetbase.h	(revision 769)
+++ trunk/tools/qtconfig/previewwidgetbase.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/previewwidgetbase.ui
===================================================================
--- trunk/tools/qtconfig/previewwidgetbase.ui	(revision 769)
+++ trunk/tools/qtconfig/previewwidgetbase.ui	(revision 846)
@@ -3,5 +3,5 @@
   <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtconfig/qtconfig.pro
===================================================================
--- trunk/tools/qtconfig/qtconfig.pro	(revision 769)
+++ trunk/tools/qtconfig/qtconfig.pro	(revision 846)
@@ -10,5 +10,8 @@
 contains(QT_CONFIG, gstreamer):LIBS += $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10
 contains(QT_CONFIG, gstreamer):QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER
-contains(QT_CONFIG, gstreamer):QT += phonon
+contains(QT_CONFIG, phonon) {
+    QT += phonon
+    DEFINES += HAVE_PHONON
+}
 SOURCES        += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \
     mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp
Index: trunk/tools/qtestlib/qtestlib.pro
===================================================================
--- trunk/tools/qtestlib/qtestlib.pro	(revision 769)
+++ trunk/tools/qtestlib/qtestlib.pro	(revision 846)
@@ -1,4 +1,4 @@
 TEMPLATE = subdirs
-!wince*: SUBDIRS += updater chart
+!wince*: SUBDIRS += updater
 wince*: contains(QT_CONFIG, cetest): SUBDIRS += wince
 CONFIG += ordered
Index: trunk/tools/qtestlib/updater/main.cpp
===================================================================
--- trunk/tools/qtestlib/updater/main.cpp	(revision 769)
+++ trunk/tools/qtestlib/updater/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsync/main.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsync/main.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsync/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.h
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsync/remoteconnection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/commands.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/commands.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/commands.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/commands.h
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/commands.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/commands.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/main.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/main.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h
===================================================================
--- trunk/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetest/activesyncconnection.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetest/activesyncconnection.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/activesyncconnection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -248,5 +248,5 @@
 
     if (!readUntilEnd) {
-        debugOutput(QString::fromLatin1("  an error occured during copy"), 2);
+        debugOutput(QString::fromLatin1("  an error occurred during copy"), 2);
         return false;
     }
Index: trunk/tools/qtestlib/wince/cetest/activesyncconnection.h
===================================================================
--- trunk/tools/qtestlib/wince/cetest/activesyncconnection.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/activesyncconnection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -199,2 +199,23 @@
     return result;
 }
+
+bool CeTcpSyncConnection::resetDevice()
+{
+    qWarning("CeTcpSyncConnection::resetDevice not implemented");
+    return false;
+}
+
+bool CeTcpSyncConnection::toggleDevicePower(int *returnValue)
+{
+    Q_UNUSED(returnValue);
+    qWarning("CeTcpSyncConnection::toggleDevicePower not implemented");
+    return false;
+}
+
+bool CeTcpSyncConnection::setDeviceAwake(bool activate, int *returnValue)
+{
+    Q_UNUSED(activate);
+    Q_UNUSED(returnValue);
+    qWarning("CeTcpSyncConnection::setDeviceAwake not implemented");
+    return false;
+}
Index: trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.h
===================================================================
--- trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/cetcpsyncconnection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -76,4 +76,7 @@
 
     bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL);
+    bool resetDevice();
+    bool toggleDevicePower(int *returnValue = NULL);
+    bool setDeviceAwake(bool activate, int *returnValue = NULL);
 private:
     bool connected;
Index: trunk/tools/qtestlib/wince/cetest/cetest.pro
===================================================================
--- trunk/tools/qtestlib/wince/cetest/cetest.pro	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/cetest.pro	(revision 846)
@@ -37,6 +37,4 @@
         remoteconnection.cpp \
         deployment.cpp \
-        symbian/epocroot.cpp \
-		windows/registry.cpp \
         main.cpp
 
Index: trunk/tools/qtestlib/wince/cetest/deployment.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetest/deployment.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/deployment.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetest/deployment.h
===================================================================
--- trunk/tools/qtestlib/wince/cetest/deployment.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/deployment.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetest/main.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetest/main.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -284,10 +284,14 @@
         return -1;
     }
-    // Check wether the project is still in debug/release mode after reading
+    // Check whether the project is still in debug/release mode after reading
     // If .pro specifies to be one mode only, we need to accept this
-    if (project.isActiveConfig("debug"))
+    if (project.isActiveConfig("debug") && !project.isActiveConfig("release")) {
         TestConfiguration::testDebug = true;
-    else
+        debugOutput("ActiveConfig: debug only in .pro.", 1);
+    }
+    if (!project.isActiveConfig("debug") && project.isActiveConfig("release")) {
         TestConfiguration::testDebug = false;
+        debugOutput("ActiveConfig: release only in .pro.", 1);
+    }
 
     // determine what is the real mkspec to use if the default mkspec is being used
Index: trunk/tools/qtestlib/wince/cetest/qmake_include.pri
===================================================================
--- trunk/tools/qtestlib/wince/cetest/qmake_include.pri	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/qmake_include.pri	(revision 846)
@@ -6,6 +6,8 @@
            $$QT_SOURCE_TREE/qmake/project.cpp \
            $$QT_SOURCE_TREE/qmake/property.cpp \
+           $$QT_SOURCE_TREE/qmake/generators/metamakefile.cpp \
            $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp \
            $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \
            $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp
 
+DEFINES += QT_QMAKE_PARSER_ONLY
Index: trunk/tools/qtestlib/wince/cetest/remoteconnection.cpp
===================================================================
--- trunk/tools/qtestlib/wince/cetest/remoteconnection.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/remoteconnection.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/cetest/remoteconnection.h
===================================================================
--- trunk/tools/qtestlib/wince/cetest/remoteconnection.h	(revision 769)
+++ trunk/tools/qtestlib/wince/cetest/remoteconnection.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/remotelib/commands.cpp
===================================================================
--- trunk/tools/qtestlib/wince/remotelib/commands.cpp	(revision 769)
+++ trunk/tools/qtestlib/wince/remotelib/commands.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qtestlib/wince/remotelib/commands.h
===================================================================
--- trunk/tools/qtestlib/wince/remotelib/commands.h	(revision 769)
+++ trunk/tools/qtestlib/wince/remotelib/commands.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qttracereplay/main.cpp
===================================================================
--- trunk/tools/qttracereplay/main.cpp	(revision 769)
+++ trunk/tools/qttracereplay/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -50,5 +50,5 @@
     Q_OBJECT
 public:
-    ReplayWidget(const QString &filename);
+    ReplayWidget(const QString &filename, int from, int to, bool single, int frame);
 
     void paintEvent(QPaintEvent *event);
@@ -67,19 +67,93 @@
 
     QList<uint> visibleUpdates;
-    QList<uint> iterationTimes;
+
+    QVector<uint> iterationTimes;
     QString filename;
+
+    int from;
+    int to;
+
+    bool single;
+
+    int frame;
+    int currentCommand;
 };
 
 void ReplayWidget::updateRect()
 {
-    if (!visibleUpdates.isEmpty())
+    if (frame >= 0 && !updates.isEmpty())
+        update(updates.at(frame));
+    else if (!visibleUpdates.isEmpty())
         update(updates.at(visibleUpdates.at(currentFrame)));
 }
 
+const int singleFrameRepeatsPerCommand = 100;
+const int singleFrameIterations = 4;
+
 void ReplayWidget::paintEvent(QPaintEvent *)
 {
     QPainter p(this);
 
+    QTimer::singleShot(0, this, SLOT(updateRect()));
+
 //    p.setClipRegion(frames.at(currentFrame).updateRegion);
+
+    if (frame >= 0) {
+        int start = buffer.frameStartIndex(frame);
+        int end = buffer.frameEndIndex(frame);
+
+        iterationTimes.resize(end - start);
+
+        int saveRestoreStackDepth = buffer.processCommands(&p, start, start + currentCommand);
+
+        for (int i = 0; i < saveRestoreStackDepth; ++i)
+            p.restore();
+
+        const int repeats = currentIteration >= 3 ? singleFrameRepeatsPerCommand : 1;
+
+        ++currentFrame;
+        if (currentFrame == repeats) {
+            currentFrame = 0;
+            if (currentIteration >= 3) {
+                iterationTimes[currentCommand - 1] = qMin(iterationTimes[currentCommand - 1], uint(timer.elapsed()));
+                timer.restart();
+            }
+
+            if (currentIteration >= singleFrameIterations + 3) {
+                printf(" #    | ms      | description\n");
+                printf("------+---------+------------------------------------------------------------\n");
+
+		qSort(iterationTimes);
+
+		int sum = 0;
+                for (int i = 0; i < iterationTimes.size(); ++i) {
+                    int delta = iterationTimes.at(i);
+                    if (i > 0)
+                        delta -= iterationTimes.at(i-1);
+		    sum += delta;
+                    qreal deltaF = delta / qreal(repeats);
+                    printf("%.5d | %.5f | %s\n", i, deltaF, qPrintable(buffer.commandDescription(start + i)));
+                }
+                printf("Total | %.5f | Total frame time\n", sum / qreal(repeats));
+                deleteLater();
+                return;
+            }
+
+            if (start + currentCommand >= end) {
+                currentCommand = 1;
+		++currentIteration;
+                if (currentIteration == 3) {
+                    timer.start();
+                    iterationTimes.fill(uint(-1));
+                }
+		if (currentIteration >= 3 && currentIteration < singleFrameIterations + 3)
+                    printf("Profiling iteration %d of %d\n", currentIteration - 2, singleFrameIterations);
+            } else {
+                ++currentCommand;
+	    }
+        }
+
+        return;
+    }
 
     buffer.draw(&p, visibleUpdates.at(currentFrame));
@@ -89,4 +163,9 @@
         currentFrame = 0;
         ++currentIteration;
+
+        if (single) {
+            deleteLater();
+            return;
+        }
 
         if (currentIteration == 3)
@@ -129,27 +208,35 @@
         }
     }
-
-    QTimer::singleShot(0, this, SLOT(updateRect()));
-}
-
-void ReplayWidget::resizeEvent(QResizeEvent *event)
+}
+
+void ReplayWidget::resizeEvent(QResizeEvent *)
 {
     visibleUpdates.clear();
 
     QRect bounds = rect();
-    for (int i = 0; i < updates.size(); ++i) {
+
+    int first = qMax(0, from);
+    int last = qMin(unsigned(to), unsigned(updates.size()));
+    for (int i = first; i < last; ++i) {
         if (updates.at(i).intersects(bounds))
             visibleUpdates << i;
     }
 
-    if (visibleUpdates.size() != updates.size())
-        printf("Warning: skipped %d frames due to limited resolution\n", updates.size() - visibleUpdates.size());
-
-}
-
-ReplayWidget::ReplayWidget(const QString &filename_)
+    int range = last - first;
+
+    if (visibleUpdates.size() != range)
+        printf("Warning: skipped %d frames due to limited resolution\n", range - visibleUpdates.size());
+
+}
+
+ReplayWidget::ReplayWidget(const QString &filename_, int from_, int to_, bool single_, int frame_)
     : currentFrame(0)
     , currentIteration(0)
     , filename(filename_)
+    , from(from_)
+    , to(to_)
+    , single(single_)
+    , frame(frame_)
+    , currentCommand(1)
 {
     setWindowTitle(filename);
@@ -166,6 +253,12 @@
     uint size;
     in.readBytes(data, size);
-    bool isTraceFile = size == 7 && qstrncmp(data, "qttrace", 7) == 0;
-    delete [] data;
+    bool isTraceFile = size >= 7 && qstrncmp(data, "qttrace", 7) == 0;
+
+    uint version = 0;
+    if (size == 9 && qstrncmp(data, "qttraceV2", 9) == 0) {
+        in.setFloatingPointPrecision(QDataStream::SinglePrecision);
+        in >> version;
+    }
+
     if (!isTraceFile) {
         printf("File '%s' is not a trace file\n", qPrintable(filename_));
@@ -174,5 +267,5 @@
 
     in >> buffer >> updates;
-    printf("Read paint buffer with %d frames\n", buffer.numFrames());
+    printf("Read paint buffer version %d with %d frames\n", version, buffer.numFrames());
 
     resize(buffer.boundingRect().size().toSize());
@@ -190,15 +283,63 @@
     if (argc <= 1 || qstrcmp(argv[1], "-h") == 0 || qstrcmp(argv[1], "--help") == 0) {
         printf("Replays a tracefile generated with '-graphicssystem trace'\n");
-        printf("Usage:\n  > %s [traceFile]\n", argv[0]);
+        printf("Usage:\n  > %s [OPTIONS] [traceFile]\n", argv[0]);
+        printf("OPTIONS\n"
+               "   --range=from-to to specify a frame range.\n"
+               "   --singlerun to do only one run (without statistics)\n"
+               "   --instrumentframe=frame to instrument a single frame\n");
         return 1;
     }
 
-    QFile file(argv[1]);
+    QFile file(app.arguments().last());
     if (!file.exists()) {
-        printf("%s does not exist\n", argv[1]);
+        printf("%s does not exist\n", qPrintable(app.arguments().last()));
         return 1;
     }
 
-    ReplayWidget *widget = new ReplayWidget(argv[1]);
+    bool single = false;
+
+    int frame = -1;
+
+    int from = 0;
+    int to = -1;
+    for (int i = 1; i < app.arguments().size() - 1; ++i) {
+        QString arg = app.arguments().at(i);
+        if (arg.startsWith(QLatin1String("--range="))) {
+            QString rest = arg.mid(8);
+            QStringList components = rest.split(QLatin1Char('-'));
+
+            bool ok1 = false;
+            bool ok2 = false;
+            int fromCandidate = 0;
+            int toCandidate = 0;
+            if (components.size() == 2) {
+                fromCandidate = components.first().toInt(&ok1);
+                toCandidate = components.last().toInt(&ok2);
+            }
+
+            if (ok1 && ok2) {
+                from = fromCandidate;
+                to = toCandidate;
+            } else {
+                printf("ERROR: malformed syntax in argument %s\n", qPrintable(arg));
+            }
+        } else if (arg == QLatin1String("--singlerun")) {
+            single = true;
+        } else if (arg.startsWith(QLatin1String("--instrumentframe="))) {
+            QString rest = arg.mid(18);
+            bool ok = false;
+            int frameCandidate = rest.toInt(&ok);
+            if (ok) {
+                frame = frameCandidate;
+            } else {
+                printf("ERROR: malformed syntax in argument %s\n", qPrintable(arg));
+            }
+        } else {
+            printf("Unrecognized argument: %s\n", qPrintable(arg));
+            return 1;
+        }
+    }
+
+    ReplayWidget *widget = new ReplayWidget(app.arguments().last(), from, to, single, frame);
 
     if (!widget->updates.isEmpty()) {
Index: trunk/tools/qvfb/config.ui
===================================================================
--- trunk/tools/qvfb/config.ui	(revision 769)
+++ trunk/tools/qvfb/config.ui	(revision 846)
@@ -3,5 +3,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/gammaview.h
===================================================================
--- trunk/tools/qvfb/gammaview.h	(revision 769)
+++ trunk/tools/qvfb/gammaview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/main.cpp
===================================================================
--- trunk/tools/qvfb/main.cpp	(revision 769)
+++ trunk/tools/qvfb/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,7 @@
 #include <QApplication>
 #include <QRegExp>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QTranslator>
 #include <stdlib.h>
 #include <stdio.h>
@@ -73,4 +76,14 @@
 
     QApplication app( argc, argv );
+
+    QTranslator translator;
+    QTranslator qtTranslator;
+    QString sysLocale = QLocale::system().name();
+    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+    if (translator.load(QLatin1String("qvfb_") + sysLocale, resourceDir)
+        && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
+        app.installTranslator(&translator);
+        app.installTranslator(&qtTranslator);
+    }
 
     int width = 0;
Index: trunk/tools/qvfb/qanimationwriter.cpp
===================================================================
--- trunk/tools/qvfb/qanimationwriter.cpp	(revision 769)
+++ trunk/tools/qvfb/qanimationwriter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qanimationwriter.h
===================================================================
--- trunk/tools/qvfb/qanimationwriter.h	(revision 769)
+++ trunk/tools/qvfb/qanimationwriter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qlock.cpp
===================================================================
--- trunk/tools/qvfb/qlock.cpp	(revision 769)
+++ trunk/tools/qvfb/qlock.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qlock_p.h
===================================================================
--- trunk/tools/qvfb/qlock_p.h	(revision 769)
+++ trunk/tools/qvfb/qlock_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qtopiakeysym.h
===================================================================
--- trunk/tools/qvfb/qtopiakeysym.h	(revision 769)
+++ trunk/tools/qvfb/qtopiakeysym.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfb.cpp
===================================================================
--- trunk/tools/qvfb/qvfb.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfb.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -399,11 +399,11 @@
 QMenu* QVFb::createFileMenu()
 {
-    QMenu *file = new QMenu( "File", this );
-    file->addAction( "Configure...", this, SLOT(configure()), 0 );
+    QMenu *file = new QMenu( tr("&File"), this );
+    file->addAction( tr("&Configure..."), this, SLOT(configure()), QKeySequence::Preferences );
     file->addSeparator();
-    file->addAction( "&Save image...", this, SLOT(saveImage()), 0 );
-    file->addAction( "&Animation...", this, SLOT(toggleAnimation()), 0 );
+    file->addAction( tr("&Save image..."), this, SLOT(saveImage()), QKeySequence::Save );
+    file->addAction( tr("&Animation..."), this, SLOT(toggleAnimation()), 0 );
     file->addSeparator();
-    file->addAction( "&Quit", qApp, SLOT(quit()) );
+    file->addAction( tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit );
     return file;
 }
@@ -411,25 +411,25 @@
 QMenu* QVFb::createViewMenu()
 {
-    viewMenu = new QMenu( "View", this );
-    cursorAction = viewMenu->addAction( "Show &Cursor", this,
+    viewMenu = new QMenu( tr("&View"), this );
+    cursorAction = viewMenu->addAction( tr("Show &Cursor"), this,
                                         SLOT(toggleCursor()) );
     cursorAction->setCheckable(true);
     if ( view )
 	enableCursor(true);
-    viewMenu->addAction( "&Refresh Rate...", this, SLOT(changeRate()) );
+    viewMenu->addAction( tr("&Refresh Rate..."), this, SLOT(changeRate()) );
     viewMenu->addSeparator();
-    viewMenu->addAction( "No rotation", this, SLOT(setRot0()) );
-    viewMenu->addAction( "90\260 rotation", this, SLOT(setRot90()) );
-    viewMenu->addAction( "180\260 rotation", this, SLOT(setRot180()) );
-    viewMenu->addAction( "270\260 rotation", this, SLOT(setRot270()) );
+    viewMenu->addAction( tr("&No rotation"), this, SLOT(setRot0()) );
+    viewMenu->addAction( tr("&90\260 rotation"), this, SLOT(setRot90()) );
+    viewMenu->addAction( tr("1&80\260 rotation"), this, SLOT(setRot180()) );
+    viewMenu->addAction( tr("2&70\260 rotation"), this, SLOT(setRot270()) );
     viewMenu->addSeparator();
-    viewMenu->addAction( "Zoom scale &0.5", this, SLOT(setZoomHalf()) );
-    viewMenu->addAction( "Zoom scale 0.75", this, SLOT(setZoom075()) );
-    viewMenu->addAction( "Zoom scale &1", this, SLOT(setZoom1()) );
-    viewMenu->addAction( "Zoom scale &2", this, SLOT(setZoom2()) );
-    viewMenu->addAction( "Zoom scale &3", this, SLOT(setZoom3()) );
-    viewMenu->addAction( "Zoom scale &4", this, SLOT(setZoom4()) );
+    viewMenu->addAction( tr("Zoom scale &0.5"), this, SLOT(setZoomHalf()) );
+    viewMenu->addAction( tr("Zoom scale 0.7&5"), this, SLOT(setZoom075()) );
+    viewMenu->addAction( tr("Zoom scale &1"), this, SLOT(setZoom1()) );
+    viewMenu->addAction( tr("Zoom scale &2"), this, SLOT(setZoom2()) );
+    viewMenu->addAction( tr("Zoom scale &3"), this, SLOT(setZoom3()) );
+    viewMenu->addAction( tr("Zoom scale &4"), this, SLOT(setZoom4()) );
     viewMenu->addSeparator();
-    viewMenu->addAction( "Zoom scale...", this, SLOT(setZoom()) );
+    viewMenu->addAction( tr("Zoom &scale..."), this, SLOT(setZoom()) );
     return viewMenu;
 }
@@ -438,6 +438,6 @@
 QMenu* QVFb::createHelpMenu()
 {
-    QMenu *help = new QMenu( "Help", this );
-    help->addAction("About...", this, SLOT(about()));
+    QMenu *help = new QMenu( tr("&Help"), this );
+    help->addAction(tr("&About..."), this, SLOT(about()));
     return help;
 }
@@ -526,15 +526,15 @@
 {
     QImage img = view->image();
-    QString filename = QFileDialog::getSaveFileName(this, "Save Main Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
+    QString filename = QFileDialog::getSaveFileName(this, tr("Save Main Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
     if (!filename.isEmpty()){
         if(!img.save(filename,"PNG"))
-                QMessageBox::critical(this, "Save Main Screen Image", "Save failed. Check that you have permission to write to the target directory.");
+                QMessageBox::critical(this, tr("Save Main Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
     }
     if (secondaryView) {
         QImage img = view->image();
-        QString filename = QFileDialog::getSaveFileName(this, "Save Second Screen image", "snapshot.png", "Portable Network Graphics (*.png)");
+        QString filename = QFileDialog::getSaveFileName(this, tr("Save Second Screen image"), tr("snapshot.png"), tr("Portable Network Graphics (*.png)"));
         if (!filename.isEmpty()) {
             if(!img.save(filename,"PNG"))
-                QMessageBox::critical(this, "Save Second Screen Image", "Save failed. Check that you have permission to write to the target directory.");
+                QMessageBox::critical(this, tr("Save Second Screen Image"), tr("Save failed. Check that you have permission to write to the target directory."));
         }
     }
@@ -578,5 +578,5 @@
 void QVFb::about()
 {
-    QMessageBox::about(this, "About QVFB",
+    QMessageBox::about(this, tr("About QVFB"), tr(
 	"<h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2>"
 	"<p>This application runs under Qt for X11, emulating a simple framebuffer, "
@@ -587,5 +587,5 @@
 	"This means you can comfortably use your other development tools such "
 	"as GUI profilers and debuggers."
-    );
+    ));
 }
 
@@ -1039,5 +1039,5 @@
     // ### can't use QProcess, not in Qt 2.3
     // ### but it's certainly in Qt 4! use it?
-    // Execute the ppmtompeg command as a seperate process to do the encoding
+    // Execute the ppmtompeg command as a separate process to do the encoding
     pid_t pid = ::fork();
     if ( !pid ) {
Index: trunk/tools/qvfb/qvfb.h
===================================================================
--- trunk/tools/qvfb/qvfb.h	(revision 769)
+++ trunk/tools/qvfb/qvfb.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfb.pro
===================================================================
--- trunk/tools/qvfb/qvfb.pro	(revision 769)
+++ trunk/tools/qvfb/qvfb.pro	(revision 846)
@@ -36,5 +36,5 @@
                   ../../src/gui/embedded/qwssignalhandler.cpp
 
-include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri)
+include(../shared/deviceskin/deviceskin.pri)
 
 contains(QT_CONFIG, opengl) {
Index: trunk/tools/qvfb/qvfbhdr.h
===================================================================
--- trunk/tools/qvfb/qvfbhdr.h	(revision 769)
+++ trunk/tools/qvfb/qvfbhdr.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbmmap.cpp
===================================================================
--- trunk/tools/qvfb/qvfbmmap.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbmmap.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbmmap.h
===================================================================
--- trunk/tools/qvfb/qvfbmmap.h	(revision 769)
+++ trunk/tools/qvfb/qvfbmmap.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbprotocol.cpp
===================================================================
--- trunk/tools/qvfb/qvfbprotocol.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbprotocol.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbprotocol.h
===================================================================
--- trunk/tools/qvfb/qvfbprotocol.h	(revision 769)
+++ trunk/tools/qvfb/qvfbprotocol.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbratedlg.cpp
===================================================================
--- trunk/tools/qvfb/qvfbratedlg.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbratedlg.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,5 +56,5 @@
     tl->setMargin(5);
 
-    QLabel *label = new QLabel("Target frame rate:", this);
+    QLabel *label = new QLabel(tr("Target frame rate:"), this);
     tl->addWidget(label);
 
@@ -68,13 +68,13 @@
     hl->addWidget(rateSlider);
     connect(rateSlider, SIGNAL(valueChanged(int)), this, SLOT(rateChanged(int)));
-    rateLabel = new QLabel(QString("%1fps").arg(rate), this);
+    rateLabel = new QLabel(tr("%1fps").arg(rate), this);
     hl->addWidget(rateLabel);
 
     hl = new QHBoxLayout();
     tl->addItem(hl);
-    QPushButton *pb = new QPushButton("OK", this);
+    QPushButton *pb = new QPushButton(tr("OK"), this);
     connect(pb, SIGNAL(clicked()), this, SLOT(ok()));
     hl->addWidget(pb);
-    pb = new QPushButton("Cancel", this);
+    pb = new QPushButton(tr("Cancel"), this);
     connect(pb, SIGNAL(clicked()), this, SLOT(cancel()));
     hl->addWidget(pb);
@@ -85,5 +85,5 @@
     if (rateSlider->value() != r)
 	rateSlider->setValue(r);
-    rateLabel->setText(QString("%1fps").arg(r));
+    rateLabel->setText(tr("%1fps").arg(r));
     emit updateRate(r);
 }
Index: trunk/tools/qvfb/qvfbratedlg.h
===================================================================
--- trunk/tools/qvfb/qvfbratedlg.h	(revision 769)
+++ trunk/tools/qvfb/qvfbratedlg.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbshmem.cpp
===================================================================
--- trunk/tools/qvfb/qvfbshmem.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbshmem.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbshmem.h
===================================================================
--- trunk/tools/qvfb/qvfbshmem.h	(revision 769)
+++ trunk/tools/qvfb/qvfbshmem.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbview.cpp
===================================================================
--- trunk/tools/qvfb/qvfbview.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbview.h
===================================================================
--- trunk/tools/qvfb/qvfbview.h	(revision 769)
+++ trunk/tools/qvfb/qvfbview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbx11view.cpp
===================================================================
--- trunk/tools/qvfb/qvfbx11view.cpp	(revision 769)
+++ trunk/tools/qvfb/qvfbx11view.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qvfbx11view.h
===================================================================
--- trunk/tools/qvfb/qvfbx11view.h	(revision 769)
+++ trunk/tools/qvfb/qvfbx11view.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qwssignalhandler.cpp
===================================================================
--- trunk/tools/qvfb/qwssignalhandler.cpp	(revision 769)
+++ trunk/tools/qvfb/qwssignalhandler.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/qwssignalhandler_p.h
===================================================================
--- trunk/tools/qvfb/qwssignalhandler_p.h	(revision 769)
+++ trunk/tools/qvfb/qwssignalhandler_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/x11keyfaker.cpp
===================================================================
--- trunk/tools/qvfb/x11keyfaker.cpp	(revision 769)
+++ trunk/tools/qvfb/x11keyfaker.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/qvfb/x11keyfaker.h
===================================================================
--- trunk/tools/qvfb/x11keyfaker.h	(revision 769)
+++ trunk/tools/qvfb/x11keyfaker.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/main.cpp
===================================================================
--- trunk/tools/runonphone/main.cpp	(revision 769)
+++ trunk/tools/runonphone/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,4 +45,5 @@
 #include <QScopedPointer>
 #include <QTimer>
+#include <QFileInfo>
 #include "symbianutils/trkutils.h"
 #include "symbianutils/trkdevice.h"
@@ -51,18 +52,25 @@
 #include "trksignalhandler.h"
 #include "serenum.h"
-
-void printUsage(QTextStream& outstream)
+#include "ossignalconverter.h"
+
+void printUsage(QTextStream& outstream, QString exeName)
 {
-    outstream << "runtest [options] <program> [program arguments]" << endl
-            << "-s, --sis <file>                     specify sis file to install" << endl
-            << "-p, --portname <COMx>                specify COM port to use by device name" << endl
-            << "-f, --portfriendlyname <substring>   specify COM port to use by friendly name" << endl
-            << "-t, --timeout <milliseconds>         terminate test if timeout occurs" << endl
-            << "-v, --verbose                        show debugging output" << endl
-            << "-q, --quiet                          hide progress messages" << endl
+    outstream << exeName << " [options] [program] [program arguments]" << endl
+            << "-s, --sis <file>                         specify sis file to install" << endl
+            << "-p, --portname <COMx>                    specify COM port to use by device name" << endl
+            << "-f, --portfriendlyname <substring>       specify COM port to use by friendly name" << endl
+            << "-t, --timeout <milliseconds>             terminate test if timeout occurs" << endl
+            << "-v, --verbose                            show debugging output" << endl
+            << "-q, --quiet                              hide progress messages" << endl
+            << "-d, --download <remote file> <local file> copy file from phone to PC after running test" << endl
+            << "--nocrashlog                             Don't capture call stack if test crashes" << endl
+            << "--crashlogpath <dir>                     Path to save crash logs (default=working dir)" << endl
             << endl
-            << "USB COM ports can usually be autodetected" << endl;
+            << "USB COM ports can usually be autodetected, use -p or -f to force a specific port." << endl
+            << "If using System TRK, it is possible to copy the program directly to sys/bin on the phone." << endl
+            << "-s can be used with both System and Application TRK to install the program" << endl;
 }
 
+#define CHECK_PARAMETER_EXISTS if(!it.hasNext()) { printUsage(outstream, args[0]); return 1; }
 int main(int argc, char *argv[])
 {
@@ -77,58 +85,70 @@
     QTextStream outstream(stdout);
     QTextStream errstream(stderr);
+    QString downloadRemoteFile;
+    QString downloadLocalFile;
     int loglevel=1;
     int timeout=0;
-    for (int i=1;i<args.size();i++) {
-        QString arg = args.at(i);
+    bool crashlog = true;
+    QString crashlogpath;
+    QListIterator<QString> it(args);
+    it.next(); //skip name of program
+    while (it.hasNext()) {
+        QString arg = it.next();
+
         if (arg.startsWith("-")) {
-            if (args.size() < i+2) {
-                errstream << "Command line missing argument parameters" << endl;
-                return 1;
-            }
-            QString param = args.at(i+1);
-            if(arg.compare("--portname", Qt::CaseSensitive) == 0
-               || arg.compare("-p", Qt::CaseSensitive) == 0) {
-                serialPortName = param;
-                i++;
-            }
-            else if(arg.compare("--portfriendlyname", Qt::CaseSensitive) == 0
-                    || arg.compare("-f", Qt::CaseSensitive) == 0) {
-                serialPortFriendlyName = param;
-                i++;
-            }
-            else if(arg.compare("--sis", Qt::CaseSensitive) == 0
-                    || arg.compare("-s", Qt::CaseSensitive) == 0) {
-                sisFile = param;
-                i++;
-            }
-            else if(arg.compare("--timeout", Qt::CaseSensitive) == 0
-                    || arg.compare("-t", Qt::CaseSensitive) == 0) {
+            if (arg == "--portname" || arg == "-p") {
+                CHECK_PARAMETER_EXISTS
+                serialPortName = it.next();
+            }
+            else if (arg == "--portfriendlyname" || arg == "-f") {
+                CHECK_PARAMETER_EXISTS
+                serialPortFriendlyName = it.next();
+            }
+            else if (arg == "--sis" || arg == "-s") {
+                CHECK_PARAMETER_EXISTS
+                sisFile = it.next();
+                if (!QFileInfo(sisFile).exists()) {
+                    errstream << "Sis file (" << sisFile << ") doesn't exist" << endl;
+                    return 1;
+                }
+            }
+            else if (arg == "--download" || arg == "-d") {
+                CHECK_PARAMETER_EXISTS
+                downloadRemoteFile = it.next();
+                CHECK_PARAMETER_EXISTS
+                downloadLocalFile = it.next();
+            }
+            else if (arg == "--timeout" || arg == "-t") {
+                CHECK_PARAMETER_EXISTS
                 bool ok;
-                timeout = param.toInt(&ok);
+                timeout = it.next().toInt(&ok);
                 if (!ok) {
                     errstream << "Timeout must be specified in milliseconds" << endl;
                     return 1;
                 }
-                i++;
-            }
-            else if(arg.compare("--verbose", Qt::CaseSensitive) == 0
-                    || arg.compare("-v", Qt::CaseSensitive) == 0)
+            }
+            else if (arg == "--verbose" || arg == "-v")
                 loglevel=2;
-            else if(arg.compare("--quiet", Qt::CaseSensitive) == 0
-                    || arg.compare("-q", Qt::CaseSensitive) == 0)
+            else if (arg == "--quiet" || arg == "-q")
                 loglevel=0;
+            else if (arg == "--nocrashlog")
+                crashlog = false;
+            else if (arg == "--crashlogpath") {
+                CHECK_PARAMETER_EXISTS
+                crashlogpath = it.next();
+            }
             else
                 errstream << "unknown command line option " << arg << endl;
         } else {
             exeFile = arg;
-            i++;
-            for(;i<args.size();i++) {
-                cmdLine.append(args.at(i));
+            while(it.hasNext()) {
+                cmdLine.append(it.next());
             }
         }
     }
 
-    if(exeFile.isEmpty()) {
-        printUsage(outstream);
+    if (exeFile.isEmpty() && sisFile.isEmpty() && 
+        (downloadLocalFile.isEmpty() || downloadRemoteFile.isEmpty())) {
+        printUsage(outstream, args[0]);
         return 1;
     }
@@ -137,20 +157,20 @@
         if (loglevel > 0)
             outstream << "Detecting serial ports" << endl;
-        QList <SerialPortId> ports = enumerateSerialPorts();
-        foreach(SerialPortId id, ports) {
+        foreach (const SerialPortId &id, enumerateSerialPorts(loglevel)) {
             if (loglevel > 0)
                 outstream << "Port Name: " << id.portName << ", "
                      << "Friendly Name:" << id.friendlyName << endl;
-            if (serialPortName.isEmpty()) {
-                if (!id.friendlyName.isEmpty()
-                        && serialPortFriendlyName.isEmpty()
-                        && (id.friendlyName.contains("symbian", Qt::CaseInsensitive)
-                            || id.friendlyName.contains("s60", Qt::CaseInsensitive)
-                            || id.friendlyName.contains("nokia", Qt::CaseInsensitive)))
-                        serialPortName = id.portName;
-                else if (!id.friendlyName.isEmpty()
-                        && !serialPortFriendlyName.isEmpty()
-                        && id.friendlyName.contains(serialPortFriendlyName))
-                    serialPortName = id.portName;
+            if (!id.friendlyName.isEmpty()
+                    && serialPortFriendlyName.isEmpty()
+                    && (id.friendlyName.contains("symbian", Qt::CaseInsensitive)
+                        || id.friendlyName.contains("s60", Qt::CaseInsensitive)
+                        || id.friendlyName.contains("nokia", Qt::CaseInsensitive))) {
+                serialPortName = id.portName;
+                break;
+            } else if (!id.friendlyName.isEmpty()
+                    && !serialPortFriendlyName.isEmpty()
+                    && id.friendlyName.contains(serialPortFriendlyName)) {
+                serialPortName = id.portName;
+                break;
             }
         }
@@ -162,14 +182,23 @@
 
     QScopedPointer<trk::Launcher> launcher;
-
-    if (sisFile.isEmpty()) {
-        launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun));
-        launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile);
-        errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl;
-    } else {
-        launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyInstallRun));
-        launcher->addStartupActions(trk::Launcher::ActionInstall);
+    launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly));
+    QFileInfo info(exeFile);
+    if (!sisFile.isEmpty()) {
+        launcher->addStartupActions(trk::Launcher::ActionCopyInstall);
         launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis");
         launcher->setInstallFileName("c:\\data\\testtemp.sis");
+    }
+    else if (info.exists()) {
+        launcher->addStartupActions(trk::Launcher::ActionCopy);
+        launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + info.fileName());
+    }
+    if (!exeFile.isEmpty()) {
+        launcher->addStartupActions(trk::Launcher::ActionRun);
+        launcher->setFileName(QString("c:\\sys\\bin\\") + info.fileName());
+        launcher->setCommandLineArgs(cmdLine);
+    }
+    if (!downloadRemoteFile.isEmpty() && !downloadLocalFile.isEmpty()) {
+        launcher->addStartupActions(trk::Launcher::ActionDownload);
+        launcher->setDownloadFileName(downloadRemoteFile, downloadLocalFile);
     }
     if (loglevel > 0)
@@ -177,7 +206,4 @@
     launcher->setTrkServerName(serialPortName);
 
-    launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile);
-    launcher->setCommandLineArgs(cmdLine);
-
     if (loglevel > 1)
         launcher->setVerbose(1);
@@ -185,4 +211,6 @@
     TrkSignalHandler handler;
     handler.setLogLevel(loglevel);
+    handler.setCrashLogging(crashlog);
+    handler.setCrashLogPath(crashlogpath);
 
     QObject::connect(launcher.data(), SIGNAL(copyingStarted()), &handler, SLOT(copyingStarted()));
@@ -201,7 +229,13 @@
     QObject::connect(launcher.data(), SIGNAL(stateChanged(int)), &handler, SLOT(stateChanged(int)));
     QObject::connect(launcher.data(), SIGNAL(processStopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString)));
+    QObject::connect(launcher.data(), SIGNAL(libraryLoaded(trk::Library)), &handler, SLOT(libraryLoaded(trk::Library)));
+    QObject::connect(launcher.data(), SIGNAL(libraryUnloaded(trk::Library)), &handler, SLOT(libraryUnloaded(trk::Library)));
+    QObject::connect(launcher.data(), SIGNAL(registersAndCallStackReadComplete(const QList<uint> &,const QByteArray &)), &handler, SLOT(registersAndCallStackReadComplete(const QList<uint> &,const QByteArray &)));
     QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resumeProcess(uint,uint)));
     QObject::connect(&handler, SIGNAL(terminate()), launcher.data(), SLOT(terminate()));
+    QObject::connect(&handler, SIGNAL(getRegistersAndCallStack(uint,uint)), launcher.data(), SLOT(getRegistersAndCallStack(uint,uint)));
     QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished()));
+
+    QObject::connect(OsSignalConverter::instance(), SIGNAL(terminate()), launcher.data(), SLOT(terminate()), Qt::QueuedConnection);
 
     QTimer timer;
Index: trunk/tools/runonphone/ossignalconverter.cpp
===================================================================
--- trunk/tools/runonphone/ossignalconverter.cpp	(revision 846)
+++ trunk/tools/runonphone/ossignalconverter.cpp	(revision 846)
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "ossignalconverter_p.h"
+#include <signal.h>
+#include <QTimer>
+#include <stdio.h>
+
+Q_GLOBAL_STATIC(OsSignalConverter, osSignalConverter);
+
+OsSignalConverter* OsSignalConverter::instance()
+{
+    return osSignalConverter();
+}
+
+OsSignalConverter::OsSignalConverter()
+: d(new OsSignalConverterPrivate(this))
+{
+};
+
+OsSignalConverter::~OsSignalConverter()
+{
+}
+
+OsSignalConverterPrivate::OsSignalConverterPrivate(OsSignalConverter* owner)
+: QObject(owner), q(owner), poller(new QTimer(this))
+{
+    trap();
+    connect(poller, SIGNAL(timeout()), this, SLOT(poll()));
+    poller->start(1000);
+}
+
+OsSignalConverterPrivate::~OsSignalConverterPrivate()
+{
+    untrap();
+}
+
+void OsSignalConverterPrivate::trap()
+{
+    signal(SIGINT, handler);
+    signal(SIGTERM, handler);
+#ifdef SIGBREAK
+    signal(SIGBREAK, handler);
+#endif
+#ifdef SIGHUP
+    signal(SIGHUP, handler);
+#endif
+#ifdef SIGQUIT
+    signal(SIGQUIT, handler);
+#endif
+}
+
+void OsSignalConverterPrivate::untrap()
+{
+    signal(SIGINT, SIG_DFL);
+    signal(SIGTERM, SIG_DFL);
+#ifdef SIGBREAK
+    signal(SIGBREAK, SIG_DFL);
+#endif
+#ifdef SIGHUP
+    signal(SIGHUP, SIG_DFL);
+#endif
+#ifdef SIGQUIT
+    signal(SIGQUIT, SIG_DFL);
+#endif
+}
+
+void OsSignalConverterPrivate::handler(int sig)
+{
+    untrap(); //allow 2nd ctrl-c to really kill us
+    terminateRequest = sig;
+}
+
+void OsSignalConverterPrivate::poll()
+{
+    if (terminateRequest) {
+        fprintf(stderr, "\n*** caught signal %d, terminating ***\n", terminateRequest);
+        poller->stop();
+        emit q->terminate();
+    }
+}
+
+sig_atomic_t OsSignalConverterPrivate::terminateRequest;
Index: trunk/tools/runonphone/ossignalconverter.h
===================================================================
--- trunk/tools/runonphone/ossignalconverter.h	(revision 846)
+++ trunk/tools/runonphone/ossignalconverter.h	(revision 846)
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OSSIGNALCONVERTER_H
+#define OSSIGNALCONVERTER_H
+#include <QObject>
+
+class OsSignalConverterPrivate;
+
+class OsSignalConverter : public QObject
+{
+    friend class OsSignalConverterPrivate;
+    Q_OBJECT
+public:
+    static OsSignalConverter* instance();
+    OsSignalConverter();
+    ~OsSignalConverter();
+signals:
+    //emitted when this process is asked to quit, e.g. by SIGINT
+    void terminate();
+private:
+    OsSignalConverterPrivate *d;
+};
+
+#endif // OSSIGNALCONVERTER_H
Index: trunk/tools/runonphone/ossignalconverter_p.h
===================================================================
--- trunk/tools/runonphone/ossignalconverter_p.h	(revision 846)
+++ trunk/tools/runonphone/ossignalconverter_p.h	(revision 846)
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OSSIGNALCONVERTER_P_H
+#define OSSIGNALCONVERTER_P_H
+#include "ossignalconverter.h"
+#include <signal.h>
+
+class QTimer;
+class OsSignalConverterPrivate : public QObject
+{
+    Q_OBJECT
+public:
+    OsSignalConverterPrivate(OsSignalConverter* owner);
+    ~OsSignalConverterPrivate();
+private:
+
+    static void trap();
+    static void untrap();
+    static void handler(int signal);
+
+private slots:
+
+    void poll();
+
+private:
+
+    OsSignalConverter* q;
+    static sig_atomic_t terminateRequest;
+    QTimer *poller;
+};
+
+#endif // OSSIGNALCONVERTER_P_H
Index: trunk/tools/runonphone/runonphone.pro
===================================================================
--- trunk/tools/runonphone/runonphone.pro	(revision 769)
+++ trunk/tools/runonphone/runonphone.pro	(revision 846)
@@ -8,8 +8,11 @@
 
 SOURCES += main.cpp \
-    trksignalhandler.cpp
+    trksignalhandler.cpp \
+    ossignalconverter.cpp
 
 HEADERS += trksignalhandler.h \
-    serenum.h
+    serenum.h \
+    ossignalconverter.h \
+    ossignalconverter_p.h
 
 DEFINES += SYMBIANUTILS_INCLUDE_PRI
@@ -23,6 +26,10 @@
 else:unix:!symbian {
     SOURCES += serenum_unix.cpp
+    LIBS += -lusb
 }
 else {
     SOURCES += serenum_stub.cpp
 }
+
+target.path=$$[QT_INSTALL_BINS]
+INSTALLS        += target
Index: trunk/tools/runonphone/serenum.h
===================================================================
--- trunk/tools/runonphone/serenum.h	(revision 769)
+++ trunk/tools/runonphone/serenum.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -52,5 +52,5 @@
 };
 
-QList<SerialPortId> enumerateSerialPorts();
+QList<SerialPortId> enumerateSerialPorts(int loglevel);
 
 #endif // WIN32SERENUM_H
Index: trunk/tools/runonphone/serenum_stub.cpp
===================================================================
--- trunk/tools/runonphone/serenum_stub.cpp	(revision 769)
+++ trunk/tools/runonphone/serenum_stub.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/serenum_unix.cpp
===================================================================
--- trunk/tools/runonphone/serenum_unix.cpp	(revision 769)
+++ trunk/tools/runonphone/serenum_unix.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -47,17 +47,192 @@
 #include <QDir>
 
-QList<SerialPortId> enumerateSerialPorts()
+#include <usb.h>
+
+class InterfaceInfo
 {
+public:
+    InterfaceInfo(const QString &mf, const QString &pr, int mfid, int prid);
+    QString manufacturer;
+    QString product;
+    int manufacturerid;
+    int productid;
+};
+
+InterfaceInfo::InterfaceInfo(const QString &mf, const QString &pr, int mfid, int prid) :
+    manufacturer(mf),
+    product(pr),
+    manufacturerid(mfid),
+    productid(prid)
+{
+    if(mf.isEmpty())
+        manufacturer = QString("[%1]").arg(mfid, 4, 16, QChar('0'));
+    if(pr.isEmpty())
+        product = QString("[%1]").arg(prid, 4, 16, QChar('0'));
+}
+
+QList<SerialPortId> enumerateSerialPorts(int loglevel)
+{
+    QList<QString> eligibleInterfaces;
+    QList<InterfaceInfo> eligibleInterfacesInfo;
     QList<SerialPortId> list;
+
+    usb_init();
+    usb_find_busses();
+    usb_find_devices();
+
+    for (struct usb_bus *bus = usb_get_busses(); bus; bus = bus->next) {
+        for (struct usb_device *device = bus->devices; device; device = device->next) {
+            for (int n = 0; n < device->descriptor.bNumConfigurations && device->config; ++n) {
+                struct usb_config_descriptor &usbConfig =device->config[n];
+                QList<int> usableInterfaces;
+                for (int m = 0; m < usbConfig.bNumInterfaces; ++m) {
+                    for (int o = 0; o < usbConfig.interface[m].num_altsetting; ++o) {
+                        struct usb_interface_descriptor &descriptor = usbConfig.interface[m].altsetting[o];
+                        if (descriptor.bInterfaceClass != 2 // "Communication"
+                                || descriptor.bInterfaceSubClass != 2 // Abstract (modem)
+                                || descriptor.bInterfaceProtocol != 255) // Vendor Specific
+                            continue;
+
+                        unsigned char *buf = descriptor.extra;
+                        unsigned int size = descriptor.extralen;
+                        while (size >= 2 * sizeof(u_int8_t)) {
+                            // for Communication devices there is a slave interface for the actual
+                            // data transmission.
+                            // the extra info stores that as a index for the interface
+                            if (buf[0] >= 5 && buf[1] == 36 && buf[2] == 6) { // CDC Union
+                                for (int i = 4; i < buf[0]; i++)
+                                    usableInterfaces.append((int) buf[i]);
+                            }
+                            size -= buf[0];
+                            buf += buf[0];
+                        }
+                    }
+                }
+                
+                if (usableInterfaces.isEmpty())
+                    continue;
+                
+                QString manufacturerString;
+                QString productString;
+                
+                usb_dev_handle *devh = usb_open(device);
+                if (devh) {
+                    QByteArray buf;
+                    buf.resize(256);
+                    int err = usb_get_string_simple(devh, device->descriptor.iManufacturer, buf.data(), buf.size());
+                    if (err < 0) {
+                        if (loglevel > 1)
+                            qDebug() << "      can't read manufacturer name, error:" << err;
+                    } else {
+                        manufacturerString = QString::fromAscii(buf);
+                        if (loglevel > 1)
+                            qDebug() << "      manufacturer:" << manufacturerString;
+                    }
+
+                    buf.resize(256);
+                    err = usb_get_string_simple(devh, device->descriptor.iProduct, buf.data(), buf.size());
+                    if (err < 0) {
+                        if (loglevel > 1)
+                            qDebug() << "      can't read product name, error:" << err;
+                    } else {
+                        productString = QString::fromAscii(buf);
+                        if (loglevel > 1)
+                            qDebug() << "      product:" << productString;
+                    }
+                    usb_close(devh);
+                } else if (loglevel > 0) {
+                    qDebug() << "      can't open usb device";
+                }
+
+                // second loop to find the actual data interface.
+                foreach (int i, usableInterfaces) {
+                    for (int m = 0; m < usbConfig.bNumInterfaces; ++m) {
+                        for (int o = 0; o < usbConfig.interface[m].num_altsetting; ++o) {
+                            struct usb_interface_descriptor &descriptor = usbConfig.interface[m].altsetting[o];
+                            if (descriptor.bInterfaceNumber != i)
+                                continue;
+                            if (descriptor.bInterfaceClass == 10) { // "CDC Data"
+                                if (loglevel > 1) {
+                                    qDebug() << "      found the data port"
+                                             << "bus:" << bus->dirname
+                                             << "device" << device->filename
+                                             << "interface" << descriptor.bInterfaceNumber;
+                                }
+#ifdef Q_OS_MAC
+                                eligibleInterfaces << QString("^cu\\.usbmodem.*%1$")
+                                                      .arg(QString("%1").arg(descriptor.bInterfaceNumber, 1, 16).toUpper()); 
+#else
+                                // ### manufacturer and product strings are only readable as root :(
+                                if (!manufacturerString.isEmpty() && !productString.isEmpty()) {
+                                    eligibleInterfaces << QString("usb-%1_%2-if%3")
+                                                          .arg(manufacturerString.replace(QChar(' '), QChar('_')))
+                                                          .arg(productString.replace(QChar(' '), QChar('_')))
+                                                          .arg(i, 2, 16, QChar('0'));
+                                } else {
+                                    eligibleInterfaces << QString("if%1").arg(i, 2, 16, QChar('0')); // fix!
+                                }
+#endif
+                                eligibleInterfacesInfo << InterfaceInfo(manufacturerString, productString, device->descriptor.idVendor, device->descriptor.idProduct);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    if (loglevel > 1)
+        qDebug() << "      searching for interfaces:" << eligibleInterfaces;
+
+#ifdef Q_OS_MAC
+    QDir dir("/dev/");
+    bool allowAny = false;
+#else
     QDir dir("/dev/serial/by-id/");
-    QFileInfoList ports(dir.entryInfoList());
-    foreach (const QFileInfo &info, ports) {
+    bool allowAny = eligibleInterfaces.isEmpty();
+#endif
+    foreach (const QFileInfo &info, dir.entryInfoList(QDir::System)) {
         if (!info.isDir()) {
+            bool usable = allowAny;
+            QString friendlyName = info.fileName();
+            foreach (const QString &iface, eligibleInterfaces) {
+                if (info.fileName().contains(QRegExp(iface))) {
+                    if (loglevel > 1)
+                        qDebug() << "      found device file:" << info.fileName() << endl;
+#ifdef Q_OS_MAC
+                    friendlyName = eligibleInterfacesInfo[eligibleInterfaces.indexOf(iface)].product;
+#endif
+                    usable = true;
+                    break;
+                }
+            }
+            if (!usable)
+                continue;
+
             SerialPortId id;
-            id.friendlyName = info.fileName();
+            id.friendlyName = friendlyName;
             id.portName = info.canonicalFilePath();
             list << id;
         }
     }
+
+    if (list.isEmpty() && !eligibleInterfacesInfo.isEmpty() && loglevel > 0) {
+        qDebug() << "Possible USB devices found, but without serial drivers:";
+        foreach(const InterfaceInfo &iface, eligibleInterfacesInfo) {
+            qDebug() << "    Manufacturer:"
+                     << iface.manufacturer
+                     << "Product:"
+                     << iface.product
+#ifdef Q_OS_LINUX
+                     << endl
+                     << "    Load generic driver using:"
+                     << QString("sudo modprobe usbserial vendor=0x%1 product=0x%2")
+                        .arg(iface.manufacturerid, 4, 16, QChar('0'))
+                        .arg(iface.productid, 4, 16, QChar('0'));
+#else
+                     ;
+#endif
+        }
+    }
     return list;
 }
Index: trunk/tools/runonphone/serenum_win.cpp
===================================================================
--- trunk/tools/runonphone/serenum_win.cpp	(revision 769)
+++ trunk/tools/runonphone/serenum_win.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -54,5 +54,5 @@
 //DEFINE_GUID(GUID_DEVCLASS_PORTS, 0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 );
 
-QList<SerialPortId> enumerateSerialPorts()
+QList<SerialPortId> enumerateSerialPorts(int)
 {
     DWORD index=0;
Index: trunk/tools/runonphone/symbianutils/bluetoothlistener.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/bluetoothlistener.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/bluetoothlistener.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/bluetoothlistener.h
===================================================================
--- trunk/tools/runonphone/symbianutils/bluetoothlistener.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/bluetoothlistener.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.h
===================================================================
--- trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/bluetoothlistener_gui.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/callback.h
===================================================================
--- trunk/tools/runonphone/symbianutils/callback.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/callback.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/communicationstarter.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/communicationstarter.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/communicationstarter.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/communicationstarter.h
===================================================================
--- trunk/tools/runonphone/symbianutils/communicationstarter.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/communicationstarter.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/json.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/json.cpp	(revision 846)
+++ trunk/tools/runonphone/symbianutils/json.cpp	(revision 846)
@@ -0,0 +1,490 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "json.h"
+
+#ifdef TODO_USE_CREATOR
+#include <utils/qtcassert.h>
+#endif // TODO_USE_CREATOR
+
+#include <QtCore/QByteArray>
+#include <QtCore/QTextStream>
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+
+#include <ctype.h>
+
+//#define DEBUG_JASON
+#ifdef DEBUG_JASON
+#define JDEBUG(s) qDebug() << s
+#else
+#define JDEBUG(s)
+#endif
+
+namespace tcftrk {
+
+static void skipSpaces(const char *&from, const char *to)
+{
+    while (from != to && isspace(*from))
+        ++from;
+}
+
+QTextStream &operator<<(QTextStream &os, const JsonValue &mi)
+{
+    return os << mi.toString();
+}
+
+void JsonValue::parsePair(const char *&from, const char *to)
+{
+    skipSpaces(from, to);
+    JDEBUG("parsePair: " << QByteArray(from, to - from));
+    m_name = parseCString(from, to);
+    skipSpaces(from, to);
+    while (from < to && *from != ':') {
+        JDEBUG("not a colon" << *from);
+        ++from;
+    }
+    ++from;
+    parseValue(from, to);
+    skipSpaces(from, to);
+}
+
+QByteArray JsonValue::parseNumber(const char *&from, const char *to)
+{
+    QByteArray result;
+    if (from < to && *from == '-') // Leading '-'.
+        result.append(*from++);
+    while (from < to && *from >= '0' && *from <= '9')
+        result.append(*from++);
+    return result;
+}
+
+QByteArray JsonValue::parseCString(const char *&from, const char *to)
+{
+    QByteArray result;
+    JDEBUG("parseCString: " << QByteArray(from, to - from));
+    if (*from != '"') {
+        qDebug() << "JSON Parse Error, double quote expected";
+        ++from; // So we don't hang
+        return QByteArray();
+    }
+    const char *ptr = from;
+    ++ptr;
+    while (ptr < to) {
+        if (*ptr == '"') {
+            ++ptr;
+            result = QByteArray(from + 1, ptr - from - 2);
+            break;
+        }
+        if (*ptr == '\\') {
+            ++ptr;
+            if (ptr == to) {
+                qDebug() << "JSON Parse Error, unterminated backslash escape";
+                from = ptr; // So we don't hang
+                return QByteArray();
+            }
+        }
+        ++ptr;
+    }
+    from = ptr;
+
+    int idx = result.indexOf('\\');
+    if (idx >= 0) {
+        char *dst = result.data() + idx;
+        const char *src = dst + 1, *end = result.data() + result.length();
+        do {
+            char c = *src++;
+            switch (c) {
+                case 'a': *dst++ = '\a'; break;
+                case 'b': *dst++ = '\b'; break;
+                case 'f': *dst++ = '\f'; break;
+                case 'n': *dst++ = '\n'; break;
+                case 'r': *dst++ = '\r'; break;
+                case 't': *dst++ = '\t'; break;
+                case 'v': *dst++ = '\v'; break;
+                case '"': *dst++ = '"'; break;
+                case '\\': *dst++ = '\\'; break;
+                default:
+                    {
+                        int chars = 0;
+                        uchar prod = 0;
+                        forever {
+                            if (c < '0' || c > '7') {
+                                --src;
+                                break;
+                            }
+                            prod = prod * 8 + c - '0';
+                            if (++chars == 3 || src == end)
+                                break;
+                            c = *src++;
+                        }
+                        if (!chars) {
+                            qDebug() << "JSON Parse Error, unrecognized backslash escape";
+                            return QByteArray();
+                        }
+                        *dst++ = prod;
+                    }
+            }
+            while (src != end) {
+                char c = *src++;
+                if (c == '\\')
+                    break;
+                *dst++ = c;
+            }
+        } while (src != end);
+        *dst = 0;
+        result.truncate(dst - result.data());
+    }
+
+    JDEBUG("parseCString, got " << result);
+    return result;
+}
+
+
+
+void JsonValue::parseValue(const char *&from, const char *to)
+{
+    JDEBUG("parseValue: " << QByteArray(from, to - from));
+    switch (*from) {
+        case '{':
+            parseObject(from, to);
+            break;
+        case 't':
+            if (to - from >= 4 && qstrncmp(from, "true", 4) == 0) {
+                m_data = QByteArray(from, 4);
+                from += m_data.size();
+                m_type = Boolean;
+            }
+            break;
+        case 'f':
+            if (to - from >= 5 && qstrncmp(from, "false", 5) == 0) {
+                m_data = QByteArray(from, 5);
+                from += m_data.size();
+                m_type = Boolean;
+            }
+            break;
+        case 'n':
+            if (to - from >= 4 && qstrncmp(from, "null", 4) == 0) {
+                m_data = QByteArray(from, 4);
+                from += m_data.size();
+                m_type = NullObject;
+            }
+            break;
+        case '[':
+            parseArray(from, to);
+            break;
+        case '"':
+            m_type = String;
+            m_data = parseCString(from, to);
+            break;
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case '-':
+            m_type = Number;
+            m_data = parseNumber(from, to);
+        default:
+            break;
+    }
+}
+
+void JsonValue::parseObject(const char *&from, const char *to)
+{
+    JDEBUG("parseObject: " << QByteArray(from, to - from));
+#ifdef TODO_USE_CREATOR
+    QTC_ASSERT(*from == '{', /**/);
+#endif
+    ++from;
+    m_type = Object;
+    while (from < to) {
+        if (*from == '}') {
+            ++from;
+            break;
+        }
+        JsonValue child;
+        child.parsePair(from, to);
+        if (!child.isValid())
+            return;
+        m_children += child;
+        if (*from == ',')
+            ++from;
+    }
+}
+
+void JsonValue::parseArray(const char *&from, const char *to)
+{
+    JDEBUG("parseArray: " << QByteArray(from, to - from));
+#ifdef TODO_USE_CREATOR
+    QTC_ASSERT(*from == '[', /**/);
+#endif
+    ++from;
+    m_type = Array;
+    while (from < to) {
+        if (*from == ']') {
+            ++from;
+            break;
+        }
+        JsonValue child;
+        child.parseValue(from, to);
+        if (child.isValid())
+            m_children += child;
+        if (*from == ',')
+            ++from;
+    }
+}
+
+void JsonValue::setStreamOutput(const QByteArray &name, const QByteArray &content)
+{
+    if (content.isEmpty())
+        return;
+    JsonValue child;
+    child.m_type = String;
+    child.m_name = name;
+    child.m_data = content;
+    m_children += child;
+    if (m_type == Invalid)
+        m_type = Object;
+}
+
+static QByteArray ind(int indent)
+{
+    return QByteArray(2 * indent, ' ');
+}
+
+void JsonValue::dumpChildren(QByteArray * str, bool multiline, int indent) const
+{
+    for (int i = 0; i < m_children.size(); ++i) {
+        if (i != 0) {
+            *str += ',';
+            if (multiline)
+                *str += '\n';
+        }
+        if (multiline)
+            *str += ind(indent);
+        *str += m_children.at(i).toString(multiline, indent);
+    }
+}
+
+class MyString : public QString {
+public:
+    ushort at(int i) const { return constData()[i].unicode(); }
+};
+
+template<class ST, typename CT>
+inline ST escapeCStringTpl(const ST &ba)
+{
+    ST ret;
+    ret.reserve(ba.length() * 2);
+    for (int i = 0; i < ba.length(); ++i) {
+        CT c = ba.at(i);
+        switch (c) {
+            case '\\': ret += "\\\\"; break;
+            case '\a': ret += "\\a"; break;
+            case '\b': ret += "\\b"; break;
+            case '\f': ret += "\\f"; break;
+            case '\n': ret += "\\n"; break;
+            case '\r': ret += "\\r"; break;
+            case '\t': ret += "\\t"; break;
+            case '\v': ret += "\\v"; break;
+            case '"': ret += "\\\""; break;
+            default:
+                if (c < 32 || c == 127) {
+                    ret += '\\';
+                    ret += '0' + (c >> 6);
+                    ret += '0' + ((c >> 3) & 7);
+                    ret += '0' + (c & 7);
+                } else {
+                    ret += c;
+                }
+        }
+    }
+    return ret;
+}
+
+QString JsonValue::escapeCString(const QString &ba)
+{
+    return escapeCStringTpl<MyString, ushort>(static_cast<const MyString &>(ba));
+}
+
+QByteArray JsonValue::escapeCString(const QByteArray &ba)
+{
+    return escapeCStringTpl<QByteArray, uchar>(ba);
+}
+
+QByteArray JsonValue::toString(bool multiline, int indent) const
+{
+    QByteArray result;
+    switch (m_type) {
+        case Invalid:
+            if (multiline)
+                result += ind(indent) + "Invalid\n";
+            else
+                result += "Invalid";
+            break;
+        case String:
+            if (!m_name.isEmpty())
+                result += m_name + "=";
+            result += '"' + escapeCString(m_data) + '"';
+            break;
+        case Number:
+            if (!m_name.isEmpty())
+                result += '"' + m_name + "\":";
+            result += m_data;
+            break;
+        case Boolean:
+        case NullObject:
+            if (!m_name.isEmpty())
+                result += '"' + m_name + "\":";
+            result += m_data;
+            break;
+        case Object:
+            if (!m_name.isEmpty())
+                result += m_name + '=';
+            if (multiline) {
+                result += "{\n";
+                dumpChildren(&result, multiline, indent + 1);
+                result += '\n' + ind(indent) + "}";
+            } else {
+                result += "{";
+                dumpChildren(&result, multiline, indent + 1);
+                result += "}";
+            }
+            break;
+        case Array:
+            if (!m_name.isEmpty())
+                result += m_name + "=";
+            if (multiline) {
+                result += "[\n";
+                dumpChildren(&result, multiline, indent + 1);
+                result += '\n' + ind(indent) + "]";
+            } else {
+                result += "[";
+                dumpChildren(&result, multiline, indent + 1);
+                result += "]";
+            }
+            break;
+    }
+    return result;
+}
+
+void JsonValue::fromString(const QByteArray &ba)
+{
+    const char *from = ba.constBegin();
+    const char *to = ba.constEnd();
+    parseValue(from, to);
+}
+
+JsonValue JsonValue::findChild(const char *name) const
+{
+    for (int i = 0; i < m_children.size(); ++i)
+        if (m_children.at(i).m_name == name)
+            return m_children.at(i);
+    return JsonValue();
+}
+
+void JsonInputStream::appendCString(const char *s)
+{
+    m_target.append('"');
+    for (const char *p = s; *p; p++) {
+        if (*p == '"' || *p == '\\')
+            m_target.append('\\');
+        m_target.append(*p);
+    }
+    m_target.append('"');
+}
+
+void JsonInputStream::appendString(const QString &in)
+{
+    if (in.isEmpty()) {
+        m_target.append("\"\"");
+        return;
+    }
+
+    const QChar doubleQuote('"');
+    const QChar backSlash('\\');
+    QString rc;
+    const int inSize = in.size();
+    rc.reserve(in.size() + 5);
+    rc.append(doubleQuote);
+    for (int i = 0; i < inSize; i++) {
+        const QChar c = in.at(i);
+        if (c == doubleQuote || c == backSlash)
+            rc.append(backSlash);
+        rc.append(c);
+    }
+    rc.append(doubleQuote);
+    m_target.append(rc.toUtf8());
+    return;
+}
+
+JsonInputStream &JsonInputStream::operator<<(const QStringList &in)
+{
+    m_target.append('[');
+    const int count = in.size();
+    for (int i = 0 ; i < count; i++) {
+        if (i)
+            m_target.append(',');
+        appendString(in.at(i));
+    }
+    m_target.append(']');
+    return *this;
+}
+
+JsonInputStream &JsonInputStream::operator<<(const QVector<QByteArray> &ba)
+{
+    m_target.append('[');
+    const int count = ba.size();
+    for (int i = 0 ; i < count; i++) {
+        if (i)
+            m_target.append(',');
+        appendCString(ba.at(i).constData());
+    }
+    m_target.append(']');
+    return *this;
+}
+
+JsonInputStream &JsonInputStream::operator<<(bool b)
+{
+    m_target.append(b ? "true" : "false");
+    return *this;
+}
+
+} // namespace tcftrk
+
Index: trunk/tools/runonphone/symbianutils/json.h
===================================================================
--- trunk/tools/runonphone/symbianutils/json.h	(revision 846)
+++ trunk/tools/runonphone/symbianutils/json.h	(revision 846)
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYMBIANUTILS_JSON_H
+#define SYMBIANUTILS_JSON_H
+
+#include "symbianutils_global.h"
+
+#include <QtCore/QByteArray>
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+
+namespace tcftrk {
+
+class SYMBIANUTILS_EXPORT JsonValue
+{
+public:
+    JsonValue() : m_type(Invalid) {}
+    explicit JsonValue(const QByteArray &str) { fromString(str); }
+
+    QByteArray m_name;
+    QByteArray m_data;
+    QList<JsonValue> m_children;
+
+    enum Type {
+        Invalid,
+        String,
+        Number,
+        Boolean,
+        Object,
+        NullObject,
+        Array,
+    };
+
+    Type m_type;
+
+    inline Type type() const { return m_type; }
+    inline QByteArray name() const { return m_name; }
+    inline bool hasName(const char *name) const { return m_name == name; }
+
+    inline bool isValid() const { return m_type != Invalid; }
+    inline bool isNumber() const { return m_type == Number; }
+    inline bool isString() const { return m_type == String; }
+    inline bool isObject() const { return m_type == Object; }
+    inline bool isArray() const { return m_type == Array; }
+
+
+    inline QByteArray data() const { return m_data; }
+    inline const QList<JsonValue> &children() const { return m_children; }
+    inline int childCount() const { return m_children.size(); }
+
+    const JsonValue &childAt(int index) const { return m_children[index]; }
+    JsonValue &childAt(int index) { return m_children[index]; }
+    JsonValue findChild(const char *name) const;
+
+    QByteArray toString(bool multiline = false, int indent = 0) const;
+    void fromString(const QByteArray &str);
+    void setStreamOutput(const QByteArray &name, const QByteArray &content);
+
+private:
+    static QByteArray parseCString(const char *&from, const char *to);
+    static QByteArray parseNumber(const char *&from, const char *to);
+    static QByteArray escapeCString(const QByteArray &ba);
+    static QString escapeCString(const QString &ba);
+    void parsePair(const char *&from, const char *to);
+    void parseValue(const char *&from, const char *to);
+    void parseObject(const char *&from, const char *to);
+    void parseArray(const char *&from, const char *to);
+
+    void dumpChildren(QByteArray *str, bool multiline, int indent) const;
+};
+
+/* Thin wrapper around QByteArray for formatting JSON input. Use as in:
+ * JsonInputStream(byteArray) << '{' <<  "bla" << ':' << "blup" << '}';
+ * Note that strings get double quotes and JSON-escaping, characters should be
+ * used for the array/hash delimiters.
+ * */
+class SYMBIANUTILS_EXPORT JsonInputStream {
+public:
+    explicit JsonInputStream(QByteArray &a) : m_target(a) {}
+
+    JsonInputStream &operator<<(char c) {  m_target.append(c); return *this; }
+    JsonInputStream &operator<<(const char *c)  { appendCString(c); return *this; }
+    JsonInputStream &operator<<(const QByteArray &a)  { appendCString(a.constData()); return *this; }
+    JsonInputStream &operator<<(const QString &c) { appendString(c); return *this; }
+
+    // Format as array
+    JsonInputStream &operator<<(const QStringList &c);
+
+    // Format as array
+    JsonInputStream &operator<<(const QVector<QByteArray> &ba);
+
+    JsonInputStream &operator<<(bool b);
+
+    JsonInputStream &operator<<(int i)
+        { m_target.append(QByteArray::number(i)); return *this; }
+    JsonInputStream &operator<<(unsigned i)
+        { m_target.append(QByteArray::number(i)); return *this; }
+    JsonInputStream &operator<<(quint64 i)
+        { m_target.append(QByteArray::number(i)); return *this; }
+
+private:
+    void appendString(const QString &);
+    void appendCString(const char *c);
+
+    QByteArray &m_target;
+};
+
+} // namespace tcftrk
+
+#endif // SYMBIANUTILS_JSON_H
Index: trunk/tools/runonphone/symbianutils/launcher.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/launcher.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/launcher.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -45,4 +45,5 @@
 #include "trkdevice.h"
 #include "bluetoothlistener.h"
+#include "symbiandevicemanager.h"
 
 #include <QtCore/QTimer>
@@ -54,5 +55,34 @@
 #include <QtCore/QScopedPointer>
 
+#include <cstdio>
+
 namespace trk {
+
+struct CrashReportState {
+    CrashReportState();
+    void clear();
+
+    typedef uint Thread;
+    typedef QList<Thread> Threads;
+    Threads threads;
+
+    QList<uint> registers;
+    QByteArray stack;
+    uint sp;
+    uint fetchingStackPID;
+    uint fetchingStackTID;
+};
+
+CrashReportState::CrashReportState()
+{
+    clear();
+}
+
+void CrashReportState::clear()
+{
+    threads.clear();
+    stack.clear();
+    sp = fetchingStackPID = fetchingStackTID = 0;
+}
 
 struct LauncherPrivate {
@@ -62,5 +92,6 @@
         uint copyFileHandle;
         QScopedPointer<QByteArray> data;
-        int position;
+        qint64 position;
+        QScopedPointer<QFile> localFile;
     };
 
@@ -76,4 +107,5 @@
 
     CopyState m_copyState;
+    CopyState m_downloadState;
     QString m_fileName;
     QStringList m_commandLineArgs;
@@ -82,4 +114,5 @@
     Launcher::Actions m_startupActions;
     bool m_closeDevice;
+    CrashReportState m_crashReportState;
 };
 
@@ -101,10 +134,13 @@
 {
     d->m_startupActions = startupActions;
-    connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));    
-    connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
+    connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
 }
 
 Launcher::~Launcher()
 {
+    // Destroyed before protocol was through: Close
+    if (d->m_closeDevice && d->m_device->isOpen())
+        d->m_device->close();
+    emit destroyed(d->m_device->port());
     logMessage("Shutting down.\n");
     delete d;
@@ -155,4 +191,10 @@
 }
 
+void Launcher::setDownloadFileName(const QString &srcName, const QString &dstName)
+{
+    d->m_downloadState.sourceFileName = srcName;
+    d->m_downloadState.destinationFileName = dstName;
+}
+
 void Launcher::setInstallFileName(const QString &name)
 {
@@ -189,9 +231,26 @@
 {
     errorMessage->clear();
+    d->m_crashReportState.clear();
     if (d->m_verbose) {
-        const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6")
-                            .arg(trkServerName(), d->m_fileName,
-                                 d->m_commandLineArgs.join(QString(QLatin1Char(' '))),
-                                 d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName);
+        QString msg;
+        QTextStream str(&msg);
+        str.setIntegerBase(16);
+        str << "Actions=0x" << d->m_startupActions;
+        str.setIntegerBase(10);
+        str << " Port=" << trkServerName();
+        if (!d->m_fileName.isEmpty())
+            str << " Executable=" << d->m_fileName;
+        if (!d->m_commandLineArgs.isEmpty())
+            str << " Arguments= " << d->m_commandLineArgs.join(QString(QLatin1Char(' ')));
+        if (!d->m_copyState.sourceFileName.isEmpty())
+            str << " Package/Source=" << d->m_copyState.sourceFileName;
+        if (!d->m_copyState.destinationFileName.isEmpty())
+            str << " Remote Package/Destination=" << d->m_copyState.destinationFileName;
+        if (!d->m_downloadState.sourceFileName.isEmpty())
+            str << " Source=" << d->m_downloadState.sourceFileName;
+        if (!d->m_downloadState.destinationFileName.isEmpty())
+            str << " Destination=" << d->m_downloadState.destinationFileName;
+        if (!d->m_installFileName.isEmpty())
+            str << " Install file=" << d->m_installFileName;
         logMessage(msg);
     }
@@ -215,9 +274,4 @@
     if (!d->m_device->isOpen() && !d->m_device->open(errorMessage))
         return false;
-    if (d->m_closeDevice) {
-        connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
-    } else {
-        disconnect(this, SIGNAL(finished()), d->m_device.data(), 0);
-    }
     setState(Connecting);
     // Set up the temporary 'waiting' state if we do not get immediate connection
@@ -253,4 +307,6 @@
     else if (d->m_startupActions & ActionRun)
         startInferiorIfNeeded();
+    else if (d->m_startupActions & ActionDownload)
+        copyFileFromRemote();
 }
 
@@ -265,4 +321,11 @@
     if (d->m_verbose)
         qDebug() << "LAUNCHER: " << qPrintable(msg);
+}
+
+void Launcher::handleFinished()
+{
+    if (d->m_closeDevice)
+        d->m_device->close();
+    emit finished();
 }
 
@@ -288,5 +351,5 @@
     case WaitingForTrk:
         setState(Disconnected);
-        emit finished();
+        handleFinished();
         break;
     }
@@ -332,6 +395,20 @@
     QByteArray str = result.toString().toUtf8();
     if (result.isDebugOutput) { // handle application output
-        logMessage("APPLICATION OUTPUT: " + result.data);
-        emit applicationOutputReceived(result.data);
+        QString msg;
+        if (result.multiplex == MuxTextTrace) {
+            if (result.data.length() > 8) {
+            quint64 timestamp = extractInt64(result.data) & 0x0FFFFFFFFFFFFFFFULL;
+            quint64 secs = timestamp / 1000000000;
+            quint64 ns = timestamp % 1000000000;
+            msg = QString("[%1.%2] %3").arg(secs).arg(ns).arg(QString(result.data.mid(8)));
+            logMessage("TEXT TRACE: " + msg);
+            }
+        } else {
+            logMessage("APPLICATION OUTPUT: " + stringFromArray(result.data));
+            msg = result.data;
+        }
+        msg.replace("\r\n", "\n");
+        if(!msg.endsWith('\n')) msg.append('\n');
+        emit applicationOutputReceived(msg);
         return;
     }
@@ -369,38 +446,29 @@
         // target->host OS notification
         case TrkNotifyCreated: { // Notify Created
-            /*
-            const char *data = result.data.data();
-            byte error = result.data.at(0);
-            byte type = result.data.at(1); // type: 1 byte; for dll item, this value is 2.
-            uint pid = extractInt(data + 2); //  ProcessID: 4 bytes;
-            uint tid = extractInt(data + 6); //threadID: 4 bytes
-            uint codeseg = extractInt(data + 10); //code address: 4 bytes; code base address for the library
-            uint dataseg = extractInt(data + 14); //data address: 4 bytes; data base address for the library
-            uint len = extractShort(data + 18); //length: 2 bytes; length of the library name string to follow
-            QByteArray name = result.data.mid(20, len); // name: library name
-
-            logMessage(prefix + "NOTE: LIBRARY LOAD: " + str);
-            logMessage(prefix + "TOKEN: " + result.token);
-            logMessage(prefix + "ERROR: " + int(error));
-            logMessage(prefix + "TYPE:  " + int(type));
-            logMessage(prefix + "PID:   " + pid);
-            logMessage(prefix + "TID:   " + tid);
-            logMessage(prefix + "CODE:  " + codeseg);
-            logMessage(prefix + "DATA:  " + dataseg);
-            logMessage(prefix + "LEN:   " + len);
-            logMessage(prefix + "NAME:  " + name);
-            */
 
             if (result.data.size() < 10)
                 break;
+            const char *data = result.data.constData();
+            const byte error = result.data.at(0);
+            Q_UNUSED(error)
+            const byte type = result.data.at(1); // type: 1 byte; for dll item, this value is 2.
+            const uint tid = extractInt(data + 6); //threadID: 4 bytes
+            Q_UNUSED(tid)
+            if (type == kDSOSDLLItem && result.data.size() >=20) {
+                const Library lib = Library(result);
+                d->m_session.libraries.push_back(lib);
+                emit libraryLoaded(lib);
+            }
             QByteArray ba;
             ba.append(result.data.mid(2, 8));
             d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
-            //d->m_device->sendTrkAck(result.token)
             break;
         }
         case TrkNotifyDeleted: { // NotifyDeleted
             const ushort itemType = (unsigned char)result.data.at(1);
-            const ushort len = result.data.size() > 12 ? extractShort(result.data.data() + 10) : ushort(0);
+            const uint pid = result.data.size() >= 6 ? extractShort(result.data.constData() + 2) : 0;
+            const uint tid = result.data.size() >= 10 ? extractShort(result.data.constData() + 6) : 0;
+            Q_UNUSED(tid)
+            const ushort len = result.data.size() > 12 ? extractShort(result.data.constData() + 10) : ushort(0);
             const QString name = len ? QString::fromAscii(result.data.mid(12, len)) : QString();
             logMessage(QString::fromLatin1("%1 %2 UNLOAD: %3").
@@ -408,8 +476,22 @@
                        arg(name));
             d->m_device->sendTrkAck(result.token);
-            if (itemType == 0 // process
+            if (itemType == kDSOSProcessItem // process
                 && result.data.size() >= 10
                 && d->m_session.pid == extractInt(result.data.data() + 6)) {
-                disconnectTrk();
+                    if (d->m_startupActions & ActionDownload)
+                        copyFileFromRemote();
+                    else
+                        disconnectTrk();
+            }
+            else if (itemType == kDSOSDLLItem && len) {
+                // Remove libraries of process.
+                for (QList<Library>::iterator it = d->m_session.libraries.begin(); it != d->m_session.libraries.end(); ) {
+                    if ((*it).pid == pid && (*it).name == name) {
+                        emit libraryUnloaded(*it);
+                        it = d->m_session.libraries.erase(it);
+                    } else {
+                        ++it;
+                    }
+                }
             }
             break;
@@ -447,5 +529,5 @@
         if (d->m_startupActions == ActionPingOnly) {
             setState(Disconnected);
-            emit finished();
+            handleFinished();
         }
         return;
@@ -456,10 +538,22 @@
     d->m_session.trkAppVersion.protocolMinor = result.data.at(4);
     setState(DeviceDescriptionReceived);
+    const QString msg = deviceDescription();
+    emit deviceDescriptionReceived(trkServerName(), msg);
     // Ping mode: Log & Terminate
     if (d->m_startupActions == ActionPingOnly) {
-        qWarning("%s", qPrintable(deviceDescription()));
+        qWarning("%s", qPrintable(msg));
         setState(Disconnected);
-        emit finished();
-    }
+        handleFinished();
+    }
+}
+
+static inline QString msgCannotOpenRemoteFile(const QString &fileName, const QString &message)
+{
+    return Launcher::tr("Cannot open remote file '%1': %2").arg(fileName, message);
+}
+
+static inline QString msgCannotOpenLocalFile(const QString &fileName, const QString &message)
+{
+    return Launcher::tr("Cannot open '%1': %2").arg(fileName, message);
 }
 
@@ -467,5 +561,7 @@
 {
     if (result.errorCode() || result.data.size() < 6) {
-        emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString());
+        const QString msg = msgCannotOpenRemoteFile(d->m_copyState.destinationFileName, result.errorString());
+        logMessage(msg);
+        emit canNotCreateFile(d->m_copyState.destinationFileName, msg);
         disconnectTrk();
         return;
@@ -473,10 +569,74 @@
     const char *data = result.data.data();
     d->m_copyState.copyFileHandle = extractInt(data + 2);
-    QFile file(d->m_copyState.sourceFileName);
-    file.open(QIODevice::ReadOnly);
+    const QString localFileName = d->m_copyState.sourceFileName;
+    QFile file(localFileName);
+    d->m_copyState.position = 0;
+    if (!file.open(QIODevice::ReadOnly)) {
+        const QString msg = msgCannotOpenLocalFile(localFileName, file.errorString());
+        logMessage(msg);
+        emit canNotOpenLocalFile(localFileName, msg);
+        closeRemoteFile(true);
+        disconnectTrk();
+        return;
+    }
     d->m_copyState.data.reset(new QByteArray(file.readAll()));
-    d->m_copyState.position = 0;
     file.close();
     continueCopying();
+}
+
+void Launcher::handleFileOpened(const TrkResult &result)
+{
+    if (result.errorCode() || result.data.size() < 6) {
+        const QString msg = msgCannotOpenRemoteFile(d->m_downloadState.sourceFileName, result.errorString());
+        logMessage(msg);
+        emit canNotOpenFile(d->m_downloadState.sourceFileName, msg);
+        disconnectTrk();
+        return;
+    }
+    d->m_downloadState.position = 0;
+    const QString localFileName = d->m_downloadState.destinationFileName;
+    bool opened = false;
+    if (localFileName == QLatin1String("-")) {
+        d->m_downloadState.localFile.reset(new QFile);
+        opened = d->m_downloadState.localFile->open(stdout, QFile::WriteOnly);
+    } else {
+        d->m_downloadState.localFile.reset(new QFile(localFileName));
+        opened = d->m_downloadState.localFile->open(QFile::WriteOnly | QFile::Truncate);
+    }
+    if (!opened) {
+        const QString msg = msgCannotOpenLocalFile(localFileName, d->m_downloadState.localFile->errorString());
+        logMessage(msg);
+        emit canNotOpenLocalFile(localFileName, msg);
+        closeRemoteFile(true);
+        disconnectTrk();
+    }
+    continueReading();
+}
+
+void Launcher::continueReading()
+{
+    QByteArray ba;
+    appendInt(&ba, d->m_downloadState.copyFileHandle, TargetByteOrder);
+    appendShort(&ba, 2048, TargetByteOrder);
+    d->m_device->sendTrkMessage(TrkReadFile, TrkCallback(this, &Launcher::handleRead), ba);
+}
+
+void Launcher::handleRead(const TrkResult &result)
+{
+    if (result.errorCode() || result.data.size() < 4) {
+        d->m_downloadState.localFile->close();
+        closeRemoteFile(true);
+        disconnectTrk();
+    } else {
+        int length = extractShort(result.data.data() + 2);
+        //TRK doesn't tell us the file length, so we need to keep reading until it returns 0 length
+        if (length > 0) {
+            d->m_downloadState.localFile->write(result.data.data() + 4, length);
+            continueReading();
+        } else {
+            closeRemoteFile(true);
+            disconnectTrk();
+        }
+    }
 }
 
@@ -494,11 +654,12 @@
 void Launcher::continueCopying(uint lastCopiedBlockSize)
 {
-    int size = d->m_copyState.data->length();
+    qint64 size = d->m_copyState.data->length();
     d->m_copyState.position += lastCopiedBlockSize;
     if (size == 0)
         emit copyProgress(100);
     else {
-        int percent = qMin((d->m_copyState.position*100)/size, 100);
-        emit copyProgress(percent);
+        const qint64 hundred = 100;
+        const qint64 percent = qMin( (d->m_copyState.position * hundred) / size, hundred);
+        emit copyProgress(static_cast<int>(percent));
     }
     if (d->m_copyState.position < size) {
@@ -533,4 +694,6 @@
     else if (d->m_startupActions & ActionRun)
         startInferiorIfNeeded();
+    else if (d->m_startupActions & ActionDownload)
+        copyFileFromRemote();
     else
         disconnectTrk();
@@ -577,4 +740,13 @@
     }
     emit applicationRunning(d->m_session.pid);
+    //create a "library" entry for the executable which launched the process
+    Library lib;
+    lib.pid = d->m_session.pid;
+    lib.codeseg = d->m_session.codeseg;
+    lib.dataseg = d->m_session.dataseg;
+    lib.name = d->m_fileName.toUtf8();
+    d->m_session.libraries << lib;
+    emit libraryLoaded(lib);
+
     QByteArray ba;
     appendInt(&ba, d->m_session.pid);
@@ -587,5 +759,5 @@
     logMessage("   FINISHED: " + stringFromArray(result.data));
     setState(Disconnected);
-    emit finished();
+    handleFinished();
 }
 
@@ -596,15 +768,16 @@
     const char *data = result.data.data() + 1;
 
-    QString str = QLatin1String("SUPPORTED: ");
-    for (int i = 0; i < 32; ++i) {
-        //str.append("  [" + formatByte(data[i]) + "]: ");
-        for (int j = 0; j < 8; ++j) {
-            if (data[i] & (1 << j)) {
-                str.append(QString::number(i * 8 + j, 16));
-                str.append(QLatin1Char(' '));
+    if (d->m_verbose > 1) {
+        QString str = QLatin1String("SUPPORTED: ");
+        for (int i = 0; i < 32; ++i) {
+            for (int j = 0; j < 8; ++j) {
+                if (data[i] & (1 << j)) {
+                    str.append(QString::number(i * 8 + j, 16));
+                    str.append(QLatin1Char(' '));
+                }
             }
         }
-    }
-    logMessage(str);
+        logMessage(str);
+    }
 }
 
@@ -670,7 +843,16 @@
     emit copyingStarted();
     QByteArray ba;
-    ba.append(char(10));
+    ba.append(char(10)); //kDSFileOpenWrite | kDSFileOpenBinary
     appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false);
     d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba);
+}
+
+void Launcher::copyFileFromRemote()
+{
+    emit copyingStarted();
+    QByteArray ba;
+    ba.append(char(9)); //kDSFileOpenRead | kDSFileOpenBinary
+    appendString(&ba, d->m_downloadState.sourceFileName.toLocal8Bit(), TargetByteOrder, false);
+    d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileOpened), ba);
 }
 
@@ -695,4 +877,6 @@
     if (d->m_startupActions & ActionRun) {
         startInferiorIfNeeded();
+    } else if (d->m_startupActions & ActionDownload) {
+        copyFileFromRemote();
     } else {
         disconnectTrk();
@@ -705,16 +889,36 @@
     // It's not started yet
     QByteArray ba;
-    appendShort(&ba, 0, TargetByteOrder); // create new process
+    appendShort(&ba, 0, TargetByteOrder); // create new process (kDSOSProcessItem)
     ba.append(char(0)); // options - currently unused
-    if(arguments.isEmpty()) {
-        appendString(&ba, executable.toLocal8Bit(), TargetByteOrder);
-        return ba;
-    }
-    // Append full command line as one string (leading length information).
-    QByteArray commandLineBa;
-    commandLineBa.append(executable.toLocal8Bit());
-    commandLineBa.append('\0');
-    commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
-    appendString(&ba, commandLineBa, TargetByteOrder);
+    // One string consisting of binary terminated by '\0' and arguments terminated by '\0'
+    QByteArray commandLineBa = executable.toLocal8Bit();
+    commandLineBa.append(char(0));
+    if (!arguments.isEmpty())
+        commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
+    appendString(&ba, commandLineBa, TargetByteOrder, true);
+    return ba;
+}
+
+QByteArray Launcher::readMemoryMessage(uint pid, uint tid, uint from, uint len)
+{
+    QByteArray ba;
+    ba.reserve(11);
+    ba.append(char(0x8)); // Options, FIXME: why?
+    appendShort(&ba, len);
+    appendInt(&ba, from);
+    appendInt(&ba, pid);
+    appendInt(&ba, tid);
+    return ba;
+}
+
+QByteArray Launcher::readRegistersMessage(uint pid, uint tid)
+{
+    QByteArray ba;
+    ba.reserve(15);
+    ba.append(char(0)); // Register set, only 0 supported
+    appendShort(&ba, 0); //R0
+    appendShort(&ba, 16); // last register CPSR
+    appendInt(&ba, pid);
+    appendInt(&ba, tid);
     return ba;
 }
@@ -738,3 +942,95 @@
     d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
 }
+
+// Acquire a device from SymbianDeviceManager, return 0 if not available.
+Launcher *Launcher::acquireFromDeviceManager(const QString &serverName,
+                                             QObject *parent,
+                                             QString *errorMessage)
+{
+    SymbianUtils::SymbianDeviceManager *sdm = SymbianUtils::SymbianDeviceManager::instance();
+    const QSharedPointer<trk::TrkDevice> device = sdm->acquireDevice(serverName);
+    if (device.isNull()) {
+        *errorMessage = tr("Unable to acquire a device for port '%1'. It appears to be in use.").arg(serverName);
+        return 0;
+    }
+    // Wire release signal.
+    Launcher *rc = new Launcher(trk::Launcher::ActionPingOnly, device, parent);
+    connect(rc, SIGNAL(deviceDescriptionReceived(QString,QString)),
+            sdm, SLOT(setAdditionalInformation(QString,QString)));
+    connect(rc, SIGNAL(destroyed(QString)), sdm, SLOT(releaseDevice(QString)));
+    return rc;
+}
+
+// Preliminary release of device, disconnecting the signal.
+void Launcher::releaseToDeviceManager(Launcher *launcher)
+{
+    SymbianUtils::SymbianDeviceManager *sdm = SymbianUtils::SymbianDeviceManager::instance();
+    // Disentangle launcher and its device, remove connection from destroyed
+    launcher->setCloseDevice(false);
+    TrkDevice *device = launcher->trkDevice().data();
+    launcher->disconnect(device);
+    device->disconnect(launcher);
+    launcher->disconnect(sdm);
+    sdm->releaseDevice(launcher->trkServerName());
+}
+
+void Launcher::getRegistersAndCallStack(uint pid, uint tid)
+{
+    d->m_device->sendTrkMessage(TrkReadRegisters,
+                                TrkCallback(this, &Launcher::handleReadRegisters),
+                                Launcher::readRegistersMessage(pid, tid));
+    d->m_crashReportState.fetchingStackPID = pid;
+    d->m_crashReportState.fetchingStackTID = tid;
+}
+
+void Launcher::handleReadRegisters(const TrkResult &result)
+{
+    if(result.errorCode() || result.data.size() < (17*4)) {
+        terminate();
+        return;
+    }
+    const char* data = result.data.constData() + 1;
+    d->m_crashReportState.registers.clear();
+    d->m_crashReportState.stack.clear();
+    for (int i=0;i<17;i++) {
+        uint r = extractInt(data);
+        data += 4;
+        d->m_crashReportState.registers.append(r);
+    }
+    d->m_crashReportState.sp = d->m_crashReportState.registers.at(13);
+
+    const ushort len = 1024 - (d->m_crashReportState.sp % 1024); //read to 1k boundary first
+    const QByteArray ba = Launcher::readMemoryMessage(d->m_crashReportState.fetchingStackPID,
+                                                      d->m_crashReportState.fetchingStackTID,
+                                                      d->m_crashReportState.sp,
+                                                      len);
+    d->m_device->sendTrkMessage(TrkReadMemory, TrkCallback(this, &Launcher::handleReadStack), ba);
+    d->m_crashReportState.sp += len;
+}
+
+void Launcher::handleReadStack(const TrkResult &result)
+{
+    if (result.errorCode()) {
+        //error implies memory fault when reaching end of stack
+        emit registersAndCallStackReadComplete(d->m_crashReportState.registers, d->m_crashReportState.stack);
+        return;
+    }
+
+    const uint len = extractShort(result.data.constData() + 1);
+    d->m_crashReportState.stack.append(result.data.mid(3, len));
+
+    if (d->m_crashReportState.sp - d->m_crashReportState.registers.at(13) > 0x10000) {
+        //read enough stack, stop here
+        emit registersAndCallStackReadComplete(d->m_crashReportState.registers, d->m_crashReportState.stack);
+        return;
+    }
+    //read 1k more
+    const QByteArray ba = Launcher::readMemoryMessage(d->m_crashReportState.fetchingStackPID,
+                                                      d->m_crashReportState.fetchingStackTID,
+                                                      d->m_crashReportState.sp,
+                                                      1024);
+    d->m_device->sendTrkMessage(TrkReadMemory, TrkCallback(this, &Launcher::handleReadStack), ba);
+    d->m_crashReportState.sp += 1024;
+}
+
 } // namespace trk
Index: trunk/tools/runonphone/symbianutils/launcher.h
===================================================================
--- trunk/tools/runonphone/symbianutils/launcher.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/launcher.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,5 @@
 
 #include "trkdevice.h"
+#include "trkutils.h"
 
 #include <QtCore/QObject>
@@ -70,4 +71,5 @@
         ActionCopyInstall = ActionCopy | ActionInstall,
         ActionRun = 0x4,
+        ActionDownload = 0x8,
         ActionCopyRun = ActionCopy | ActionRun,
         ActionInstallRun = ActionInstall | ActionRun,
@@ -95,8 +97,9 @@
     void setFileName(const QString &name);
     void setCopyFileName(const QString &srcName, const QString &dstName);
+    void setDownloadFileName(const QString &srcName, const QString &dstName);
     void setInstallFileName(const QString &name);
     void setCommandLineArgs(const QStringList &args);
     bool startServer(QString *errorMessage);
-    void setVerbose(int v);    
+    void setVerbose(int v);
     void setSerialFrame(bool b);
     bool serialFrame() const;
@@ -110,6 +113,18 @@
     QString deviceDescription(unsigned verbose = 0u) const;
 
+    // Acquire a device from SymbianDeviceManager, return 0 if not available.
+    // The device will be released on destruction.
+    static Launcher *acquireFromDeviceManager(const QString &serverName,
+                                              QObject *parent,
+                                              QString *errorMessage);
+    // Preliminary release of device, disconnecting the signal.
+    static void releaseToDeviceManager(Launcher *l);
+
+    // Create Trk message to start a process.
     static QByteArray startProcessMessage(const QString &executable,
                                           const QStringList &arguments);
+    // Create Trk message to read memory
+    static QByteArray readMemoryMessage(uint pid, uint tid, uint from, uint len);
+    static QByteArray readRegistersMessage(uint pid, uint tid);
     // Parse a TrkNotifyStopped message
     static bool parseNotifyStopped(const QByteArray &a,
@@ -120,7 +135,10 @@
 
 signals:
+    void deviceDescriptionReceived(const QString &port, const QString &description);
     void copyingStarted();
     void canNotConnect(const QString &errorMessage);
     void canNotCreateFile(const QString &filename, const QString &errorMessage);
+    void canNotOpenFile(const QString &filename, const QString &errorMessage);
+    void canNotOpenLocalFile(const QString &filename, const QString &errorMessage);
     void canNotWriteFile(const QString &filename, const QString &errorMessage);
     void canNotCloseFile(const QString &filename, const QString &errorMessage);
@@ -136,8 +154,16 @@
     void stateChanged(int);
     void processStopped(uint pc, uint pid, uint tid, const QString& reason);
+    void processResumed(uint pid, uint tid);
+    void libraryLoaded(const trk::Library &lib);
+    void libraryUnloaded(const trk::Library &lib);
+    void registersAndCallStackReadComplete(const QList<uint>& registers, const QByteArray& stack);
+    // Emitted by the destructor, for releasing devices of SymbianDeviceManager by name
+    void destroyed(const QString &serverName);
 
 public slots:
     void terminate();
     void resumeProcess(uint pid, uint tid);
+    //can be used to obtain traceback after a breakpoint / exception
+    void getRegistersAndCallStack(uint pid, uint tid);
 
 private slots:
@@ -153,6 +179,9 @@
     void handleConnect(const TrkResult &result);
     void handleFileCreation(const TrkResult &result);
+    void handleFileOpened(const TrkResult &result);
     void handleCopy(const TrkResult &result);
+    void handleRead(const TrkResult &result);
     void continueCopying(uint lastCopiedBlockSize = 0);
+    void continueReading();
     void closeRemoteFile(bool failed = false);
     void handleFileCopied(const TrkResult &result);
@@ -164,8 +193,12 @@
     void handleSupportMask(const TrkResult &result);
     void handleTrkVersion(const TrkResult &result);
+    void handleReadRegisters(const TrkResult &result);
+    void handleReadStack(const TrkResult &result);
 
     void copyFileToRemote();
+    void copyFileFromRemote();
     void installRemotePackageSilently();
     void startInferiorIfNeeded();
+    void handleFinished();
 
     void logMessage(const QString &msg);
Index: trunk/tools/runonphone/symbianutils/symbiandevicemanager.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/symbiandevicemanager.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/symbiandevicemanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -41,4 +41,5 @@
 
 #include "symbiandevicemanager.h"
+#include "trkdevice.h"
 
 #include <QtCore/QSettings>
@@ -49,4 +50,5 @@
 #include <QtCore/QSharedData>
 #include <QtCore/QScopedPointer>
+#include <QtCore/QSignalMapper>
 
 namespace SymbianUtils {
@@ -62,5 +64,9 @@
 class SymbianDeviceData : public QSharedData {
 public:
-    SymbianDeviceData() : type(SerialPortCommunication) {}
+    SymbianDeviceData();
+    ~SymbianDeviceData();
+
+    inline bool isOpen() const { return !device.isNull() && device->isOpen(); }
+    void forcedClose();
 
     QString portName;
@@ -68,11 +74,39 @@
     QString deviceDesc;
     QString manufacturer;
+    QString additionalInformation;
+
     DeviceCommunicationType type;
+    QSharedPointer<trk::TrkDevice> device;
+    bool deviceAcquired;
 };
+
+SymbianDeviceData::SymbianDeviceData() :
+        type(SerialPortCommunication),
+        deviceAcquired(false)
+{
+}
+
+SymbianDeviceData::~SymbianDeviceData()
+{
+    forcedClose();
+}
+
+void SymbianDeviceData::forcedClose()
+{
+    // Close the device when unplugging. Should devices be in 'acquired' state,
+    // their owners should hit on write failures.
+    // Apart from the <shared item> destructor, also called by the devicemanager
+    // to ensure it also happens if other shared instances are still around.
+    if (isOpen()) {
+        if (deviceAcquired)
+            qWarning("Device on '%s' unplugged while an operation is in progress.",
+                     qPrintable(portName));
+        device->close();
+    }
+}
 
 SymbianDevice::SymbianDevice(SymbianDeviceData *data) :
     m_data(data)
 {
-
 }
 
@@ -97,4 +131,9 @@
 }
 
+void SymbianDevice::forcedClose()
+{
+    m_data->forcedClose();
+}
+
 QString SymbianDevice::portName() const
 {
@@ -107,4 +146,49 @@
 }
 
+QString SymbianDevice::additionalInformation() const
+{
+    return m_data->additionalInformation;
+}
+
+void SymbianDevice::setAdditionalInformation(const QString &a)
+{
+    m_data->additionalInformation = a;
+}
+
+SymbianDevice::TrkDevicePtr SymbianDevice::acquireDevice()
+{
+    if (debug)
+        qDebug() << "SymbianDevice::acquireDevice" << m_data->portName
+                << "acquired: " << m_data->deviceAcquired << " open: " << isOpen();
+    if (isNull() || m_data->deviceAcquired)
+        return TrkDevicePtr();
+    if (m_data->device.isNull()) {
+        m_data->device = TrkDevicePtr(new trk::TrkDevice);
+        m_data->device->setPort(m_data->portName);
+        m_data->device->setSerialFrame(m_data->type == SerialPortCommunication);
+    }
+    m_data->deviceAcquired = true;
+    return m_data->device;
+}
+
+void SymbianDevice::releaseDevice(TrkDevicePtr *ptr /* = 0 */)
+{
+    if (debug)
+        qDebug() << "SymbianDevice::releaseDevice" << m_data->portName
+                << " open: " << isOpen();
+    if (m_data->deviceAcquired) {
+        if (m_data->device->isOpen())
+            m_data->device->clearWriteQueue();
+        // Release if a valid pointer was passed in.
+        if (ptr && !ptr->isNull()) {
+            ptr->data()->disconnect();
+            *ptr = TrkDevicePtr();
+        }
+        m_data->deviceAcquired = false;
+    } else {
+        qWarning("Internal error: Attempt to release device that is not acquired.");
+    }
+}
+
 QString SymbianDevice::deviceDesc() const
 {
@@ -124,5 +208,10 @@
 bool SymbianDevice::isNull() const
 {
-    return !m_data->portName.isEmpty();
+    return m_data->portName.isEmpty();
+}
+
+bool SymbianDevice::isOpen() const
+{
+    return m_data->isOpen();
 }
 
@@ -159,5 +248,5 @@
 }
 
-QDebug operator<<(QDebug d, const SymbianDevice &cd)
+SYMBIANUTILS_EXPORT QDebug operator<<(QDebug d, const SymbianDevice &cd)
 {
     d.nospace() << cd.toString();
@@ -167,8 +256,9 @@
 // ------------- SymbianDeviceManagerPrivate
 struct SymbianDeviceManagerPrivate {
-    SymbianDeviceManagerPrivate() : m_initialized(false) {}
+    SymbianDeviceManagerPrivate() : m_initialized(false), m_destroyReleaseMapper(0) {}
 
     bool m_initialized;
     SymbianDeviceManager::SymbianDeviceList m_devices;
+    QSignalMapper *m_destroyReleaseMapper;
 };
 
@@ -186,6 +276,5 @@
 SymbianDeviceManager::SymbianDeviceList SymbianDeviceManager::devices() const
 {
-    if (!d->m_initialized)
-        const_cast<SymbianDeviceManager*>(this)->update(false);
+    ensureInitialized();
     return d->m_devices;
 }
@@ -195,4 +284,5 @@
     QString rc;
     QTextStream str(&rc);
+    str << d->m_devices.size() << " devices:\n";
     const int count = d->m_devices.size();
     for (int i = 0; i < count; i++) {
@@ -204,11 +294,35 @@
 }
 
+int SymbianDeviceManager::findByPortName(const QString &p) const
+{
+    ensureInitialized();
+    const int count = d->m_devices.size();
+    for (int i = 0; i < count; i++)
+        if (d->m_devices.at(i).portName() == p)
+            return i;
+    return -1;
+}
+
 QString SymbianDeviceManager::friendlyNameForPort(const QString &port) const
 {
-    foreach (const SymbianDevice &device, d->m_devices) {
-        if (device.portName() == port)
-            return device.friendlyName();
-    }
-    return QString();
+    const int idx = findByPortName(port);
+    return idx == -1 ? QString() : d->m_devices.at(idx).friendlyName();
+}
+
+SymbianDeviceManager::TrkDevicePtr
+        SymbianDeviceManager::acquireDevice(const QString &port)
+{
+    ensureInitialized();
+    const int idx = findByPortName(port);
+    if (idx == -1) {
+        qWarning("Attempt to acquire device '%s' that does not exist.", qPrintable(port));
+        if (debug)
+            qDebug() << *this;
+        return TrkDevicePtr();
+      }
+    const TrkDevicePtr rc = d->m_devices[idx].acquireDevice();
+    if (debug)
+        qDebug() << "SymbianDeviceManager::acquireDevice" << port << " returns " << !rc.isNull();
+    return rc;
 }
 
@@ -218,10 +332,36 @@
 }
 
+void SymbianDeviceManager::releaseDevice(const QString &port)
+{
+    const int idx = findByPortName(port);
+    if (debug)
+        qDebug() << "SymbianDeviceManager::releaseDevice" << port << idx << sender();
+    if (idx != -1) {
+        d->m_devices[idx].releaseDevice();
+    } else {
+        qWarning("Attempt to release non-existing device %s.", qPrintable(port));
+    }
+}
+
+void SymbianDeviceManager::setAdditionalInformation(const QString &port, const QString &ai)
+{
+    const int idx = findByPortName(port);
+    if (idx != -1)
+        d->m_devices[idx].setAdditionalInformation(ai);
+}
+
+void SymbianDeviceManager::ensureInitialized() const
+{
+    if (!d->m_initialized) // Flag is set in update()
+        const_cast<SymbianDeviceManager*>(this)->update(false);
+}
+
 void SymbianDeviceManager::update(bool emitSignals)
 {
+    static int n = 0;
     typedef SymbianDeviceList::iterator SymbianDeviceListIterator;
 
     if (debug)
-        qDebug(">SerialDeviceLister::update(%d)\n%s", int(emitSignals),
+        qDebug(">SerialDeviceLister::update(#%d, signals=%d)\n%s", n++, int(emitSignals),
                qPrintable(toString()));
 
@@ -231,6 +371,9 @@
     if (newDevices.size() > 1)
         qStableSort(newDevices.begin(), newDevices.end());
-    if (d->m_devices == newDevices) // Happy, nothing changed.
+    if (d->m_devices == newDevices) { // Happy, nothing changed.
+        if (debug)
+            qDebug("<SerialDeviceLister::update: unchanged\n");
         return;
+    }
     // Merge the lists and emit the respective added/removed signals, assuming
     // no one can plug a different device on the same port at the speed of lightning
@@ -241,5 +384,6 @@
                 ++oldIt;
             } else {
-                const SymbianDevice toBeDeleted = *oldIt;
+                SymbianDevice toBeDeleted = *oldIt;
+                toBeDeleted.forcedClose();
                 oldIt = d->m_devices.erase(oldIt);
                 if (emitSignals)
@@ -302,5 +446,5 @@
     // or at least the first one.
     const QString prefix = QLatin1String(linuxBlueToothDeviceRootC);
-    const QString friendlyFormat = QLatin1String("Bluetooth device (%1)");
+    const QString blueToothfriendlyFormat = QLatin1String("Bluetooth device (%1)");
     for (int d = 0; d < 4; d++) {
         QScopedPointer<SymbianDeviceData> device(new SymbianDeviceData);
@@ -308,6 +452,20 @@
         device->portName = prefix + QString::number(d);
         if (d == 0 || QFileInfo(device->portName).exists()) {
-            device->friendlyName = friendlyFormat.arg(device->portName);
+            device->friendlyName = blueToothfriendlyFormat.arg(device->portName);
             rc.push_back(SymbianDevice(device.take()));
+        }
+    }
+    // New kernel versions support /dev/ttyUSB0, /dev/ttyUSB1. Trk responds
+    // on the latter (usually), try first.
+    static const char *usbTtyDevices[] = { "/dev/ttyUSB1", "/dev/ttyUSB0" };
+    const int usbTtyCount = sizeof(usbTtyDevices)/sizeof(const char *);
+    for (int d = 0; d < usbTtyCount; d++) {
+        const QString ttyUSBDevice = QLatin1String(usbTtyDevices[d]);
+        if (QFileInfo(ttyUSBDevice).exists()) {
+            SymbianDeviceData *device = new SymbianDeviceData;
+            device->type = SerialPortCommunication;
+            device->portName = ttyUSBDevice;
+            device->friendlyName = QString::fromLatin1("USB/Serial device (%1)").arg(device->portName);
+            rc.push_back(SymbianDevice(device));
         }
     }
@@ -323,5 +481,5 @@
 }
 
-QDebug operator<<(QDebug d, const SymbianDeviceManager &sdm)
+SYMBIANUTILS_EXPORT QDebug operator<<(QDebug d, const SymbianDeviceManager &sdm)
 {
     d.nospace() << sdm.toString();
Index: trunk/tools/runonphone/symbianutils/symbiandevicemanager.h
===================================================================
--- trunk/tools/runonphone/symbianutils/symbiandevicemanager.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/symbiandevicemanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -47,4 +47,5 @@
 #include <QtCore/QObject>
 #include <QtCore/QExplicitlySharedDataPointer>
+#include <QtCore/QSharedPointer>
 
 QT_BEGIN_NAMESPACE
@@ -52,4 +53,8 @@
 class QTextStream;
 QT_END_NAMESPACE
+
+namespace trk {
+    class TrkDevice;
+}
 
 namespace SymbianUtils {
@@ -63,9 +68,14 @@
 };
 
-// SymbianDevice, explicitly shared.
+// SymbianDevice: Explicitly shared device data and a TrkDevice
+// instance that can be acquired (exclusively) for use.
+// A device removal from the manager will result in the
+// device being closed.
 class SYMBIANUTILS_EXPORT SymbianDevice {
     explicit SymbianDevice(SymbianDeviceData *data);
     friend class SymbianDeviceManager;
 public:
+    typedef QSharedPointer<trk::TrkDevice> TrkDevicePtr;
+
     SymbianDevice();
     SymbianDevice(const SymbianDevice &rhs);
@@ -78,4 +88,15 @@
     QString portName() const;
     QString friendlyName() const;
+    QString additionalInformation() const;
+    void setAdditionalInformation(const QString &);
+
+    // Acquire: Mark the device as 'out' and return a shared pointer
+    // unless it is already in use by another owner. The result should not
+    // be passed on further.
+    TrkDevicePtr acquireDevice();
+    // Give back a device and mark it as 'free'.
+    void releaseDevice(TrkDevicePtr *ptr = 0);
+
+    bool isOpen() const;
 
     // Windows only.
@@ -87,8 +108,10 @@
 
 private:
+    void forcedClose();
+
     QExplicitlySharedDataPointer<SymbianDeviceData> m_data;
 };
 
-QDebug operator<<(QDebug d, const SymbianDevice &);
+SYMBIANUTILS_EXPORT QDebug operator<<(QDebug d, const SymbianDevice &);
 
 inline bool operator==(const SymbianDevice &d1, const SymbianDevice &d2)
@@ -101,6 +124,7 @@
 /* SymbianDeviceManager: Singleton that maintains a list of Symbian devices.
  * and emits change signals.
- * On Windows, the update slot must be connected to a signal
- * emitted from an event handler listening for WM_DEVICECHANGE. */
+ * On Windows, the update slot must be connected to a [delayed] signal
+ * emitted from an event handler listening for WM_DEVICECHANGE.
+ * Device removal will result in the device being closed. */
 class SYMBIANUTILS_EXPORT SymbianDeviceManager : public QObject
 {
@@ -108,4 +132,5 @@
 public:
     typedef QList<SymbianDevice> SymbianDeviceList;
+    typedef QSharedPointer<trk::TrkDevice> TrkDevicePtr;
 
     static const char *linuxBlueToothDeviceRootC;
@@ -121,15 +146,23 @@
     QString toString() const;
 
+    // Acquire a device for use. See releaseDevice().
+    TrkDevicePtr acquireDevice(const QString &port);
+
+    int findByPortName(const QString &p) const;
     QString friendlyNameForPort(const QString &port) const;
 
 public slots:
     void update();
+    // Relase a device, make it available for further use.
+    void releaseDevice(const QString &port);
+    void setAdditionalInformation(const QString &port, const QString &ai);
 
 signals:
-    void deviceRemoved(const SymbianDevice &d);
-    void deviceAdded(const SymbianDevice &d);
+    void deviceRemoved(const SymbianUtils::SymbianDevice &d);
+    void deviceAdded(const SymbianUtils::SymbianDevice &d);
     void updated();
 
 private:
+    void ensureInitialized() const;
     void update(bool emitSignals);
     SymbianDeviceList serialPorts() const;
@@ -139,5 +172,5 @@
 };
 
-QDebug operator<<(QDebug d, const SymbianDeviceManager &);
+SYMBIANUTILS_EXPORT QDebug operator<<(QDebug d, const SymbianDeviceManager &);
 
 } // namespace SymbianUtils
Index: trunk/tools/runonphone/symbianutils/symbianutils.pri
===================================================================
--- trunk/tools/runonphone/symbianutils/symbianutils.pri	(revision 769)
+++ trunk/tools/runonphone/symbianutils/symbianutils.pri	(revision 846)
@@ -1,3 +1,5 @@
 INCLUDEPATH *= $$PWD
+
+QT += network
 
 # Input
@@ -10,5 +12,8 @@
     $$PWD/bluetoothlistener.h \
     $$PWD/communicationstarter.h \
-    $$PWD/symbiandevicemanager.h
+    $$PWD/symbiandevicemanager.h \
+    $$PWD/tcftrkdevice.h \
+    $$PWD/tcftrkmessage.h \
+    $$PWD/json.h
 
 SOURCES += $$PWD/trkutils.cpp \
@@ -17,5 +22,8 @@
     $$PWD/bluetoothlistener.cpp \
     $$PWD/communicationstarter.cpp \
-    $$PWD/symbiandevicemanager.cpp
+    $$PWD/symbiandevicemanager.cpp \
+    $$PWD/tcftrkdevice.cpp \
+    $$PWD/tcftrkmessage.cpp \
+    $$PWD/json.cpp
 
 # Tests/trklauncher is a console application
Index: trunk/tools/runonphone/symbianutils/symbianutils_global.h
===================================================================
--- trunk/tools/runonphone/symbianutils/symbianutils_global.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/symbianutils_global.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/runonphone/symbianutils/tcftrkdevice.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/tcftrkdevice.cpp	(revision 846)
+++ trunk/tools/runonphone/symbianutils/tcftrkdevice.cpp	(revision 846)
@@ -0,0 +1,929 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tcftrkdevice.h"
+#include "json.h"
+
+#include <QtNetwork/QAbstractSocket>
+#include <QtCore/QDebug>
+#include <QtCore/QVector>
+#include <QtCore/QQueue>
+#include <QtCore/QTextStream>
+#include <QtCore/QDateTime>
+#include <QtCore/QFileInfo>
+
+enum { debug = 0 };
+
+static const char messageTerminatorC[] = "\003\001";
+
+namespace tcftrk {
+// ------------- TcfTrkCommandError
+
+TcfTrkCommandError::TcfTrkCommandError() : timeMS(0), code(0), alternativeCode(0)
+{
+}
+
+void TcfTrkCommandError::clear()
+{
+    timeMS = 0;
+    code = alternativeCode = 0;
+    format.clear();
+    alternativeOrganization.clear();
+}
+
+void TcfTrkCommandError::write(QTextStream &str) const
+{
+    if (timeMS) {
+        const QDateTime time(QDate(1970, 1, 1));
+        str << time.addMSecs(timeMS).toString(Qt::ISODate) << ": Error code: " << code
+                << " '" << format << '\'';
+        if (!alternativeOrganization.isEmpty())
+            str << " ('" << alternativeOrganization << "', code: " << alternativeCode << ')';
+    } else{
+        str << "<No error>";
+    }
+}
+
+QString TcfTrkCommandError::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    write(str);
+    return rc;
+}
+
+/* {"Time":1277459762255,"Code":1,"AltCode":-6,"AltOrg":"POSIX","Format":"Unknown error: -6"} */
+bool TcfTrkCommandError::parse(const QVector<JsonValue> &values)
+{
+    // Parse an arbitrary hash (that could as well be a command response)
+    // and check for error elements.
+    unsigned errorKeyCount = 0;
+    clear();
+    do {
+        if (values.isEmpty() || values.front().type() != JsonValue::Object)
+            break;
+        foreach (const JsonValue &c, values.front().children()) {
+            if (c.name() == "Time") {
+                timeMS = c.data().toULongLong();
+                errorKeyCount++;
+            } else if (c.name() == "Code") {
+                code = c.data().toInt();
+                errorKeyCount++;
+            } else if (c.name() == "Format") {
+                format = c.data();
+                errorKeyCount++;
+            } else if (c.name() == "AltCode") {
+                alternativeCode = c.data().toInt();
+                errorKeyCount++;
+            } else if (c.name() == "AltOrg") {
+                alternativeOrganization = c.data();
+                errorKeyCount++;
+            }
+        }
+    } while (false);
+    const bool errorFound = errorKeyCount >= 2u; // Should be at least 'Time', 'Code'.
+    if (!errorFound)
+        clear();
+    if (debug) {
+        qDebug() << "TcfTrkCommandError::parse: Found error: " << errorFound;
+        if (!values.isEmpty())
+            qDebug() << values.front().toString();
+    }
+    return errorFound;
+}
+
+// ------------ TcfTrkCommandResult
+
+TcfTrkCommandResult::TcfTrkCommandResult(Type t) :
+    type(t), service(LocatorService)
+{
+}
+
+TcfTrkCommandResult::TcfTrkCommandResult(char typeChar, Services s,
+                                         const QByteArray &r,
+                                         const QVector<JsonValue> &v,
+                                         const QVariant &ck) :
+    type(FailReply), service(s), request(r), values(v), cookie(ck)
+{
+    switch (typeChar) {
+    case 'N':
+        type = FailReply;
+        break;
+    case 'P':
+        type = ProgressReply;
+        break;
+    case 'R':
+        type = commandError.parse(values) ? CommandErrorReply : SuccessReply;
+        break;
+    default:
+        qWarning("Unknown TCF reply type '%c'", typeChar);
+    }
+}
+
+QString TcfTrkCommandResult::errorString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+
+    switch (type) {
+    case SuccessReply:
+    case ProgressReply:
+        str << "<No error>";
+        return rc;
+    case FailReply:
+        str << "NAK";
+    case CommandErrorReply:
+        commandError.write(str);
+        break;
+    }
+    // Append the failed command for reference
+    str << " (Command was: '";
+    QByteArray printableRequest = request;
+    printableRequest.replace('\0', '|');
+    str << printableRequest << "')";
+    return rc;
+}
+
+QString TcfTrkCommandResult::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    str << "Command answer ";
+    switch (type) {
+    case SuccessReply:
+        str << "[success]";
+        break;
+    case CommandErrorReply:
+        str << "[command error]";
+        break;
+    case FailReply:
+        str << "[fail (NAK)]";
+        break;
+    case ProgressReply:
+        str << "[progress]";
+        break;
+    }
+    str << ", " << values.size() << " values(s) to request: '";
+    QByteArray printableRequest = request;
+    printableRequest.replace('\0', '|');
+    str << printableRequest << "' ";
+    if (cookie.isValid())
+        str << " cookie: " << cookie.toString();
+    str << '\n';
+    for (int i = 0, count = values.size(); i < count; i++)
+        str << '#' << i << ' ' << values.at(i).toString() << '\n';
+    if (type == CommandErrorReply)
+        str << "Error: " << errorString();
+    return rc;
+}
+
+struct TcfTrkSendQueueEntry
+{
+    typedef TcfTrkDevice::MessageType MessageType;
+
+    explicit TcfTrkSendQueueEntry(MessageType mt,
+                                  int tok,
+                                  Services s,
+                           const QByteArray &d,
+                           const TcfTrkCallback &cb= TcfTrkCallback(),
+                           const QVariant &ck = QVariant()) :
+    messageType(mt), service(s), data(d), token(tok), cookie(ck), callback(cb)  {}
+
+    MessageType messageType;
+    Services service;
+    QByteArray data;
+    int token;
+    QVariant cookie;
+    TcfTrkCallback callback;
+};
+
+struct TcfTrkDevicePrivate {
+    typedef TcfTrkDevice::IODevicePtr IODevicePtr;
+    typedef QHash<int, TcfTrkSendQueueEntry> TokenWrittenMessageMap;
+
+    TcfTrkDevicePrivate();
+
+    const QByteArray m_messageTerminator;
+
+    IODevicePtr m_device;
+    unsigned m_verbose;
+    QByteArray m_readBuffer;
+    int m_token;
+    QQueue<TcfTrkSendQueueEntry> m_sendQueue;
+    TokenWrittenMessageMap m_writtenMessages;
+    QVector<QByteArray> m_registerNames;
+};
+
+TcfTrkDevicePrivate::TcfTrkDevicePrivate() :
+    m_messageTerminator(messageTerminatorC),
+    m_verbose(0), m_token(0)
+{
+}
+
+TcfTrkDevice::TcfTrkDevice(QObject *parent) :
+    QObject(parent), d(new TcfTrkDevicePrivate)
+{
+}
+
+TcfTrkDevice::~TcfTrkDevice()
+{
+    delete d;
+}
+
+QVector<QByteArray> TcfTrkDevice::registerNames() const
+{
+    return d->m_registerNames;
+}
+
+void TcfTrkDevice::setRegisterNames(const QVector<QByteArray>& n)
+{
+    d->m_registerNames = n;
+    if (d->m_verbose) {
+        QString msg;
+        QTextStream str(&msg);
+        const int count = n.size();
+        str << "Registers (" << count << "): ";
+        for (int i = 0; i < count; i++)
+            str << '#' << i << '=' << n.at(i) << ' ';
+        emitLogMessage(msg);
+    }
+}
+
+TcfTrkDevice::IODevicePtr TcfTrkDevice::device() const
+{
+    return d->m_device;
+}
+
+TcfTrkDevice::IODevicePtr TcfTrkDevice::takeDevice()
+{
+    const IODevicePtr old = d->m_device;
+    if (!old.isNull()) {
+        old.data()->disconnect(this);
+        d->m_device = IODevicePtr();
+    }
+    d->m_readBuffer.clear();
+    d->m_token = 0;
+    d->m_sendQueue.clear();
+    return old;
+}
+
+void TcfTrkDevice::setDevice(const IODevicePtr &dp)
+{
+    if (dp.data() == d->m_device.data())
+        return;
+    if (dp.isNull()) {
+        emitLogMessage(QLatin1String("Internal error: Attempt to set NULL device."));
+        return;
+    }
+    takeDevice();
+    d->m_device = dp;
+    connect(dp.data(), SIGNAL(readyRead()), this, SLOT(slotDeviceReadyRead()));
+    if (QAbstractSocket *s = qobject_cast<QAbstractSocket *>(dp.data())) {
+        connect(s, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotDeviceError()));
+        connect(s, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(slotDeviceSocketStateChanged()));
+    }
+}
+
+void TcfTrkDevice::slotDeviceError()
+{
+    const QString message = d->m_device->errorString();
+    emitLogMessage(message);
+    emit error(message);
+}
+
+void TcfTrkDevice::slotDeviceSocketStateChanged()
+{
+    if (const QAbstractSocket *s = qobject_cast<const QAbstractSocket *>(d->m_device.data())) {
+        const QAbstractSocket::SocketState st = s->state();
+        switch (st) {
+        case QAbstractSocket::UnconnectedState:
+            emitLogMessage(QLatin1String("Unconnected"));
+            break;
+        case QAbstractSocket::HostLookupState:
+            emitLogMessage(QLatin1String("HostLookupState"));
+            break;
+        case QAbstractSocket::ConnectingState:
+            emitLogMessage(QLatin1String("Connecting"));
+            break;
+        case QAbstractSocket::ConnectedState:
+            emitLogMessage(QLatin1String("Connected"));
+            break;
+        case QAbstractSocket::ClosingState:
+            emitLogMessage(QLatin1String("Closing"));
+            break;
+        default:
+            emitLogMessage(QString::fromLatin1("State %1").arg(st));
+            break;
+        }
+    }
+}
+
+static inline QString debugMessage(QByteArray  message, const char *prefix = 0)
+{
+    message.replace('\0', '|');
+    const QString messageS = QString::fromLatin1(message);
+    return prefix ?
+            (QLatin1String(prefix) + messageS) :  messageS;
+}
+
+void TcfTrkDevice::slotDeviceReadyRead()
+{
+    d->m_readBuffer += d->m_device->readAll();
+    // Take complete message off front of readbuffer.
+    do {
+        const int messageEndPos = d->m_readBuffer.indexOf(d->m_messageTerminator);
+        if (messageEndPos == -1)
+            break;
+        const QByteArray message = d->m_readBuffer.left(messageEndPos);
+        if (debug)
+            qDebug("Read:\n%s", qPrintable(formatData(message)));
+        if (const int errorCode = parseMessage(message)) {
+            emitLogMessage(QString::fromLatin1("Parse error %1 for: %2").arg(errorCode).arg(debugMessage(message)));
+        }
+        d->m_readBuffer.remove(0, messageEndPos + d->m_messageTerminator.size());
+    } while (!d->m_readBuffer.isEmpty());
+    checkSendQueue(); // Send off further message
+}
+
+// Split \0-terminated message into tokens, skipping the initial type character
+static inline QVector<QByteArray> splitMessage(const QByteArray &message)
+{
+    QVector<QByteArray> tokens;
+    tokens.reserve(7);
+    const int messageSize = message.size();
+    for (int pos = 2; pos < messageSize; ) {
+        const int nextPos = message.indexOf('\0', pos);
+        if (nextPos == -1)
+            break;
+        tokens.push_back(message.mid(pos, nextPos - pos));
+        pos = nextPos + 1;
+    }
+    return tokens;
+}
+
+int TcfTrkDevice::parseMessage(const QByteArray &message)
+{
+    if (d->m_verbose)
+        emitLogMessage(debugMessage(message, "TCF ->"));
+    // Special JSON parse error message or protocol format error.
+    // The port is usually closed after receiving it.
+    // "\3\2{"Time":1276096098255,"Code":3,"Format": "Protocol format error"}"
+    if (message.startsWith("\003\002")) {
+        QByteArray text = message.mid(2);
+        const QString errorMessage = QString::fromLatin1("Parse error received: %1").arg(QString::fromAscii(text));
+        emit error(errorMessage);
+        return 0;
+    }
+    if (message.size() < 4 || message.at(1) != '\0')
+        return 1;
+    // Split into tokens
+    const char type = message.at(0);
+    const QVector<QByteArray> tokens = splitMessage(message);
+    switch (type) {
+    case 'E':
+        return parseTcfEvent(tokens);
+    case 'R': // Command replies
+    case 'N':
+    case 'P':
+        return parseTcfCommandReply(type, tokens);
+    default:
+        emitLogMessage(QString::fromLatin1("Unhandled message type: %1").arg(debugMessage(message)));
+        return 756;
+    }
+    return 0;
+}
+
+int TcfTrkDevice::parseTcfCommandReply(char type, const QVector<QByteArray> &tokens)
+{
+    typedef TcfTrkDevicePrivate::TokenWrittenMessageMap::iterator TokenWrittenMessageMapIterator;
+    // Find the corresponding entry in the written messages hash.
+    const int tokenCount = tokens.size();
+    if (tokenCount < 1)
+        return 234;
+    bool tokenOk;
+    const int token = tokens.at(0).toInt(&tokenOk);
+    if (!tokenOk)
+        return 235;
+    const TokenWrittenMessageMapIterator it = d->m_writtenMessages.find(token);
+    if (it == d->m_writtenMessages.end()) {
+        qWarning("TcfTrkDevice: Internal error: token %d not found for '%s'",
+                 token, qPrintable(joinByteArrays(tokens)));
+        return 236;
+    }
+    // No callback: remove entry from map, happy
+    if (!it.value().callback) {
+        d->m_writtenMessages.erase(it);
+        return 0;
+    }
+    // Parse values into JSON
+    QVector<JsonValue> values;
+    values.reserve(tokenCount);
+    for (int i = 1; i < tokenCount; i++) {
+        if (!tokens.at(i).isEmpty()) { // Strange: Empty tokens occur.
+            const JsonValue value(tokens.at(i));
+            if (value.isValid()) {
+                values.push_back(value);
+            } else {
+                qWarning("JSON parse error for reply to command token %d: #%d '%s'",
+                         token, i, tokens.at(i).constData());
+                d->m_writtenMessages.erase(it);
+                return -1;
+            }
+        }
+    }
+
+    // Construct result and invoke callback, remove entry from map.
+    TcfTrkCallback callback = it.value().callback;
+    TcfTrkCommandResult result(type, it.value().service, it.value().data,
+                               values, it.value().cookie);
+    d->m_writtenMessages.erase(it);
+    callback(result);
+    return 0;
+}
+
+static const char locatorAnswerC[] = "E\0Locator\0Hello\0[\"Locator\"]";
+
+int TcfTrkDevice::parseTcfEvent(const QVector<QByteArray> &tokens)
+{
+    // Event: Ignore the periodical heartbeat event, answer 'Hello',
+    // emit signal for the rest
+    if (tokens.size() < 3)
+        return 433;
+    const Services service = serviceFromName(tokens.at(0).constData());
+    if (service == LocatorService && tokens.at(1) == "peerHeartBeat")
+        return 0;
+    QVector<JsonValue> values;
+    for (int i = 2; i < tokens.size(); i++) {
+        const JsonValue value(tokens.at(i));
+        if (!value.isValid())
+            return 434;
+        values.push_back(value);
+    }
+    // Parse known events, emit signals
+    QScopedPointer<TcfTrkEvent> knownEvent(TcfTrkEvent::parseEvent(service, tokens.at(1), values));
+    if (!knownEvent.isNull()) {
+        // Answer hello event.
+        if (knownEvent->type() == TcfTrkEvent::LocatorHello)
+            writeMessage(QByteArray(locatorAnswerC, sizeof(locatorAnswerC)));
+        emit tcfEvent(*knownEvent);
+    }
+    emit genericTcfEvent(service, tokens.at(1), values);
+
+    if (debug || d->m_verbose) {
+        QString msg;
+        QTextStream str(&msg);
+        if (knownEvent.isNull()) {
+            str << "Event: " << tokens.at(0) << ' ' << tokens.at(1) << '\n';
+            foreach(const JsonValue &val, values)
+                str << "  " << val.toString() << '\n';
+        } else {
+            str << knownEvent->toString();
+        }
+        emitLogMessage(msg);
+    }
+
+    return 0;
+}
+
+unsigned TcfTrkDevice::verbose() const
+{
+    return d->m_verbose;
+}
+
+void TcfTrkDevice::setVerbose(unsigned v)
+{
+    d->m_verbose = v;
+}
+
+void TcfTrkDevice::emitLogMessage(const QString &m)
+{
+    if (debug)
+        qWarning("%s", qPrintable(m));
+    emit logMessage(m);
+}
+
+bool TcfTrkDevice::checkOpen()
+{
+    if (d->m_device.isNull()) {
+        emitLogMessage(QLatin1String("Internal error: No device set on TcfTrkDevice."));
+        return false;
+    }
+    if (!d->m_device->isOpen()) {
+        emitLogMessage(QLatin1String("Internal error: Device not open in TcfTrkDevice."));
+        return false;
+    }
+    return true;
+}
+
+void TcfTrkDevice::sendTcfTrkMessage(MessageType mt, Services service, const char *command,
+                                     const char *commandParameters, int commandParametersLength,
+                                     const TcfTrkCallback &callBack,
+                                     const QVariant &cookie)
+
+{
+    if (!checkOpen())
+        return;
+    // Format the message
+    const int  token = d->m_token++;
+    QByteArray data;
+    data.reserve(30 + commandParametersLength);
+    data.append('C');
+    data.append('\0');
+    data.append(QByteArray::number(token));
+    data.append('\0');
+    data.append(serviceName(service));
+    data.append('\0');
+    data.append(command);
+    data.append('\0');
+    if (commandParametersLength)
+        data.append(commandParameters, commandParametersLength);
+    const TcfTrkSendQueueEntry entry(mt, token, service, data, callBack, cookie);
+    d->m_sendQueue.enqueue(entry);
+    checkSendQueue();
+}
+
+void TcfTrkDevice::sendTcfTrkMessage(MessageType mt, Services service, const char *command,
+                                     const QByteArray &commandParameters,
+                                     const TcfTrkCallback &callBack,
+                                     const QVariant &cookie)
+{
+    sendTcfTrkMessage(mt, service, command, commandParameters.constData(), commandParameters.size(),
+                      callBack, cookie);
+}
+
+// Enclose in message frame and write.
+void TcfTrkDevice::writeMessage(QByteArray data)
+{
+    if (!checkOpen())
+        return;
+
+    if (d->m_verbose)
+        emitLogMessage(debugMessage(data, "TCF <-"));
+
+    // Ensure \0-termination which easily gets lost in QByteArray CT.
+    if (!data.endsWith('\0'))
+        data.append('\0');
+    data += d->m_messageTerminator;
+
+    if (debug > 1)
+        qDebug("Writing:\n%s", qPrintable(formatData(data)));
+
+    d->m_device->write(data);
+    if (QAbstractSocket *as = qobject_cast<QAbstractSocket *>(d->m_device.data()))
+        as->flush();
+}
+
+void TcfTrkDevice::checkSendQueue()
+{
+    // Fire off messages or invoke noops until a message with reply is found
+    // and an entry to writtenMessages is made.
+    while (d->m_writtenMessages.empty()) {
+        if (d->m_sendQueue.isEmpty())
+            break;
+        TcfTrkSendQueueEntry entry = d->m_sendQueue.dequeue();
+        switch (entry.messageType) {
+        case MessageWithReply:
+            d->m_writtenMessages.insert(entry.token, entry);
+            writeMessage(entry.data);
+            break;
+        case MessageWithoutReply:
+            writeMessage(entry.data);
+            break;
+        case NoopMessage: // Invoke the noop-callback for synchronization
+            if (entry.callback) {
+                TcfTrkCommandResult noopResult(TcfTrkCommandResult::SuccessReply);
+                noopResult.cookie = entry.cookie;
+                entry.callback(noopResult);
+            }
+            break;
+        }
+    }
+}
+
+// Fix slashes
+static inline QString fixFileName(QString in)
+{
+    in.replace(QLatin1Char('/'), QLatin1Char('\\'));
+    return in;
+}
+
+// Start a process (consisting of a non-reply setSettings and start).
+void TcfTrkDevice::sendProcessStartCommand(const TcfTrkCallback &callBack,
+                                                 const QString &binaryIn,
+                                                 unsigned uid,
+                                                 QStringList arguments,
+                                                 QString workingDirectory,
+                                                 bool debugControl,
+                                                 const QStringList &additionalLibraries,
+                                                 const QVariant &cookie)
+{
+    // Obtain the bin directory, expand by c:/sys/bin if missing
+    const QChar backSlash('\\');
+    int slashPos = binaryIn.lastIndexOf(QLatin1Char('/'));
+    if (slashPos == -1)
+        slashPos = binaryIn.lastIndexOf(backSlash);
+    const QString sysBin = QLatin1String("c:/sys/bin");
+    const QString binaryFileName  = slashPos == -1 ? binaryIn : binaryIn.mid(slashPos + 1);
+    const QString binaryDirectory = slashPos == -1 ? sysBin : binaryIn.left(slashPos);
+    const QString binary = fixFileName(binaryDirectory + QLatin1Char('/') + binaryFileName);
+
+    // Fixup: Does argv[0] convention exist on Symbian?
+    arguments.push_front(binary);
+    if (workingDirectory.isEmpty())
+        workingDirectory = sysBin;
+
+    // Format settings with empty dummy parameter
+    QByteArray setData;
+    JsonInputStream setStr(setData);
+    setStr << "" << '\0'
+            << '[' << "exeToLaunch" << ',' << "addExecutables" << ',' << "addLibraries" << ']'
+            << '\0' << '['
+                << binary << ','
+                << '{' << binaryFileName << ':' << QString::number(uid, 16) << '}' << ','
+                << additionalLibraries
+            << ']';
+    sendTcfTrkMessage(MessageWithoutReply, SettingsService, "set", setData);
+
+    QByteArray startData;
+    JsonInputStream startStr(startData);
+    startStr << fixFileName(workingDirectory)
+            << '\0' << binary << '\0' << arguments << '\0'
+            << QStringList() << '\0' // Env is an array ["PATH=value"] (non-standard)
+            << debugControl;
+    sendTcfTrkMessage(MessageWithReply, ProcessesService, "start", startData, callBack, cookie);
+}
+
+void TcfTrkDevice::sendProcessTerminateCommand(const TcfTrkCallback &callBack,
+                                               const QByteArray &id,
+                                               const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << id;
+    sendTcfTrkMessage(MessageWithReply, ProcessesService, "terminate", data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendRunControlTerminateCommand(const TcfTrkCallback &callBack,
+                                                  const QByteArray &id,
+                                                  const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << id;
+    sendTcfTrkMessage(MessageWithReply, RunControlService, "terminate", data, callBack, cookie);
+}
+
+// Non-standard: Remove executable from settings
+void TcfTrkDevice::sendSettingsRemoveExecutableCommand(const QString &binaryIn,
+                                                       unsigned uid,
+                                                       const QStringList &additionalLibraries,
+                                                       const QVariant &cookie)
+{
+    QByteArray setData;
+    JsonInputStream setStr(setData);
+    setStr << "" << '\0'
+            << '[' << "removedExecutables" << ',' << "removedLibraries" << ']'
+            << '\0' << '['
+                << '{' << QFileInfo(binaryIn).fileName() << ':' << QString::number(uid, 16) << '}' << ','
+                << additionalLibraries
+            << ']';
+    sendTcfTrkMessage(MessageWithoutReply, SettingsService, "set", setData, TcfTrkCallback(), cookie);
+}
+
+void TcfTrkDevice::sendRunControlResumeCommand(const TcfTrkCallback &callBack,
+                                               const QByteArray &id,
+                                               RunControlResumeMode mode,
+                                               unsigned count,
+                                               quint64 rangeStart,
+                                               quint64 rangeEnd,
+                                               const QVariant &cookie)
+{
+    QByteArray resumeData;
+    JsonInputStream str(resumeData);
+    str << id << '\0' << int(mode) << '\0' << count;
+    switch (mode) {
+    case RM_STEP_OVER_RANGE:
+    case RM_STEP_INTO_RANGE:
+    case RM_REVERSE_STEP_OVER_RANGE:
+    case RM_REVERSE_STEP_INTO_RANGE:
+        str << '\0' << '{' << "RANGE_START" << ':' << rangeStart
+                << ',' << "RANGE_END" << ':' << rangeEnd << '}';
+        break;
+    default:
+        break;
+    }
+    sendTcfTrkMessage(MessageWithReply, RunControlService, "resume", resumeData, callBack, cookie);
+}
+
+void TcfTrkDevice::sendRunControlSuspendCommand(const TcfTrkCallback &callBack,
+                                                const QByteArray &id,
+                                                const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << id;
+    sendTcfTrkMessage(MessageWithReply, RunControlService, "suspend", data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendRunControlResumeCommand(const TcfTrkCallback &callBack,
+                                               const QByteArray &id,
+                                               const QVariant &cookie)
+{
+    sendRunControlResumeCommand(callBack, id, RM_RESUME, 1, 0, 0, cookie);
+}
+
+void TcfTrkDevice::sendBreakpointsAddCommand(const TcfTrkCallback &callBack,
+                                             const Breakpoint &bp,
+                                             const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << bp;
+    sendTcfTrkMessage(MessageWithReply, BreakpointsService, "add", data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendBreakpointsRemoveCommand(const TcfTrkCallback &callBack,
+                                                const QByteArray &id,
+                                                const QVariant &cookie)
+{
+    sendBreakpointsRemoveCommand(callBack, QVector<QByteArray>(1, id), cookie);
+}
+
+void TcfTrkDevice::sendBreakpointsRemoveCommand(const TcfTrkCallback &callBack,
+                                                const QVector<QByteArray> &ids,
+                                                const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << ids;
+    sendTcfTrkMessage(MessageWithReply, BreakpointsService, "remove", data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendBreakpointsEnableCommand(const TcfTrkCallback &callBack,
+                                                const QByteArray &id,
+                                                bool enable,
+                                                const QVariant &cookie)
+{
+    sendBreakpointsEnableCommand(callBack, QVector<QByteArray>(1, id), enable, cookie);
+}
+
+void TcfTrkDevice::sendBreakpointsEnableCommand(const TcfTrkCallback &callBack,
+                                                const QVector<QByteArray> &ids,
+                                                bool enable,
+                                                const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    str << ids;
+    sendTcfTrkMessage(MessageWithReply, BreakpointsService,
+                      enable ? "enable" : "disable",
+                      data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendMemorySetCommand(const TcfTrkCallback &callBack,
+                                        const QByteArray &contextId,
+                                        quint64 start, const QByteArray& data,
+                                        const QVariant &cookie)
+{
+    QByteArray getData;
+    JsonInputStream str(getData);
+    // start/word size/mode. Mode should ideally be 1 (continue on error?)
+    str << contextId << '\0' << start << '\0' << 1 << '\0' << data.size() << '\0' << 1
+        << '\0' << data.toBase64();
+    sendTcfTrkMessage(MessageWithReply, MemoryService, "set", getData, callBack, cookie);
+}
+
+void TcfTrkDevice::sendMemoryGetCommand(const TcfTrkCallback &callBack,
+                                        const QByteArray &contextId,
+                                        quint64 start, quint64 size,
+                                        const QVariant &cookie)
+{
+    QByteArray data;
+    JsonInputStream str(data);
+    // start/word size/mode. Mode should ideally be 1 (continue on error?)
+    str << contextId << '\0' << start << '\0' << 1 << '\0' << size << '\0' << 1;
+    sendTcfTrkMessage(MessageWithReply, MemoryService, "get", data, callBack, cookie);
+}
+
+QByteArray TcfTrkDevice::parseMemoryGet(const TcfTrkCommandResult &r)
+{
+    if (r.type != TcfTrkCommandResult::SuccessReply || r.values.size() < 1)
+        return QByteArray();
+    const JsonValue &memoryV = r.values.front();
+
+    if (memoryV.type() != JsonValue::String || memoryV.data().size() < 2
+        || !memoryV.data().endsWith('='))
+        return QByteArray();
+    // Catch errors reported as hash:
+    // R.4."TlVMTA==".{"Time":1276786871255,"Code":1,"AltCode":-38,"AltOrg":"POSIX","Format":"BadDescriptor"}
+    // Not sure what to make of it.
+    if (r.values.size() >= 2 && r.values.at(1).type() == JsonValue::Object)
+        qWarning("Error retrieving memory: %s", r.values.at(1).toString(false).constData());
+    // decode
+    const QByteArray memory = QByteArray::fromBase64(memoryV.data());
+    if (memory.isEmpty())
+        qWarning("Base64 decoding of %s failed.", memoryV.data().constData());
+    if (debug)
+        qDebug("TcfTrkDevice::parseMemoryGet: received %d bytes", memory.size());
+    return memory;
+}
+
+void TcfTrkDevice::sendRegistersGetMCommand(const TcfTrkCallback &callBack,
+                                            const QByteArray &contextId,
+                                            const QVector<QByteArray> &ids,
+                                            const QVariant &cookie)
+{
+    // TODO: use "Registers" (which uses base64-encoded values)
+    QByteArray data;
+    JsonInputStream str(data);
+    str << contextId << '\0' << ids;
+    sendTcfTrkMessage(MessageWithReply, SimpleRegistersService, "get", data, callBack, cookie);
+}
+
+void TcfTrkDevice::sendRegistersGetMRangeCommand(const TcfTrkCallback &callBack,
+                                                 const QByteArray &contextId,
+                                                 unsigned start, unsigned count)
+{
+    const unsigned end = start + count;
+    if (end > (unsigned)d->m_registerNames.size()) {
+        qWarning("TcfTrkDevice: No register name set for index %u (size: %d).", end, d->m_registerNames.size());
+        return;
+    }
+
+    QVector<QByteArray> ids;
+    ids.reserve(count);
+    for (unsigned i = start; i < end; i++)
+        ids.push_back(d->m_registerNames.at(i));
+    sendRegistersGetMCommand(callBack, contextId, ids, QVariant(start));
+}
+
+// Set register
+void TcfTrkDevice::sendRegistersSetCommand(const TcfTrkCallback &callBack,
+                                           const QByteArray &contextId,
+                                           const QByteArray &id,
+                                           unsigned value,
+                                           const QVariant &cookie)
+{
+    // TODO: use "Registers" (which uses base64-encoded values)
+    QByteArray data;
+    JsonInputStream str(data);
+    str << contextId << '\0' << QVector<QByteArray>(1, id)
+            << '\0' << QVector<QByteArray>(1, QByteArray::number(value, 16));
+    sendTcfTrkMessage(MessageWithReply, SimpleRegistersService, "set", data, callBack, cookie);
+}
+
+// Set register
+void TcfTrkDevice::sendRegistersSetCommand(const TcfTrkCallback &callBack,
+                                           const QByteArray &contextId,
+                                           unsigned registerNumber,
+                                           unsigned value,
+                                           const QVariant &cookie)
+{
+    if (registerNumber >= (unsigned)d->m_registerNames.size()) {
+        qWarning("TcfTrkDevice: No register name set for index %u (size: %d).", registerNumber, d->m_registerNames.size());
+        return;
+    }
+    sendRegistersSetCommand(callBack, contextId,
+                            d->m_registerNames[registerNumber],
+                            value, cookie);
+}
+
+} // namespace tcftrk
Index: trunk/tools/runonphone/symbianutils/tcftrkdevice.h
===================================================================
--- trunk/tools/runonphone/symbianutils/tcftrkdevice.h	(revision 846)
+++ trunk/tools/runonphone/symbianutils/tcftrkdevice.h	(revision 846)
@@ -0,0 +1,295 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TCFTRKENGINE_H
+#define TCFTRKENGINE_H
+
+#include "symbianutils_global.h"
+#include "tcftrkmessage.h"
+#include "callback.h"
+#include "json.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QVector>
+#include <QtCore/QVariant>
+#include <QtCore/QStringList>
+
+QT_BEGIN_NAMESPACE
+class QIODevice;
+class QTextStream;
+QT_END_NAMESPACE
+
+namespace tcftrk {
+
+struct TcfTrkDevicePrivate;
+struct Breakpoint;
+
+/* Command error handling in TCF:
+ * 1) 'Severe' errors (JSON format, parameter format): Trk emits a
+ *     nonstandard message (\3\2 error parameters) and closes the connection.
+ * 2) Protocol errors: 'N' without error message is returned.
+ * 3) Errors in command execution: 'R' with a TCF error hash is returned
+ *    (see TcfTrkCommandError). */
+
+/* Error code return in 'R' reply to command
+ * (see top of 'Services' documentation). */
+struct SYMBIANUTILS_EXPORT TcfTrkCommandError {
+    TcfTrkCommandError();
+    void clear();
+    operator bool() const { return timeMS != 0; }
+    QString toString() const;
+    void write(QTextStream &str) const;
+    bool parse(const QVector<JsonValue> &values);
+
+    quint64 timeMS; // Since 1.1.1970
+    int code;
+    QByteArray format; // message
+    // 'Alternative' meaning, like altOrg="POSIX"/altCode=<some errno>
+    QByteArray alternativeOrganization;
+    int alternativeCode;
+};
+
+/* Answer to a Tcf command passed to the callback. */
+struct SYMBIANUTILS_EXPORT TcfTrkCommandResult {
+    enum Type {
+        SuccessReply,       // 'R' and no error -> all happy.
+        CommandErrorReply,  // 'R' with TcfTrkCommandError received
+        ProgressReply,      // 'P', progress indicator
+        FailReply           // 'N' Protocol NAK, severe error
+    };
+
+    explicit TcfTrkCommandResult(Type t = SuccessReply);
+    explicit TcfTrkCommandResult(char typeChar, Services service,
+                                 const QByteArray &request,
+                                 const QVector<JsonValue> &values,
+                                 const QVariant &cookie);
+
+    QString toString() const;
+    QString errorString() const;
+    operator bool() const { return type == SuccessReply || type == ProgressReply; }
+
+    Type type;
+    Services service;
+    QByteArray request;
+    TcfTrkCommandError commandError;
+    QVector<JsonValue> values;
+    QVariant cookie;
+};
+
+typedef trk::Callback<const TcfTrkCommandResult &> TcfTrkCallback;
+
+/* TcfTrkDevice: TCF communication helper using an asynchronous QIODevice
+ * implementing the TCF protocol according to:
+http://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/trunk/docs/TCF%20Specification.html
+http://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/trunk/docs/TCF%20Services.html
+ * Commands can be sent along with callbacks that are passed a
+ * TcfTrkCommandResult and an opaque QVariant cookie. In addition, events are emitted.
+*/
+
+class SYMBIANUTILS_EXPORT TcfTrkDevice : public QObject
+{
+    Q_PROPERTY(unsigned verbose READ verbose WRITE setVerbose)
+    Q_OBJECT
+public:
+    enum MessageType { MessageWithReply,
+                       MessageWithoutReply, /* Non-standard: "Settings:set" command does not reply */
+                       NoopMessage };
+
+    typedef QSharedPointer<QIODevice> IODevicePtr;
+
+    explicit TcfTrkDevice(QObject *parent = 0);
+    virtual ~TcfTrkDevice();
+
+    unsigned verbose() const;
+
+    // Mapping of register names for indices
+    QVector<QByteArray> registerNames() const;
+    void setRegisterNames(const QVector<QByteArray>& n);
+
+    IODevicePtr device() const;
+    IODevicePtr takeDevice();
+    void setDevice(const IODevicePtr &dp);
+
+    void sendTcfTrkMessage(MessageType mt, Services service,
+                           const char *command,
+                           const char *commandParameters, int commandParametersLength,
+                           const TcfTrkCallback &callBack = TcfTrkCallback(),
+                           const QVariant &cookie = QVariant());
+
+    void sendTcfTrkMessage(MessageType mt, Services service, const char *command,
+                           const QByteArray &commandParameters,
+                           const TcfTrkCallback &callBack = TcfTrkCallback(),
+                           const QVariant &cookie = QVariant());
+
+    // Convenience messages: Start a process
+    void sendProcessStartCommand(const TcfTrkCallback &callBack,
+                                 const QString &binary,
+                                 unsigned uid,
+                                 QStringList arguments = QStringList(),
+                                 QString workingDirectory = QString(),
+                                 bool debugControl = true,
+                                 const QStringList &additionalLibraries = QStringList(),
+                                 const QVariant &cookie = QVariant());
+
+    // Preferred over Processes:Terminate by TCF TRK.
+    void sendRunControlTerminateCommand(const TcfTrkCallback &callBack,
+                                        const QByteArray &id,
+                                        const QVariant &cookie = QVariant());
+
+    void sendProcessTerminateCommand(const TcfTrkCallback &callBack,
+                                     const QByteArray &id,
+                                     const QVariant &cookie = QVariant());
+
+    // Non-standard: Remove executable from settings.
+    // Probably needs to be called after stopping. This command has no response.
+    void sendSettingsRemoveExecutableCommand(const QString &binaryIn,
+                                             unsigned uid,
+                                             const QStringList &additionalLibraries = QStringList(),
+                                             const QVariant &cookie = QVariant());
+
+    void sendRunControlSuspendCommand(const TcfTrkCallback &callBack,
+                                      const QByteArray &id,
+                                      const QVariant &cookie = QVariant());
+
+    // Resume / Step (see RunControlResumeMode).
+    void sendRunControlResumeCommand(const TcfTrkCallback &callBack,
+                                     const QByteArray &id,
+                                     RunControlResumeMode mode,
+                                     unsigned count /* = 1, currently ignored. */,
+                                     quint64 rangeStart, quint64 rangeEnd,
+                                     const QVariant &cookie = QVariant());
+
+    // Convenience to resume a suspended process
+    void sendRunControlResumeCommand(const TcfTrkCallback &callBack,
+                                     const QByteArray &id,
+                                     const QVariant &cookie = QVariant());
+
+    void sendBreakpointsAddCommand(const TcfTrkCallback &callBack,
+                                   const Breakpoint &b,
+                                   const QVariant &cookie = QVariant());
+
+    void sendBreakpointsRemoveCommand(const TcfTrkCallback &callBack,
+                                      const QByteArray &id,
+                                      const QVariant &cookie = QVariant());
+
+    void sendBreakpointsRemoveCommand(const TcfTrkCallback &callBack,
+                                      const QVector<QByteArray> &id,
+                                      const QVariant &cookie = QVariant());
+
+    void sendBreakpointsEnableCommand(const TcfTrkCallback &callBack,
+                                      const QByteArray &id,
+                                      bool enable,
+                                      const QVariant &cookie = QVariant());
+
+    void sendBreakpointsEnableCommand(const TcfTrkCallback &callBack,
+                                      const QVector<QByteArray> &id,
+                                      bool enable,
+                                      const QVariant &cookie = QVariant());
+
+
+    void sendMemoryGetCommand(const TcfTrkCallback &callBack,
+                              const QByteArray &contextId,
+                              quint64 start, quint64 size,
+                              const QVariant &cookie = QVariant());
+
+    void sendMemorySetCommand(const TcfTrkCallback &callBack,
+                              const QByteArray &contextId,
+                              quint64 start, const QByteArray& data,
+                              const QVariant &cookie = QVariant());
+
+    // Reply is an array of hexvalues
+    void sendRegistersGetMCommand(const TcfTrkCallback &callBack,
+                                  const QByteArray &contextId,
+                                  const QVector<QByteArray> &ids,
+                                  const QVariant &cookie = QVariant());
+
+    // Convenience to get a range of register "R0" .. "R<n>".
+    // Cookie will be an int containing "start".
+    void sendRegistersGetMRangeCommand(const TcfTrkCallback &callBack,
+                                 const QByteArray &contextId,
+                                  unsigned start, unsigned count);
+
+    // Set register
+    void sendRegistersSetCommand(const TcfTrkCallback &callBack,
+                                 const QByteArray &contextId,
+                                 const QByteArray &ids,
+                                 unsigned value,
+                                 const QVariant &cookie = QVariant());
+    // Set register
+    void sendRegistersSetCommand(const TcfTrkCallback &callBack,
+                                 const QByteArray &contextId,
+                                 unsigned registerNumber,
+                                 unsigned value,
+                                 const QVariant &cookie = QVariant());
+
+    static QByteArray parseMemoryGet(const TcfTrkCommandResult &r);
+
+signals:
+    void genericTcfEvent(int service, const QByteArray &name, const QVector<tcftrk::JsonValue> &value);
+    void tcfEvent(const tcftrk::TcfTrkEvent &knownEvent);
+
+    void logMessage(const QString &);
+    void error(const QString &);
+
+public slots:
+    void setVerbose(unsigned v);
+
+private slots:
+    void slotDeviceError();
+    void slotDeviceSocketStateChanged();
+    void slotDeviceReadyRead();
+
+private:
+    bool checkOpen();
+    void checkSendQueue();
+    void writeMessage(QByteArray data);
+    void emitLogMessage(const QString &);
+    int parseMessage(const QByteArray &);
+    int parseTcfCommandReply(char type, const QVector<QByteArray> &tokens);
+    int parseTcfEvent(const QVector<QByteArray> &tokens);
+
+    TcfTrkDevicePrivate *d;
+};
+
+} // namespace tcftrk
+
+#endif // TCFTRKENGINE_H
Index: trunk/tools/runonphone/symbianutils/tcftrkmessage.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/tcftrkmessage.cpp	(revision 846)
+++ trunk/tools/runonphone/symbianutils/tcftrkmessage.cpp	(revision 846)
@@ -0,0 +1,562 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tcftrkmessage.h"
+#include "json.h"
+
+#include <QtCore/QString>
+#include <QtCore/QTextStream>
+
+// Names matching the enum
+static const char *serviceNamesC[] =
+{ "Locator", "RunControl", "Processes", "Memory", "Settings", "Breakpoints",
+  "Registers", "SimpleRegisters",
+  "UnknownService"};
+
+namespace tcftrk {
+
+SYMBIANUTILS_EXPORT QString joinByteArrays(const QVector<QByteArray> &a, char sep)
+{
+    QString rc;
+    const int count = a.size();
+    for (int i = 0; i < count; i++) {
+        if (i)
+            rc += QLatin1Char(sep);
+        rc += QString::fromUtf8(a.at(i));
+    }
+    return rc;
+}
+
+static inline bool jsonToBool(const JsonValue& js)
+{
+    return js.type() == JsonValue::Boolean && js.data() == "true";
+}
+
+SYMBIANUTILS_EXPORT const char *serviceName(Services s)
+{
+    return serviceNamesC[s];
+}
+
+SYMBIANUTILS_EXPORT Services serviceFromName(const char *n)
+{
+    const int count = sizeof(serviceNamesC)/sizeof(char *);
+    for (int i = 0; i < count; i++)
+        if (!qstrcmp(serviceNamesC[i], n))
+            return static_cast<Services>(i);
+    return UnknownService;
+}
+
+SYMBIANUTILS_EXPORT QString formatData(const QByteArray &a)
+{
+    const int columns = 16;
+    QString rc;
+    QTextStream str(&rc);
+    str.setIntegerBase(16);
+    str.setPadChar(QLatin1Char('0'));
+    const unsigned char *start = reinterpret_cast<const unsigned char *>(a.constData());
+    const unsigned char *end = start + a.size();
+    for  (const unsigned char *p = start; p < end ; ) {
+        str << "0x";
+        str.setFieldWidth(4);
+        str << (p - start);
+        str.setFieldWidth(0);
+        str << ' ';
+        QString asc;
+        int c = 0;
+        for ( ; c < columns && p < end; c++, p++) {
+            const unsigned u = *p;
+            str.setFieldWidth(2);
+            str << u;
+            str.setFieldWidth(0);
+            str << ' ';
+            switch (u) {
+            case '\n':
+                asc += QLatin1String("\\n");
+                break;
+            case '\r':
+                asc += QLatin1String("\\r");
+                break;
+            case '\t':
+                asc += QLatin1String("\\t");
+                break;
+            default:
+                if (u >= 32 && u < 128) {
+                    asc += QLatin1Char(' ');
+                    asc += QLatin1Char(u);
+                } else {
+                    asc += QLatin1String(" .");
+                }
+                break;
+            }
+        }
+        if (const int remainder = columns - c)
+            str << QString(3 * remainder, QLatin1Char(' '));
+        str << ' ' << asc << '\n';
+    }
+    return rc;
+}
+
+// ----------- RunControlContext
+RunControlContext::RunControlContext() :
+        flags(0), resumeFlags(0)
+{
+}
+
+void RunControlContext::clear()
+{
+    flags =0;
+    resumeFlags = 0;
+    id.clear();
+    osid.clear();
+    parentId.clear();
+}
+
+RunControlContext::Type RunControlContext::typeFromTcfId(const QByteArray &id)
+{
+    // "p12" or "p12.t34"?
+    return id.contains(".t") ? Thread : Process;
+}
+
+unsigned RunControlContext::processId() const
+{
+    return processIdFromTcdfId(id);
+}
+
+unsigned RunControlContext::threadId() const
+{
+    return threadIdFromTcdfId(id);
+}
+
+unsigned RunControlContext::processIdFromTcdfId(const QByteArray &id)
+{
+    // Cut out process id from "p12" or "p12.t34"?
+    if (!id.startsWith('p'))
+        return 0;
+    const int dotPos = id.indexOf('.');
+    const int pLen = dotPos == -1 ? id.size() : dotPos;
+    return id.mid(1, pLen - 1).toUInt();
+}
+
+unsigned RunControlContext::threadIdFromTcdfId(const QByteArray &id)
+{
+    const int tPos = id.indexOf(".t");
+    return tPos != -1 ? id.mid(tPos + 2).toUInt() : uint(0);
+}
+
+QByteArray RunControlContext::tcfId(unsigned processId,  unsigned threadId /* = 0 */)
+{
+    QByteArray rc("p");
+    rc += QByteArray::number(processId);
+    if (threadId) {
+        rc += ".t";
+        rc += QByteArray::number(threadId);
+    }
+    return rc;
+}
+
+RunControlContext::Type RunControlContext::type() const
+{
+    return RunControlContext::typeFromTcfId(id);
+}
+
+bool RunControlContext::parse(const JsonValue &val)
+{
+    clear();
+    if (val.type() != JsonValue::Object)
+        return false;
+    foreach(const JsonValue &c, val.children()) {
+        if (c.name() == "ID") {
+            id = c.data();
+        } else if (c.name() == "OSID") {
+            osid = c.data();
+        } else if (c.name() == "ParentID") {
+            parentId = c.data();
+        }  else if (c.name() == "IsContainer") {
+            if (jsonToBool(c))
+                flags |= Container;
+        }  else if (c.name() == "CanTerminate") {
+            if (jsonToBool(c))
+                flags |= CanTerminate;
+        }  else if (c.name() == "CanResume") {
+            resumeFlags = c.data().toUInt();
+        }  else if (c.name() == "HasState") {
+            if (jsonToBool(c))
+                flags |= HasState;
+        } else if (c.name() == "CanSuspend") {
+            if (jsonToBool(c))
+                flags |= CanSuspend;
+        }
+    }
+    return true;
+}
+
+QString RunControlContext::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    format(str);
+    return rc;
+}
+
+void RunControlContext::format(QTextStream &str) const
+{
+    str << " id='" << id << "' osid='" << osid
+        << "' parentId='" << parentId <<"' ";
+    if (flags & Container)
+        str << "[container] ";
+    if (flags & HasState)
+        str << "[has state] ";
+    if (flags & CanSuspend)
+        str << "[can suspend] ";
+    if (flags & CanSuspend)
+        str << "[can terminate] ";
+    str.setIntegerBase(16);
+    str << " resume_flags: 0x" <<  resumeFlags;
+    str.setIntegerBase(10);
+}
+
+// ------ ModuleLoadEventInfo
+ModuleLoadEventInfo::ModuleLoadEventInfo() :
+   loaded(false), codeAddress(0), dataAddress(0), requireResume(false)
+{
+}
+
+void ModuleLoadEventInfo::clear()
+{
+    loaded = requireResume = false;
+    codeAddress = dataAddress =0;
+}
+
+bool ModuleLoadEventInfo::parse(const JsonValue &val)
+{
+    clear();
+    if (val.type() != JsonValue::Object)
+        return false;
+    foreach(const JsonValue &c, val.children()) {
+        if (c.name() == "Name") {
+            name = c.data();
+        } else if (c.name() == "File") {
+            file = c.data();
+        } else if (c.name() == "CodeAddress") {
+            codeAddress = c.data().toULongLong();
+        }  else if (c.name() == "DataAddress") {
+            dataAddress = c.data().toULongLong();
+        }  else if (c.name() == "Loaded") {
+            loaded = jsonToBool(c);
+        }  else if (c.name() == "RequireResume") {
+            requireResume =jsonToBool(c);
+        }
+    }
+    return true;
+}
+void ModuleLoadEventInfo::format(QTextStream &str) const
+{
+    str << "name='" << name << "' file='" << file << "' " <<
+            (loaded ? "[loaded] " : "[not loaded] ");
+    if (requireResume)
+        str << "[requires resume] ";
+    str.setIntegerBase(16);
+    str  << " code: 0x" << codeAddress << " data: 0x" << dataAddress;
+    str.setIntegerBase(10);
+}
+
+// ---------------------- Breakpoint
+
+// Types matching enum
+static const char *breakPointTypesC[] = {"Software", "Hardware", "Auto"};
+
+Breakpoint::Breakpoint(quint64 loc) :
+    type(Auto), enabled(true), ignoreCount(0), location(loc), size(1), thumb(true)
+{
+    if (loc)
+        id = idFromLocation(location);
+}
+
+void Breakpoint::setContextId(unsigned processId, unsigned threadId)
+{
+    contextIds = QVector<QByteArray>(1, RunControlContext::tcfId(processId, threadId));
+}
+
+QByteArray Breakpoint::idFromLocation(quint64 loc)
+{
+    return QByteArray("BP_0x") + QByteArray::number(loc, 16);
+}
+
+QString Breakpoint::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    str.setIntegerBase(16);
+    str << "Breakpoint '" << id << "' "  << breakPointTypesC[type] << " for contexts '"
+            << joinByteArrays(contextIds, ',') << "' at 0x" << location;
+    str.setIntegerBase(10);
+    str << " size " << size;
+    if (enabled)
+        str << " [enabled]";
+    if (thumb)
+        str << " [thumb]";
+    if (ignoreCount)
+        str << " IgnoreCount " << ignoreCount;
+    return rc;
+}
+
+JsonInputStream &operator<<(JsonInputStream &str, const Breakpoint &b)
+{
+    if (b.contextIds.isEmpty())
+        qWarning("tcftrk::Breakpoint: No context ids specified");
+
+    str << '{' << "ID" << ':' << QString::fromUtf8(b.id) << ','
+        << "BreakpointType" << ':' << breakPointTypesC[b.type] << ','
+        << "Enabled" << ':' << b.enabled << ','
+        << "IgnoreCount" << ':' << b.ignoreCount << ','
+        << "ContextIds" << ':' << b.contextIds << ','
+        << "Location" << ':' << QString::number(b.location) << ','
+        << "Size"  << ':' << b.size << ','
+        << "THUMB_BREAKPOINT" << ':' << b.thumb
+        << '}';
+    return str;
+}
+
+// --- Events
+TcfTrkEvent::TcfTrkEvent(Type type) : m_type(type)
+{
+}
+
+TcfTrkEvent::~TcfTrkEvent()
+{
+}
+
+TcfTrkEvent::Type TcfTrkEvent::type() const
+{
+    return m_type;
+}
+
+QString TcfTrkEvent::toString() const
+{
+    return QString();
+}
+
+static const char sharedLibrarySuspendReasonC[] = "Shared Library";
+
+TcfTrkEvent *TcfTrkEvent::parseEvent(Services s, const QByteArray &nameBA, const QVector<JsonValue> &values)
+{
+    switch (s) {
+    case LocatorService:
+        if (nameBA == "Hello" && values.size() == 1 && values.front().type() == JsonValue::Array) {
+            QStringList services;
+            foreach (const JsonValue &jv, values.front().children())
+                services.push_back(QString::fromUtf8(jv.data()));
+            return new TcfTrkLocatorHelloEvent(services);
+        }
+        break;
+    case RunControlService:
+        if (values.empty())
+            return 0;
+        // "id/PC/Reason/Data"
+        if (nameBA == "contextSuspended" && values.size() == 4) {
+            const QByteArray idBA = values.at(0).data();
+            const quint64 pc = values.at(1).data().toULongLong();
+            const QByteArray reasonBA = values.at(2).data();
+            // Module load: Special
+            if (reasonBA == sharedLibrarySuspendReasonC) {
+                ModuleLoadEventInfo info;
+                if (!info.parse(values.at(3)))
+                    return 0;
+                return new TcfTrkRunControlModuleLoadContextSuspendedEvent(idBA, reasonBA, pc, info);
+            }
+            return new TcfTrkRunControlContextSuspendedEvent(idBA, reasonBA, pc);
+        } // "contextSuspended"
+        if (nameBA == "contextAdded")
+            return TcfTrkRunControlContextAddedEvent::parseEvent(values);
+        if (nameBA == "contextRemoved" && values.front().type() == JsonValue::Array) {
+            QVector<QByteArray> ids;
+            foreach(const JsonValue &c, values.front().children())
+                ids.push_back(c.data());
+            return new TcfTrkRunControlContextRemovedEvent(ids);
+        }
+        break;
+   default:
+        break;
+    }
+    return 0;
+}
+
+// -------------- TcfTrkServiceHelloEvent
+TcfTrkLocatorHelloEvent::TcfTrkLocatorHelloEvent(const QStringList &s) :
+    TcfTrkEvent(LocatorHello),
+    m_services(s)
+{
+}
+
+QString TcfTrkLocatorHelloEvent::toString() const
+{
+    return QLatin1String("ServiceHello: ") + m_services.join(QLatin1String(", "));
+}
+
+// -------------- TcfTrkIdEvent
+TcfTrkIdEvent::TcfTrkIdEvent(Type t, const QByteArray &id) :
+   TcfTrkEvent(t), m_id(id)
+{
+}
+
+// ---------- TcfTrkIdsEvent
+TcfTrkIdsEvent::TcfTrkIdsEvent(Type t, const QVector<QByteArray> &ids) :
+    TcfTrkEvent(t), m_ids(ids)
+{
+}
+
+QString TcfTrkIdsEvent::joinedIdString(const char sep) const
+{
+    return joinByteArrays(m_ids, sep);
+}
+
+//  ---------------- TcfTrkRunControlContextAddedEvent
+TcfTrkRunControlContextAddedEvent::TcfTrkRunControlContextAddedEvent(const RunControlContexts &c) :
+        TcfTrkEvent(RunControlContextAdded), m_contexts(c)
+{
+}
+
+TcfTrkRunControlContextAddedEvent
+        *TcfTrkRunControlContextAddedEvent::parseEvent(const QVector<JsonValue> &values)
+{
+    // Parse array of contexts
+    if (values.size() < 1 || values.front().type() != JsonValue::Array)
+        return 0;
+
+    RunControlContexts contexts;
+    foreach (const JsonValue &v, values.front().children()) {
+        RunControlContext context;
+        if (context.parse(v))
+            contexts.push_back(context);
+    }
+    return new TcfTrkRunControlContextAddedEvent(contexts);
+}
+
+QString TcfTrkRunControlContextAddedEvent::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    str << "RunControl: " << m_contexts.size() << " context(s) "
+        << (type() == RunControlContextAdded ? "added" : "removed")
+        << '\n';
+    foreach (const RunControlContext &c, m_contexts) {
+        c.format(str);
+        str << '\n';
+    }
+    return rc;
+}
+
+// --------------- TcfTrkRunControlContextRemovedEvent
+TcfTrkRunControlContextRemovedEvent::TcfTrkRunControlContextRemovedEvent(const QVector<QByteArray> &ids) :
+        TcfTrkIdsEvent(RunControlContextRemoved, ids)
+{
+}
+
+QString TcfTrkRunControlContextRemovedEvent::toString() const
+{
+    return QLatin1String("RunControl: Removed contexts '") + joinedIdString() + ("'.");
+}
+
+// --------------- TcfTrkRunControlContextSuspendedEvent
+TcfTrkRunControlContextSuspendedEvent::TcfTrkRunControlContextSuspendedEvent(const QByteArray &id,
+                                                                             const QByteArray &reason,
+                                                                             quint64 pc) :
+        TcfTrkIdEvent(RunControlSuspended, id), m_pc(pc), m_reason(reason)
+{
+}
+
+TcfTrkRunControlContextSuspendedEvent::TcfTrkRunControlContextSuspendedEvent(Type t,
+                                                                             const QByteArray &id,
+                                                                             const QByteArray &reason,
+                                                                             quint64 pc) :
+        TcfTrkIdEvent(t, id), m_pc(pc), m_reason(reason)
+{
+}
+
+void TcfTrkRunControlContextSuspendedEvent::format(QTextStream &str) const
+{
+    str.setIntegerBase(16);
+    str << "RunControl: '" << idString()  << "' suspended at 0x"
+            << m_pc << ": '" << m_reason << "'.";
+    str.setIntegerBase(10);
+}
+
+QString TcfTrkRunControlContextSuspendedEvent::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    format(str);
+    return rc;
+}
+
+TcfTrkRunControlContextSuspendedEvent::Reason TcfTrkRunControlContextSuspendedEvent::reason() const
+{
+    if (m_reason == sharedLibrarySuspendReasonC)
+        return ModuleLoad;
+    if (m_reason == "Breakpoint")
+        return BreakPoint;
+    // 'Data abort exception'/'Thread has panicked' ... unfortunately somewhat unspecific.
+    if (m_reason.contains("exception") || m_reason.contains("panick"))
+        return Crash;
+    return Other;
+}
+
+TcfTrkRunControlModuleLoadContextSuspendedEvent::TcfTrkRunControlModuleLoadContextSuspendedEvent(const QByteArray &id,
+                                                                                                 const QByteArray &reason,
+                                                                                                 quint64 pc,
+                                                                                                 const ModuleLoadEventInfo &mi) :
+    TcfTrkRunControlContextSuspendedEvent(RunControlModuleLoadSuspended, id, reason, pc),
+    m_mi(mi)
+{
+}
+
+QString TcfTrkRunControlModuleLoadContextSuspendedEvent::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    TcfTrkRunControlContextSuspendedEvent::format(str);
+    str <<  ' ';
+    m_mi.format(str);
+    return rc;
+}
+
+
+} // namespace tcftrk
Index: trunk/tools/runonphone/symbianutils/tcftrkmessage.h
===================================================================
--- trunk/tools/runonphone/symbianutils/tcftrkmessage.h	(revision 846)
+++ trunk/tools/runonphone/symbianutils/tcftrkmessage.h	(revision 846)
@@ -0,0 +1,296 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TRCFTRKMESSAGE_H
+#define TRCFTRKMESSAGE_H
+
+#include "symbianutils_global.h"
+
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+
+QT_BEGIN_NAMESPACE
+class QTextStream;
+QT_END_NAMESPACE
+
+namespace tcftrk {
+
+class JsonValue;
+class JsonInputStream;
+
+enum Services {
+    LocatorService,
+    RunControlService,
+    ProcessesService,
+    MemoryService,
+    SettingsService,  // non-standard, trk specific
+    BreakpointsService,
+    RegistersService,
+    SimpleRegistersService, // non-standard, trk specific
+    UnknownService
+}; // Note: Check string array 'serviceNamesC' of same size when modifying this.
+
+// Modes of RunControl/'Resume' (see EDF documentation).
+// As of 24.6.2010, RM_RESUME, RM_STEP_OVER, RM_STEP_INTO,
+// RM_STEP_OVER_RANGE, RM_STEP_INTO_RANGE are supported with
+// RANG_START/RANGE_END parameters.
+enum RunControlResumeMode {
+    RM_RESUME = 0,
+    RM_STEP_OVER = 1, RM_STEP_INTO = 2,
+    RM_STEP_OVER_LINE = 3, RM_STEP_INTO_LINE = 4,
+    RM_STEP_OUT = 5, RM_REVERSE_RESUME = 6,
+    RM_REVERSE_STEP_OVER = 7, RM_REVERSE_STEP_INTO = 8,
+    RM_REVERSE_STEP_OVER_LINE = 9, RM_REVERSE_STEP_INTO_LINE = 10,
+    RM_REVERSE_STEP_OUT = 11, RM_STEP_OVER_RANGE = 12,
+    RM_STEP_INTO_RANGE = 13, RM_REVERSE_STEP_OVER_RANGE = 14,
+    RM_REVERSE_STEP_INTO_RANGE = 15
+};
+
+SYMBIANUTILS_EXPORT const char *serviceName(Services s);
+SYMBIANUTILS_EXPORT Services serviceFromName(const char *);
+
+// Debug helpers
+SYMBIANUTILS_EXPORT QString formatData(const QByteArray &a);
+SYMBIANUTILS_EXPORT QString joinByteArrays(const QVector<QByteArray> &a, char sep = ',');
+
+// Context used in 'RunControl contextAdded' events and in reply
+// to 'Processes start'. Could be thread or process.
+struct SYMBIANUTILS_EXPORT RunControlContext {
+    enum Flags {
+        Container = 0x1, HasState = 0x2, CanSuspend = 0x4,
+        CanTerminate = 0x8
+    };
+    enum Type { Process, Thread };
+
+    RunControlContext();
+    Type type() const;
+    unsigned processId() const;
+    unsigned threadId() const;
+
+    void clear();
+    bool parse(const JsonValue &v);
+    void format(QTextStream &str) const;
+    QString toString() const;
+
+    // Helper for converting the TCF ids ("p12" or "p12.t34")
+    static Type typeFromTcfId(const QByteArray &id);
+    static unsigned processIdFromTcdfId(const QByteArray &id);
+    static unsigned threadIdFromTcdfId(const QByteArray &id);
+    static QByteArray tcfId(unsigned processId,  unsigned threadId = 0);
+
+    unsigned flags;
+    unsigned resumeFlags;
+    QByteArray id;     // "p434.t699"
+    QByteArray osid;   // Non-standard: Process or thread id
+    QByteArray parentId; // Parent process id of a thread.
+};
+
+// Module load information occurring with 'RunControl contextSuspended' events
+struct SYMBIANUTILS_EXPORT ModuleLoadEventInfo {
+    ModuleLoadEventInfo();
+    void clear();
+    bool parse(const JsonValue &v);
+    void format(QTextStream &str) const;
+
+    QByteArray name;
+    QByteArray file;
+    bool loaded;
+    quint64 codeAddress;
+    quint64 dataAddress;
+    bool requireResume;
+};
+
+// Breakpoint as supported by TcfTrk source June 2010
+// TODO: Add watchpoints,etc once they are implemented
+struct SYMBIANUTILS_EXPORT Breakpoint {
+    enum Type { Software, Hardware, Auto };
+
+    explicit Breakpoint(quint64 loc = 0);
+    void setContextId(unsigned processId, unsigned threadId = 0);
+    QString toString() const;
+
+    static QByteArray idFromLocation(quint64 loc); // Automagically determine from location
+
+    Type type;
+    bool enabled;
+    int ignoreCount;
+    QVector<QByteArray> contextIds;   // Process or thread ids.
+    QByteArray id;                    // Id of the breakpoint;
+    quint64 location;
+    unsigned size;
+    bool thumb;
+};
+
+SYMBIANUTILS_EXPORT JsonInputStream &operator<<(JsonInputStream &str, const Breakpoint &b);
+
+// Event hierarchy
+class SYMBIANUTILS_EXPORT TcfTrkEvent {
+    Q_DISABLE_COPY(TcfTrkEvent)
+public:
+    enum Type { None,
+                LocatorHello,
+                RunControlContextAdded,
+                RunControlContextRemoved,
+                RunControlSuspended,
+                RunControlBreakpointSuspended,
+                RunControlModuleLoadSuspended,
+                RunControlResumed
+              };
+
+    virtual ~TcfTrkEvent();
+
+    Type type() const;
+    virtual QString toString() const;
+
+    static TcfTrkEvent *parseEvent(Services s, const QByteArray &name, const QVector<JsonValue> &val);
+
+protected:
+    explicit TcfTrkEvent(Type type = None);
+
+private:
+    const Type m_type;
+};
+
+// ServiceHello
+class SYMBIANUTILS_EXPORT TcfTrkLocatorHelloEvent : public TcfTrkEvent {
+public:
+    explicit TcfTrkLocatorHelloEvent(const QStringList &);
+
+    const QStringList &services() { return m_services; }
+    virtual QString toString() const;
+
+private:
+    QStringList m_services;
+};
+
+// Base for events that just have one id as parameter
+// (simple suspend)
+class SYMBIANUTILS_EXPORT TcfTrkIdEvent : public TcfTrkEvent {
+protected:
+    explicit TcfTrkIdEvent(Type t, const QByteArray &id);
+public:
+    QByteArray id() const { return m_id; }
+    QString idString() const { return QString::fromUtf8(m_id); }
+
+private:
+    const QByteArray m_id;
+};
+
+// Base for events that just have some ids as parameter
+// (context removed)
+class SYMBIANUTILS_EXPORT TcfTrkIdsEvent : public TcfTrkEvent {
+protected:
+    explicit TcfTrkIdsEvent(Type t, const QVector<QByteArray> &ids);
+
+public:
+    QVector<QByteArray> ids() const { return m_ids; }
+    QString joinedIdString(const char sep = ',') const;
+
+private:
+    const QVector<QByteArray> m_ids;
+};
+
+// RunControlContextAdded
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextAddedEvent : public TcfTrkEvent {
+public:
+    typedef QVector<RunControlContext> RunControlContexts;
+
+    explicit TcfTrkRunControlContextAddedEvent(const RunControlContexts &c);
+
+    const RunControlContexts &contexts() const { return m_contexts; }
+    virtual QString toString() const;
+
+    static TcfTrkRunControlContextAddedEvent *parseEvent(const QVector<JsonValue> &val);
+
+private:
+    const RunControlContexts m_contexts;
+};
+
+// RunControlContextRemoved
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextRemovedEvent : public TcfTrkIdsEvent {
+public:
+    explicit TcfTrkRunControlContextRemovedEvent(const QVector<QByteArray> &id);
+    virtual QString toString() const;
+};
+
+// Simple RunControlContextSuspended (process/thread)
+class SYMBIANUTILS_EXPORT TcfTrkRunControlContextSuspendedEvent : public TcfTrkIdEvent {
+public:
+    enum Reason  { BreakPoint, ModuleLoad, Crash, Other } ;
+
+    explicit TcfTrkRunControlContextSuspendedEvent(const QByteArray &id,
+                                                   const QByteArray &reason,
+                                                   quint64 pc = 0);
+    virtual QString toString() const;
+
+    quint64 pc() const { return m_pc; }
+    QByteArray reasonID() const { return m_reason; }
+    Reason reason() const;
+
+protected:
+    explicit TcfTrkRunControlContextSuspendedEvent(Type t,
+                                                   const QByteArray &id,
+                                                   const QByteArray &reason,
+                                                   quint64 pc = 0);
+    void format(QTextStream &str) const;
+
+private:
+    const quint64 m_pc;
+    const QByteArray m_reason;
+};
+
+// RunControlContextSuspended due to module load
+class SYMBIANUTILS_EXPORT TcfTrkRunControlModuleLoadContextSuspendedEvent : public TcfTrkRunControlContextSuspendedEvent {
+public:
+    explicit TcfTrkRunControlModuleLoadContextSuspendedEvent(const QByteArray &id,
+                                                             const QByteArray &reason,
+                                                             quint64 pc,
+                                                             const ModuleLoadEventInfo &mi);
+
+    virtual QString toString() const;
+    const ModuleLoadEventInfo &info() const { return m_mi; }
+
+private:
+    const ModuleLoadEventInfo m_mi;
+};
+
+} // namespace tcftrk
+#endif // TRCFTRKMESSAGE_H
Index: trunk/tools/runonphone/symbianutils/trkdevice.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/trkdevice.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/trkdevice.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -53,4 +53,5 @@
 #include <QtCore/QWaitCondition>
 #include <QtCore/QSharedPointer>
+#include <QtCore/QScopedPointer>
 #include <QtCore/QMetaType>
 
@@ -103,4 +104,9 @@
 enum { verboseTrk = 0 };
 
+static inline QString msgAccessingClosedDevice(const QString &msg)
+{
+    return QString::fromLatin1("Error: Attempt to access device '%1', which is closed.").arg(msg);
+}
+
 namespace trk {
 
@@ -156,8 +162,9 @@
 
 class TrkWriteQueue
-{    
+{
     Q_DISABLE_COPY(TrkWriteQueue)
 public:
     explicit TrkWriteQueue();
+    void clear();
 
     // Enqueue messages.
@@ -209,4 +216,15 @@
 }
 
+void TrkWriteQueue::clear()
+{
+    m_trkWriteToken = 0;
+    m_trkWriteBusy = false;
+    m_trkWriteQueue.clear();
+    const int discarded = m_writtenTrkMessages.size();
+    m_writtenTrkMessages.clear();
+    if (verboseTrk)
+        qDebug() << "TrkWriteQueue::clear: discarded " << discarded;
+}
+
 byte TrkWriteQueue::nextTrkWriteToken()
 {
@@ -215,5 +233,5 @@
         ++m_trkWriteToken;
     if (verboseTrk)
-        qDebug() << "Write token: " << m_trkWriteToken;
+        qDebug() << "nextTrkWriteToken:" << m_trkWriteToken;
     return m_trkWriteToken;
 }
@@ -350,5 +368,5 @@
     Q_OBJECT
     Q_DISABLE_COPY(WriterThread)
-public:            
+public:
     explicit WriterThread(const QSharedPointer<DeviceContext> &context);
 
@@ -358,4 +376,6 @@
     void queueTrkInitialPing();
 
+    void clearWriteQueue();
+
     // Call this from the device read notification with the results.
     void slotHandleResult(const TrkResult &result);
@@ -375,5 +395,5 @@
     void invokeNoopMessage(const trk::TrkMessage &);
 
-private:    
+private:
     bool write(const QByteArray &data, QString *errorMessage);
     inline int writePendingMessage();
@@ -463,4 +483,5 @@
     wait();
     m_terminate = false;
+    m_queue.clear();
 }
 
@@ -562,4 +583,11 @@
 }
 
+void WriterThread::clearWriteQueue()
+{
+    m_dataMutex.lock();
+    m_queue.clear();
+    m_dataMutex.unlock();
+}
+
 void WriterThread::queueTrkInitialPing()
 {
@@ -593,4 +621,6 @@
 public:
 
+    int bytesPending() const { return m_trkReadBuffer.size(); }
+
 signals:
     void messageReceived(const trk::TrkResult &result, const QByteArray &rawData);
@@ -607,8 +637,9 @@
 
     QByteArray m_trkReadBuffer;
+    bool linkEstablishmentMode;
 };
 
 ReaderThreadBase::ReaderThreadBase(const QSharedPointer<DeviceContext> &context) :
-    m_context(context)
+    m_context(context), linkEstablishmentMode(true)
 {
     static const int trkResultMetaId = qRegisterMetaType<trk::TrkResult>();
@@ -633,5 +664,5 @@
     TrkResult r;
     QByteArray rawData;
-    while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, &rawData)) {
+    while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, linkEstablishmentMode, &rawData)) {
         emit messageReceived(r, rawData);
     }
@@ -693,5 +724,5 @@
         emit error(QString::fromLatin1("ClearCommError failed: %1").arg(winErrorMessage(GetLastError())));
         return -7;
-    }    
+    }
     const DWORD bytesToRead = qMax(DWORD(1), qMin(comStat.cbInQue, DWORD(BufSize)));
     // Trigger read
@@ -709,5 +740,5 @@
         emit error(QString::fromLatin1("Read error: %1").arg(winErrorMessage(readError)));
         return -1;
-    }    
+    }
     // Wait for either termination or data
     const DWORD wr = WaitForMultipleObjects(HandleCount, m_handles, false, INFINITE);
@@ -784,5 +815,5 @@
 };
 
-UnixReaderThread::UnixReaderThread(const QSharedPointer<DeviceContext> &context) : 
+UnixReaderThread::UnixReaderThread(const QSharedPointer<DeviceContext> &context) :
     ReaderThreadBase(context)
 {
@@ -878,6 +909,6 @@
 
     QSharedPointer<DeviceContext> deviceContext;
-    QSharedPointer<WriterThread> writerThread;
-    QSharedPointer<ReaderThread> readerThread;
+    QScopedPointer<WriterThread> writerThread;
+    QScopedPointer<ReaderThread> readerThread;
 
     QByteArray trkReadBuffer;
@@ -918,12 +949,12 @@
 bool TrkDevice::open(QString *errorMessage)
 {
-    if (d->verbose)
+    if (d->verbose || verboseTrk)
         qDebug() << "Opening" << port() << "is open: " << isOpen() << " serialFrame=" << serialFrame();
+    if (isOpen())
+        return true;
     if (d->port.isEmpty()) {
         *errorMessage = QLatin1String("Internal error: No port set on TrkDevice");
         return false;
     }
-
-    close();
 #ifdef Q_OS_WIN
     const QString fullPort = QLatin1String("\\\\.\\") + d->port;
@@ -976,5 +1007,5 @@
     }
 #endif
-    d->readerThread = QSharedPointer<ReaderThread>(new ReaderThread(d->deviceContext));
+    d->readerThread.reset(new ReaderThread(d->deviceContext));
     connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)),
             Qt::QueuedConnection);
@@ -984,11 +1015,11 @@
     d->readerThread->start();
 
-    d->writerThread = QSharedPointer<WriterThread>(new WriterThread(d->deviceContext));
+    d->writerThread.reset(new WriterThread(d->deviceContext));
     connect(d->writerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)),
-            Qt::QueuedConnection);    
-    d->writerThread->start();    
-
-    if (d->verbose)
-        qDebug() << "Opened" << d->port;
+            Qt::QueuedConnection);
+    d->writerThread->start();
+
+    if (d->verbose || verboseTrk)
+        qDebug() << "Opened" << d->port << d->readerThread.data() << d->writerThread.data();
     return true;
 }
@@ -996,4 +1027,8 @@
 void TrkDevice::close()
 {
+    if (verboseTrk)
+        qDebug() << "close" << d->port << " is open: " << isOpen()
+        << " read pending " << (d->readerThread.isNull() ? 0 : d->readerThread->bytesPending())
+        << sender();
     if (!isOpen())
         return;
@@ -1011,4 +1046,5 @@
     d->deviceContext->file.close();
 #endif
+
     if (d->verbose)
         emitLogMessage("Close");
@@ -1031,4 +1067,6 @@
 void TrkDevice::setPort(const QString &p)
 {
+    if (verboseTrk)
+        qDebug() << "setPort" << p;
     d->port = p;
 }
@@ -1046,4 +1084,6 @@
 void TrkDevice::setSerialFrame(bool f)
 {
+    if (verboseTrk)
+        qDebug() << "setSerialFrame" << f;
     d->deviceContext->serialFrame = f;
 }
@@ -1061,10 +1101,12 @@
 void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData)
 {
-    d->writerThread->slotHandleResult(result);
-    if (d->verbose > 1)
-        qDebug() << "Received: " << result.toString();
-    emit messageReceived(result);    
-    if (!rawData.isEmpty())
-        emit rawDataReceived(rawData);
+    if (isOpen()) { // Might receive bytes after closing due to queued connections.
+        d->writerThread->slotHandleResult(result);
+        if (d->verbose > 1)
+            qDebug() << "Received: " << result.toString();
+        emit messageReceived(result);
+        if (!rawData.isEmpty())
+            emit rawDataReceived(rawData);
+    }
 }
 
@@ -1076,13 +1118,25 @@
 }
 
+void TrkDevice::clearWriteQueue()
+{
+    if (isOpen())
+        d->writerThread->clearWriteQueue();
+}
+
 void TrkDevice::sendTrkMessage(byte code, TrkCallback callback,
      const QByteArray &data, const QVariant &cookie)
 {
+    if (!isOpen()) {
+        emitError(msgAccessingClosedDevice(d->port));
+        return;
+    }
     if (!d->writerThread.isNull()) {
         if (d->verbose > 1) {
-            QByteArray msg = "Sending:  ";
+            QByteArray msg = "Sending:  0x";
             msg += QByteArray::number(code, 16);
             msg += ": ";
             msg += stringFromArray(data).toLatin1();
+            if (cookie.isValid())
+                msg += " Cookie: " + cookie.toString().toLatin1();
             qDebug("%s", msg.data());
         }
@@ -1093,4 +1147,8 @@
 void TrkDevice::sendTrkInitialPing()
 {
+    if (!isOpen()) {
+        emitError(msgAccessingClosedDevice(d->port));
+        return;
+    }
     if (!d->writerThread.isNull())
         d->writerThread->queueTrkInitialPing();
@@ -1099,4 +1157,8 @@
 bool TrkDevice::sendTrkAck(byte token)
 {
+    if (!isOpen()) {
+        emitError(msgAccessingClosedDevice(d->port));
+        return false;
+    }
     if (d->writerThread.isNull())
         return false;
Index: trunk/tools/runonphone/symbianutils/trkdevice.h
===================================================================
--- trunk/tools/runonphone/symbianutils/trkdevice.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/trkdevice.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -65,10 +65,12 @@
  * read operation.
  * The serialFrames property specifies whether packets are encapsulated in
- * "0x90 <length>" frames, which is currently the case for serial ports. 
+ * "0x90 <length>" frames, which is currently the case for serial ports.
  * Contains a write message queue allowing
  * for queueing messages with a notification callback. If the message receives
  * an ACK, the callback is invoked.
- * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronisation.
- * The respective  message will not be sent, the callback is just invoked. */
+ * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronization.
+ * The respective  message will not be sent, the callback is just invoked.
+ * Note that calling open/close in quick succession can cause crashes
+ * due to the use of queused signals. */
 
 enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f };
@@ -112,4 +114,7 @@
     bool sendTrkAck(unsigned char token);
 
+public slots:
+    void clearWriteQueue();
+
 signals:
     void messageReceived(const trk::TrkResult &result);
Index: trunk/tools/runonphone/symbianutils/trkutils.cpp
===================================================================
--- trunk/tools/runonphone/symbianutils/trkutils.cpp	(revision 769)
+++ trunk/tools/runonphone/symbianutils/trkutils.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -52,4 +52,23 @@
 
 namespace trk {
+
+Library::Library() : codeseg(0), dataseg(0), pid(0)
+{
+}
+
+Library::Library(const TrkResult &result) : codeseg(0), dataseg(0), pid(0)
+{
+    if (result.data.size() < 20) {
+        qWarning("Invalid trk creation notification received.");
+        return;
+    }
+
+    const char *data = result.data.constData();
+    pid = extractInt(data + 2);
+    codeseg = extractInt(data + 10);
+    dataseg = extractInt(data + 14);
+    const uint len = extractShort(data + 18);
+    name = result.data.mid(20, len);
+}
 
 TrkAppVersion::TrkAppVersion()
@@ -78,9 +97,9 @@
     extended2TypeSize = 0;
     pid = 0;
+    mainTid = 0;
     tid = 0;
     codeseg = 0;
     dataseg = 0;
 
-    currentThread = 0;
     libraries.clear();
     trkAppVersion.reset();
@@ -144,4 +163,88 @@
 }
 
+QByteArray Session::gdbLibraryList() const
+{
+    const int count = libraries.size();
+    QByteArray response = "l<library-list>";
+    for (int i = 0; i != count; ++i) {
+        const trk::Library &lib = libraries.at(i);
+        response += "<library name=\"";
+        response += lib.name;
+        response += "\">";
+        response += "<section address=\"0x";
+        response += trk::hexNumber(lib.codeseg);
+        response += "\"/>";
+        response += "<section address=\"0x";
+        response += trk::hexNumber(lib.dataseg);
+        response += "\"/>";
+        response += "<section address=\"0x";
+        response += trk::hexNumber(lib.dataseg);
+        response += "\"/>";
+        response += "</library>";
+    }
+    response += "</library-list>";
+    return response;
+}
+
+QByteArray Session::gdbQsDllInfo(int start, int count) const
+{
+    // Happens with  gdb 6.4.50.20060226-cvs / CodeSourcery.
+    // Never made it into FSF gdb that got qXfer:libraries:read instead.
+    // http://sourceware.org/ml/gdb/2007-05/msg00038.html
+    // Name=hexname,TextSeg=textaddr[,DataSeg=dataaddr]
+    const int libraryCount = libraries.size();
+    const int end = count < 0 ? libraryCount : qMin(libraryCount, start + count);
+    QByteArray response(1, end == libraryCount ? 'l' : 'm');
+    for (int i = start; i < end; ++i) {
+        if (i != start)
+            response += ';';
+        const Library &lib = libraries.at(i);
+        response += "Name=";
+        response += lib.name.toHex();
+        response += ",TextSeg=";
+        response += hexNumber(lib.codeseg);
+        response += ",DataSeg=";
+        response += hexNumber(lib.dataseg);
+    }
+    return response;
+}
+
+QString Session::toString() const
+{
+    QString rc;
+    QTextStream str(&rc);
+    str << "Session: " << deviceDescription(false) << '\n'
+            << "pid: " << pid <<  "main thread: " << mainTid
+            << " current thread: " << tid << ' ';
+    str.setIntegerBase(16);
+    str << " code: 0x" << codeseg << " data: 0x" << dataseg << '\n';
+    if (const int libCount = libraries.size()) {
+        str << "Libraries:\n";
+        for (int i = 0; i < libCount; i++)
+            str << " #" << i << ' ' << libraries.at(i).name
+                << " code: 0x" << libraries.at(i).codeseg
+                << " data: 0x" << libraries.at(i).dataseg << '\n';
+    }
+    if (const int moduleCount = modules.size()) {
+        str << "Modules:\n";
+        for (int i = 0; i < moduleCount; i++)
+            str << " #" << i << ' ' << modules.at(i) << '\n';
+    }
+    str.setIntegerBase(10);
+    if (!addressToBP.isEmpty()) {
+        typedef QHash<uint, uint>::const_iterator BP_ConstIterator;
+        str << "Breakpoints:\n";
+        const BP_ConstIterator cend = addressToBP.constEnd();
+        for (BP_ConstIterator it = addressToBP.constBegin(); it != cend; ++it) {
+            str.setIntegerBase(16);
+            str << "  0x" << it.key();
+            str.setIntegerBase(10);
+            str << ' ' << it.value() << '\n';
+        }
+    }
+
+    return rc;
+}
+
 // --------------
 
@@ -189,16 +292,13 @@
     const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen);
     for (int i = 0; i < size; ++i) {
-        //if (i == 5 || i == ba.size() - 2)
-        //    str += "  ";
-        int c = byte(ba.at(i));
-        str += QString("%1 ").arg(c, 2, 16, QChar('0'));
-        if (i >= 8 && i < ba.size() - 2)
-            ascii += QChar(c).isPrint() ? QChar(c) : QChar('.');
+        const int c = byte(ba.at(i));
+        str += QString::fromAscii("%1 ").arg(c, 2, 16, QChar('0'));
+        ascii += QChar(c).isPrint() ? QChar(c) : QChar('.');
     }
     if (size != ba.size()) {
-        str += "...";
-        ascii += "...";
-    }
-    return str + "  " + ascii;
+        str += QLatin1String("...");
+        ascii += QLatin1String("...");
+    }
+    return str + QLatin1String("  ") + ascii;
 }
 
@@ -277,5 +377,5 @@
 /* returns 0 if array doesn't represent a result,
 otherwise returns the length of the result data */
-ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame)
+ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame, ushort& mux)
 {
     if (serialFrame) {
@@ -283,6 +383,5 @@
         if (buffer.length() < 4)
             return 0;
-        if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90)
-            return 0;
+        mux = extractShort(buffer.data());
         const ushort len = extractShort(buffer.data() + 2);
         return (buffer.size() >= len + 4) ? len : ushort(0);
@@ -293,4 +392,5 @@
     // Regular message delimited by 0x7e..0x7e
     if (firstDelimiterPos == 0) {
+        mux = MuxTrk;
         const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1);
         return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0;
@@ -300,19 +400,28 @@
 }
 
-bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByteArray *rawData)
+bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, bool &linkEstablishmentMode, QByteArray *rawData)
 {
     result->clear();
     if(rawData)
         rawData->clear();
-    const ushort len = isValidTrkResult(*buffer, serialFrame);
+    ushort len = isValidTrkResult(*buffer, serialFrame, result->multiplex);
+    // handle receiving application output, which is not a regular command
+    const int delimiterPos = serialFrame ? 4 : 0;
+    if (linkEstablishmentMode) {
+        //when "hot connecting" a device, we can receive partial frames.
+        //this code resyncs by discarding data until a TRK frame is found
+        while (buffer->length() > delimiterPos
+               && result->multiplex != MuxTextTrace
+               && !(result->multiplex == MuxTrk && buffer->at(delimiterPos) == 0x7e)) {
+            buffer->remove(0,1);
+            len = isValidTrkResult(*buffer, serialFrame, result->multiplex);
+        }
+    }
     if (!len)
         return false;
-    // handle receiving application output, which is not a regular command
-    const int delimiterPos = serialFrame ? 4 : 0;
     if (buffer->at(delimiterPos) != 0x7e) {
         result->isDebugOutput = true;
         result->data = buffer->mid(delimiterPos, len);
-        result->data.replace("\r\n", "\n");
-        *buffer->remove(0, delimiterPos + len);
+        buffer->remove(0, delimiterPos + len);
         return true;
     }
@@ -322,5 +431,5 @@
     if(rawData)
         *rawData = data;
-    *buffer->remove(0, delimiterPos + len);
+    buffer->remove(0, delimiterPos + len);
 
     byte sum = 0;
@@ -337,4 +446,5 @@
     //QByteArray prefix = "READ BUF:                                       ";
     //logMessage((prefix + "HEADER: " + stringFromArray(header).toLatin1()).data());
+    linkEstablishmentMode = false; //have received a good TRK packet, therefore in sync
     return true;
 }
@@ -351,4 +461,17 @@
     res *= 256; res += byte(data[2]);
     res *= 256; res += byte(data[3]);
+    return res;
+}
+
+SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data)
+{
+    quint64 res = byte(data[0]);
+    res <<= 8; res += byte(data[1]);
+    res <<= 8; res += byte(data[2]);
+    res <<= 8; res += byte(data[3]);
+    res <<= 8; res += byte(data[4]);
+    res <<= 8; res += byte(data[5]);
+    res <<= 8; res += byte(data[6]);
+    res <<= 8; res += byte(data[7]);
     return res;
 }
Index: trunk/tools/runonphone/symbianutils/trkutils.h
===================================================================
--- trunk/tools/runonphone/symbianutils/trkutils.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/trkutils.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,5 @@
 
 #include "symbianutils_global.h"
+
 #include <QtCore/QByteArray>
 #include <QtCore/QHash>
@@ -56,33 +57,102 @@
 
 typedef unsigned char byte;
+struct TrkResult;
 
 enum Command {
+    //meta commands
     TrkPing = 0x00,
     TrkConnect = 0x01,
     TrkDisconnect = 0x02,
+    TrkReset = 0x03,
     TrkVersions = 0x04,
     TrkSupported = 0x05,
     TrkCpuType = 0x06,
+    TrkConfigTransport = 0x07,
+    TrkVersions2 = 0x08,
     TrkHostVersions = 0x09,
+
+    //state commands
+    TrkReadMemory = 0x10,
+    TrkWriteMemory = 0x11,
+    TrkReadRegisters = 0x12,
+    TrkWriteRegisters = 0x13,
+    TrkFillMemory = 0x14,
+    TrkCopyMemory = 0x15,
+    TrkFlushCache = 0x16,
+
+    //execution commands
     TrkContinue = 0x18,
+    TrkStep = 0x19,
+    TrkStop = 0x1a,
+    TrkSetBreak = 0x1b,
+    TrkClearBreak = 0x1c,
+    TrkDownload = 0x1d,
+    TrkModifyBreakThread = 0x1e,
+
+    //host -> target IO management
+    TrkNotifyFileInput = 0x20,
+    TrkBlockFileIo = 0x21,
+
+    //host -> target os commands
     TrkCreateItem = 0x40,
     TrkDeleteItem = 0x41,
+    TrkReadInfo = 0x42,
+    TrkWriteInfo = 0x43,
 
     TrkWriteFile = 0x48,
+    TrkReadFile = 0x49,
     TrkOpenFile = 0x4a,
     TrkCloseFile = 0x4b,
+    TrkPositionFile = 0x4c,
     TrkInstallFile = 0x4d,
     TrkInstallFile2 = 0x4e,
 
+    TrkPhoneSwVersion = 0x4f,
+    TrkPhoneName = 0x50,
+    TrkVersions3 = 0x51,
+
+    //replies
     TrkNotifyAck = 0x80,
     TrkNotifyNak = 0xff,
+
+    //target -> host notification
     TrkNotifyStopped = 0x90,
     TrkNotifyException = 0x91,
     TrkNotifyInternalError = 0x92,
+    TrkNotifyStopped2 = 0x94,
+
+    //target -> host OS notification
     TrkNotifyCreated = 0xa0,
     TrkNotifyDeleted = 0xa1,
     TrkNotifyProcessorStarted = 0xa2,
     TrkNotifyProcessorStandBy = 0xa6,
-    TrkNotifyProcessorReset = 0xa7
+    TrkNotifyProcessorReset = 0xa7,
+
+    //target -> host support commands (these are defined but not implemented in TRK)
+    TrkDSWriteFile = 0xd0,
+    TrkDSReadFile = 0xd1,
+    TrkDSOpenFile = 0xd2,
+    TrkDSCloseFile = 0xd3,
+    TrkDSPositionFile = 0xd4
+};
+
+enum DSOSItemTypes {
+    kDSOSProcessItem = 0x0000,
+    kDSOSThreadItem = 0x0001,
+    kDSOSDLLItem = 0x0002,
+    kDSOSAppItem = 0x0003,
+    kDSOSMemBlockItem = 0x0004,
+    kDSOSProcAttachItem = 0x0005,
+    kDSOSThreadAttachItem = 0x0006,
+    kDSOSProcAttach2Item = 0x0007,
+    kDSOSProcRunItem = 0x0008,
+    /* 0x0009 - 0x00ff reserved for general expansion */
+    /* 0x0100 - 0xffff available for target-specific use */
+};
+
+enum SerialMultiplexor {
+    MuxRaw = 0,
+    MuxTextTrace = 0x0102,
+    MuxTrk = 0x0190
 };
 
@@ -90,4 +160,5 @@
 SYMBIANUTILS_EXPORT ushort extractShort(const char *data);
 SYMBIANUTILS_EXPORT uint extractInt(const char *data);
+SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data);
 
 SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba);
@@ -109,9 +180,12 @@
 struct SYMBIANUTILS_EXPORT Library
 {
-    Library() {}
+    Library();
+    explicit Library(const TrkResult &r);
 
     QByteArray name;
     uint codeseg;
     uint dataseg;
+     //library addresses are valid for a given process (depending on memory model, they might be loaded at the same address in all processes or not)
+    uint pid;
 };
 
@@ -119,5 +193,5 @@
 {
     TrkAppVersion();
-    void reset();    
+    void reset();
 
     int trkMajor;
@@ -132,4 +206,9 @@
     void reset();
     QString deviceDescription(unsigned verbose) const;
+    QString toString() const;
+    // Answer to qXfer::libraries
+    QByteArray gdbLibraryList() const;
+    // Answer to qsDllInfo, can be sent chunk-wise.
+    QByteArray gdbQsDllInfo(int start = 0, int count = -1) const;
 
     // Trk feedback
@@ -143,4 +222,5 @@
     TrkAppVersion trkAppVersion;
     uint pid;
+    uint mainTid;
     uint tid;
     uint codeseg;
@@ -151,10 +231,5 @@
     Libraries libraries;
 
-    typedef uint Thread;
-    typedef QList<Thread> Threads;
-    Threads threads;
-
     // Gdb request
-    uint currentThread;
     QStringList modules;
 };
@@ -169,4 +244,5 @@
     QString errorString() const;
 
+    ushort multiplex;
     byte code;
     byte token;
Index: trunk/tools/runonphone/symbianutils/trkutils_p.h
===================================================================
--- trunk/tools/runonphone/symbianutils/trkutils_p.h	(revision 769)
+++ trunk/tools/runonphone/symbianutils/trkutils_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -56,5 +56,5 @@
 // the serial frame [0x01 0x90 <len>] and 0x7e encoded7d(ba) 0x7e
 QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame);
-bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0);
+bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, bool& linkEstablishmentMode, QByteArray *rawData = 0);
 
 } // namespace trk
Index: trunk/tools/runonphone/trksignalhandler.cpp
===================================================================
--- trunk/tools/runonphone/trksignalhandler.cpp	(revision 769)
+++ trunk/tools/runonphone/trksignalhandler.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -43,5 +43,17 @@
 #include <QCoreApplication>
 #include <QObject>
+#include <QFile>
+#include <QDir>
 #include "trksignalhandler.h"
+#include "trkutils.h"
+
+class CrashState
+{
+public:
+    uint pid;
+    uint tid;
+    QString crashReason;
+    uint crashPC;
+};
 
 class TrkSignalHandlerPrivate
@@ -55,4 +67,13 @@
     QTextStream err;
     int loglevel;
+    int lastpercent;
+    QList<trk::Library> libraries;
+    QFile crashlogtextfile;
+    QFile crashstackfile;
+    QList<CrashState> queuedCrashes;
+    QList<int> dyingThreads;
+    QString crashlogPath;
+    bool crashlog;
+    bool terminateNeeded;
 };
 
@@ -108,4 +129,5 @@
 void TrkSignalHandler::applicationRunning(uint pid)
 {
+    Q_UNUSED(pid)
     if (d->loglevel > 0)
         d->out << "Running..." << endl;
@@ -132,5 +154,10 @@
 {
     if (d->loglevel > 0) {
-        d->out << percent << "% ";
+        if (d->lastpercent == 0)
+            d->out << "[                                                 ]\r[" << flush;
+        while (percent > d->lastpercent) {
+            d->out << QLatin1Char('#');
+            d->lastpercent+=2; //because typical console is 80 chars wide
+        }
         d->out.flush();
         if (percent==100)
@@ -150,11 +177,161 @@
 }
 
+void TrkSignalHandler::setCrashLogging(bool enabled)
+{
+    d->crashlog = enabled;
+}
+
+void TrkSignalHandler::setCrashLogPath(QString path)
+{
+    d->crashlogPath = path;
+}
+
+bool lessThanCodeBase(const trk::Library& cs1, const trk::Library& cs2)
+{
+    return cs1.codeseg < cs2.codeseg;
+}
+
 void TrkSignalHandler::stopped(uint pc, uint pid, uint tid, const QString& reason)
 {
     d->err << "STOPPED: pc=" << hex << pc << " pid=" << pid
            << " tid=" << tid << dec << " - " << reason << endl;
-    // if it was a breakpoint, then we could continue with "emit resume(pid, tid);"
-    // since we have set no breakpoints, it will be a just in time debug of a panic / exception
-    emit terminate();
+
+    if (d->crashlog) {
+        CrashState cs;
+        cs.pid = pid;
+        cs.tid = tid;
+        cs.crashPC = pc;
+        cs.crashReason = reason;
+
+        if (d->dyingThreads.contains(tid)) {
+            if(d->queuedCrashes.isEmpty())
+                emit terminate();
+            else
+                d->terminateNeeded = true;
+        } else {
+            d->queuedCrashes.append(cs);
+            d->dyingThreads.append(tid);
+
+            if (d->queuedCrashes.count() == 1) {
+                d->err << "Fetching registers and stack..." << endl;
+                emit getRegistersAndCallStack(pid, tid);
+            }
+        }
+    }
+    else
+        emit terminate();
+}
+
+void TrkSignalHandler::registersAndCallStackReadComplete(const QList<uint>& registers, const QByteArray& stack)
+{
+    CrashState cs = d->queuedCrashes.first();
+    QDir dir(d->crashlogPath);
+    d->crashlogtextfile.setFileName(dir.filePath(QString("d_exc_%1.txt").arg(cs.tid)));
+    d->crashstackfile.setFileName(dir.filePath(QString("d_exc_%1.stk").arg(cs.tid)));
+    d->crashlogtextfile.open(QIODevice::WriteOnly);
+    QTextStream crashlog(&d->crashlogtextfile);
+
+    crashlog << "-----------------------------------------------------------------------------" << endl;
+    crashlog << "EKA2 USER CRASH LOG" << endl;
+    crashlog << "Thread Name: " << QString("ProcessID-%1::ThreadID-%2").arg(cs.pid).arg(cs.tid) << endl;
+    crashlog << "Thread ID: " << cs.tid << endl;
+    //this is wrong, but TRK doesn't make stack limit available so we lie
+    crashlog << QString("User Stack %1-%2").arg(registers.at(13), 8, 16, QChar('0')).arg(registers.at(13) + stack.size(), 8, 16, QChar('0')) << endl;
+    //this is also wrong, but TRK doesn't give all information for exceptions
+    crashlog << QString("Panic: PC=%1 ").arg(cs.crashPC, 8, 16, QChar('0')) << cs.crashReason << endl;
+    crashlog << endl;
+    crashlog << "USER REGISTERS:" << endl;
+    crashlog << QString("CPSR=%1").arg(registers.at(16), 8, 16, QChar('0')) << endl;
+    for (int i=0;i<16;i+=4) {
+        crashlog << QString("r%1=%2 %3 %4 %5")
+            .arg(i, 2, 10, QChar('0'))
+            .arg(registers.at(i), 8, 16, QChar('0'))
+            .arg(registers.at(i+1), 8, 16, QChar('0'))
+            .arg(registers.at(i+2), 8, 16, QChar('0'))
+            .arg(registers.at(i+3), 8, 16, QChar('0')) << endl;
+    }
+    crashlog << endl;
+
+    //emit info for post mortem debug
+    qSort(d->libraries.begin(), d->libraries.end(), lessThanCodeBase);
+    d->err << "Code Segments:" << endl;
+    crashlog << "CODE SEGMENTS:" << endl;
+    for(int i=0; i<d->libraries.count(); i++) {
+        const trk::Library& seg = d->libraries.at(i);
+        if(seg.pid != cs.pid)
+            continue;
+        if (d->loglevel > 1) {
+            d->err << QString("Code: %1 Data: %2 Name: ")
+                .arg(seg.codeseg, 8, 16, QChar('0'))
+                .arg(seg.dataseg, 8, 16, QChar('0'))
+                << seg.name << endl;
+        }
+
+        //produce fake code segment end addresses since we don't get the real ones from TRK
+        uint end;
+        if (i+1 < d->libraries.count())
+            end = d->libraries.at(i+1).codeseg - 1;
+        else
+            end = 0xFFFFFFFF;
+
+        crashlog << QString("%1-%2 ")
+            .arg(seg.codeseg, 8, 16, QChar('0'))
+            .arg(end, 8, 16, QChar('0'))
+            << seg.name << endl;
+    }
+
+    d->crashlogtextfile.close();
+
+    if (d->loglevel > 1) {
+        d->err << "Registers:" << endl;
+        for (int i=0;i<16;i++) {
+            d->err << QString("R%1: %2 ").arg(i, 2, 10, QChar('0')).arg(registers.at(i), 8, 16, QChar('0'));
+            if (i % 4 == 3)
+                d->err << endl;
+        }
+        d->err << QString("CPSR: %1").arg(registers.at(16), 8, 16, QChar('0')) << endl;
+
+        d->err << "Stack:" << endl;
+        uint sp = registers.at(13);
+        for(int i=0; i<stack.size(); i+=16, sp+=16) {
+            d->err << QString("%1: ").arg(sp, 8, 16, QChar('0'));
+            d->err << trk::stringFromArray(stack.mid(i,16));
+            d->err << endl;
+        }
+    }
+    d->crashstackfile.open(QIODevice::WriteOnly);
+    d->crashstackfile.write(stack);
+    d->crashstackfile.close();
+
+    if (d->loglevel > 0)
+        d->err << "Crash logs saved to " << d->crashlogtextfile.fileName() << " & " << d->crashstackfile.fileName() << endl;
+
+    // resume the thread to allow Symbian OS to handle the panic normally.
+    // terminate when a non main thread is suspended reboots the phone (TRK bug)
+    emit resume(cs.pid, cs.tid);
+
+    //fetch next crashed thread
+    d->queuedCrashes.removeFirst();
+    if (d->queuedCrashes.count()) {
+        cs = d->queuedCrashes.first();
+        d->err << "Fetching registers and stack..." << endl;
+        emit getRegistersAndCallStack(cs.pid, cs.tid);
+    }
+    else if (d->terminateNeeded)
+        emit terminate();
+
+}
+
+void TrkSignalHandler::libraryLoaded(const trk::Library &lib)
+{
+    d->libraries << lib;
+}
+
+void TrkSignalHandler::libraryUnloaded(const trk::Library &lib)
+{
+    for (QList<trk::Library>::iterator i = d->libraries.begin(); i != d->libraries.end(); i++) {
+        if((*i).name == lib.name && (*i).pid == lib.pid)
+            i = d->libraries.erase(i);
+    }
 }
 
@@ -168,5 +345,7 @@
     : out(stdout),
     err(stderr),
-    loglevel(0)
+    loglevel(0),
+    lastpercent(0),
+    terminateNeeded(false)
 {
 
Index: trunk/tools/runonphone/trksignalhandler.h
===================================================================
--- trunk/tools/runonphone/trksignalhandler.h	(revision 769)
+++ trunk/tools/runonphone/trksignalhandler.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -44,4 +44,5 @@
 #include <QObject>
 #include <QString>
+#include "symbianutils/trkutils.h"
 
 class TrkSignalHandlerPrivate;
@@ -67,11 +68,18 @@
     void stopped(uint pc, uint pid, uint tid, const QString& reason);
     void timeout();
+    void libraryLoaded(const trk::Library &lib);
+    void libraryUnloaded(const trk::Library &lib);
+    void registersAndCallStackReadComplete(const QList<uint>& registers, const QByteArray& stack);
 signals:
     void resume(uint pid, uint tid);
+    void stop(uint pid, uint tid);
     void terminate();
+    void getRegistersAndCallStack(uint pid, uint tid);
 public:
     TrkSignalHandler();
     ~TrkSignalHandler();
     void setLogLevel(int);
+    void setCrashLogging(bool);
+    void setCrashLogPath(QString);
 private:
     TrkSignalHandlerPrivate *d;
Index: trunk/tools/shared/deviceskin/deviceskin.cpp
===================================================================
--- trunk/tools/shared/deviceskin/deviceskin.cpp	(revision 769)
+++ trunk/tools/shared/deviceskin/deviceskin.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/deviceskin/deviceskin.h
===================================================================
--- trunk/tools/shared/deviceskin/deviceskin.h	(revision 769)
+++ trunk/tools/shared/deviceskin/deviceskin.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/deviceskin/deviceskin.pri
===================================================================
--- trunk/tools/shared/deviceskin/deviceskin.pri	(revision 769)
+++ trunk/tools/shared/deviceskin/deviceskin.pri	(revision 846)
@@ -3,11 +3,8 @@
 SOURCES += $$PWD/deviceskin.cpp
 RESOURCES += $$PWD/skins/ClamshellPhone.qrc \
-    $$PWD/skins/PDAPhone.qrc \
     $$PWD/skins/SmartPhone2.qrc \
     $$PWD/skins/SmartPhone.qrc \
     $$PWD/skins/SmartPhoneWithButtons.qrc \
     $$PWD/skins/TouchscreenPhone.qrc \
-    $$PWD/skins/Trolltech-Keypad.qrc \
-    $$PWD/skins/Trolltech-Touchscreen.qrc \
     $$PWD/skins/PortableMedia.qrc \
     $$PWD/skins/S60-QVGA-Candybar.qrc \
Index: trunk/tools/shared/deviceskin/skins/PDAPhone.qrc
===================================================================
--- trunk/tools/shared/deviceskin/skins/PDAPhone.qrc	(revision 769)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/skins">
-    <file>PDAPhone.skin</file>
-</qresource>
-</RCC>
Index: trunk/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc
===================================================================
--- trunk/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc	(revision 769)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/skins">
-    <file>Trolltech-Keypad.skin</file>
-</qresource>
-</RCC>
Index: trunk/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc
===================================================================
--- trunk/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc	(revision 769)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/skins">
-    <file>Trolltech-Touchscreen.skin</file>
-</qresource>
-</RCC>
Index: trunk/tools/shared/findwidget/abstractfindwidget.cpp
===================================================================
--- trunk/tools/shared/findwidget/abstractfindwidget.cpp	(revision 769)
+++ trunk/tools/shared/findwidget/abstractfindwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/findwidget/abstractfindwidget.h
===================================================================
--- trunk/tools/shared/findwidget/abstractfindwidget.h	(revision 769)
+++ trunk/tools/shared/findwidget/abstractfindwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/findwidget/itemviewfindwidget.cpp
===================================================================
--- trunk/tools/shared/findwidget/itemviewfindwidget.cpp	(revision 769)
+++ trunk/tools/shared/findwidget/itemviewfindwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/findwidget/itemviewfindwidget.h
===================================================================
--- trunk/tools/shared/findwidget/itemviewfindwidget.h	(revision 769)
+++ trunk/tools/shared/findwidget/itemviewfindwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/findwidget/texteditfindwidget.cpp
===================================================================
--- trunk/tools/shared/findwidget/texteditfindwidget.cpp	(revision 769)
+++ trunk/tools/shared/findwidget/texteditfindwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/findwidget/texteditfindwidget.h
===================================================================
--- trunk/tools/shared/findwidget/texteditfindwidget.h	(revision 769)
+++ trunk/tools/shared/findwidget/texteditfindwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/fontpanel/fontpanel.cpp
===================================================================
--- trunk/tools/shared/fontpanel/fontpanel.cpp	(revision 769)
+++ trunk/tools/shared/fontpanel/fontpanel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -97,6 +97,10 @@
     rc.setPointSize(pointSize());
     const QString styleDescription = styleString();
-    rc.setItalic(m_fontDatabase.italic(family, styleDescription));
-
+    if (styleDescription.contains(QLatin1String("Italic")))
+        rc.setStyle(QFont::StyleItalic);
+    else if (styleDescription.contains(QLatin1String("Oblique")))
+        rc.setStyle(QFont::StyleOblique);
+    else
+        rc.setStyle(QFont::StyleNormal);
     rc.setBold(m_fontDatabase.bold(family, styleDescription));
 
Index: trunk/tools/shared/fontpanel/fontpanel.h
===================================================================
--- trunk/tools/shared/fontpanel/fontpanel.h	(revision 769)
+++ trunk/tools/shared/fontpanel/fontpanel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtcolorbutton.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtcolorbutton.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtcolorbutton.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtcolorbutton.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtcolorbutton.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtcolorbutton.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtcolorline.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtcolorline.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtcolorline.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtcolorline.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtcolorline.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtcolorline.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientdialog.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientdialog.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientdialog.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientdialog.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientdialog.ui
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientdialog.ui	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientdialog.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradienteditor.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradienteditor.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradienteditor.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradienteditor.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradienteditor.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradienteditor.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradienteditor.ui
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradienteditor.ui	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradienteditor.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientmanager.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientmanager.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientmanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientmanager.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientmanager.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientmanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopscontroller.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopsmodel.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientstopswidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientutils.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientutils.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientutils.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientutils.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientutils.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientutils.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientview.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientview.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientview.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientview.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientview.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientview.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.ui
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.ui	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientviewdialog.ui	(revision 846)
@@ -2,5 +2,5 @@
  <comment>*********************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientwidget.cpp
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientwidget.cpp	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientwidget.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtgradienteditor/qtgradientwidget.h
===================================================================
--- trunk/tools/shared/qtgradienteditor/qtgradientwidget.h	(revision 769)
+++ trunk/tools/shared/qtgradienteditor/qtgradientwidget.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qteditorfactory.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qteditorfactory.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qteditorfactory.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qteditorfactory.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qteditorfactory.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qteditorfactory.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertybrowser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertymanager.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertymanager.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -2400,13 +2400,21 @@
         return QString();
 
-    QLocale loc = it.value();
+    const QLocale loc = it.value();
 
     int langIdx = 0;
     int countryIdx = 0;
-    metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
-    QString str = tr("%1, %2")
-            .arg(metaEnumProvider()->languageEnumNames().at(langIdx))
-            .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx));
-    return str;
+    const QtMetaEnumProvider *me = metaEnumProvider();
+    me->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
+    if (langIdx < 0) {
+        qWarning("QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
+        return tr("<Invalid>");
+    }
+    const QString languageName = me->languageEnumNames().at(langIdx);
+    if (countryIdx < 0) {
+        qWarning("QtLocalePropertyManager::valueText: Unknown country %d for %s", loc.country(), qPrintable(languageName));
+        return languageName;
+    }
+    const QString countryName = me->countryEnumNames(loc.language()).at(countryIdx);
+    return tr("%1, %2").arg(languageName, countryName);
 }
 
@@ -2636,6 +2644,6 @@
         return QString();
     const QPoint v = it.value();
-    return QString(tr("(%1, %2)").arg(QString::number(v.x()))
-                                 .arg(QString::number(v.y())));
+    return tr("(%1, %2)").arg(QString::number(v.x()))
+                         .arg(QString::number(v.y()));
 }
 
@@ -2877,6 +2885,6 @@
     const QPointF v = it.value().val;
     const int dec =  it.value().decimals;
-    return QString(tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec))
-                                 .arg(QString::number(v.y(), 'f', dec)));
+    return tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec))
+                         .arg(QString::number(v.y(), 'f', dec));
 }
 
@@ -3197,6 +3205,6 @@
         return QString();
     const QSize v = it.value().val;
-    return QString(tr("%1 x %2").arg(QString::number(v.width()))
-                                .arg(QString::number(v.height())));
+    return tr("%1 x %2").arg(QString::number(v.width()))
+                        .arg(QString::number(v.height()));
 }
 
@@ -3562,6 +3570,6 @@
     const QSizeF v = it.value().val;
     const int dec = it.value().decimals;
-    return QString(tr("%1 x %2").arg(QString::number(v.width(), 'f', dec))
-                                .arg(QString::number(v.height(), 'f', dec)));
+    return tr("%1 x %2").arg(QString::number(v.width(), 'f', dec))
+                        .arg(QString::number(v.height(), 'f', dec));
 }
 
@@ -3955,8 +3963,8 @@
         return QString();
     const QRect v = it.value().val;
-    return QString(tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x()))
-                                .arg(QString::number(v.y()))
-                                .arg(QString::number(v.width()))
-                                .arg(QString::number(v.height())));
+    return tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x()))
+                                    .arg(QString::number(v.y()))
+                                    .arg(QString::number(v.width()))
+                                    .arg(QString::number(v.height()));
 }
 
Index: trunk/tools/shared/qtpropertybrowser/qtpropertymanager.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtpropertymanager.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtpropertymanager.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qttreepropertybrowser.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtvariantproperty.cpp
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtvariantproperty.cpp	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtvariantproperty.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qtpropertybrowser/qtvariantproperty.h
===================================================================
--- trunk/tools/shared/qtpropertybrowser/qtvariantproperty.h	(revision 769)
+++ trunk/tools/shared/qtpropertybrowser/qtvariantproperty.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qttoolbardialog/qttoolbardialog.cpp
===================================================================
--- trunk/tools/shared/qttoolbardialog/qttoolbardialog.cpp	(revision 769)
+++ trunk/tools/shared/qttoolbardialog/qttoolbardialog.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/qttoolbardialog/qttoolbardialog.h
===================================================================
--- trunk/tools/shared/qttoolbardialog/qttoolbardialog.h	(revision 769)
+++ trunk/tools/shared/qttoolbardialog/qttoolbardialog.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/shared/symbian/epocroot.cpp
===================================================================
--- trunk/tools/shared/symbian/epocroot.cpp	(revision 769)
+++ trunk/tools/shared/symbian/epocroot.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -40,11 +40,11 @@
 ****************************************************************************/
 
-#include <iostream>
-
 #include <QtCore/qdir.h>
 #include <QtCore/qxmlstream.h>
 
-#include "epocroot.h"
-#include "../windows/registry.h"
+#include "epocroot_p.h"
+#include "../windows/registry_p.h"
+
+QT_BEGIN_NAMESPACE
 
 // Registry key under which the location of the Symbian devices.xml file is
@@ -65,15 +65,5 @@
 static QString epocRootValue;
 
-#ifdef QT_BUILD_QMAKE
-std::ostream &operator<<(std::ostream &s, const QString &val) {
-    s << val.toLocal8Bit().data();
-    return s;
-}
-#else
-// Operator implemented in configureapp.cpp
-std::ostream &operator<<(std::ostream &s, const QString &val);
-#endif
-
-QString getDevicesXmlPath()
+static QString getDevicesXmlPath()
     {
     // Note that the following call will return a null string on platforms other
@@ -81,5 +71,5 @@
     // an alternative mechanism for retrieving the location of this file will
     // be required.
-    return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, SYMBIAN_SDKS_REG_SUBKEY);
+    return qt_readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY));
     }
 
@@ -88,10 +78,11 @@
  * If not, epocRootValue is set to an empty string and an error message is printed.
  */
-void checkEpocRootExists(const QString &source)
+static void checkEpocRootExists(const QString &source)
 {
     if (!epocRootValue.isEmpty()) {
         QDir dir(epocRootValue);
         if (!dir.exists()) {
-            std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl;
+            qWarning("Warning: %s is set to an invalid path: '%s'", qPrintable(source),
+                     qPrintable(epocRootValue));
             epocRootValue = QString();
         }
@@ -104,12 +95,8 @@
 static void fixEpocRoot(QString &path)
 {
-    path.replace("\\", "/");
-
-    if (path.size() > 1 && path[1] == QChar(':')) {
-        path = path.mid(2);
-    }
-
-    if (!path.size() || path[path.size()-1] != QChar('/')) {
-        path += QChar('/');
+    path.replace(QLatin1Char('\\'), QLatin1Char('/'));
+
+    if (!path.size() || path[path.size()-1] != QLatin1Char('/')) {
+        path += QLatin1Char('/');
     }
 }
@@ -118,11 +105,11 @@
  * Determine the epoc root for the currently active SDK.
  */
-QString epocRoot()
+QString qt_epocRoot()
 {
     if (epocRootValue.isEmpty()) {
         // 1. If environment variable EPOCROOT is set and points to an existent
         //    directory, this is returned.
-        epocRootValue = qgetenv("EPOCROOT");
-        checkEpocRootExists("EPOCROOT");
+        epocRootValue = QString::fromLocal8Bit(qgetenv("EPOCROOT").constData());
+        checkEpocRootExists(QLatin1String("EPOCROOT environment variable"));
 
         if (epocRootValue.isEmpty()) {
@@ -130,8 +117,6 @@
             //    file exists, it is parsed.
             QString devicesXmlPath = getDevicesXmlPath();
-            if (devicesXmlPath.isEmpty()) {
-                std::cerr << "Error: Symbian SDK registry key not found" << std::endl;
-            } else {
-                devicesXmlPath += "/devices.xml";
+            if (!devicesXmlPath.isEmpty()) {
+                devicesXmlPath += QLatin1String("/devices.xml");
                 QFile devicesFile(devicesXmlPath);
                 if (devicesFile.open(QIODevice::ReadOnly)) {
@@ -143,5 +128,5 @@
                     //    epocroot value points to an existent directory, this is returned.
 
-                    const QString epocDeviceValue = qgetenv("EPOCDEVICE");
+                    const QString epocDeviceValue = QString::fromLocal8Bit(qgetenv("EPOCDEVICE").constData());
                     bool epocDeviceFound = false;
 
@@ -149,24 +134,27 @@
                     while (!xml.atEnd()) {
                         xml.readNext();
-                        if (xml.isStartElement() && xml.name() == "devices") {
-                            if (xml.attributes().value("version") == "1.0") {
-                                while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
+                        if (xml.isStartElement() && xml.name() == QLatin1String("devices")) {
+                            if (xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0")) {
+                                while (!(xml.isEndElement() && xml.name() == QLatin1String("devices")) && !xml.atEnd()) {
                                     xml.readNext();
-                                    if (xml.isStartElement() && xml.name() == "device") {
-                                        const bool isDefault =  xml.attributes().value("default") == "yes";
-                                        const QString id = xml.attributes().value("id").toString();
-                                        const QString name =  xml.attributes().value("name").toString();
-                                        const bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue;
+                                    if (xml.isStartElement() && xml.name() == QLatin1String("device")) {
+                                        const bool isDefault = xml.attributes().value(QLatin1String("default")) == QLatin1String("yes");
+                                        const QString id = xml.attributes().value(QLatin1String("id")).toString();
+                                        const QString name = xml.attributes().value(QLatin1String("name")).toString();
+                                        const QString alias = xml.attributes().value(QLatin1String("alias")).toString();
+                                        bool epocDeviceMatch = QString(id + QLatin1String(":") + name) == epocDeviceValue;
+                                        if (!alias.isEmpty())
+                                            epocDeviceMatch |= alias == epocDeviceValue;
                                         epocDeviceFound |= epocDeviceMatch;
 
                                         if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) {
                                             // Found a matching device
-                                            while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
+                                            while (!(xml.isEndElement() && xml.name() == QLatin1String("device")) && !xml.atEnd()) {
                                                 xml.readNext();
-                                                if (xml.isStartElement() && xml.name() == "epocroot") {
+                                                if (xml.isStartElement() && xml.name() == QLatin1String("epocroot")) {
                                                     epocRootValue = xml.readElementText();
                                                     const QString deviceSource = epocDeviceValue.isEmpty()
-                                                        ? "default device"
-                                                        : "EPOCDEVICE (" + epocDeviceValue + ")";
+                                                        ? QLatin1String("default device")
+                                                        : QString(QLatin1String("EPOCDEVICE (") + epocDeviceValue + QLatin1String(")"));
                                                     checkEpocRootExists(deviceSource);
                                                 }
@@ -174,38 +162,37 @@
 
                                             if (epocRootValue.isEmpty())
-                                                xml.raiseError("No epocroot element found");
+                                                xml.raiseError(QLatin1String("No epocroot element found"));
                                         }
                                     }
                                 }
                             } else {
-                                xml.raiseError("Invalid 'devices' element version");
+                                xml.raiseError(QLatin1String("Invalid 'devices' element version"));
                             }
                         }
                     }
                     if (xml.hasError()) {
-                        std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl;
+                        qWarning("Warning: Error \"%s\" when parsing devices.xml",
+                                 qPrintable(xml.errorString()));
                     } else {
                         if (epocRootValue.isEmpty()) {
                             if (!epocDeviceValue.isEmpty()) {
                                 if (epocDeviceFound) {
-                                    std::cerr << "Error: missing or invalid epocroot attribute "
-                                              << "in device '" << epocDeviceValue << "'";
+                                    qWarning("Warning: Missing or invalid epocroot attribute in device '%s' in devices.xml.",
+                                             qPrintable(epocDeviceValue));
                                 } else {
-                                    std::cerr << "Error: no device matching EPOCDEVICE ("
-                                              << epocDeviceValue << ")";
+                                    qWarning("Warning: No device matching EPOCDEVICE (%s) in devices.xml.",
+                                             qPrintable(epocDeviceValue));
                                 }
                             } else {
                                 if (epocDeviceFound) {
-                                    std::cerr << "Error: missing or invalid epocroot attribute "
-                                              << "in default device";
+                                    qWarning("Warning: Missing or invalid epocroot attribute in default device in devices.xml.");
                                 } else {
-                                    std::cerr << "Error: no default device";
+                                    qWarning("Warning: No default device set in devices.xml.");
                                 }
                             }
-                            std::cerr << " found in devices.xml file." << std::endl;
                         }
                     }
                 } else {
-                    std::cerr << "Error: could not open file " << devicesXmlPath << std::endl;
+                    qWarning("Warning: Could not open file: '%s'.", qPrintable(devicesXmlPath));
                 }
             }
@@ -214,11 +201,15 @@
         if (epocRootValue.isEmpty()) {
             // 5. An empty string is returned.
-            std::cerr << "Error: failed to find epoc root" << std::endl
-                 << "Either" << std::endl
-                 << "    1. Set EPOCROOT environment variable to a valid value" << std::endl
-                 << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY
-                    " registry key is set, and then" << std::endl
-                 << "       a. Set EPOCDEVICE environment variable to a valid device" << std::endl
-                 << "    or b. Specify a default device in the devices.xml file." << std::endl;
+            qWarning("Warning: failed to resolve epocroot."
+#ifdef Q_OS_WIN32
+                     "\nEither\n"
+                     "    1. Set EPOCROOT environment variable to a valid value.\n"
+                     " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY
+                     " registry key is set, and then\n"
+                     "       a. Set EPOCDEVICE environment variable to a valid device\n"
+                     "    or b. Specify a default device in the devices.xml file.");
+#else
+                     " Set EPOCROOT environment variable to a valid value.");
+#endif
         } else {
             fixEpocRoot(epocRootValue);
@@ -229,2 +220,3 @@
 }
 
+QT_END_NAMESPACE
Index: trunk/tools/shared/symbian/epocroot.h
===================================================================
--- trunk/tools/shared/symbian/epocroot.h	(revision 769)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake application of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SYMBIAN_EPOCROOT_H
-#define SYMBIAN_EPOCROOT_H
-
-#include <QtCore/qstring.h>
-
-/**
- * Determine the epoc root for the currently active SDK.
- *
- * The algorithm used is as follows:
- * 1. If environment variable EPOCROOT is set and points to an existent
- *    directory, this is returned.
- * 2. The location of devices.xml is specified by a registry key.  If this
- *    file exists, it is parsed.
- * 3. If the EPOCDEVICE environment variable is set and a corresponding
- *    entry is found in devices.xml, and its epocroot value points to an
- *    existent directory, it is returned.
- * 4. If a device element marked as default is found in devices.xml and its
- *    epocroot value points to an existent directory, this is returned.
- * 5. An empty string is returned.
- *
- * Any return value other than the empty string therefore is guaranteed to
- * point to an existent directory.
- */
-QString epocRoot();
-
-#endif // EPOCROOT_H
Index: trunk/tools/shared/symbian/epocroot.pri
===================================================================
--- trunk/tools/shared/symbian/epocroot.pri	(revision 846)
+++ trunk/tools/shared/symbian/epocroot.pri	(revision 846)
@@ -0,0 +1,11 @@
+# Epocroot resolving is only required for tools, so omit it from all mobile/embedded builds
+!symbian:!wince*:!embedded {
+HEADERS += \
+        $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \
+        $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h
+SOURCES += \
+        $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \
+        $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp
+INCLUDEPATH += $$QT_SOURCE_TREE/tools/shared
+DEFINES += QLIBRARYINFO_EPOCROOT
+}
Index: trunk/tools/shared/symbian/epocroot_p.h
===================================================================
--- trunk/tools/shared/symbian/epocroot_p.h	(revision 846)
+++ trunk/tools/shared/symbian/epocroot_p.h	(revision 846)
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_SYMBIAN_EPOCROOT_H
+#define QT_SYMBIAN_EPOCROOT_H
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists purely as an
+// implementation detail.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ *
+ * The algorithm used is as follows:
+ * 1. If environment variable EPOCROOT is set and points to an existent
+ *    directory, this is returned.
+ * 2. The location of devices.xml is specified by a registry key.  If this
+ *    file exists, it is parsed.
+ * 3. If the EPOCDEVICE environment variable is set and a corresponding
+ *    entry is found in devices.xml, and its epocroot value points to an
+ *    existent directory, it is returned.
+ * 4. If a device element marked as default is found in devices.xml and its
+ *    epocroot value points to an existent directory, this is returned.
+ * 5. An empty string is returned.
+ *
+ * Any return value other than the empty string therefore is guaranteed to
+ * point to an existent directory.
+ */
+QString qt_epocRoot();
+
+QT_END_NAMESPACE
+
+#endif // QT_SYMBIAN_EPOCROOT_H
+
Index: trunk/tools/shared/windows/registry.cpp
===================================================================
--- trunk/tools/shared/windows/registry.cpp	(revision 769)
+++ trunk/tools/shared/windows/registry.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -41,6 +41,9 @@
 
 #include <QtCore/qstringlist.h>
-#include "registry.h"
+#include "registry_p.h"
 
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_OS_WIN32
 /*!
   Returns the path part of a registry key.
@@ -74,10 +77,11 @@
 
     QString res(rKey.mid(idx + 1));
-    if (res == "Default" || res == ".")
-        res = "";
+    if (res == QLatin1String("Default") || res == QLatin1String("."))
+        res = QString();
     return res;
 }
+#endif
 
-QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
+QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey)
 {
     QString result;
@@ -129,5 +133,5 @@
                 l.append(s);
             }
-            result = l.join(", ");
+            result = l.join(QLatin1String(", "));
             break;
         }
@@ -149,9 +153,12 @@
 
         default:
-            qWarning("QSettings: unknown data %d type in windows registry", dataType);
+            qWarning("QSettings: unknown data %u type in windows registry", quint32(dataType));
             break;
     }
 
     RegCloseKey(handle);
+#else
+    Q_UNUSED(parentHandle);
+    Q_UNUSED(rSubkey)
 #endif
 
@@ -159,3 +166,4 @@
 }
 
+QT_END_NAMESPACE
 
Index: trunk/tools/shared/windows/registry.h
===================================================================
--- trunk/tools/shared/windows/registry.h	(revision 769)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake application of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOWS_REGISTRY_H
-#define WINDOWS_REGISTRY_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_WIN32
-   #include <QtCore/qt_windows.h>
-#else
-    typedef void* HKEY;
-#endif
-
-#include <QtCore/qstring.h>
-
-/**
- * Read a value from the Windows registry.
- *
- * If the key is not found, or the registry cannot be accessed (for example
- * if this code is compiled for a platform other than Windows), a null
- * string is returned.
- */
-QString readRegistryKey(HKEY parentHandle, const QString &rSubkey);
-
-#endif // WINDOWS_REGISTRY_H
Index: trunk/tools/shared/windows/registry_p.h
===================================================================
--- trunk/tools/shared/windows/registry_p.h	(revision 846)
+++ trunk/tools/shared/windows/registry_p.h	(revision 846)
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_WINDOWS_REGISTRY_H
+#define QT_WINDOWS_REGISTRY_H
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists purely as an
+// implementation detail.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+#include <QtCore/qglobal.h>
+
+#ifdef Q_OS_WIN32
+   #include <QtCore/qt_windows.h>
+#else
+    typedef void* HKEY;
+#endif
+
+#include <QtCore/qstring.h>
+
+/**
+ * Read a value from the Windows registry.
+ *
+ * If the key is not found, or the registry cannot be accessed (for example
+ * if this code is compiled for a platform other than Windows), a null
+ * string is returned.
+ */
+QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey);
+
+QT_END_NAMESPACE
+
+#endif // QT_WINDOWS_REGISTRY_H
+
Index: trunk/tools/tools.pro
===================================================================
--- trunk/tools/tools.pro	(revision 769)
+++ trunk/tools/tools.pro	(revision 846)
@@ -1,23 +1,31 @@
 TEMPLATE        = subdirs
 
-no-png {
-    message("Some graphics-related tools are unavailable without PNG support")
-} else {
-     SUBDIRS += assistant \
-		pixeltool \
-		porting \
-                qtestlib \
-                qttracereplay
-     contains(QT_EDITION, Console) {
-         SUBDIRS += designer/src/uitools     # Linguist depends on this
-     } else {
-         SUBDIRS += designer
-     }
-     SUBDIRS     += linguist
-     symbian: SUBDIRS = designer
-     wince*: SUBDIRS = qtestlib designer
-     unix:!mac:!embedded:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig
-     win32:!wince*:SUBDIRS += activeqt
+!contains(QT_CONFIG, no-gui) {
+    no-png {
+        message("Some graphics-related tools are unavailable without PNG support")
+    } else {
+        symbian {
+            SUBDIRS = designer
+        } else:wince* {
+            SUBDIRS = qtestlib designer
+        } else {
+            SUBDIRS = assistant \
+                      pixeltool \
+                      porting \
+                      qtestlib \
+                      qttracereplay
+            contains(QT_EDITION, Console) {
+                SUBDIRS += designer/src/uitools     # Linguist depends on this
+            } else {
+                SUBDIRS += designer
+            }
+        }
+        unix:!mac:!embedded:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig
+        win32:!wince*:SUBDIRS += activeqt
+    }
+    contains(QT_CONFIG, declarative):SUBDIRS += qml
 }
+
+!wince*:!symbian:SUBDIRS += linguist
 
 mac {
@@ -27,5 +35,4 @@
 embedded:SUBDIRS += kmap2qmap
 
-contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer qmldebugger
 contains(QT_CONFIG, dbus):SUBDIRS += qdbus
 # We don't need these command line utilities on embedded platforms.
@@ -37,2 +44,6 @@
 CONFIG+=ordered
 QTDIR_build:REQUIRES = "contains(QT_CONFIG, full-config)"
+
+!win32:!embedded:!mac:!symbian:CONFIG += x11
+
+x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += qmeegographicssystemhelper
Index: trunk/tools/xmlpatterns/main.cpp
===================================================================
--- trunk/tools/xmlpatterns/main.cpp	(revision 769)
+++ trunk/tools/xmlpatterns/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatterns/main.h
===================================================================
--- trunk/tools/xmlpatterns/main.h	(revision 769)
+++ trunk/tools/xmlpatterns/main.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatterns/qapplicationargument.cpp
===================================================================
--- trunk/tools/xmlpatterns/qapplicationargument.cpp	(revision 769)
+++ trunk/tools/xmlpatterns/qapplicationargument.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatterns/qapplicationargument_p.h
===================================================================
--- trunk/tools/xmlpatterns/qapplicationargument_p.h	(revision 769)
+++ trunk/tools/xmlpatterns/qapplicationargument_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatterns/qapplicationargumentparser.cpp
===================================================================
--- trunk/tools/xmlpatterns/qapplicationargumentparser.cpp	(revision 769)
+++ trunk/tools/xmlpatterns/qapplicationargumentparser.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatterns/qapplicationargumentparser_p.h
===================================================================
--- trunk/tools/xmlpatterns/qapplicationargumentparser_p.h	(revision 769)
+++ trunk/tools/xmlpatterns/qapplicationargumentparser_p.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatternsvalidator/main.cpp
===================================================================
--- trunk/tools/xmlpatternsvalidator/main.cpp	(revision 769)
+++ trunk/tools/xmlpatternsvalidator/main.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
Index: trunk/tools/xmlpatternsvalidator/main.h
===================================================================
--- trunk/tools/xmlpatternsvalidator/main.h	(revision 769)
+++ trunk/tools/xmlpatternsvalidator/main.h	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
