25 #include "recipientseditor.h"
27 #include "recipientspicker.h"
28 #include "twindowpositioner.h"
29 #include "distributionlistdialog.h"
30 #include "globalsettings.h"
32 #include <libemailfunctions/email.h>
34 #include <tdeapplication.h>
35 #include <tdecompletionbox.h>
37 #include <kinputdialog.h>
38 #include <tdelocale.h>
39 #include <kiconloader.h>
40 #include <tdemessagebox.h>
44 #include <tqscrollview.h>
45 #include <tqcombobox.h>
48 #include <tqpushbutton.h>
49 #include <tqstylesheet.h>
51 Recipient::Recipient(
const TQString &email, Recipient::Type type )
52 : mEmail( email ), mType( type )
56 void Recipient::setType( Type type )
61 Recipient::Type Recipient::type()
const
66 void Recipient::setEmail(
const TQString &email )
71 TQString Recipient::email()
const
76 bool Recipient::isEmpty()
const
78 return mEmail.isEmpty();
81 int Recipient::typeToId( Recipient::Type type )
83 return static_cast<int>( type );
86 Recipient::Type Recipient::idToType(
int id )
88 return static_cast<Type
>( id );
91 TQString Recipient::typeLabel()
const
93 return typeLabel( mType );
96 TQString Recipient::typeLabel( Recipient::Type type )
109 return i18n(
"<Undefined RecipientType>");
112 TQStringList Recipient::allTypeLabels()
115 types.append( typeLabel( To ) );
116 types.append( typeLabel( Cc ) );
117 types.append( typeLabel( Bcc ) );
122 RecipientComboBox::RecipientComboBox( TQWidget *parent )
123 : TQComboBox( parent )
127 void RecipientComboBox::keyPressEvent( TQKeyEvent *ev )
129 if ( ev->key() == Key_Right ) emit rightPressed();
130 else TQComboBox::keyPressEvent( ev );
134 void RecipientLineEdit::keyPressEvent( TQKeyEvent *ev )
136 if ( ev->key() == Key_Backspace && text().isEmpty() ) {
139 }
else if ( ev->key() == Key_Left && cursorPosition() == 0 ) {
141 }
else if ( ev->key() == Key_Right && cursorPosition() == (
int)text().length() ) {
144 KMLineEdit::keyPressEvent( ev );
148 RecipientLine::RecipientLine( TQWidget *parent )
149 : TQWidget( parent ), mRecipientsCount( 0 ), mModified( false )
151 TQBoxLayout *topLayout =
new TQHBoxLayout(
this );
152 topLayout->setSpacing( KDialog::spacingHint() );
154 TQStringList recipientTypes = Recipient::allTypeLabels();
156 mCombo =
new RecipientComboBox(
this );
157 mCombo->insertStringList( recipientTypes );
158 topLayout->addWidget( mCombo );
159 TQToolTip::add( mCombo, i18n(
"Select type of recipient") );
161 mEdit =
new RecipientLineEdit(
this );
162 TQToolTip::add( mEdit,
163 i18n(
"Set the list of email addresses to receive this message" ) );
164 topLayout->addWidget( mEdit );
165 connect( mEdit, TQ_SIGNAL( returnPressed() ), TQ_SLOT( slotReturnPressed() ) );
166 connect( mEdit, TQ_SIGNAL( deleteMe() ), TQ_SLOT( slotPropagateDeletion() ) );
167 connect( mEdit, TQ_SIGNAL( textChanged(
const TQString & ) ),
168 TQ_SLOT( analyzeLine(
const TQString & ) ) );
169 connect( mEdit, TQ_SIGNAL( focusUp() ), TQ_SLOT( slotFocusUp() ) );
170 connect( mEdit, TQ_SIGNAL( focusDown() ), TQ_SLOT( slotFocusDown() ) );
171 connect( mEdit, TQ_SIGNAL( rightPressed() ), TQ_SIGNAL( rightPressed() ) );
173 connect( mEdit, TQ_SIGNAL( leftPressed() ), mCombo, TQ_SLOT( setFocus() ) );
174 connect( mCombo, TQ_SIGNAL( rightPressed() ), mEdit, TQ_SLOT( setFocus() ) );
176 connect( mCombo, TQ_SIGNAL( activated (
int ) ),
177 this, TQ_SLOT( slotTypeModified() ) );
179 mRemoveButton =
new TQPushButton(
this );
180 mRemoveButton->setIconSet( TDEApplication::reverseLayout() ? SmallIconSet(
"locationbar_erase") : SmallIconSet(
"clear_left" ) );
181 topLayout->addWidget( mRemoveButton );
182 connect( mRemoveButton, TQ_SIGNAL( clicked() ), TQ_SLOT( slotPropagateDeletion() ) );
183 TQToolTip::add( mRemoveButton, i18n(
"Remove recipient line") );
186 void RecipientLine::slotFocusUp()
188 emit upPressed(
this );
191 void RecipientLine::slotFocusDown()
193 emit downPressed(
this );
196 void RecipientLine::slotTypeModified()
200 emit typeModified(
this );
203 void RecipientLine::analyzeLine(
const TQString &text )
205 TQStringList r = KPIM::splitEmailAddrList( text );
206 if (
int( r.count() ) != mRecipientsCount ) {
207 mRecipientsCount = r.count();
212 int RecipientLine::recipientsCount()
214 return mRecipientsCount;
217 void RecipientLine::setRecipient(
const Recipient &rec )
219 mEdit->setText( rec.email() );
220 mCombo->setCurrentItem( Recipient::typeToId( rec.type() ) );
223 void RecipientLine::setRecipient(
const TQString &email )
225 setRecipient( Recipient( email ) );
228 Recipient RecipientLine::recipient()
const
230 return Recipient( mEdit->text(),
231 Recipient::idToType( mCombo->currentItem() ) );
234 void RecipientLine::setRecipientType( Recipient::Type type )
236 mCombo->setCurrentItem( Recipient::typeToId( type ) );
239 Recipient::Type RecipientLine::recipientType()
const
241 return Recipient::idToType( mCombo->currentItem() );
244 void RecipientLine::activate()
249 bool RecipientLine::isActive()
251 return mEdit->hasFocus();
254 bool RecipientLine::isEmpty()
256 return mEdit->text().isEmpty();
259 bool RecipientLine::isModified()
261 return mModified || mEdit->isModified();
264 void RecipientLine::clearModified()
267 mEdit->clearModified();
270 void RecipientLine::slotReturnPressed()
272 emit returnPressed(
this );
275 void RecipientLine::slotPropagateDeletion()
277 emit deleteLine(
this );
280 void RecipientLine::keyPressEvent( TQKeyEvent *ev )
282 if ( ev->key() == Key_Up ) {
283 emit upPressed(
this );
284 }
else if ( ev->key() == Key_Down ) {
285 emit downPressed(
this );
289 int RecipientLine::setComboWidth(
int w )
291 w = TQMAX( w, mCombo->sizeHint().width() );
292 mCombo->setFixedWidth( w );
293 mCombo->updateGeometry();
294 parentWidget()->updateGeometry();
298 void RecipientLine::fixTabOrder( TQWidget *previous )
300 setTabOrder( previous, mCombo );
301 setTabOrder( mCombo, mEdit );
302 setTabOrder( mEdit, mRemoveButton );
305 TQWidget *RecipientLine::tabOut()
const
307 return mRemoveButton;
310 void RecipientLine::clear()
315 void RecipientLine::setRemoveLineButtonEnabled(
bool b )
317 mRemoveButton->setEnabled( b );
323 RecipientsView::RecipientsView( TQWidget *parent )
324 : TQScrollView( parent ), mCurDelLine( 0 ),
325 mLineHeight( 0 ), mFirstColumnWidth( 0 ),
328 mCompletionMode = TDEGlobalSettings::completionMode();
329 setHScrollBarMode( AlwaysOff );
333 setResizePolicy( TQScrollView::Manual );
334 setSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding );
336 viewport()->setPaletteBackgroundColor( paletteBackgroundColor() );
339 RecipientLine *RecipientsView::activeLine()
341 return mLines.last();
344 RecipientLine *RecipientsView::emptyLine()
347 for( line = mLines.first(); line; line = mLines.next() ) {
348 if ( line->isEmpty() )
return line;
354 RecipientLine *RecipientsView::addLine()
356 RecipientLine *line =
new RecipientLine( viewport() );
357 addChild( line, 0, mLines.count() * mLineHeight );
358 line->mEdit->setCompletionMode( mCompletionMode );
360 connect( line, TQ_SIGNAL( returnPressed( RecipientLine * ) ),
361 TQ_SLOT( slotReturnPressed( RecipientLine * ) ) );
362 connect( line, TQ_SIGNAL( upPressed( RecipientLine * ) ),
363 TQ_SLOT( slotUpPressed( RecipientLine * ) ) );
364 connect( line, TQ_SIGNAL( downPressed( RecipientLine * ) ),
365 TQ_SLOT( slotDownPressed( RecipientLine * ) ) );
366 connect( line, TQ_SIGNAL( rightPressed() ), TQ_SIGNAL( focusRight() ) );
367 connect( line, TQ_SIGNAL( deleteLine( RecipientLine * ) ),
368 TQ_SLOT( slotDecideLineDeletion( RecipientLine * ) ) );
369 connect( line, TQ_SIGNAL( countChanged() ), TQ_SLOT( calculateTotal() ) );
370 connect( line, TQ_SIGNAL( typeModified( RecipientLine * ) ),
371 TQ_SLOT( slotTypeModified( RecipientLine * ) ) );
372 connect( line->mEdit, TQ_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion ) ),
373 TQ_SLOT( setCompletionMode( TDEGlobalSettings::Completion ) ) );
375 if ( mLines.last() ) {
376 if ( mLines.count() == 1 ) {
377 if ( GlobalSettings::self()->secondRecipientTypeDefault() ==
378 GlobalSettings::EnumSecondRecipientTypeDefault::To ) {
379 line->setRecipientType( Recipient::To );
381 if ( mLines.last()->recipientType() == Recipient::Bcc ) {
382 line->setRecipientType( Recipient::To );
384 line->setRecipientType( Recipient::Cc );
388 line->setRecipientType( mLines.last()->recipientType() );
390 line->fixTabOrder( mLines.last()->tabOut() );
393 mLines.append( line );
395 if ( mLines.count() == 1 ) {
396 mLines.first()->setRemoveLineButtonEnabled(
false );
398 mLines.first()->setRemoveLineButtonEnabled(
true );
401 mFirstColumnWidth = line->setComboWidth( mFirstColumnWidth );
403 mLineHeight = line->minimumSizeHint().height();
405 line->resize( viewport()->width(), mLineHeight );
411 ensureVisible( 0, mLines.count() * mLineHeight );
416 void RecipientsView::slotTypeModified( RecipientLine *line )
418 if ( mLines.count() == 2 ||
419 ( mLines.count() == 3 && mLines.at( 2 )->isEmpty() ) ) {
420 if ( mLines.at( 1 ) == line ) {
421 if ( line->recipientType() == Recipient::To ) {
422 GlobalSettings::self()->setSecondRecipientTypeDefault(
423 GlobalSettings::EnumSecondRecipientTypeDefault::To );
424 }
else if ( line->recipientType() == Recipient::Cc ) {
425 GlobalSettings::self()->setSecondRecipientTypeDefault(
426 GlobalSettings::EnumSecondRecipientTypeDefault::Cc );
432 void RecipientsView::calculateTotal()
438 for( line = mLines.first(); line; line = mLines.next() ) {
439 if ( line->isEmpty() ) ++empty;
440 else count += line->recipientsCount();
443 if ( empty == 0 ) addLine();
445 emit totalChanged( count, mLines.count() );
448 void RecipientsView::slotReturnPressed( RecipientLine *line )
450 if ( !line->recipient().isEmpty() ) {
451 RecipientLine *empty = emptyLine();
452 if ( !empty ) empty = addLine();
453 activateLine( empty );
457 void RecipientsView::slotDownPressed( RecipientLine *line )
459 int pos = mLines.find( line );
460 if ( pos >= (
int)mLines.count() - 1 ) {
462 }
else if ( pos >= 0 ) {
463 activateLine( mLines.at( pos + 1 ) );
467 void RecipientsView::slotUpPressed( RecipientLine *line )
469 int pos = mLines.find( line );
471 activateLine( mLines.at( pos - 1 ) );
477 void RecipientsView::slotDecideLineDeletion( RecipientLine *line )
479 if ( !line->isEmpty() )
481 if ( mLines.count() == 1 ) {
485 TQTimer::singleShot( 0,
this, TQ_SLOT( slotDeleteLine( ) ) );
489 void RecipientsView::slotDeleteLine()
494 RecipientLine *line = mCurDelLine;
495 int pos = mLines.find( line );
498 if ( pos == 0 ) newPos = pos + 1;
499 else newPos = pos - 1;
502 if ( mLines.at( newPos ) )
503 mLines.at( newPos )->activate();
505 mLines.remove( line );
509 bool atLeastOneToLine =
false;
510 unsigned int firstCC = 0;
511 for( uint i = pos; i < mLines.count(); ++i ) {
512 RecipientLine *line = mLines.at( i );
513 moveChild( line, childX( line ), childY( line ) - mLineHeight );
514 if ( line->recipientType() == Recipient::To )
515 atLeastOneToLine =
true;
516 else if ( ( line->recipientType() == Recipient::Cc ) && ( i == 0 ) )
520 if ( mLines.count() == 1 )
521 mLines.first()->setRemoveLineButtonEnabled(
false );
523 if ( !atLeastOneToLine )
524 mLines.at( firstCC )->setRecipientType( Recipient::To );
531 void RecipientsView::resizeView()
533 resizeContents( width(), mLines.count() * mLineHeight );
535 if ( mLines.count() < 6 ) {
539 parentWidget()->layout()->activate();
540 emit sizeHintChanged();
541 TQTimer::singleShot( 0,
this, TQ_SLOT(moveCompletionPopup()) );
544 void RecipientsView::activateLine( RecipientLine *line )
547 ensureVisible( 0, childY( line ) );
550 void RecipientsView::viewportResizeEvent ( TQResizeEvent *ev )
552 for( uint i = 0; i < mLines.count(); ++i ) {
553 mLines.at( i )->resize( ev->size().width(), mLineHeight );
555 ensureVisible( 0, mLines.count() * mLineHeight );
558 TQSize RecipientsView::sizeHint()
const
560 return TQSize( 200, mLineHeight * mLines.count() );
563 TQSize RecipientsView::minimumSizeHint()
const
567 if ( mLines.count() < numLines ) height = mLineHeight * mLines.count();
568 else height = mLineHeight * numLines;
569 return TQSize( 200, height );
572 Recipient::List RecipientsView::recipients()
const
574 Recipient::List recipients;
576 TQPtrListIterator<RecipientLine> it( mLines );
578 while( ( line = it.current() ) ) {
579 if ( !line->recipient().isEmpty() ) {
580 recipients.append( line->recipient() );
589 void RecipientsView::setCompletionMode ( TDEGlobalSettings::Completion mode )
591 if ( mCompletionMode == mode )
593 mCompletionMode = mode;
595 TQPtrListIterator<RecipientLine> it( mLines );
597 while( ( line = it.current() ) ) {
598 line->mEdit->blockSignals(
true );
599 line->mEdit->setCompletionMode( mode );
600 line->mEdit->blockSignals(
false );
603 emit completionModeChanged( mode );
606 void RecipientsView::removeRecipient(
const TQString & recipient,
607 Recipient::Type type )
610 TQPtrListIterator<RecipientLine> it( mLines );
612 while( ( line = it.current() ) ) {
613 if ( ( line->recipient().email() == recipient ) &&
614 ( line->recipientType() == type ) ) {
620 line->slotPropagateDeletion();
623 bool RecipientsView::isModified()
628 TQPtrListIterator<RecipientLine> it( mLines );
630 while( ( line = it.current() ) ) {
631 if ( line->isModified() ) {
640 void RecipientsView::clearModified()
644 TQPtrListIterator<RecipientLine> it( mLines );
646 while( ( line = it.current() ) ) {
647 line->clearModified();
652 void RecipientsView::setFocus()
654 if ( mLines.last()->isActive() ) setFocusBottom();
658 void RecipientsView::setFocusTop()
660 RecipientLine *line = mLines.first();
661 if ( line ) line->activate();
662 else kdWarning() <<
"No first" << endl;
665 void RecipientsView::setFocusBottom()
667 RecipientLine *line = mLines.last();
668 if ( line ) line->activate();
669 else kdWarning() <<
"No last" << endl;
672 int RecipientsView::setFirstColumnWidth(
int w )
674 mFirstColumnWidth = w;
676 TQPtrListIterator<RecipientLine> it( mLines );
678 while( ( line = it.current() ) ) {
679 mFirstColumnWidth = line->setComboWidth( mFirstColumnWidth );
684 return mFirstColumnWidth;
687 void RecipientsView::moveCompletionPopup()
689 for( RecipientLine* line = mLines.first(); line; line = mLines.next() ) {
690 if ( line->lineEdit()->completionBox(
false ) ) {
691 if ( line->lineEdit()->completionBox()->isVisible() ) {
693 line->lineEdit()->completionBox()->hide();
694 line->lineEdit()->completionBox()->show();
701 RecipientsToolTip::RecipientsToolTip( RecipientsView *view, TQWidget *parent )
702 : TQToolTip( parent ), mView( view )
706 TQString RecipientsToolTip::line(
const Recipient &r )
708 TQString txt = r.email();
710 return " " + TQStyleSheet::escape( txt ) +
"<br/>";
713 void RecipientsToolTip::maybeTip(
const TQPoint & p )
715 TQString text =
"<qt>";
721 Recipient::List recipients = mView->recipients();
722 Recipient::List::ConstIterator it;
723 for( it = recipients.begin(); it != recipients.end(); ++it ) {
724 switch( (*it).type() ) {
739 text += i18n(
"<b>To:</b><br/>") + to;
740 if ( !cc.isEmpty() ) text += i18n(
"<b>CC:</b><br/>") + cc;
741 if ( !bcc.isEmpty() ) text += i18n(
"<b>BCC:</b><br/>") + bcc;
743 text.append(
"</qt>" );
745 TQRect geometry( p + TQPoint( 2, 2 ), TQPoint( 400, 100 ) );
747 tip( TQRect( p.x() - 20, p.y() - 20, 40, 40 ), text, geometry );
751 SideWidget::SideWidget( RecipientsView *view, TQWidget *parent )
752 : TQWidget( parent ), mView( view ), mRecipientPicker( 0 )
754 TQBoxLayout *topLayout =
new TQVBoxLayout(
this );
756 topLayout->setSpacing( KDialog::spacingHint() );
757 topLayout->addStretch( 1 );
759 mTotalLabel =
new TQLabel(
this );
760 mTotalLabel->setAlignment( AlignCenter );
761 topLayout->addWidget( mTotalLabel );
764 topLayout->addStretch( 1 );
766 new RecipientsToolTip( view, mTotalLabel );
768 mDistributionListButton =
new TQPushButton( i18n(
"Save List..."),
this );
769 topLayout->addWidget( mDistributionListButton );
770 mDistributionListButton->hide();
771 connect( mDistributionListButton, TQ_SIGNAL( clicked() ),
772 TQ_SIGNAL( saveDistributionList() ) );
773 TQToolTip::add( mDistributionListButton,
774 i18n(
"Save recipients as distribution list") );
776 mSelectButton =
new TQPushButton( i18n(
"Se&lect..."),
this );
777 topLayout->addWidget( mSelectButton );
778 connect( mSelectButton, TQ_SIGNAL( clicked() ), TQ_SLOT( pickRecipient() ) );
779 TQToolTip::add( mSelectButton, i18n(
"Select recipients from address book") );
782 SideWidget::~SideWidget()
786 RecipientsPicker* SideWidget::picker()
const
788 if ( !mRecipientPicker ) {
790 SideWidget *non_const_this =
const_cast<SideWidget*
>( this );
791 mRecipientPicker =
new RecipientsPicker( non_const_this );
792 connect( mRecipientPicker, TQ_SIGNAL( pickedRecipient(
const Recipient & ) ),
793 non_const_this, TQ_SIGNAL( pickedRecipient(
const Recipient & ) ) );
794 mPickerPositioner =
new KWindowPositioner( non_const_this, mRecipientPicker );
796 return mRecipientPicker;
799 void SideWidget::setFocus()
801 mSelectButton->setFocus();
804 void SideWidget::setTotal(
int recipients,
int lines )
807 kdDebug() <<
"SideWidget::setTotal() recipients: " << recipients <<
808 " lines: " << lines << endl;
812 if ( recipients == 0 ) labelText = i18n(
"No recipients");
813 else labelText = i18n(
"1 recipient",
"%n recipients", recipients );
814 mTotalLabel->setText( labelText );
816 if ( lines > 3 ) mTotalLabel->show();
817 else mTotalLabel->hide();
819 if ( lines > 2 ) mDistributionListButton->show();
820 else mDistributionListButton->hide();
823 void SideWidget::pickRecipient()
826 TQString rec = KInputDialog::getText(
"Pick Recipient",
827 "Email address of recipient" );
828 if ( !rec.isEmpty() ) emit pickedRecipient( rec );
830 RecipientsPicker *p = picker();
831 p->setDefaultType( mView->activeLine()->recipientType() );
832 p->setRecipients( mView->recipients() );
834 mPickerPositioner->reposition();
840 RecipientsEditor::RecipientsEditor( TQWidget *parent )
841 : TQWidget( parent ), mModified( false )
843 TQBoxLayout *topLayout =
new TQHBoxLayout(
this );
844 topLayout->setSpacing( KDialog::spacingHint() );
846 mRecipientsView =
new RecipientsView(
this );
847 topLayout->addWidget( mRecipientsView );
848 connect( mRecipientsView, TQ_SIGNAL( focusUp() ), TQ_SIGNAL( focusUp() ) );
849 connect( mRecipientsView, TQ_SIGNAL( focusDown() ), TQ_SIGNAL( focusDown() ) );
850 connect( mRecipientsView, TQ_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion ) ),
851 TQ_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion ) ) );
853 mSideWidget =
new SideWidget( mRecipientsView,
this );
854 topLayout->addWidget( mSideWidget );
855 connect( mSideWidget, TQ_SIGNAL( pickedRecipient(
const Recipient & ) ),
856 TQ_SLOT( slotPickedRecipient(
const Recipient & ) ) );
857 connect( mSideWidget, TQ_SIGNAL( saveDistributionList() ),
858 TQ_SLOT( saveDistributionList() ) );
860 connect( mRecipientsView, TQ_SIGNAL( totalChanged(
int,
int ) ),
861 mSideWidget, TQ_SLOT( setTotal(
int,
int ) ) );
862 connect( mRecipientsView, TQ_SIGNAL( focusRight() ),
863 mSideWidget, TQ_SLOT( setFocus() ) );
865 connect( mRecipientsView, TQ_SIGNAL(sizeHintChanged()),
866 TQ_SIGNAL(sizeHintChanged()) );
869 RecipientsEditor::~RecipientsEditor()
873 RecipientsPicker* RecipientsEditor::picker()
const
875 return mSideWidget->picker();
878 void RecipientsEditor::slotPickedRecipient(
const Recipient &rec )
880 RecipientLine *line = mRecipientsView->activeLine();
881 if ( !line->isEmpty() ) line = mRecipientsView->addLine();
884 if ( r.type() == Recipient::Undefined ) {
885 r.setType( line->recipientType() );
888 line->setRecipient( r );
892 void RecipientsEditor::saveDistributionList()
894 DistributionListDialog *dlg =
new DistributionListDialog(
this );
895 dlg->setRecipients( mRecipientsView->recipients() );
900 Recipient::List RecipientsEditor::recipients()
const
902 return mRecipientsView->recipients();
905 void RecipientsEditor::setRecipientString(
const TQString &str,
906 Recipient::Type type )
912 TQStringList r = KPIM::splitEmailAddrList( str );
913 TQStringList::ConstIterator it;
914 for( it = r.begin(); it != r.end(); ++it ) {
915 if ( count++ > GlobalSettings::self()->maximumRecipients() ) {
916 KMessageBox::sorry(
this,
917 i18n(
"Truncating recipients list to %1 of %2 entries.")
918 .arg( GlobalSettings::self()->maximumRecipients() )
922 addRecipient( *it, type );
926 TQString RecipientsEditor::recipientString( Recipient::Type type )
930 Recipient::List recipients = mRecipientsView->recipients();
931 Recipient::List::ConstIterator it;
932 for( it = recipients.begin(); it != recipients.end(); ++it ) {
933 if ( (*it).type() == type ) {
934 if ( !str.isEmpty() ) str +=
", ";
935 str.append( (*it).email() );
942 void RecipientsEditor::addRecipient(
const TQString & recipient,
943 Recipient::Type type )
945 RecipientLine *line = mRecipientsView->emptyLine();
946 if ( !line ) line = mRecipientsView->addLine();
947 line->setRecipient( Recipient( recipient, type ) );
950 void RecipientsEditor::removeRecipient(
const TQString & recipient,
951 Recipient::Type type )
953 mRecipientsView->removeRecipient( recipient, type );
956 bool RecipientsEditor::isModified()
958 return mModified || mRecipientsView->isModified();
961 void RecipientsEditor::clearModified()
964 mRecipientsView->clearModified();
967 void RecipientsEditor::clear()
971 void RecipientsEditor::setFocus()
973 mRecipientsView->setFocus();
976 void RecipientsEditor::setFocusTop()
978 mRecipientsView->setFocusTop();
981 void RecipientsEditor::setFocusBottom()
983 mRecipientsView->setFocusBottom();
986 int RecipientsEditor::setFirstColumnWidth(
int w )
988 return mRecipientsView->setFirstColumnWidth( w );
991 void RecipientsEditor::selectRecipients()
993 mSideWidget->pickRecipient();
996 void RecipientsEditor::setCompletionMode( TDEGlobalSettings::Completion mode )
998 mRecipientsView->setCompletionMode( mode );
1001 #include "recipientseditor.moc"