libtdepim

kvcarddrag.h
00001 /*
00002     This file is part of libtdepim.
00003 
00004     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KVCARDDRAG_H
00023 #define KVCARDDRAG_H
00024 
00025 #include <tqdragobject.h>
00026 #include <tqstring.h>
00027 
00028 #include <tdeabc/addressee.h>
00029 #include <tdeabc/vcardparser.h> // for KABC_VCARD_ENCODING_FIX define
00030 #include <tdepimmacros.h>
00031 
00032 class KVCardDragPrivate;
00033 
00040 class KDE_EXPORT KVCardDrag : public TQStoredDrag
00041 {
00042   Q_OBJECT
00043   
00044 
00045   public:
00049     KVCardDrag( TQWidget *dragsource = 0, const char *name = 0 );
00050 
00054 #if defined(KABC_VCARD_ENCODING_FIX)
00055     KVCardDrag( const TQByteArray &content, TQWidget *dragsource = 0, const char *name = 0 );
00056 #else
00057     KVCardDrag( const TQString &content, TQWidget *dragsource = 0, const char *name = 0 );
00058 #endif
00059     virtual ~KVCardDrag() {}
00060 
00064 #if defined(KABC_VCARD_ENCODING_FIX)
00065     void setVCard( const TQByteArray &content );
00066 #else
00067     void setVCard( const TQString &content );
00068 #endif
00069 
00072     static bool canDecode( TQMimeSource *e );
00073 
00077 #if defined(KABC_VCARD_ENCODING_FIX)
00078     static bool decode( TQMimeSource *e, TQByteArray &content );
00079 #else
00080     static bool decode( TQMimeSource *e, TQString &content );
00081 #endif
00082 
00086     static bool decode( TQMimeSource *e, TDEABC::Addressee::List& addressees );
00087 
00088   protected:
00089      virtual void virtual_hook( int id, void* data );
00090 
00091   private:
00092      KVCardDragPrivate *d;
00093 };
00094 
00095 #endif // KVCARDDRAG_H