diff --git a/meta/recipes-qt/qt4/qt4-embedded.inc b/meta/recipes-qt/qt4/qt4-embedded.inc
index 9914c61..1ede922 100644
--- a/meta/recipes-qt/qt4/qt4-embedded.inc
+++ b/meta/recipes-qt/qt4/qt4-embedded.inc
@@ -3,7 +3,7 @@ SECTION = "libs"
 LICENSE = "LGPLv2.1 | GPLv3"
 HOMEPAGE = "http://qt.nokia.com"
 DEPENDS += "directfb tslib"
-INC_PR = "r30"
+INC_PR = "r31"
 
 QT_BASE_NAME ?= "qt4-embedded"
 QT_BASE_LIB  ?= "libqt-embedded"
diff --git a/meta/recipes-qt/qt4/qt4-x11-free.inc b/meta/recipes-qt/qt4/qt4-x11-free.inc
index 0a714be..a360ec3 100644
--- a/meta/recipes-qt/qt4/qt4-x11-free.inc
+++ b/meta/recipes-qt/qt4/qt4-x11-free.inc
@@ -5,7 +5,7 @@ HOMEPAGE = "http://qt.nokia.com"
 SECTION = "x11/libs"
 DEPENDS += "virtual/libgl virtual/libx11 fontconfig libxft libxext libxrender libxrandr libxcursor"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 QT_GLFLAGS ?= "${@base_contains('DISTRO_FEATURES', 'opengl', '-opengl', '-no-opengl', d)} "
 QT_GLFLAGS_qemux86 = "-opengl"
diff --git a/meta/recipes-qt/qt4/qt4.inc b/meta/recipes-qt/qt4/qt4.inc
index 5545be7..585df83 100644
--- a/meta/recipes-qt/qt4/qt4.inc
+++ b/meta/recipes-qt/qt4/qt4.inc
@@ -101,6 +101,8 @@ OTHER_PACKAGES = "\
              ${QT_BASE_NAME}-qt3to4 \
              ${QT_BASE_NAME}-qml-plugins"
 
+#We prepend so ${QT_BASE_NAME}-demos-doc comes before ${PN}-doc,so the packaging of FILES_ get done before.
+PACKAGES =+ "${QT_BASE_NAME}-demos-doc"
 PACKAGES += "${LIB_PACKAGES} ${DEV_PACKAGES} ${DBG_PACKAGES} ${OTHER_PACKAGES}"
 PACKAGES_DYNAMIC = "${QT_BASE_NAME}-plugin-* ${QT_BASE_NAME}-translation-* ${QT_BASE_NAME}-fonts-*"
 
@@ -125,13 +127,15 @@ RRECOMMENDS_${QT_BASE_NAME}-demos += " \
             ${QT_BASE_NAME}-plugin-imageformat-jpeg \
             ${QT_BASE_NAME}-qml-plugins \
             ${QT_BASE_NAME}-assistant \
-            ${PN}-doc"
+            ${QT_BASE_NAME}-demos-doc"
 RRECOMMENDS_${QT_BASE_NAME}-examples += " \
             ${QT_BASE_NAME}-plugin-sqldriver-sqlite \
             ${QT_BASE_NAME}-plugin-imageformat-jpeg \
             ${QT_BASE_NAME}-qml-plugins"
 RRECOMMENDS_${QT_BASE_NAME}-qmlviewer += " \
             ${QT_BASE_NAME}-qml-plugins"
+RRECOMMENDS_${QT_BASE_NAME}-doc += " \
+            ${QT_BASE_NAME}-demos-doc"
 
 FILES_${QT_BASE_NAME}-tools                = "${bindir}/qttracereplay ${bindir}/qdoc*"
 FILES_${QT_BASE_NAME}-tools-dbg            = "${bindir}/.debug/qttracereplay ${bindir}/.debug/qdoc*"
@@ -272,6 +276,57 @@ python populate_packages_prepend() {
         qtopia_split('styles',        'style',         '^libq(.*)\.so$')
         qtopia_split('phonon_backend','phonon-backend','^libphonon_(.*)\.so$')
         qtopia_split('bearer',        'bearer',        '^libq(.*)bearer\.so$')
+
+        #handle the QT documentation split:
+        #only a small part of the documentation is needed for qt-doc
+        import xml.parsers.expat
+        curdir = []
+
+        class handler:
+                def __init__(self):
+                        self.allfiles = []
+                def add(self,name,attrs):
+                        if name == 'demos' and 'dirname' in attrs:
+                                if (attrs['dirname'] != '.'):
+                                        curdir.append(attrs['dirname'].replace('/','-'))
+                                else:
+                                        curdir.append(name.replace('/','-'))
+                        if name == 'category' and 'dirname' in attrs:
+                                curdir.append(attrs['dirname'].replace('/','-'))
+                        if name == 'example' and 'filename' in attrs:
+                                path = (attrs['filename'].replace('/','-'))
+                                if (len(curdir) is 0):
+                                        self.allfiles.append(path)
+                                else:
+                                        self.allfiles.append("-".join(curdir) + '-' + path)
+                def clean(self,name):
+                        if (len(curdir) is not 0 ) and (name == 'category' or name == 'demos'):
+                                curdir.remove(curdir[-1])
+                def __repr__(self):
+                        return repr(self.allfiles)
+                def result(self):
+                        return self.allfiles
+        h = handler()
+        # 3 handler functions
+        def start_element(name, attrs):
+                h.add(name,attrs)
+        def end_element(name):
+                h.clean(name)
+        def char_data(data):
+                pass
+
+        p = xml.parsers.expat.ParserCreate()
+        p.StartElementHandler = start_element
+        p.EndElementHandler = end_element
+        p.CharacterDataHandler = char_data
+
+        f = open("%s/%s/qtopia/demos/qtdemo/xml/examples.xml" % ( bb.data.getVar("D",d,1) ,  bb.data.getVar("bindir",d,1) ) ,'r');
+        p.ParseFile(f)
+
+        docs = []
+        for element in h.result():
+                docs.append("${docdir}/qtopia/html/" + element + "*")
+        bb.data.setVar("FILES_%s-demos-doc" % bb.data.getVar("QT_BASE_NAME",d,1) ,str(" ".join(docs)),d)
 }
 
 do_install() {
