Hi all,

I'm trying to devellop my own "widget assistant" using QtHelp to manage some software documentation. To be able to show the ressources (png, css & co) of the html pages I overloaded some QNetworkAccessManager Method and QNetworkRequest Method :

Qt Code:
  1. QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
  2. const QNetworkRequest &request, QIODevice* /*outgoingData*/)
  3. {
  4. qDebug("dbt");
  5. const QUrl& url = request.url();
  6. QString mimeType = url.toString();
  7. if (mimeType.endsWith(QLatin1String(".svg"))
  8. || mimeType.endsWith(QLatin1String(".svgz"))) {
  9. mimeType = QLatin1String("image/svg+xml");
  10. } else if (mimeType.endsWith(QLatin1String(".css"))) {
  11. mimeType = QLatin1String("text/css");
  12. } else if (mimeType.endsWith(QLatin1String(".js"))) {
  13. mimeType = QLatin1String("text/javascript");
  14. } else if (mimeType.endsWith(QLatin1String(".txt"))) {
  15. mimeType = QLatin1String("text/plain");
  16. } else if (mimeType.endsWith(QLatin1String(".swf"))) {
  17. mimeType = QLatin1String("application/x-shockwave-flash");
  18. } else {
  19. mimeType = QLatin1String("text/html");
  20. }
  21.  
  22. const QByteArray &data = helpEngine->findFile(url).isValid()
  23. ? helpEngine->fileData(url) : QByteArray("File not found!");
  24. qDebug(url.toString());
  25. qDebug("fin");
  26. return new HelpNetworkReply(request, data, mimeType);
  27. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
  2. const QByteArray &fileData, const QString& mimeType)
  3. : data(fileData), origLen(fileData.length())
  4. {
  5. qDebug("DBT NETWORK REPLY");
  6. setRequest(request);
  7. setOpenMode(QIODevice::ReadOnly);
  8.  
  9. setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
  10. setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
  11. QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
  12. QTimer::singleShot(0, this, SIGNAL(readyRead()));
  13. qDebug("FIN NETWORK REPLY");
  14. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
  2. {
  3. qDebug("DBT READ DATA");
  4. qint64 len = qMin(qint64(data.length()), maxlen);
  5. if (len) {
  6. qMemCopy(buffer, data.constData(), len);
  7. data.remove(0, len);
  8. }
  9. if (!data.length())
  10. QTimer::singleShot(0, this, SIGNAL(finished()));
  11.  
  12. qDebug("FIN READ DATA");
  13. return len;
  14. }
To copy to clipboard, switch view to plain text mode 

It works well and now I can display all my qhc documentation with pictures and other ressources. Nevertheless I'm not able to display well swf video. On my page, instead of the flash video there is a white box. The plugin seems not be able to load the .swf file but I dont understand why.
Is there someone who could help me to understand ?

Thanks in advance for you response,

Sebboh.

PS : i'm not a native english speaker, sorry if there are any mistakes