From: <ho...@us...> - 2009-12-12 18:39:34
|
Revision: 16324 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=16324&view=rev Author: hofman Date: 2009-12-12 18:38:50 +0000 (Sat, 12 Dec 2009) Log Message: ----------- remove sheet on editor before finishing action, so warning sheets can be attached without serious problems. Don't explicitly end editing before reloading the table, because that will happen when needed anyway. Modified Paths: -------------- trunk/bibdesk/BDSKEditor.m Modified: trunk/bibdesk/BDSKEditor.m =================================================================== --- trunk/bibdesk/BDSKEditor.m 2009-12-12 18:11:10 UTC (rev 16323) +++ trunk/bibdesk/BDSKEditor.m 2009-12-12 18:38:50 UTC (rev 16324) @@ -624,6 +624,9 @@ - (void)chooseRemoteURLSheetDidEnd:(BDSKURLSheetController *)urlController returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo{ if (returnCode == NSOKButton) { + // remove the sheet in case we get an alert + [[urlController window] orderOut:nil]; + NSString *aURLString = [urlController urlString]; if ([NSString isEmptyString:aURLString]) return; @@ -685,6 +688,9 @@ if(returnCode == NSCancelButton || newField == nil) return; + // remove the sheet in case we get an alert + [[addFieldController window] orderOut:nil]; + newField = [newField fieldName]; if([currentFields containsObject:newField] == NO){ if (addedFields == nil) @@ -727,6 +733,9 @@ NSArray *removableFields = [removeFieldController fieldsArray]; if (returnCode == NSOKButton && oldField != nil && [removableFields count]) { + // remove the sheet in case we get an alert + [[removeFieldController window] orderOut:nil]; + [addedFields removeObject:oldField]; [tabView selectFirstTabViewItem:nil]; [publication setField:oldField toValue:nil]; @@ -781,6 +790,8 @@ if (returnCode == NSOKButton && [NSString isEmptyString:newField] == NO && [newField isEqualToString:oldField] == NO && [fields containsObject:newField] == NO) { + // remove the sheet in case we get an alert + [[changeFieldController window] orderOut:nil]; [addedFields removeObject:oldField]; [addedFields addObject:newField]; @@ -852,6 +863,9 @@ if(returnCode == NSAlertAlternateReturn) return; + // remove the sheet in case we get an alert + [[alert window] orderOut:nil]; + // could use [[alert window] orderOut:nil] here, but we're using the didDismissSelector instead BDSKPRECONDITION([self commitEditing]); @@ -929,9 +943,13 @@ else files = [NSArray arrayWithObject:[publication objectInFilesAtIndex:anIndex]]; - if (returnCode == NSAlertAlternateReturn){ + if (returnCode == NSAlertAlternateReturn) return; - }else if(returnCode == NSAlertOtherReturn){ + + // remove the sheet in case we get an alert + [[alert window] orderOut:nil]; + + if (returnCode == NSAlertOtherReturn) { NSMutableArray *tmpFiles = [NSMutableArray array]; for (BDSKLinkedFile *file in files) { @@ -3176,8 +3194,6 @@ if(fieldEditor){ selection = [fieldEditor selectedRange]; editedTitle = [[fields objectAtIndex:[tableView editedRow]] retain]; - if ([[self window] makeFirstResponder:[self window]] == NO) - [NSException raise:NSInternalInconsistencyException format:@"Failed to commit edits in %s, trouble ahead", __func__]; } if (newFields && [fields isEqualToArray:newFields] == NO) { @@ -3215,7 +3231,7 @@ // restore the edited cell and its selection if(editedTitle){ NSUInteger editedRow = [fields indexOfObject:editedTitle]; - if (editedRow != NSNotFound) { + if (editedRow != NSNotFound && [tableView editedRow] != (NSInteger)editedRow) { [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow] byExtendingSelection:NO]; [tableView editColumn:1 row:editedRow withEvent:nil select:NO]; fieldEditor = [tableView currentEditor]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |