Fix signal/slot

svn path=/trunk/KDE/kdebase/workspace/; revision=662908
This commit is contained in:
Laurent Montel 2007-05-09 14:59:04 +00:00
parent b99fcd4862
commit d83256ae1f
2 changed files with 10 additions and 6 deletions

View file

@ -34,9 +34,9 @@ KCMRulesList::KCMRulesList( QWidget* parent)
{ {
// connect both current/selected, so that current==selected (stupid QListBox :( ) // connect both current/selected, so that current==selected (stupid QListBox :( )
connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)), connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
SLOT(activeChanged(QListWidgetItem*))); SLOT(activeChanged()));
connect( rules_listbox, SIGNAL( selectionChanged( QListWidgetItem* )), connect( rules_listbox, SIGNAL(itemSelectionChanged()),
SLOT( activeChanged( QListWidgetItem*))); SLOT( activeChanged()));
connect( new_button, SIGNAL( clicked()), connect( new_button, SIGNAL( clicked()),
SLOT( newClicked())); SLOT( newClicked()));
connect( modify_button, SIGNAL( clicked()), connect( modify_button, SIGNAL( clicked()),
@ -61,8 +61,9 @@ KCMRulesList::~KCMRulesList()
rules.clear(); rules.clear();
} }
void KCMRulesList::activeChanged( QListWidgetItem* item ) void KCMRulesList::activeChanged()
{ {
QListWidgetItem *item = rules_listbox->currentItem();
int itemRow = rules_listbox->row(item); int itemRow = rules_listbox->row(item);
if( item != NULL ) if( item != NULL )
@ -168,7 +169,10 @@ void KCMRulesList::load()
if( rules.count() > 0 ) if( rules.count() > 0 )
rules_listbox->item(0)->setSelected( true ); rules_listbox->item(0)->setSelected( true );
else else
activeChanged( NULL ); {
rules_listbox->setCurrentItem(0L);
activeChanged();
}
} }
void KCMRulesList::save() void KCMRulesList::save()

View file

@ -58,7 +58,7 @@ class KCMRulesList
void deleteClicked(); void deleteClicked();
void moveupClicked(); void moveupClicked();
void movedownClicked(); void movedownClicked();
void activeChanged( QListWidgetItem* ); void activeChanged();
private: private:
QVector< Rules* > rules; QVector< Rules* > rules;
}; };