Merged revisions 960995 via svnmerge from

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

................
  r960995 | winterz | 2009-04-29 14:46:14 +0200 (Wed, 29 Apr 2009) | 9 lines
  
  Merged revisions 960940 via svnmerge from 
  https://svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim
  
  ........
    r960940 | mlaurent | 2009-04-29 06:22:31 -0400 (Wed, 29 Apr 2009) | 2 lines
    
    not allow to duplicate entry
  ........
................

svn path=/trunk/KDE/kdepim/; revision=961647
wilder-work
Thomas McGuire 17 years ago
parent 0386bf1f2b
commit 2fcffbf462
  1. 10
      simplestringlisteditor.cpp
  2. 1
      simplestringlisteditor.h

@ -158,6 +158,14 @@ QStringList SimpleStringListEditor::stringList() const {
return result;
}
bool SimpleStringListEditor::containsString( const QString & str ) {
for ( int i = 0; i < mListBox->count(); i++ ) {
if ( mListBox->item( i )->text() == str )
return true;
}
return false;
}
void SimpleStringListEditor::setButtonText( ButtonCode button,
const QString & text ) {
switch ( button ) {
@ -196,7 +204,7 @@ void SimpleStringListEditor::slotAdd() {
&ok, this );
// let the user verify the string before adding
emit aboutToAdd( newEntry );
if ( ok && !newEntry.isEmpty() ) {
if ( ok && !newEntry.isEmpty() && !containsString( newEntry )) {
mListBox->addItem( newEntry );
emit changed();
}

@ -91,6 +91,7 @@ protected slots:
void slotSelectionChanged();
protected:
bool containsString( const QString & str );
QListWidget *mListBox;
QPushButton *mAddButton;
QPushButton *mRemoveButton;

Loading…
Cancel
Save