Friday, July 18th 2008, 11:37pm UTC+1

You are not logged in.

  • Login
  • Register

Posts: 1

Location: Japan

1

Monday, May 12th 2008, 3:35pm

4.4 assistant: adding PostgreSQL manual

We got a nice help viewer system since version 4.4.0. The `assistant' features
text searching, it is very useful.

Unfortunately, every pgsql manual pages are shown as untitled at search results,
because in this html style a new line break is given just before each ending tag bracket.
For example:
...
><TITLE
>PostgreSQL 8.2.7 Documentation</TITLE
><META
...

Here's a patch for removing unnecessary line-breaks:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- tools/assistant/lib/qhelp_global.h.orig     2008-04-28 22:11:20.000000000 +0900
+++ tools/assistant/lib/qhelp_global.h  2008-05-12 02:47:47.000000000 +0900
@@ -75,10 +75,12 @@
     {
         QString title = QObject::tr("Untitled");
         if (!content.isEmpty()) {
-            int start = content.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7;
-            int end = content.indexOf(QLatin1String("</title>"), 0, Qt::CaseInsensitive);
+            QString flat_content= content;
+            flat_content.remove('\r').remove('\n');
+            int start = flat_content.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7;
+            int end = flat_content.indexOf(QLatin1String("</title>"), 0, Qt::CaseInsensitive);
             if ((end - start) > 0) {
-                title = content.mid(start, end - start);
+                title = flat_content.mid(start, end - start);
                 if (Qt::mightBeRichText(title)) {
                     QTextDocument doc;
                     doc.setHtml(title);


.qhp file for PostgreSQL 8.2.7 documentation
  • Go to the top of the page

Rate this thread