kmail

kmmimeparttree.h
1/*
2 kmmimeparttree.cpp A MIME part tree viwer.
3
4 This file is part of KMail, the KDE mail client.
5 Copyright (c) 2002-2004 Klarälvdalens Datakonsult AB
6
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
10
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the TQt library by Trolltech AS, Norway (or with modified versions
23 of TQt that use the same license as TQt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 TQt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
29 your version.
30*/
31#ifndef KMMIMEPARTTREE_H
32#define KMMIMEPARTTREE_H
33
34#include <tdelistview.h>
35#include <tdeio/global.h>
36
37#include <tqstring.h>
38
39class partNode;
40class KMReaderWin;
41class KMMimePartTreeItem;
42
43class KMMimePartTree : public TDEListView
44{
45 TQ_OBJECT
46
47 friend class ::KMReaderWin;
48
49public:
50 KMMimePartTree( KMReaderWin* readerWin,
51 TQWidget* parent,
52 const char* name = 0 );
53 virtual ~KMMimePartTree();
54
55 void correctSize( TQListViewItem * item );
56
57protected slots:
58 void itemClicked( TQListViewItem* );
59 void itemRightClicked( TQListViewItem*, const TQPoint& );
60 void slotSaveAs();
61 void slotSaveAsEncoded();
62 void slotSaveAll();
63 void slotDelete();
64 void slotEdit();
65 void slotOpen();
66 void slotOpenWith();
67 void slotView();
68 void slotProperties();
69 void slotCopy();
70
71protected:
74 void styleChange( TQStyle& oldStyle );
75
78 void setStyleDependantFrameWidth();
79
80 void saveSelectedBodyParts( bool encoded );
81 void restoreLayoutIfPresent();
82
83 /* reimpl */
84 void startDrag();
85
86 void startHandleAttachmentCommand( int type );
87
88protected:
89 KMReaderWin* mReaderWin;
90 KMMimePartTreeItem* mCurrentContextMenuItem;
91 int mSizeColumn;
92};
93
94class KMMimePartTreeItem :public TQListViewItem
95{
96public:
97 KMMimePartTreeItem( KMMimePartTree * parent,
98 partNode* node,
99 const TQString & labelDescr,
100 const TQString & labelCntType = TQString(),
101 const TQString & labelEncoding = TQString(),
102 TDEIO::filesize_t size=0 );
103 KMMimePartTreeItem( KMMimePartTreeItem * parent,
104 partNode* node,
105 const TQString & labelDescr,
106 const TQString & labelCntType = TQString(),
107 const TQString & labelEncoding = TQString(),
108 TDEIO::filesize_t size=0,
109 bool revertOrder = false );
110 partNode* node() const { return mPartNode; }
111
112 TDEIO::filesize_t origSize() const { return mOrigSize; }
113 void setOrigSize( TDEIO::filesize_t size ) { mOrigSize = size; }
114
115private:
116 void setIconAndTextForType( const TQString & mimetype );
117
118 partNode* mPartNode;
119 TDEIO::filesize_t mOrigSize;
120};
121
122#endif // KMMIMEPARTTREE_H
This class implements a "reader window", that is a window used for reading or viewing messages.
Definition: kmreaderwin.h:75