Skip to content

Commit

Permalink
Made keyboard input a little bit better.
Browse files Browse the repository at this point in the history
  • Loading branch information
sammcd committed Feb 27, 2010
1 parent 2fa9b53 commit 5d7dace
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion BTBlackListWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ - (void)deleteBackward:(id)sender {
[blackListWindowController removeSelectedItem];
}


@end
15 changes: 14 additions & 1 deletion BTBlackListWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ - (void) dealloc {


- (IBAction)addItem:(id)sender {
NSInteger newRowNumber;

[blackList addSite:@"NewSite.com"];
[tableView reloadData];

newRowNumber = [tableView numberOfRows] - 1;
[tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRowNumber] byExtendingSelection:NO];
}


Expand All @@ -37,8 +42,12 @@ - (IBAction)removeItem:(id)sender {
}

- (void)removeSelectedItem {
NSInteger newRowNumber;

[[blackList siteList] removeObjectAtIndex:[tableView selectedRow]];
[tableView reloadData];
newRowNumber = [tableView numberOfRows] - 1;
[tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRowNumber] byExtendingSelection:NO];
}

- (id)tableView:(NSTableView *)aTableView
Expand All @@ -54,8 +63,12 @@ - (void)tableView:(NSTableView *)aTableView
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
// Strip "http://" from new object.
// This does not work with hosts
NSString* newString = [anObject stringByReplacingOccurrencesOfString:@"http://" withString:@""];

[[blackList siteList] removeObjectAtIndex:rowIndex];
[[blackList siteList] insertObject:anObject atIndex:rowIndex];
[[blackList siteList] insertObject:newString atIndex:rowIndex];

}

Expand Down

0 comments on commit 5d7dace

Please sign in to comment.