libkcal

attachment.h

00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2002 Michael Brade <brade@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 #ifndef KCAL_ATTACHMENT_H
00022 #define KCAL_ATTACHMENT_H
00023 
00024 #include "listbase.h"
00025 #include "libkcal_export.h"
00026 
00027 #include <tqstring.h>
00028 
00029 namespace KCal {
00030 
00034 class KDE_EXPORT Attachment
00035 {
00036   public:
00037     typedef ListBase<Attachment> List;
00038 
00044     Attachment( const Attachment &attachment );
00045 
00052     Attachment( const TQString &uri, const TQString &mime = TQString() );
00053 
00060     Attachment( const char *base64, const TQString &mime = TQString() );
00061 
00062     ~Attachment();
00063 
00064     /* The VALUE parameter in iCal */
00065     bool isUri() const;
00066     TQString uri() const;
00067     void setUri( const TQString &uri );
00068 
00069     bool isBinary() const;
00070     char *data() const;
00071     void setData( const char *base64 );
00072 
00073     void setDecodedData( const TQByteArray &data );
00074     TQByteArray &decodedData();
00075 
00076     uint size();
00077 
00078     /* The optional FMTTYPE parameter in iCal */
00079     TQString mimeType() const;
00080     void setMimeType( const TQString &mime );
00081 
00082     /* The custom X-CONTENT-DISPOSITION parameter, used by OGo etc. */
00083     bool showInline() const;
00084     void setShowInline( bool showinline );
00085 
00086     /* The custom X-LABEL parameter to show a human-readable title */
00087     TQString label() const;
00088     void setLabel( const TQString &label );
00089 
00099     void setLocal( bool local );
00100 
00104     bool isLocal() const;
00105 
00106   private:
00107     TQByteArray mDataCache;
00108     uint mSize;
00109     TQString mMimeType;
00110     TQString mUri;
00111     char *mData;
00112     TQString mLabel;
00113     bool mBinary;
00114     bool mLocal;
00115     bool mShowInline;
00116 
00117     class Private;
00118     Private *d;
00119 };
00120 
00121 }
00122 
00123 #endif