summaryrefslogtreecommitdiffstats
path: root/kmail/kmatmlistview.h
blob: e42f2628ea8d59446e0e3eadd806d78804e111dc (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 <tqlistview.h>
#include <tqcstring.h>

class KMComposeWin;
class MessageComposer;
class QCheckBox;

class KMAtmListViewItem : public TQObject, public QListViewItem
{
  Q_OBJECT

public:
  KMAtmListViewItem( TQListView *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( TQListViewItem *i, int col, bool ascending ) const;

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

  void setUncompressedMimeType( const TQCString & type, const TQCString & subtype ) {
    mType = type; mSubtype = subtype;
  }
  void setAttachmentSize( int numBytes ) {
    mAttachmentSize = numBytes;
  }
  void uncompressedMimeType( TQCString & type, TQCString & subtype ) const {
    type = mType; subtype = mSubtype;
  }
  void setUncompressedCodec( const TQCString &codec ) { mCodec = codec; }
  TQCString 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, TQCheckBox *cb );
  void updateAllCheckBoxes();

private:
  TQCheckBox *mCBEncrypt;
  TQCheckBox *mCBSign;
  TQCheckBox *mCBCompress;
  TQCString mType, mSubtype, mCodec;
  int mAttachmentSize;
};

#endif // __KMAIL_KMATMLISTVIEW_H__