Commit 606c8205 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QMimeData

parent 4725dc24
...@@ -398,9 +398,10 @@ QString KAMail::appendBodyAttachments(KMime::Message& message, JobData& data) ...@@ -398,9 +398,10 @@ QString KAMail::appendBodyAttachments(KMime::Message& message, JobData& data)
content->setBody(coded + "\n\n"); content->setBody(coded + "\n\n");
// Set the content type // Set the content type
KMimeType::Ptr type = KMimeType::findByUrl(url); QMimeDatabase mimeDb;
QString typeName = mimeDb.mimeTypeForUrl(url).name();
KMime::Headers::ContentType* ctype = new KMime::Headers::ContentType; KMime::Headers::ContentType* ctype = new KMime::Headers::ContentType;
ctype->fromUnicodeString(type->name(), autoDetectCharset(type->name())); ctype->fromUnicodeString(typeName, autoDetectCharset(typeName));
ctype->setName(attachment, "local"); ctype->setName(attachment, "local");
content->setHeader(ctype); content->setHeader(ctype);
......
...@@ -78,6 +78,7 @@ using namespace KCalUtils; ...@@ -78,6 +78,7 @@ using namespace KCalUtils;
#include <QCloseEvent> #include <QCloseEvent>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QMenu> #include <QMenu>
#include <QMimeDatabase>
#include <qinputdialog.h> #include <qinputdialog.h>
#include "kalarm_debug.h" #include "kalarm_debug.h"
...@@ -1359,8 +1360,9 @@ void MainWindow::executeDropEvent(MainWindow* win, QDropEvent* e) ...@@ -1359,8 +1360,9 @@ void MainWindow::executeDropEvent(MainWindow* win, QDropEvent* e)
{ {
qCDebug(KALARM_LOG) << "URL"; qCDebug(KALARM_LOG) << "URL";
// Try to find the mime type of the file, without downloading a remote file // Try to find the mime type of the file, without downloading a remote file
KMimeType::Ptr mimeType = KMimeType::findByUrl(files[0]); QMimeDatabase mimeDb;
action = mimeType->name().startsWith(QStringLiteral("audio/")) ? KAEvent::AUDIO : KAEvent::FILE; const QString mimeTypeName = mimeDb.mimeTypeForUrl(files[0]).name();
action = mimeTypeName.startsWith(QStringLiteral("audio/")) ? KAEvent::AUDIO : KAEvent::FILE;
alarmText.setText(files[0].prettyUrl()); alarmText.setText(files[0].prettyUrl());
} }
else if (data->hasText()) else if (data->hasText())
......
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