Commit ddef2119 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

No apps can generate this mimedata (old code from kde 3.x)

parent 61913127
Pipeline #23697 passed with stage
in 19 minutes and 52 seconds
......@@ -50,8 +50,6 @@
#include "lib/timespinbox.h"
#include "kalarm_debug.h"
#include <Libkdepim/MaillistDrag>
#include <KLocalizedString>
#include <KConfig>
#include <KSharedConfig>
......
......@@ -20,7 +20,6 @@
#include "lineedit.h"
#include <Libkdepim/MaillistDrag>
#include <KContacts/VCardDrag>
#include <KCalUtils/ICalDrag>
......@@ -103,7 +102,6 @@ void LineEdit::dragEnterEvent(QDragEnterEvent* e)
else
ok = (data->hasText()
|| data->hasUrls()
|| (mType != Url && KPIM::MailList::canDecode(data))
|| (mType == Emails && KContacts::VCardDrag::canDecode(data)));
if (ok)
e->accept(rect());
......@@ -119,21 +117,7 @@ void LineEdit::dropEvent(QDropEvent* e)
QList<QUrl> files;
KContacts::Addressee::List addrList;
if (mType != Url
&& KPIM::MailList::canDecode(data))
{
KPIM::MailList mailList = KPIM::MailList::fromMimeData(data);
// KMail message(s) - ignore all but the first
if (mailList.count())
{
if (mType == Emails)
newText = mailList.first().from();
else
setText(mailList.first().subject()); // replace any existing text
}
}
// This must come before QUrl
else if (mType == Emails
if (mType == Emails
&& KContacts::VCardDrag::canDecode(data) && KContacts::VCardDrag::fromMimeData(data, addrList))
{
// KAddressBook entries
......
......@@ -47,7 +47,6 @@
#include <KAlarmCal/AlarmText>
#include <KAlarmCal/KAEvent>
#include <Libkdepim/MaillistDrag>
#include <KMime/Message>
#include <AkonadiCore/Item>
#include <AkonadiCore/ItemFetchJob>
......@@ -87,6 +86,7 @@ using namespace KCalUtils;
#include <QUrlQuery>
#include <QMenuBar>
#include <QSystemTrayIcon>
#include <QMimeData>
using namespace KAlarmCal;
......@@ -1201,8 +1201,7 @@ void MainWindow::executeDragEnterEvent(QDragEnterEvent* e)
const QMimeData* data = e->mimeData();
bool accept = ICalDrag::canDecode(data) ? !e->source() // don't accept "text/calendar" objects from this application
: data->hasText()
|| data->hasUrls()
|| KPIM::MailList::canDecode(data);
|| data->hasUrls();
if (accept)
e->acceptProposedAction();
}
......@@ -1233,7 +1232,6 @@ void MainWindow::executeDropEvent(MainWindow* win, QDropEvent* e)
KAEvent::SubAction action = KAEvent::MESSAGE;
QByteArray bytes;
AlarmText alarmText;
KPIM::MailList mailList;
QList<QUrl> urls;
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeSpecAsZone()));
#ifndef NDEBUG
......@@ -1256,14 +1254,6 @@ void MainWindow::executeDropEvent(MainWindow* win, QDropEvent* e)
if (content.textContent())
body = content.textContent()->decodedText(true, true); // strip trailing newlines & spaces
unsigned long sernum = 0;
if (KPIM::MailList::canDecode(data))
{
// Get its KMail serial number to allow the KMail message
// to be called up from the alarm message window.
mailList = KPIM::MailList::fromMimeData(data);
if (!mailList.isEmpty())
sernum = mailList.at(0).serialNumber();
}
alarmText.setEmail(getMailHeader("To", content),
getMailHeader("From", content),
getMailHeader("Cc", content),
......@@ -1271,21 +1261,6 @@ void MainWindow::executeDropEvent(MainWindow* win, QDropEvent* e)
getMailHeader("Subject", content),
body, sernum);
}
else if (KPIM::MailList::canDecode(data))
{
mailList = KPIM::MailList::fromMimeData(data);
// KMail message(s). Ignore all but the first.
qCDebug(KALARM_LOG) << "MainWindow::executeDropEvent: KMail_list";
if (mailList.isEmpty())
return;
const KPIM::MailSummary& summary = mailList.at(0);
QDateTime dt;
dt.setSecsSinceEpoch(summary.date());
const QString body = KAMail::getMailBody(summary.serialNumber());
alarmText.setEmail(summary.to(), summary.from(), QString(),
QLocale().toString(dt), summary.subject(),
body, summary.serialNumber());
}
else if (ICalDrag::fromMimeData(data, calendar))
{
// iCalendar - If events are included, use the first event
......
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