24#ifndef RECIPIENTSEDITOR_H 
   25#define RECIPIENTSEDITOR_H 
   28#include <tqscrollview.h> 
   29#include <tqguardedptr.h> 
   30#include <tqlineedit.h> 
   33#include "kmlineeditspell.h" 
   34#include <tqcombobox.h> 
   36class RecipientsPicker;
 
   38class KWindowPositioner;
 
   47    typedef TQValueList<Recipient> List;
 
   49    enum Type { To, Cc, Bcc, Undefined };
 
   51    Recipient( 
const TQString &email = TQString(), Type type = To );
 
   56    void setEmail( 
const TQString & );
 
   57    TQString email() 
const;
 
   61    static int typeToId( Type );
 
   62    static Type idToType( 
int );
 
   64    TQString typeLabel() 
const;    
static TQString typeLabel( Type );
 
   65    static TQStringList allTypeLabels();
 
   72class RecipientComboBox : 
public TQComboBox
 
   77    RecipientComboBox( TQWidget *parent );
 
   83    void keyPressEvent( TQKeyEvent *ev );
 
   86class RecipientLineEdit : 
public KMLineEdit
 
   91    RecipientLineEdit( TQWidget * parent ) :
 
   92      KMLineEdit( true, parent ) {}
 
  100    void keyPressEvent( TQKeyEvent *ev );
 
  103class RecipientLine : 
public TQWidget
 
  108    RecipientLine( TQWidget *parent );
 
  110    void setRecipient( 
const Recipient & );
 
  111    Recipient recipient() 
const;
 
  113    void setRecipientType( Recipient::Type );
 
  114    Recipient::Type recipientType() 
const;
 
  116    void setRecipient( 
const TQString & );
 
  130    void clearModified();
 
  132    int setComboWidth( 
int w );
 
  134    void fixTabOrder( TQWidget *previous );
 
  135    TQWidget *tabOut() 
const;
 
  139    int recipientsCount();
 
  141    void setRemoveLineButtonEnabled( 
bool b );
 
  144    void returnPressed( RecipientLine * );
 
  145    void downPressed( RecipientLine * );
 
  146    void upPressed( RecipientLine * );
 
  148    void deleteLine(  RecipientLine * );
 
  150    void typeModified( RecipientLine * );
 
  153    void keyPressEvent( TQKeyEvent * );
 
  154    RecipientLineEdit* lineEdit()
 const { 
return mEdit; }
 
  157    void slotReturnPressed();
 
  158    void analyzeLine( 
const TQString & );
 
  160    void slotFocusDown();
 
  161    void slotPropagateDeletion();
 
  162    void slotTypeModified();
 
  165    friend class RecipientsView;
 
  167    RecipientLineEdit *mEdit;
 
  168    TQPushButton *mRemoveButton;
 
  169    int mRecipientsCount;
 
  173class RecipientsView : 
public TQScrollView
 
  178    RecipientsView( TQWidget *parent );
 
  180    TQSize minimumSizeHint() 
const;
 
  181    TQSize sizeHint() 
const;
 
  183    RecipientLine *activeLine();
 
  185    RecipientLine *emptyLine();
 
  187    Recipient::List recipients() 
const;
 
  193    void removeRecipient( 
const TQString & recipient, Recipient::Type type );
 
  202    void clearModified();
 
  204    void activateLine( RecipientLine * );
 
  212    int setFirstColumnWidth( 
int );
 
  215    void setCompletionMode( TDEGlobalSettings::Completion );
 
  216    RecipientLine *addLine();
 
  220    void setFocusBottom();
 
  223    void totalChanged( 
int recipients, 
int lines );
 
  227    void completionModeChanged( TDEGlobalSettings::Completion );
 
  228    void sizeHintChanged();
 
  231    void viewportResizeEvent( TQResizeEvent * );
 
  235    void slotReturnPressed( RecipientLine * );
 
  236    void slotDownPressed( RecipientLine * );
 
  237    void slotUpPressed( RecipientLine * );
 
  238    void slotDecideLineDeletion(  RecipientLine * );
 
  239    void slotDeleteLine();
 
  240    void calculateTotal();
 
  241    void slotTypeModified( RecipientLine * );
 
  242    void moveCompletionPopup();
 
  245    TQPtrList<RecipientLine> mLines;
 
  246    TQGuardedPtr<RecipientLine> mCurDelLine;
 
  248    int mFirstColumnWidth;
 
  250    TDEGlobalSettings::Completion mCompletionMode;
 
  253class RecipientsToolTip : 
public TQToolTip
 
  256    RecipientsToolTip( RecipientsView *, TQWidget *parent );
 
  259    void maybeTip( 
const TQPoint & p );
 
  261    TQString line( 
const Recipient & );
 
  264    RecipientsView *mView;
 
  267class SideWidget : 
public TQWidget
 
  272    SideWidget( RecipientsView *view, TQWidget *parent );
 
  275    RecipientsPicker* picker() 
const;
 
  278    void setTotal( 
int recipients, 
int lines );
 
  281    void pickRecipient();
 
  284    void pickedRecipient( 
const Recipient & );
 
  285    void saveDistributionList();
 
  288    RecipientsView *mView;
 
  289    TQLabel *mTotalLabel;
 
  290    TQPushButton *mDistributionListButton;
 
  291    TQPushButton *mSelectButton;
 
  294    mutable RecipientsPicker *mRecipientPicker;
 
  296    mutable KWindowPositioner *mPickerPositioner;
 
  299class RecipientsEditor : 
public TQWidget
 
  304    RecipientsEditor( TQWidget *parent );
 
  309    Recipient::List recipients() 
const;
 
  310    RecipientsPicker* picker() 
const;
 
  312    void setRecipientString( 
const TQString &, Recipient::Type );
 
  313    TQString recipientString( Recipient::Type );
 
  319    void addRecipient( 
const TQString & recipient, Recipient::Type type );
 
  325    void removeRecipient( 
const TQString & recipient, Recipient::Type type );
 
  334    void clearModified();
 
  342    int setFirstColumnWidth( 
int );
 
  347    void setCompletionMode( TDEGlobalSettings::Completion );
 
  352    void setFocusBottom();
 
  354    void selectRecipients();
 
  355    void saveDistributionList();
 
  360    void completionModeChanged( TDEGlobalSettings::Completion );
 
  361    void sizeHintChanged();
 
  364    void slotPickedRecipient( 
const Recipient & );
 
  367    RecipientsView *mRecipientsView;
 
  368    SideWidget* mSideWidget;