00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "vcaldrag.h"
00024
00025 #include "vcalformat.h"
00026
00027 using namespace KCal;
00028
00029 VCalDrag::VCalDrag( Calendar *cal, TQWidget *parent, const char *name )
00030 : TQStoredDrag( "text/x-vCalendar", parent, name )
00031 {
00032 VCalFormat format;
00033 setEncodedData( format.toString( cal ).utf8() );
00034 }
00035
00036 bool VCalDrag::canDecode( TQMimeSource *me )
00037 {
00038 return me->provides( "text/x-vCalendar" );
00039 }
00040
00041 bool VCalDrag::decode( TQMimeSource *de, Calendar *cal )
00042 {
00043 bool success = false;
00044
00045 TQByteArray payload = de->encodedData( "text/x-vCalendar" );
00046 if ( payload.size() ) {
00047 TQString txt = TQString::fromUtf8( payload.data() );
00048
00049 VCalFormat format;
00050 success = format.fromString( cal, txt );
00051 }
00052
00053 return success;
00054 }
00055