Merged in frumin/subler (pull request #11)

Fixing a bug where selecting a TV show name could leave Search button disabled.
This commit is contained in:
Damiano Galassi committed 2016-04-07 08:28:28 +02:00
commit 9b70292941
1 file changed
+19 -1
+19 -1
View File
@@ -35,6 +35,7 @@
#pragma mark Search input fields
- (void) updateSearchButtonVisibility;
- (void) searchTVSeriesNameDone:(NSArray *)seriesArray;
- (NSString *)selectedTvShowName;
#pragma mark Search for metadata
- (IBAction) searchForResults:(id)sender;
@@ -179,7 +180,7 @@
return;
}
} else if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"TV Episode"]) {
if ([[tvSeriesName stringValue] length] > 0) {
if ([[self selectedTvShowName] length] > 0) {
if (([[tvSeasonNum stringValue] length] == 0) && ([[tvEpisodeNum stringValue] length] > 0)) {
[searchButton setEnabled:NO];
return;
@@ -209,6 +210,17 @@
[tvSeriesName reloadData];
}
- (NSString *)selectedTvShowName {
NSString *name = nil;
NSComboBox *comboBox = tvSeriesName;
NSInteger selectedIndex = comboBox.indexOfSelectedItem;
if (selectedIndex > -1) {
id<NSComboBoxDataSource> dataSource = comboBox.dataSource;
name = [dataSource comboBox:comboBox objectValueForItemAtIndex:selectedIndex];
}
return name;
}
#pragma mark Search for results
- (IBAction) searchForResults: (id) sender {
@@ -537,6 +549,12 @@
}
}
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
if ([notification object] == tvSeriesName) {
[self updateSearchButtonVisibility];
}
}
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)comboBox {
if (comboBox == tvSeriesName) {
return self.tvSeriesNameSearchArray.count;