Add possibility to add and remove single recipients (needed for the identity's BCC).

svn path=/trunk/kdepim/; revision=392390
wilder-work
Ingo Klcker 21 years ago
parent 4f720adf54
commit aeb00ff433
  1. 37
      recipientseditor.cpp
  2. 18
      recipientseditor.h

@ -374,7 +374,7 @@ void RecipientsView::calculateTotal()
}
if ( empty == 0 ) addLine();
emit totalChanged( count, mLines.count() );
}
@ -502,6 +502,23 @@ Recipient::List RecipientsView::recipients() const
return recipients;
}
void RecipientsView::removeRecipient( const QString & recipient,
Recipient::Type type )
{
// search a line which matches recipient and type
QPtrListIterator<RecipientLine> it( mLines );
RecipientLine *line;
while( ( line = it.current() ) ) {
if ( ( line->recipient().email() == recipient ) &&
( line->recipientType() == type ) ) {
break;
}
++it;
}
if ( line )
line->clear();
}
void RecipientsView::setFocus()
{
if ( mLines.last()->isActive() ) setFocusBottom();
@ -754,9 +771,7 @@ void RecipientsEditor::setRecipientString( const QString &str,
.arg( r.count() ) );
break;
}
RecipientLine *line = mRecipientsView->emptyLine();
if ( !line ) line = mRecipientsView->addLine();
line->setRecipient( Recipient( *it, type ) );
addRecipient( *it, type );
}
}
@ -778,6 +793,20 @@ QString RecipientsEditor::recipientString( Recipient::Type type )
return str;
}
void RecipientsEditor::addRecipient( const QString & recipient,
Recipient::Type type )
{
RecipientLine *line = mRecipientsView->emptyLine();
if ( !line ) line = mRecipientsView->addLine();
line->setRecipient( Recipient( recipient, type ) );
}
void RecipientsEditor::removeRecipient( const QString & recipient,
Recipient::Type type )
{
mRecipientsView->removeRecipient( recipient, type );
}
void RecipientsEditor::clear()
{
}

@ -167,6 +167,12 @@ class RecipientsView : public QScrollView
Recipient::List recipients() const;
/** Removes the recipient provided it can be found and has the given type.
@param recipient The recipient(s) you want to remove.
@param type The recipient type.
*/
void removeRecipient( const QString & recipient, Recipient::Type type );
void activateLine( RecipientLine * );
void setFirstColumnWidth( int );
@ -263,6 +269,18 @@ class RecipientsEditor : public QWidget
void setRecipientString( const QString &, Recipient::Type );
QString recipientString( Recipient::Type );
/** Adds a recipient (or multiple recipients) to one line of the editor.
@param recipient The recipient(s) you want to add.
@param type The recipient type.
*/
void addRecipient( const QString & recipient, Recipient::Type type );
/** Removes the recipient provided it can be found and has the given type.
@param recipient The recipient(s) you want to remove.
@param type The recipient type.
*/
void removeRecipient( const QString & recipient, Recipient::Type type );
void setFirstColumnWidth( int );
public slots:

Loading…
Cancel
Save