Commit 9f7fa3c5 authored by David Faure's avatar David Faure

add_definitions(-DQT_NO_URL_CAST_FROM_STRING) + fix compilation

Fixes one old todo (QUrl misuse on Windows)
parent 860a7113
......@@ -106,7 +106,7 @@ if(EXISTS "${Messagelib_SOURCE_DIR}/.git")
endif()
endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_subdirectory(mimetreeparser)
add_subdirectory(messageviewer)
......
......@@ -71,7 +71,7 @@ void ScamExpandUrlJob::expandedUrl(const QUrl &url)
deleteLater();
return;
}
const QUrl newUrl = QStringLiteral("http://api.longurl.org/v2/expand?url=%1&format=json").arg(url.url());
const QUrl newUrl(QStringLiteral("http://api.longurl.org/v2/expand?url=%1&format=json").arg(url.url()));
qCDebug(MESSAGEVIEWER_LOG) << " newUrl " << newUrl;
QNetworkReply *reply = d->mNetworkAccessManager->get(QNetworkRequest(newUrl));
......
......@@ -380,7 +380,7 @@ static KMime::Content *partNodeFromXKMailUrl(const QUrl &url, ViewerPrivate *w,
}
//KMime::ContentIndex index( urlParts[1] );
*path = QUrl::fromPercentEncoding(urlParts.at(2).toLatin1());
return w->nodeFromUrl(urlParts.at(1));
return w->nodeFromUrl(QUrl(urlParts.at(1)));
}
bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url, ViewerPrivate *w) const
......@@ -927,9 +927,8 @@ bool AttachmentURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
w->scrollToAttachment(node);
}
if (shouldShowDialog)
// PENDING(romain_kdab) : replace with toLocalFile() ?
{
w->openAttachment(node, w->nodeHelper()->tempFileUrlFromNode(node).path());
w->openAttachment(node, w->nodeHelper()->tempFileUrlFromNode(node));
}
return true;
......
......@@ -284,7 +284,7 @@ KMime::Content *ViewerPrivate::nodeFromUrl(const QUrl &url) const
return mNodeHelper->fromHREF(mMessage, url);
}
void ViewerPrivate::openAttachment(KMime::Content *node, const QString &name)
void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
{
if (!node) {
return;
......@@ -324,16 +324,16 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QString &name)
}
// special case treatment on mac and windows
QString atmName = name;
if (name.isEmpty()) {
atmName = mNodeHelper->tempFileUrlFromNode(node).toLocalFile();
QUrl atmUrl = url;
if (url.isEmpty()) {
atmUrl = mNodeHelper->tempFileUrlFromNode(node);
}
if (Util::handleUrlWithQDesktopServices(atmName)) {
if (Util::handleUrlWithQDesktopServices(atmUrl)) {
return;
}
if (!mimetype.isValid() || mimetype.name() == QLatin1String("application/octet-stream")) {
mimetype = MimeTreeParser::Util::mimetype(name);
mimetype = MimeTreeParser::Util::mimetype(url.isLocalFile() ? url.toLocalFile() : url.fileName());
}
KService::Ptr offer =
KMimeTypeTrader::self()->preferredService(mimetype.name(), QStringLiteral("Application"));
......
......@@ -203,7 +203,7 @@ public:
/** Open the attachment pointed to the node.
* @param fileName - if not empty, use this file to load the attachment content
*/
void openAttachment(KMime::Content *node, const QString &fileName);
void openAttachment(KMime::Content *node, const QUrl &url);
/** Delete the attachment the @param node points to. Returns false if the user
cancelled the deletion, true in all other cases (including failure to delete
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment