diff options
-rw-r--r-- | tdeui/keditlistbox.cpp | 23 | ||||
-rw-r--r-- | tdeui/keditlistbox.h | 43 |
2 files changed, 52 insertions, 14 deletions
diff --git a/tdeui/keditlistbox.cpp b/tdeui/keditlistbox.cpp index 4b224ede0..142c4b437 100644 --- a/tdeui/keditlistbox.cpp +++ b/tdeui/keditlistbox.cpp @@ -175,11 +175,13 @@ void KEditListBox::typedSomething(const TQString& text) // but TT disagree with me on this one (it's been that way since ages ... grrr) bool block = m_listBox->signalsBlocked(); const TQString& oldText = currentText(); + int item = currentItem(); m_listBox->blockSignals( true ); - m_listBox->changeItem(text, currentItem()); + m_listBox->changeItem(text, item); m_listBox->blockSignals( block ); emit changed(); emit renamed(oldText, text); + emit renamed(item, oldText, text); } } @@ -280,7 +282,8 @@ void KEditListBox::addItem() m_lineEdit->clear(); m_lineEdit->blockSignals(block); - m_listBox->setSelected(currentItem(), false); + int item = currentItem(); + m_listBox->setSelected(item, false); if (!alreadyInList) { @@ -289,7 +292,8 @@ void KEditListBox::addItem() m_listBox->insertItem(currentTextLE); m_listBox->blockSignals( block ); emit changed(); - emit added( currentTextLE ); + emit added( currentTextLE ); + emit added( item, currentTextLE ); } } @@ -302,18 +306,19 @@ int KEditListBox::currentItem() const void KEditListBox::removeItem() { - int selected = m_listBox->currentItem(); + int item = m_listBox->currentItem(); - if ( selected >= 0 ) + if ( item >= 0 ) { - TQString removedText = m_listBox->currentText(); + TQString removedText = m_listBox->currentText(); - m_listBox->removeItem( selected ); + m_listBox->removeItem( item ); if ( count() > 0 ) - m_listBox->setSelected( TQMIN( selected, count() - 1 ), true ); + m_listBox->setSelected( TQMIN( item, count() - 1 ), true ); emit changed(); - emit removed( removedText ); + emit removed( removedText ); + emit removed( item, removedText ); } if ( servRemoveButton && m_listBox->currentItem() == -1 ) diff --git a/tdeui/keditlistbox.h b/tdeui/keditlistbox.h index 4a00b0cb7..c6930128b 100644 --- a/tdeui/keditlistbox.h +++ b/tdeui/keditlistbox.h @@ -33,7 +33,7 @@ class KEditListBoxPrivate; /** * An editable listbox * - * This class provides a editable listbox ;-), this means + * This class provides an editable listbox ;-), this means * a listbox which is accompanied by a line edit to enter new * items into the listbox and pushbuttons to add and remove * items from the listbox and two buttons to move items up and down. @@ -199,25 +199,58 @@ public: void changed(); /** - * This signal is emitted when the user adds a new string to the list, - * the parameter is the added string. + * This signal is emitted when the user adds a new string to the list. + * @param text is the added string. * @since 3.2 + * @see added( int item, const TQString & text ) */ void added( const TQString & text ); /** - * This signal is emitted when the user removes a string from the list, - * the parameter is the removed string. + * This signal is emitted when the user adds a new string to the list. + * @param item is the added item's position in the list. + * @param text is the added string. + * @since R14.1.0 + * @see added( const TQString & text ) + */ + void added( int item, const TQString & text ); + + /** + * This signal is emitted when the user removes a string from the list. + * @param text is the removed string. * @since 3.2 + * @see removed( int item, const TQString & text ) */ void removed( const TQString & text ); /** + * This signal is emitted when the user removes a string from the list. + * @param item is the removed item's position in the list. + * @param text is the removed string. + * @since R14.1.0 + * @see removed( const TQString & text ) + */ + void removed( int item, const TQString & text ); + + /** * This signal is emitted when the user renames a list item. + * @param from is the original item's text. + * @param to is the new text of the item. * @since R14.1.0 + * @see renamed( int item, const TQString &from, const TQString &to ) */ void renamed( const TQString &from, const TQString &to ); + /** + * This signal is emitted when the user renames a list item. + * @param item is the renamed item's position in the list. + * @param from is the original item's text. + * @param to is the new text of the item. + * @since R14.1.0 + * @see renamed( const TQString &from, const TQString &to ) + */ + void renamed( int item, const TQString &from, const TQString &to ); + protected slots: //the names should be self-explaining void moveItemUp(); |