00001 /*************************************************************************** 00002 showrecord.h - description 00003 ------------------- 00004 begin : Thu Dec 28 2000 00005 copyright : (C) 2000-2001 by Eggert Ehmke 00006 email : eggert.ehmke@berlin.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef SHOWRECORDELEM_H 00019 #define SHOWRECORDELEM_H 00020 00021 //Qt headers 00022 #include <qdom.h> 00023 #include <qstring.h> 00024 #include <qlistview.h> 00025 #include <qdatetime.h> 00026 00027 //KDE headers 00028 #include <klocale.h> 00029 #include <kglobal.h> 00030 #include <kdebug.h> 00031 #include <mimelib/datetime.h> 00032 #include <kmdcodec.h> 00033 00034 //KShowmail headers 00035 #include "showlistviewitem.h" 00036 #include "decodeRFC2047.h" 00037 #include "filterelem.h" 00038 #include "filter.h" 00039 #include "logger.h" 00040 #include "constants.h" 00041 #include "kshowmailview.h" 00042 #include "showheaderdialog.h" 00043 00044 using namespace Constants; 00045 00046 //forward class declarations 00047 class KshowmailView; 00048 class FilterElem; 00049 00062 class ShowRecordElem 00063 { 00064 00065 public: 00066 00071 static const int continueShowHeaders; 00072 00077 static const int cancelShowHeaders; 00078 00082 ShowRecordElem (); 00083 00090 ShowRecordElem( int number, QString& uid, bool isNew ); 00091 00097 void setHeader( const QString& header ); 00098 00103 QString header() const; 00104 00109 QString from() const; 00110 00115 QString to() const; 00116 00121 QString subject() const; 00122 00127 QString content() const; 00128 00129 00135 QString date() const; 00136 00143 QString strUnixTime () const; 00144 00149 void setUIDL( const QString& uid ); 00150 00155 QString uidl() const; 00156 00161 void setSize( int size ); 00162 00167 int size() const; 00168 00173 QString strSize () const; 00174 00178 QString strSizePrefix() const; 00179 00184 void setNew( bool isnew ); 00185 00191 bool isNew() const; 00192 00198 QString state() const; 00199 00204 void setNumber( int n ); 00205 00210 int number() const; 00211 00218 void setViewItem( ShowListViewItem* item ); 00219 00226 ShowListViewItem* viewItem() const; 00227 00236 void applyFilters(); 00237 00245 void readOptions( QDomElement& elem ); 00246 00253 void saveOptions( QDomDocument& doc, QDomElement& parent ); 00254 00260 bool isSelected() const; 00261 00273 QString decodeMailBody( QByteArray body, bool preferHTML ) const; 00274 00281 int showHeader( QString& account ); 00282 00283 private: 00284 00288 QCString m_header; 00289 00293 QCString m_from; 00294 00298 QCString m_to; 00299 00303 QCString m_subject; 00304 00308 QDateTime m_unixDate; 00309 00313 QCString m_content; 00314 00318 QString m_uid; 00319 00323 int m_size; 00324 00328 bool m_new; 00329 00333 int m_nNumber; 00334 00340 ShowListViewItem* m_pItem; 00341 00348 FilterElem* m_pFilter; 00349 00361 QCString scanHeader( const QString& item ) const; 00362 00367 void setFrom( const QCString& from ); 00368 00373 void setTo( const QCString& to ); 00374 00379 void setSubject( const QCString& subject ); 00380 00385 void setDate( const QCString& date ); 00386 00391 void setContent( const QCString& content ); 00392 00398 void setFilter( FilterElem* filter ); 00399 00405 QString getBoundary() const; 00406 00412 QString getCharset() const; 00413 00420 QString getTransferEncoding() const; 00421 00422 }; 00423 00424 #endif