aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/macwebkithelpviewer.mm
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-06-17 15:37:40 +0200
committerEike Ziller <eike.ziller@digia.com>2014-06-18 12:09:12 +0200
commitbe68fe7f4a73c0ca51258fd3ae8d907da6ffc55a (patch)
treec9f73e13db1a6ca7bd073885da992db1427ac65c /src/plugins/help/macwebkithelpviewer.mm
parent46cdd910242f1ba155c66096d2ba11f7a61ec53d (diff)
Help: Unify help content loading and error message.
Task-number: QTCREATORBUG-12352 Change-Id: If74453e75cc8eaf27c114d0976099388be778fa6 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/plugins/help/macwebkithelpviewer.mm')
-rw-r--r--src/plugins/help/macwebkithelpviewer.mm19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/plugins/help/macwebkithelpviewer.mm b/src/plugins/help/macwebkithelpviewer.mm
index 64fd77b6eb0..65be98bac40 100644
--- a/src/plugins/help/macwebkithelpviewer.mm
+++ b/src/plugins/help/macwebkithelpviewer.mm
@@ -163,22 +163,19 @@ AutoreleasePool::~AutoreleasePool()
- (void)startLoading
{
const QUrl &url = QUrl::fromNSURL(self.request.URL);
- QByteArray data;
+ Help::Internal::LocalHelpManager::HelpData data;
Help::Internal::LocalHelpManager *helpManager = Help::Internal::LocalHelpManager::instance();
QMetaObject::invokeMethod(helpManager, "helpData", Qt::BlockingQueuedConnection,
- Q_RETURN_ARG(QByteArray, data), Q_ARG(QUrl, url));
+ Q_RETURN_ARG(Help::Internal::LocalHelpManager::HelpData, data),
+ Q_ARG(QUrl, url));
- QString mtString = Help::Internal::HelpViewer::mimeFromUrl(url);
- if (mtString.isEmpty())
- mtString = QLatin1String("application/octet-stream");
- NSString *mimeType = mtString.toNSString();
-
- NSData *nsdata = QtMac::toNSData(data); // Qt 5.3 has this in QByteArray
-
- NSURLResponse *response = [[NSURLResponse alloc] initWithURL:self.request.URL
+ NSURL *resolvedURL = data.resolvedUrl.toNSURL();
+ NSString *mimeType = data.mimeType.toNSString();
+ NSData *nsdata = QtMac::toNSData(data.data); // Qt 5.3 has this in QByteArray
+ NSURLResponse *response = [[NSURLResponse alloc] initWithURL:resolvedURL
MIMEType:mimeType
- expectedContentLength:data.length()
+ expectedContentLength:data.data.length()
textEncodingName:@"UTF8"];
[self.client URLProtocol:self didReceiveResponse:response
cacheStoragePolicy:NSURLCacheStorageNotAllowed];