summaryrefslogtreecommitdiffstats
path: root/kmail/kmmsgpartdlg.h
blob: d53b7d5656f6c79aa5c688d747e539637416b8ba (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 * kmail: KDE mail client
 * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */
#ifndef kmmsgpartdlg_h
#define kmmsgpartdlg_h

#include <kdialogbase.h>
#include <kio/global.h>

class KMMessagePart;
class TQPushButton;
class KComboBox;
class TQComboBox;
class TQCheckBox;
class TQLabel;
class TQLineEdit;

#undef None

/** @short GUI for KMMsgPartDialog
    @author Marc Mutz <mutz@kde.org>
*/
class KMMsgPartDialog: public KDialogBase
{
  Q_OBJECT

public:
  KMMsgPartDialog( const TQString & caption=TQString::null,
		   TQWidget * parent=0, const char * name=0 );
  virtual ~KMMsgPartDialog();

  /** Get the currently selected mimetype */
  TQString mimeType() const;
  /** Sets the mime type to be displayed. */
  void setMimeType( const TQString & type, const TQString & subtype );
  /** This is an overloaded member function, provided for
      convenience. It behaves essentially like the above function.

      Sets the mime type to be displayed, but only if @p mimeType
      passes KMimeTypeValidator's test.  */
  void setMimeType( const TQString & mimeType );
  /** Sets the initial list of mime types to be displayed in the
      combobox. The items are @em not validated. */
  void setMimeTypeList( const TQStringList & mimeTypes );

  /** Sets the size of the file to be attached in bytes. This is
      strictly informational and thus can't be queried. If @p approx
      is true, the size is an estimation based on typical */
  void setSize( KIO::filesize_t size, bool estimated=false );

  /** Returns the current file name of the attachment. Note that this
      doesn't define which file is being attached. It only defines
      what the attachment's filename parameter should contain. */
  TQString fileName() const;
  /** Sets the file name of the attachment. Note that this doesn't
      define which file is being attached. It only defines what the
      attachment's filename parameter should contain. */
  void setFileName( const TQString & fileName );

  /** Returns the content of the Content-Description header
      field. This field is only informational. */
  TQString description() const;
  /** Sets the description of the attachment, ie. the content of the
      Content-Description header field. */
  void setDescription( const TQString & description );

  /** The list of supported encodings */
  enum Encoding {
    None     = 0x00,
    SevenBit = 0x01,
    EightBit = 0x02,
    QuotedPrintable = 0x04,
    Base64   = 0x08
  };

  /** Returns the current encoding */
  Encoding encoding() const;
  /** Sets the encoding to use */
  void setEncoding( Encoding encoding );
  /** Sets the list of encodings to be shown. @p encodings is the
      bitwise OR of Encoding flags */
  void setShownEncodings( int encodings );

  /** Returns true if the attchment has a content-disposition of
      "inline", false otherwise. */
  bool isInline() const;
  /** Sets whether this attachment has a content-disposition of
      "inline" */
  void setInline( bool inlined );

  /** Returns whether or not this attachment is or shall be encrypted */
  bool isEncrypted() const;
  /** Sets whether or not this attachment is or should be encrypted */
  void setEncrypted( bool encrypted );
  /** Sets whether or not this attachment can be encrypted */
  void setCanEncrypt( bool enable );

  /** Returns whether or not this attachment is or shall be signed */
  bool isSigned() const;
  /** Sets whether or not this attachment is or should be signed */
  void setSigned( bool sign );
  /** Sets whether or not this attachment can be signed */
  void setCanSign( bool enable );

protected slots:
  void slotMimeTypeChanged( const TQString & mimeType );

protected:
  KComboBox  *mMimeType;
  TQLabel     *mIcon;
  TQLabel     *mSize;
  TQLineEdit  *mFileName;
  TQLineEdit  *mDescription;
  TQComboBox  *mEncoding;
  TQCheckBox  *mInline;
  TQCheckBox  *mEncrypted;
  TQCheckBox  *mSigned;
  TQStringList mI18nizedEncodings;
};

/** @short The attachment dialog with convenience backward compatible methods
    @author Marc Mutz <mutz@kde.org>
*/
class KMMsgPartDialogCompat : public KMMsgPartDialog {
  Q_OBJECT
public:
  KMMsgPartDialogCompat( TQWidget * parent=0, const char * caption=0, bool=FALSE );
  virtual ~KMMsgPartDialogCompat();

  /** Display information about this message part. */
  void setMsgPart(KMMessagePart* msgPart);

  /** Returns the (possibly modified) message part. */
  KMMessagePart* msgPart(void) const { return mMsgPart; }

protected slots:
  void slotOk();

protected:
  /** Applies changes from the dialog to the message part. Called
      when the Ok button is pressed. */
  void applyChanges(void);

  KMMessagePart *mMsgPart;
};

#endif /*kmmsgpartdlg_h*/