[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kalarm
From: David Jarvie <software () astrojar ! org ! uk>
Date: 2005-04-03 13:38:36
Message-ID: 20050403133836.6374E637 () office ! kde ! org
[Download RAW message or body]
CVS commit by djarvie:
Improve email drag-and-drop from KMail
M +23 -2 mainwindow.cpp 1.119
--- kdepim/kalarm/mainwindow.cpp #1.118:1.119
@@ -45,4 +45,5 @@
#include <libkdepim/maillistdrag.h>
+#include <libkmime/kmime_content.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icaldrag.h>
@@ -1064,11 +1064,30 @@ void MainWindow::executeDropEvent(MainWi
if (KURLDrag::decode(e, files) && files.count())
{
+ kdDebug(5950) << "MainWindow::executeDropEvent(URL)" << endl;
action = KAEvent::FILE;
alarmText.setText(files.first().prettyURL());
}
+ else if (e->provides("message/rfc822")
+ && KPIM::MailListDrag::canDecode(e))
+ {
+ // Email message(s). Ignore all but the first.
+ kdDebug(5950) << "MainWindow::executeDropEvent(email)" << endl;
+ QByteArray bytes = e->encodedData("message/rfc822");
+ QCString mails(bytes.data(), bytes.size());
+ KMime::Content content;
+ content.setContent(mails);
+ QCString headers = content.head();
+ KMime::Content* bodyContent = content.textContent();
+ alarmText.setEmail(KMime::extractHeader(headers, "To"),
+ KMime::extractHeader(headers, "From"),
+ KMime::extractHeader(headers, "Date"),
+ KMime::extractHeader(headers, "Subject"),
+ (bodyContent ? bodyContent->body() : QString::null));
+ }
else if (e->provides(KPIM::MailListDrag::format())
&& KPIM::MailListDrag::decode(e, mailList))
{
// KMail message(s). Ignore all but the first.
+ kdDebug(5950) << "MainWindow::executeDropEvent(KMail_list)" << endl;
if (!mailList.count())
return;
@@ -1083,4 +1102,5 @@ void MainWindow::executeDropEvent(MainWi
{
// iCalendar - ignore all but the first event
+ kdDebug(5950) << "MainWindow::executeDropEvent(iCalendar)" << endl;
KCal::Event::List events = calendar.rawEvents();
if (!events.isEmpty())
@@ -1093,4 +1113,5 @@ void MainWindow::executeDropEvent(MainWi
else if (QTextDrag::decode(e, text))
{
+ kdDebug(5950) << "MainWindow::executeDropEvent(text)" << endl;
alarmText.setText(text);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic