summaryrefslogtreecommitdiffstats
path: root/kmail/kmatmlistview.h
blob: f50d4e398862fbab0f05f105c3301b2a3d7a1842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* -*- mode: C++; c-file-style: "gnu" -*-
 * KMAtmListViewItem Header File
 * Author: Markus Wuebben <markus.wuebben@kde.org>
 */
#ifndef __KMAIL_KMATMLISTVIEW_H__
#define __KMAIL_KMATMLISTVIEW_H__

#include <qlistview.h>
#include <qcstring.h>

class KMComposeWin;
class MessageComposer;
class QCheckBox;

class KMAtmListViewItem : public QObject, public QListViewItem
{
  Q_OBJECT

public:
  KMAtmListViewItem( QListView *parent );
  virtual ~KMAtmListViewItem();

  //A custom compare function is needed because the size column is
  //human-readable and therefore doesn't sort correctly.
  virtual int compare( QListViewItem *i, int col, bool ascending ) const;

  virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align );

  void setUncompressedMimeType( const QCString & type, const QCString & subtype ) {
    mType = type; mSubtype = subtype;
  }
  void setAttachmentSize( int numBytes ) {
    mAttachmentSize = numBytes;
  }
  void uncompressedMimeType( QCString & type, QCString & subtype ) const {
    type = mType; subtype = mSubtype;
  }
  void setUncompressedCodec( const QCString &codec ) { mCodec = codec; }
  QCString uncompressedCodec() const { return mCodec; }

  void enableCryptoCBs( bool on );
  void setEncrypt( bool on );
  bool isEncrypt();
  void setSign( bool on );
  bool isSign();
  void setCompress( bool on );
  bool isCompress();

signals:
  void compress( int );
  void uncompress( int );

private slots:
  void slotCompress();
  void slotHeaderChange( int, int, int );
  void slotHeaderClick( int );

protected:

  void updateCheckBox( int headerSection, QCheckBox *cb );
  void updateAllCheckBoxes();

private:
  QCheckBox *mCBEncrypt;
  QCheckBox *mCBSign;
  QCheckBox *mCBCompress;
  QCString mType, mSubtype, mCodec;
  int mAttachmentSize;
};

#endif // __KMAIL_KMATMLISTVIEW_H__