kmail

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 Qt library by Trolltech AS, Norway (or with modified versions
00023     of Qt that use the same license as Qt), 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     Qt.  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 <klistview.h>
00039 #include <kio/global.h>
00040 
00041 #include <qstring.h>
00042 
00043 class partNode;
00044 class KMReaderWin;
00045 class KMMimePartTreeItem;
00046 
00047 class KMMimePartTree : public KListView
00048 {
00049   Q_OBJECT
00050   friend class ::KMReaderWin;
00051 
00052 public:
00053   KMMimePartTree( KMReaderWin* readerWin,
00054                   QWidget* parent,
00055                   const char* name = 0 );
00056   virtual ~KMMimePartTree();
00057 
00058   void correctSize( QListViewItem * item );
00059 
00060 protected slots:
00061   void itemClicked( QListViewItem* );
00062   void itemRightClicked( QListViewItem*, const QPoint& );
00063   void slotSaveAs();
00064   void slotSaveAsEncoded();
00065   void slotSaveAll();
00066 
00067 protected:
00070   void styleChange( QStyle& oldStyle );
00071 
00074   void setStyleDependantFrameWidth();
00075 
00076   void saveSelectedBodyParts( bool encoded );
00077   void restoreLayoutIfPresent();
00078 
00079 protected:
00080   KMReaderWin* mReaderWin;
00081   KMMimePartTreeItem* mCurrentContextMenuItem;
00082   int mSizeColumn;
00083 };
00084 
00085 class KMMimePartTreeItem :public QListViewItem
00086 {
00087 public:
00088   KMMimePartTreeItem( KMMimePartTree * parent,
00089                       partNode* node,
00090                       const QString & labelDescr,
00091                       const QString & labelCntType  = QString::null,
00092                       const QString & labelEncoding = QString::null,
00093                       KIO::filesize_t size=0 );
00094   KMMimePartTreeItem( KMMimePartTreeItem * parent,
00095                       partNode* node,
00096                       const QString & labelDescr,
00097                       const QString & labelCntType  = QString::null,
00098                       const QString & labelEncoding = QString::null,
00099                       KIO::filesize_t size=0,
00100                       bool revertOrder = false );
00101   partNode* node() const { return mPartNode; }
00102 
00103   KIO::filesize_t origSize() const { return mOrigSize; }
00104   void setOrigSize( KIO::filesize_t size ) { mOrigSize = size; }
00105 
00106 private:
00107   void setIconAndTextForType( const QString & mimetype );
00108 
00109   partNode* mPartNode;
00110   KIO::filesize_t mOrigSize;
00111 };
00112 
00113 #endif // KMMIMEPARTTREE_H
KDE Home | KDE Accessibility Home | Description of Access Keys