Commit 92d7cb37 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to KEMailClientLauncherJob

parent 26e75be6
Pipeline #91943 passed with stage
in 52 minutes and 6 seconds
......@@ -25,7 +25,7 @@ if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(kaddressbook_sendvcardsplugin PROPERTIES UNITY_BUILD ON)
endif()
target_link_libraries(kaddressbook_sendvcardsplugin
KF5::PimCommon KF5::Completion KF5::PimCommonAkonadi KF5::XmlGui KF5::MimeTreeParser KF5::I18n KF5::Service
KF5::PimCommon KF5::Completion KF5::PimCommonAkonadi KF5::XmlGui KF5::MimeTreeParser KF5::I18n KF5::Service KF5::KIOGui
)
if (BUILD_TESTING)
......
......@@ -5,5 +5,5 @@ if (KDEPIM_RUN_AKONADI_TEST)
set(KDEPIMLIBS_RUN_ISOLATED_TESTS TRUE)
set(KDEPIMLIBS_RUN_SQLITE_ISOLATED_TESTS TRUE)
add_akonadi_isolated_test_advanced( sendvcardsjobtest.cpp "../sendvcardsjob.cpp;../kaddressbook_sendvcardsplugin_debug.cpp" "KF5::Contacts;KF5::PimCommon;KF5::MimeTreeParser;KF5::I18n;KF5::AkonadiContact;KF5::Service")
add_akonadi_isolated_test_advanced( sendvcardsjobtest.cpp "../sendvcardsjob.cpp;../kaddressbook_sendvcardsplugin_debug.cpp" "KF5::Contacts;KF5::PimCommon;KF5::MimeTreeParser;KF5::I18n;KF5::AkonadiContact;KF5::Service;KF5::KIOGui")
endif()
......@@ -10,8 +10,8 @@
#include <Akonadi/Contact/ContactGroupExpandJob>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <KEMailClientLauncherJob>
#include <KLocalizedString>
#include <KToolInvocation>
#include <MimeTreeParser/AttachmentTemporaryFilesDirs>
#include <QFile>
#include <QTemporaryDir>
......@@ -83,9 +83,15 @@ void SendVcardsJob::createTemporaryDir()
void SendVcardsJob::jobFinished()
{
const QStringList lstAttachment = mAttachmentTemporary->temporaryFiles();
const QStringList tempFilePaths{mAttachmentTemporary->temporaryFiles()};
QList<QUrl> lstAttachment;
for (const QString &path : tempFilePaths) {
lstAttachment.append(QUrl::fromLocalFile(path));
}
if (!lstAttachment.isEmpty()) {
KToolInvocation::invokeMailer(QString(), QString(), QString(), QString(), QString(), QString(), lstAttachment);
KEMailClientLauncherJob *job = new KEMailClientLauncherJob(this);
job->setAttachments(lstAttachment);
job->start();
} else {
Q_EMIT sendVCardsError(i18n("No vCard created."));
}
......
Supports Markdown
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