summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2015-08-21 19:11:21 +0200
committerVolker Krause <[email protected]>2015-08-21 19:11:21 +0200
commitc702bae9ac1792955b0caf0b10427fb49855cc06 (patch)
tree6ed560ec415d931c562800fdac267895929e3d2e
parentd96cb4104b8be1c6c7cf2d6b4b0f9ea83d332bd6 (diff)
Port away from KIO::NetAccess.
-rw-r--r--plugins/messageviewer/bodypartformatter/calendar/CMakeLists.txt1
-rw-r--r--plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp31
2 files changed, 21 insertions, 11 deletions
diff --git a/plugins/messageviewer/bodypartformatter/calendar/CMakeLists.txt b/plugins/messageviewer/bodypartformatter/calendar/CMakeLists.txt
index 5c84728..3f954e4 100644
--- a/plugins/messageviewer/bodypartformatter/calendar/CMakeLists.txt
+++ b/plugins/messageviewer/bodypartformatter/calendar/CMakeLists.txt
@@ -13,7 +13,6 @@ add_library(messageviewer_bodypartformatter_text_calendar MODULE ${messageviewer
target_link_libraries(messageviewer_bodypartformatter_text_calendar
- KF5::AkonadiContact
KF5::Codecs
Qt5::Core
KF5::CalendarCore
diff --git a/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp b/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp
index 77952b07..19880ce 100644
--- a/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp
+++ b/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp
@@ -60,23 +60,25 @@ using namespace KCalCore;
#include <MailTransport/MessageQueueJob>
#include <MailTransport/TransportManager>
-#include <KDBusServiceStarter>
-#include <QUrl>
#include "text_calendar_debug.h"
-#include <QInputDialog>
-#include <QMenu>
-#include <KMessageBox>
+#include <KDBusServiceStarter>
+#include <KMessageBox>
#include <KRun>
#include <KSystemTimeZone>
+#include <KIO/FileCopyJob>
+#include <KIO/StatJob>
+#include <KLocalizedString>
+
+#include <QUrl>
#include <QTemporaryFile>
-#include <KIO/NetAccess>
#include <QIcon>
-#include <KLocalizedString>
#include <QFileDialog>
#include <QMimeDatabase>
#include <QMimeType>
#include <QDesktopServices>
+#include <QInputDialog>
+#include <QMenu>
using namespace MailTransport;
@@ -371,7 +373,14 @@ public:
}
if (attachment->isUri()) {
- if (!KIO::NetAccess::exists(attachment->uri(), KIO::NetAccess::SourceSide, 0)) {
+ bool fileExists = false;
+ if (QUrl(attachment->uri()).isLocalFile()) {
+ fileExists = QFile::exists(attachment->uri());
+ } else {
+ auto job = KIO::stat(attachment->uri(), KIO::StatJob::SourceSide, 0);
+ fileExists = job->exec();
+ }
+ if (fileExists) {
KMessageBox::information(
0,
i18n("The invitation attachment \"%1\" is a web link that "
@@ -1063,7 +1072,8 @@ public:
bool stat = false;
if (a->isUri()) {
// save the attachment url
- stat = KIO::NetAccess::file_copy(a->uri(), QUrl::fromLocalFile(saveAsFile));
+ auto job = KIO::file_copy(a->uri(), QUrl::fromLocalFile(saveAsFile));
+ stat = job->exec();
} else {
// put the attachment in a temporary file and save it
QTemporaryFile *file;
@@ -1081,7 +1091,8 @@ public:
file->write(QByteArray::fromBase64(a->data()));
file->close();
- stat = KIO::NetAccess::file_copy(QUrl::fromLocalFile(file->fileName()), QUrl::fromLocalFile(saveAsFile));
+ auto job = KIO::file_copy(QUrl::fromLocalFile(file->fileName()), QUrl::fromLocalFile(saveAsFile));
+ stat = job->exec();
delete file;
}