Backport r950340 | aacid | 2009-04-06 23:21:18 +0200 (Mon, 06 Apr 2009) | 4 lines
[kdepim.git] / kmail / kmatmlistview.h
blob1c6179e4d0c44e65a303239c14867c65604d36ad
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2 This file is part of KMail, the KDE mail client.
3 Copyright (c) 1997 Markus Wuebben <markus.wuebben@kde.org>
4 Copyright (c) 2007 Thomas McGuire <Thomas.McGuire@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __KMAIL_KMATMLISTVIEW_H__
22 #define __KMAIL_KMATMLISTVIEW_H__
24 #include <QTreeWidgetItem>
26 class QCheckBox;
27 class KMMessagePart;
29 namespace KMail {
30 class AttachmentListView;
33 class KMAtmListViewItem : public QObject, public QTreeWidgetItem
35 Q_OBJECT
37 public:
38 explicit KMAtmListViewItem( KMail::AttachmentListView *parent,
39 KMMessagePart* attachment );
40 virtual ~KMAtmListViewItem();
42 // A custom compare operator is needed because the size column is
43 // human-readable and therefore doesn't sort correctly.
44 virtual bool operator < ( const QTreeWidgetItem & other ) const;
46 void setUncompressedMimeType( const QByteArray &type, const QByteArray &subtype )
48 mType = type; mSubtype = subtype;
50 void setAttachmentSize( int numBytes )
52 mAttachmentSize = numBytes;
54 void uncompressedMimeType( QByteArray & type, QByteArray & subtype ) const
56 type = mType; subtype = mSubtype;
58 void setUncompressedCodec( const QByteArray & codec ) { mCodec = codec; }
59 QByteArray uncompressedCodec() const { return mCodec; }
61 void setEncrypt( bool on );
62 bool isEncrypt() const;
63 void setSign( bool on );
64 bool isSign() const;
65 void setCompress( bool on );
66 bool isCompress() const;
68 // Returns a pointer to the KMMessagePart this item is associated with.
69 KMMessagePart* attachment() const;
71 signals:
72 void compress( KMAtmListViewItem* );
73 void uncompress( KMAtmListViewItem* );
75 private slots:
76 void slotCompress();
78 private:
80 // This function adds a center-aligned checkbox to the specified column
81 // and then returns that checkbox.
82 QCheckBox* addCheckBox( int column );
84 QCheckBox *mCBEncrypt;
85 QCheckBox *mCBSign;
86 QCheckBox *mCBCompress;
87 QByteArray mType, mSubtype, mCodec;
88 int mAttachmentSize;
89 KMMessagePart* mAttachment;
90 KMail::AttachmentListView *mParent;
93 #endif // __KMAIL_KMATMLISTVIEW_H__