Context bar display now works again. Search is still broken

This commit is contained in:
michael starke
2014-02-27 01:40:50 +01:00
parent 61310d2300
commit ffabda0242
7 changed files with 58 additions and 54 deletions

View File

@@ -44,6 +44,7 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
@implementation MPContextBarViewController
#pragma mark Livecycle
- (instancetype)init {
self = [self initWithNibName:@"ContextBar" bundle:nil];
return self;
@@ -76,7 +77,13 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
[self _updateFilterButtons];
}
#pragma mark Properties
#pragma mark MPDocument Notifications
- (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateFilterButtons) name:MPDocumentDidChangeSearchFlags object:document];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterSearch:) name:MPDocumentDidEnterSearchNotification object:document];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterHistory:) name:MPDocumentDidEnterHistoryNotification object:document];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeCurrentItem:) name:MPDocumentCurrentItemChangedNotification object:document];
}
- (void)_didEnterSearch:(NSNotification *)notification {
/* Select text if already visible */
@@ -89,15 +96,13 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
[self _updateBindings];
}
- (void)_showTrash {
self.activeTab = MPContextTabTrash;
[self _updateBindings];
}
- (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateFilterButtons) name:MPDocumentDidChangeSearchFlags object:document];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterSearch:) name:MPDocumentDidEnterSearchNotification object:document];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterHistory:) name:MPDocumentDidEnterHistoryNotification object:document];
- (void)_didChangeCurrentItem:(NSNotification *)notification {
MPDocument *document = [notification object];
BOOL showTrash = document.useTrash && (document.selectedGroup == document.trash || [document isItemTrashed:document.selectedItem]);
if(showTrash) {
self.activeTab = MPContextTabTrash;
[self _updateBindings];
}
}
/*
@@ -109,6 +114,7 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
}
*/
#pragma mark UI Helper
- (void)_updateBindings {
// only the entry view has to be bound, the rest not