Index: trunk/tools/qdoc3/main.cpp
===================================================================
--- trunk/tools/qdoc3/main.cpp	(revision 651)
+++ 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);
