diff --git a/macosx/Controller.h b/macosx/Controller.h
index a35136b09..05cf3f98d 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -69,6 +69,7 @@
NSString * fFilterType;
IBOutlet BarButton * fNoFilterButton, * fPauseFilterButton,
* fSeedFilterButton, * fDownloadFilterButton;
+ IBOutlet NSSearchField * fSearchFilterField;
IBOutlet NSMenuItem * fNextInfoTabItem, * fPrevInfoTabItem;
@@ -133,7 +134,7 @@
- (void) sortTorrents;
- (void) sortTorrentsIgnoreSelected;
- (void) setSort: (id) sender;
-- (void) applyFilter;
+- (void) applyFilter: (id) sender;
- (void) setFilter: (id) sender;
- (void) toggleSpeedLimit: (id) sender;
diff --git a/macosx/Controller.m b/macosx/Controller.m
index b3da8df4c..95bf1db12 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -314,7 +314,7 @@ static void sleepCallBack(void * controller, io_service_t y,
selector: @selector(checkAutoImportDirectory:) userInfo: nil repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: fAutoImportTimer forMode: NSDefaultRunLoopMode];
- [self applyFilter];
+ [self applyFilter: nil];
[fWindow makeKeyAndOrderFront: nil];
@@ -474,7 +474,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[self torrentNumberChanged];
[self updateUI: nil];
- [self applyFilter];
+ [self applyFilter: nil];
[self updateTorrentHistory];
}
@@ -547,7 +547,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[torrents makeObjectsPerformSelector: @selector(startTransfer)];
[self updateUI: nil];
- [self applyFilter];
+ [self applyFilter: nil];
[fInfoController updateInfoStatsAndSettings];
[self updateTorrentHistory];
}
@@ -573,7 +573,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[torrents makeObjectsPerformSelector: @selector(stopTransfer)];
[self updateUI: nil];
- [self applyFilter];
+ [self applyFilter: nil];
[fInfoController updateInfoStatsAndSettings];
[self updateTorrentHistory];
}
@@ -840,7 +840,7 @@ static void sleepCallBack(void * controller, io_service_t y,
if ([torrent justFinished])
{
- [self applyFilter];
+ [self applyFilter: nil];
[self checkToStartWaiting: torrent];
[GrowlApplicationBridge notifyWithTitle: @"Download Complete"
@@ -991,7 +991,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[self sortTorrents];
}
-- (void) applyFilter
+- (void) applyFilter: (id) sender
{
//remember selected rows if needed
NSArray * selectedTorrents = [fTableView numberOfSelectedRows] > 0
@@ -1026,6 +1026,16 @@ static void sleepCallBack(void * controller, io_service_t y,
else
[tempTorrents setArray: fTorrents];
+ NSString * searchString = [fSearchFilterField stringValue];
+ if (![searchString isEqualToString: @""])
+ {
+ int i;
+ for (i = [tempTorrents count] - 1; i >= 0; i--)
+ if ([[[tempTorrents objectAtIndex: i] name] rangeOfString: searchString
+ options: NSCaseInsensitiveSearch].location == NSNotFound)
+ [tempTorrents removeObjectAtIndex: i];
+ }
+
[fFilteredTorrents setArray: tempTorrents];
[tempTorrents release];
@@ -1078,7 +1088,7 @@ static void sleepCallBack(void * controller, io_service_t y,
[fDefaults setObject: fFilterType forKey: @"Filter"];
}
- [self applyFilter];
+ [self applyFilter: nil];
}
- (void) toggleSpeedLimit: (id) sender
@@ -1198,7 +1208,7 @@ static void sleepCallBack(void * controller, io_service_t y,
{
[torrentToStart startTransfer];
- [self applyFilter];
+ [self applyFilter: nil];
[self updateUI: nil];
[fInfoController updateInfoStatsAndSettings];
[self updateTorrentHistory];
@@ -1209,7 +1219,7 @@ static void sleepCallBack(void * controller, io_service_t y,
{
[self attemptToStartMultipleAuto: [notification object]];
- [self applyFilter];
+ [self applyFilter: nil];
[self updateUI: nil];
[fInfoController updateInfoStatsAndSettings];
[self updateTorrentHistory];
@@ -1219,7 +1229,7 @@ static void sleepCallBack(void * controller, io_service_t y,
{
[self attemptToStartMultipleAuto: fTorrents];
- [self applyFilter];
+ [self applyFilter: nil];
[self updateUI: nil];
[fInfoController updateInfoStatsAndSettings];
[self updateTorrentHistory];
@@ -1227,7 +1237,7 @@ static void sleepCallBack(void * controller, io_service_t y,
- (void) torrentStoppedForRatio: (NSNotification *) notification
{
- [self applyFilter];
+ [self applyFilter: nil];
[fInfoController updateInfoStatsAndSettings];
[GrowlApplicationBridge notifyWithTitle: @"Seeding Complete"
@@ -1561,12 +1571,19 @@ static void sleepCallBack(void * controller, io_service_t y,
- (void) toggleFilterBar: (id) sender
{
+ if (!fFilterBarVisible)
+ [fSearchFilterField setEnabled: YES];
+
[self showFilterBar: !fFilterBarVisible animate: YES];
[fDefaults setBool: fFilterBarVisible forKey: @"FilterBar"];
//disable filtering when hiding
if (!fFilterBarVisible)
+ {
+ [fSearchFilterField setEnabled: NO];
+ [fSearchFilterField setStringValue: @""];
[self setFilter: fNoFilterButton];
+ }
}
- (void) showFilterBar: (BOOL) show animate: (BOOL) animate
diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib
index e81137fa6..40bdff1c3 100644
--- a/macosx/English.lproj/MainMenu.nib/classes.nib
+++ b/macosx/English.lproj/MainMenu.nib/classes.nib
@@ -3,6 +3,7 @@
{CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },
{
ACTIONS = {
+ applyFilter = id;
checkUpdate = id;
copyTorrentFile = id;
linkForums = id;
@@ -54,6 +55,7 @@
fRatioNotSetItem = NSMenuItem;
fRatioSetItem = NSMenuItem;
fScrollView = NSScrollView;
+ fSearchFilterField = NSSearchField;
fSeedFilterButton = BarButton;
fSmallViewItem = NSMenuItem;
fSpeedLimitButton = NSButton;
diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib
index d9c756d67..3f46d49ff 100644
--- a/macosx/English.lproj/MainMenu.nib/info.nib
+++ b/macosx/English.lproj/MainMenu.nib/info.nib
@@ -11,7 +11,7 @@
1480
364 490 420 60 0 0 1152 842
1603
- 188 407 477 65 0 0 1152 842
+ 241 540 477 65 0 0 1152 842
29
9 780 451 44 0 0 1152 842
456
@@ -31,8 +31,8 @@
3
IBOpenObjects
- 29
1603
+ 29
IBSystem Version
8J135
diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib
index a6fbdcf3f..d7ba65065 100644
Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ
diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m
index ac3741b6c..23455c5c1 100644
--- a/macosx/TorrentCell.m
+++ b/macosx/TorrentCell.m
@@ -285,12 +285,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
BOOL highlighted = [self isHighlighted] && [[self highlightColorWithFrame: cellFrame inView: view]
isEqual: [NSColor alternateSelectedControlColor]];
NSDictionary * nameAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
- highlighted ? [NSColor whiteColor] : [NSColor blackColor],
- NSForegroundColorAttributeName,
+ highlighted ? [NSColor whiteColor] : [NSColor blackColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 12.0], NSFontAttributeName, nil];
NSDictionary * statusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
- highlighted ? [NSColor whiteColor] : [NSColor darkGrayColor],
- NSForegroundColorAttributeName,
+ highlighted ? [NSColor whiteColor] : [NSColor darkGrayColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
NSPoint pen = cellFrame.origin;