From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kontact/plugins/korganizer/korganizerplugin.cpp | 47 +++++++++++++++++++------ 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'kontact/plugins/korganizer/korganizerplugin.cpp') diff --git a/kontact/plugins/korganizer/korganizerplugin.cpp b/kontact/plugins/korganizer/korganizerplugin.cpp index f0f88c7ca..cd590ec96 100644 --- a/kontact/plugins/korganizer/korganizerplugin.cpp +++ b/kontact/plugins/korganizer/korganizerplugin.cpp @@ -42,6 +42,10 @@ #include #include +#include + +#include +#include #include "core.h" #include "summarywidget.h" @@ -78,6 +82,11 @@ KOrganizerPlugin::~KOrganizerPlugin() Kontact::Summary *KOrganizerPlugin::createSummaryWidget( TQWidget *parent ) { + // korg part must be loaded, otherwise when starting kontact on summary view + // it won't display our stuff. + // If the part is already loaded loadPart() is harmless and just returns + loadPart(); + return new SummaryWidget( this, parent ); } @@ -160,27 +169,43 @@ bool KOrganizerPlugin::canDecodeDrag( TQMimeSource *mimeSource ) void KOrganizerPlugin::processDropEvent( TQDropEvent *event ) { - TQString text; - - KABC::VCardConverter converter; - if ( KVCardDrag::canDecode( event ) && KVCardDrag::decode( event, text ) ) { - KABC::Addressee::List contacts = converter.parseVCards( text ); - KABC::Addressee::List::Iterator it; - + KABC::Addressee::List list; + if ( KVCardDrag::decode( event, list ) ) { TQStringList attendees; - for ( it = contacts.begin(); it != contacts.end(); ++it ) { + KABC::Addressee::List::Iterator it; + for ( it = list.begin(); it != list.end(); ++it ) { TQString email = (*it).fullEmail(); - if ( email.isEmpty() ) + if ( email.isEmpty() ) { attendees.append( (*it).realName() + "<>" ); - else + } else { attendees.append( email ); + } } - interface()->openEventEditor( i18n( "Meeting" ), TQString::null, TQString::null, attendees ); return; } + if ( KCal::ICalDrag::canDecode( event) ) { + KCal::CalendarLocal cal( KPimPrefs::timezone() ); + if ( KCal::ICalDrag::decode( event, &cal ) ) { + KCal::Incidence::List incidences = cal.incidences(); + if ( !incidences.isEmpty() ) { + event->accept(); + KCal::Incidence *i = incidences.first(); + TQString summary; + if ( dynamic_cast( i ) ) + summary = i18n( "Note: %1" ).arg( i->summary() ); + else + summary = i->summary(); + interface()->openEventEditor( summary, i->description(), TQString() ); + return; + } + // else fall through to text decoding + } + } + + TQString text; if ( TQTextDrag::decode( event, text ) ) { kdDebug(5602) << "DROP:" << text << endl; interface()->openEventEditor( text ); -- cgit v1.2.1