kmmimeparttree.h
00001 /* -*- c++ -*- 00002 kmmimeparttree.cpp A MIME part tree viwer. 00003 00004 This file is part of KMail, the KDE mail client. 00005 Copyright (c) 2002-2004 Klarälvdalens Datakonsult AB 00006 00007 KMail is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License, version 2, as 00009 published by the Free Software Foundation. 00010 00011 KMail is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 In addition, as a special exception, the copyright holders give 00021 permission to link the code of this program with any edition of 00022 the TQt library by Trolltech AS, Norway (or with modified versions 00023 of TQt that use the same license as TQt), and distribute linked 00024 combinations including the two. You must obey the GNU General 00025 Public License in all respects for all of the code used other than 00026 TQt. If you modify this file, you may extend this exception to 00027 your version of the file, but you are not obligated to do so. If 00028 you do not wish to do so, delete this exception statement from 00029 your version. 00030 */ 00031 00032 00033 00034 // -*- c++ -*- 00035 #ifndef KMMIMEPARTTREE_H 00036 #define KMMIMEPARTTREE_H 00037 00038 #include <tdelistview.h> 00039 #include <tdeio/global.h> 00040 00041 #include <tqstring.h> 00042 00043 class partNode; 00044 class KMReaderWin; 00045 class KMMimePartTreeItem; 00046 00047 class KMMimePartTree : public TDEListView 00048 { 00049 Q_OBJECT 00050 00051 friend class ::KMReaderWin; 00052 00053 public: 00054 KMMimePartTree( KMReaderWin* readerWin, 00055 TQWidget* parent, 00056 const char* name = 0 ); 00057 virtual ~KMMimePartTree(); 00058 00059 void correctSize( TQListViewItem * item ); 00060 00061 protected slots: 00062 void itemClicked( TQListViewItem* ); 00063 void itemRightClicked( TQListViewItem*, const TQPoint& ); 00064 void slotSaveAs(); 00065 void slotSaveAsEncoded(); 00066 void slotSaveAll(); 00067 void slotDelete(); 00068 void slotEdit(); 00069 void slotOpen(); 00070 void slotOpenWith(); 00071 void slotView(); 00072 void slotProperties(); 00073 void slotCopy(); 00074 00075 protected: 00078 void styleChange( TQStyle& oldStyle ); 00079 00082 void setStyleDependantFrameWidth(); 00083 00084 void saveSelectedBodyParts( bool encoded ); 00085 void restoreLayoutIfPresent(); 00086 00087 /* reimpl */ 00088 void startDrag(); 00089 00090 void startHandleAttachmentCommand( int type ); 00091 00092 protected: 00093 KMReaderWin* mReaderWin; 00094 KMMimePartTreeItem* mCurrentContextMenuItem; 00095 int mSizeColumn; 00096 }; 00097 00098 class KMMimePartTreeItem :public TQListViewItem 00099 { 00100 public: 00101 KMMimePartTreeItem( KMMimePartTree * parent, 00102 partNode* node, 00103 const TQString & labelDescr, 00104 const TQString & labelCntType = TQString(), 00105 const TQString & labelEncoding = TQString(), 00106 TDEIO::filesize_t size=0 ); 00107 KMMimePartTreeItem( KMMimePartTreeItem * parent, 00108 partNode* node, 00109 const TQString & labelDescr, 00110 const TQString & labelCntType = TQString(), 00111 const TQString & labelEncoding = TQString(), 00112 TDEIO::filesize_t size=0, 00113 bool revertOrder = false ); 00114 partNode* node() const { return mPartNode; } 00115 00116 TDEIO::filesize_t origSize() const { return mOrigSize; } 00117 void setOrigSize( TDEIO::filesize_t size ) { mOrigSize = size; } 00118 00119 private: 00120 void setIconAndTextForType( const TQString & mimetype ); 00121 00122 partNode* mPartNode; 00123 TDEIO::filesize_t mOrigSize; 00124 }; 00125 00126 #endif // KMMIMEPARTTREE_H