/*
 * 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 <tdeio/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
{
  TQ_OBJECT
  

public:
  KMMsgPartDialog( const TQString & caption=TQString(),
		   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( TDEIO::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 {
  TQ_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*/
