Merged revisions 945861 via svnmerge from

svn+ssh://tmcguire@svn.kde.org/home/kde/branches/KDE/4.2/kdepim

........
  r945861 | mleupold | 2009-03-28 14:11:39 +0100 (Sat, 28 Mar 2009) | 6 lines
  
  Backport of r945063.
  
  Automatically remove empty lines in the recipients-editor. On removing only move to the next line if the removed line has the focus.
  
  CCBUG: 177543
........

svn path=/branches/kdepim/enterprise4/kdepim/; revision=953737
wilder-work
Thomas McGuire 17 years ago
parent 97aac2e294
commit 754500e3a6
  1. 24
      recipientseditor.cpp
  2. 1
      recipientseditor.h

@ -170,6 +170,7 @@ RecipientLine::RecipientLine( QWidget *parent )
connect( mEdit, SIGNAL( rightPressed() ), SIGNAL( rightPressed() ) );
connect( mEdit, SIGNAL( leftPressed() ), mCombo, SLOT( setFocus() ) );
connect( mEdit, SIGNAL( editingFinished() ), SLOT( slotEditingFinished() ) );
connect( mEdit, SIGNAL( clearButtonClicked() ), SLOT( slotPropagateDeletion() ) );
connect( mCombo, SIGNAL( rightPressed() ), mEdit, SLOT( setFocus() ) );
@ -271,6 +272,13 @@ void RecipientLine::slotPropagateDeletion()
emit deleteLine( this );
}
void RecipientLine::slotEditingFinished()
{
if ( mEdit->text().isEmpty() ) {
emit deleteLine( this );
}
}
void RecipientLine::keyPressEvent( QKeyEvent *ev )
{
if ( ev->key() == Qt::Key_Up ) {
@ -482,7 +490,7 @@ void RecipientsView::slotDecideLineDeletion( RecipientLine *line )
mModified = true;
if ( mLines.count() == 1 ) {
line->clear();
} else {
} else if ( mLines.indexOf( line ) != mLines.count() - 1 ) {
mCurDelLine = line;
QTimer::singleShot( 0, this, SLOT( slotDeleteLine( ) ) );
}
@ -496,13 +504,15 @@ void RecipientsView::slotDeleteLine()
RecipientLine *line = mCurDelLine;
int pos = mLines.indexOf( line );
int newPos;
if ( pos == 0 ) newPos = pos + 1;
else newPos = pos - 1;
if ( mCurDelLine->isActive() ) {
int newPos;
if ( pos == 0 ) newPos = pos + 1;
else newPos = pos - 1;
// if there is something left to activate, do so
if ( mLines.at( newPos ) )
mLines.at( newPos )->activate();
// if there is something left to activate, do so
if ( mLines.at( newPos ) )
mLines.at( newPos )->activate();
}
mLines.removeAll( line );
line->setParent( 0 );

@ -151,6 +151,7 @@ class RecipientLine : public QWidget
void analyzeLine( const QString & );
void slotFocusUp();
void slotFocusDown();
void slotEditingFinished();
void slotPropagateDeletion();
void slotTypeModified();

Loading…
Cancel
Save