kvcarddrag.cpp
00001 /* 00002 This file is part of the KDE PIM library. 00003 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 00024 #include "kvcarddrag.h" 00025 00026 #include <kdebug.h> 00027 00028 static const char *vcard_mime_string = "text/x-vcard"; 00029 00030 KVCardDrag::KVCardDrag( const QString &content, QWidget *dragsource, 00031 const char *name ) 00032 : QStoredDrag( vcard_mime_string, dragsource, name ) 00033 { 00034 setVCard( content ); 00035 } 00036 00037 KVCardDrag::KVCardDrag( QWidget *dragsource, const char *name ) 00038 : QStoredDrag( vcard_mime_string, dragsource, name ) 00039 { 00040 setVCard( QString::null ); 00041 } 00042 00043 void KVCardDrag::setVCard( const QString &content ) 00044 { 00045 setEncodedData( content.utf8() ); 00046 } 00047 00048 bool KVCardDrag::canDecode( QMimeSource *e ) 00049 { 00050 return e->provides( vcard_mime_string ); 00051 } 00052 00053 bool KVCardDrag::decode( QMimeSource *e, QString &content ) 00054 { 00055 content = QString::fromUtf8( e->encodedData( vcard_mime_string ) ); 00056 return true; 00057 } 00058 00059 void KVCardDrag::virtual_hook( int, void* ) 00060 { /*BASE::virtual_hook( id, data );*/ } 00061 00062 #include "kvcarddrag.moc"