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 library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #include "kvcarddrag.h" 00022 00023 static const char vcard_mime_string[] = "text/x-vcard"; 00024 00025 KVCardDrag::KVCardDrag( const QString &content, QWidget *dragsource, 00026 const char *name ) 00027 : QStoredDrag( vcard_mime_string, dragsource, name ) 00028 { 00029 setVCard( content ); 00030 } 00031 00032 KVCardDrag::KVCardDrag( QWidget *dragsource, const char *name ) 00033 : QStoredDrag( vcard_mime_string, dragsource, name ) 00034 { 00035 setVCard( QString::null ); 00036 } 00037 00038 void KVCardDrag::setVCard( const QString &content ) 00039 { 00040 setEncodedData( content.utf8() ); 00041 } 00042 00043 bool KVCardDrag::canDecode( QMimeSource *e ) 00044 { 00045 return e->provides( vcard_mime_string ); 00046 } 00047 00048 bool KVCardDrag::decode( QMimeSource *e, QString &content ) 00049 { 00050 content = QString::fromUtf8( e->encodedData( vcard_mime_string ) ); 00051 return true; 00052 } 00053 00054 void KVCardDrag::virtual_hook( int, void* ) 00055 { /*BASE::virtual_hook( id, data );*/ } 00056 00057 #include "kvcarddrag.moc"