Fix inbuild help and message. Remove Trolltech references.
authorkh1 <karsten.heimrich@digia.com>
Fri, 23 Nov 2012 16:26:13 +0000 (17:26 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 26 Nov 2012 12:40:11 +0000 (13:40 +0100)
Change-Id: Ibe74e744d737c68854ca98dfe72af43287ff89c7
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
src/assistant/assistant/assistant.qch
src/assistant/assistant/helpviewer.cpp
src/assistant/assistant/helpviewer_qwv.cpp
src/assistant/assistant/mainwindow.cpp

index e6d5299..b023d53 100644 (file)
Binary files a/src/assistant/assistant/assistant.qch and b/src/assistant/assistant/assistant.qch differ
index f1f4681..314a765 100644 (file)
@@ -62,7 +62,7 @@ const QString HelpViewer::AboutBlank =
     QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
 
 const QString HelpViewer::LocalHelpFile = QLatin1String("qthelp://"
-    "com.trolltech.com.assistantinternal-1.0.0/assistant/assistant.html");
+    "org.qt-project.assistantinternal-1.0.0/assistant/assistant-quick-guide.html");
 
 const QString HelpViewer::PageNotFoundMessage =
     QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div "
index 25acf57..81fb828 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
+static const char g_htmlPage[] = "<html><head><meta http-equiv=\"content-type\" content=\"text/html; "
+    "charset=UTF-8\"><title>%1</title><style>body{padding: 3em 0em;background: #eeeeee;}"
+    "hr{color: lightgray;width: 100%;}img{float: left;opacity: .8;}#box{background: white;border: 1px solid "
+    "lightgray;width: 600px;padding: 60px;margin: auto;}h1{font-size: 130%;font-weight: bold;border-bottom: "
+    "1px solid lightgray;margin-left: 48px;}h2{font-size: 100%;font-weight: normal;border-bottom: 1px solid "
+    "lightgray;margin-left: 48px;}ul{font-size: 80%;padding-left: 48px;margin: 0;}#reloadButton{padding-left:"
+    "48px;}</style></head><body><div id=\"box\"><h1>%2</h1><h2>%3</h2><h2><b>%4</b></h2></div></body></html>";
+
+// some of the values we will replace %1...4 inside the former html
+const QString g_percent1 = QCoreApplication::translate("HelpViewer", "Error 404...");
+const QString g_percent2 = QCoreApplication::translate("HelpViewer", "The page could not be found!");
+// percent3 will be the url of the page we got the error from
+const QString g_percent4 = QCoreApplication::translate("HelpViewer", "Please make sure that you have all "
+    "documentation sets installed.");
+
+
 // -- HelpNetworkReply
 
 class HelpNetworkReply : public QNetworkReply
@@ -148,8 +164,8 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
         url = HelpViewer::fixupVirtualFolderForUrl(&engine, request.url(), &fileFound);
 
     const QString &mimeType = HelpViewer::mimeFromUrl(url);
-    const QByteArray &data = fileFound ? engine.fileData(url)
-        : HelpViewer::PageNotFoundMessage.arg(url).toUtf8();
+    const QByteArray &data = fileFound ? engine.fileData(url) : QString::fromLatin1(g_htmlPage)
+        .arg(g_percent1, g_percent2, HelpViewer::tr("Error loading: %1").arg(url), g_percent4).toUtf8();
 
     return new HelpNetworkReply(request, data, mimeType.isEmpty()
         ? QLatin1String("application/octet-stream") : mimeType);
index 4663a67..1c447af 100644 (file)
@@ -223,6 +223,9 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
         contentDock->raise();
         const QRect screen = QApplication::desktop()->screenGeometry();
         resize(4*screen.width()/5, 4*screen.height()/5);
+
+        adjustSize();   // make sure we won't start outside of the screen
+        move(screen.center() - rect().center());
     }
 
     if (!helpEngineWrapper.hasFontSettings()) {
@@ -326,7 +329,7 @@ bool MainWindow::initHelpDB(bool registerInternalDoc)
         return true;
     }
     bool assistantInternalDocRegistered = false;
-    QString intern(QLatin1String("com.trolltech.com.assistantinternal-"));
+    QString intern(QLatin1String("org.qt-project.assistantinternal-"));
     foreach (const QString &ns, helpEngineWrapper.registeredDocumentations()) {
         if (ns.startsWith(intern)) {
             intern = ns;
@@ -1016,7 +1019,7 @@ QString MainWindow::collectionFileDirectory(bool createDir, const QString &cache
 {
     TRACE_OBJ
     QString collectionPath =
-        QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+        QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
     if (collectionPath.isEmpty()) {
         if (cacheDir.isEmpty())
             collectionPath = QDir::homePath() + QDir::separator()
@@ -1025,7 +1028,7 @@ QString MainWindow::collectionFileDirectory(bool createDir, const QString &cache
             collectionPath = QDir::homePath() + QLatin1String("/.") + cacheDir;
     } else {
         if (cacheDir.isEmpty())
-            collectionPath = collectionPath + QLatin1String("/Trolltech/Assistant");
+            collectionPath = collectionPath + QLatin1String("/QtProject/Assistant");
         else
             collectionPath = collectionPath + QDir::separator() + cacheDir;
     }