diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.cpp b/src/smartplaylists/smartplaylistsearchtermwidget.cpp index f622af2f8..36032712c 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.cpp +++ b/src/smartplaylists/smartplaylistsearchtermwidget.cpp @@ -68,6 +68,7 @@ SmartPlaylistSearchTermWidget::SmartPlaylistSearchTermWidget(LibraryBackend* lib { ui_->setupUi(this); connect(ui_->field, SIGNAL(currentIndexChanged(int)), SLOT(FieldChanged(int))); + connect(ui_->remove, SIGNAL(clicked()), SIGNAL(RemoveClicked())); // Populate the combo boxes for (int i=0 ; iinsertWidget(search_terms_.count(), widget); search_terms_ << widget; } -SmartPlaylistWizard::~SmartPlaylistWizard() { - delete ui_; +void SmartPlaylistWizard::RemoveSearchTerm() { + SmartPlaylistSearchTermWidget* widget = + qobject_cast(sender()); + if (!widget) + return; + + const int index = search_terms_.indexOf(widget); + if (index == -1) + return; + + delete search_terms_.takeAt(index); } + diff --git a/src/smartplaylists/smartplaylistwizard.h b/src/smartplaylists/smartplaylistwizard.h index de4a306c5..51f016f6f 100644 --- a/src/smartplaylists/smartplaylistwizard.h +++ b/src/smartplaylists/smartplaylistwizard.h @@ -34,6 +34,7 @@ public: private slots: void AddSearchTerm(); + void RemoveSearchTerm(); private: Ui_SmartPlaylistWizard* ui_;