It's getting there again :)

This commit is contained in:
michael starke
2014-02-26 23:04:00 +01:00
parent 51bb22a9b7
commit 61310d2300
10 changed files with 77 additions and 83 deletions

2
HNHUi

Submodule HNHUi updated: 16daea5a12...b915d2b150

View File

@@ -102,6 +102,7 @@
4C46E09E17673A0A00DA62E8 /* HNHShadowBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C46E09D17673A0A00DA62E8 /* HNHShadowBox.m */; }; 4C46E09E17673A0A00DA62E8 /* HNHShadowBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C46E09D17673A0A00DA62E8 /* HNHShadowBox.m */; };
4C473A7F18AFD6340073FD2E /* KPKTestReference.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C473A7E18AFD6340073FD2E /* KPKTestReference.m */; }; 4C473A7F18AFD6340073FD2E /* KPKTestReference.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C473A7E18AFD6340073FD2E /* KPKTestReference.m */; };
4C473A8718AFD85B0073FD2E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C473A8518AFD7250073FD2E /* XCTest.framework */; }; 4C473A8718AFD85B0073FD2E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C473A8518AFD7250073FD2E /* XCTest.framework */; };
4C48A56218BE932100278A2D /* HNHCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C48A56118BE932100278A2D /* HNHCommon.m */; };
4C4A100F176286FD00BBF2CA /* MPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A100E176286FD00BBF2CA /* MPTableView.m */; }; 4C4A100F176286FD00BBF2CA /* MPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A100E176286FD00BBF2CA /* MPTableView.m */; };
4C4B7EE917A45EC6000234C7 /* MPDatePickingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4B7EE717A45EC5000234C7 /* MPDatePickingViewController.m */; }; 4C4B7EE917A45EC6000234C7 /* MPDatePickingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4B7EE717A45EC5000234C7 /* MPDatePickingViewController.m */; };
4C4B7EEA17A45EC6000234C7 /* DatePickingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C4B7EE817A45EC5000234C7 /* DatePickingView.xib */; }; 4C4B7EEA17A45EC6000234C7 /* DatePickingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C4B7EE817A45EC5000234C7 /* DatePickingView.xib */; };
@@ -519,6 +520,8 @@
4C46E09D17673A0A00DA62E8 /* HNHShadowBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHShadowBox.m; sourceTree = "<group>"; }; 4C46E09D17673A0A00DA62E8 /* HNHShadowBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHShadowBox.m; sourceTree = "<group>"; };
4C473A7E18AFD6340073FD2E /* KPKTestReference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestReference.m; sourceTree = "<group>"; }; 4C473A7E18AFD6340073FD2E /* KPKTestReference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestReference.m; sourceTree = "<group>"; };
4C473A8518AFD7250073FD2E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 4C473A8518AFD7250073FD2E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
4C48A56018BE932100278A2D /* HNHCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHCommon.h; sourceTree = "<group>"; };
4C48A56118BE932100278A2D /* HNHCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHCommon.m; sourceTree = "<group>"; };
4C4A100D176286FD00BBF2CA /* MPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTableView.h; sourceTree = "<group>"; }; 4C4A100D176286FD00BBF2CA /* MPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTableView.h; sourceTree = "<group>"; };
4C4A100E176286FD00BBF2CA /* MPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTableView.m; sourceTree = "<group>"; }; 4C4A100E176286FD00BBF2CA /* MPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTableView.m; sourceTree = "<group>"; };
4C4B7EE617A45EC5000234C7 /* MPDatePickingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatePickingViewController.h; sourceTree = "<group>"; }; 4C4B7EE617A45EC5000234C7 /* MPDatePickingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatePickingViewController.h; sourceTree = "<group>"; };
@@ -1589,6 +1592,8 @@
4C2671AC17A7D8FC00F3A645 /* HNHColorWell.m */, 4C2671AC17A7D8FC00F3A645 /* HNHColorWell.m */,
4CFDDDE7185E92A600A9E7F1 /* HNHTextView.h */, 4CFDDDE7185E92A600A9E7F1 /* HNHTextView.h */,
4CFDDDE8185E92A600A9E7F1 /* HNHTextView.m */, 4CFDDDE8185E92A600A9E7F1 /* HNHTextView.m */,
4C48A56018BE932100278A2D /* HNHCommon.h */,
4C48A56118BE932100278A2D /* HNHCommon.m */,
); );
path = HNHUi; path = HNHUi;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -2118,6 +2123,7 @@
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */, 4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */,
4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */, 4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */,
4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */, 4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */,
4C48A56218BE932100278A2D /* HNHCommon.m in Sources */,
4CE39ABF16ECE34A000FE29D /* MPIconSelectViewController.m in Sources */, 4CE39ABF16ECE34A000FE29D /* MPIconSelectViewController.m in Sources */,
4CE39AC416ECE4F7000FE29D /* MPPopupImageView.m in Sources */, 4CE39AC416ECE4F7000FE29D /* MPPopupImageView.m in Sources */,
4C46B88517063A070046109A /* NSString+MPPasswordCreation.m in Sources */, 4C46B88517063A070046109A /* NSString+MPPasswordCreation.m in Sources */,

View File

@@ -8,11 +8,17 @@
<customObject id="-2" userLabel="File's Owner" customClass="MPContextBarViewController"> <customObject id="-2" userLabel="File's Owner" customClass="MPContextBarViewController">
<connections> <connections>
<outlet property="emptyTrashButton" destination="szx-Hx-OrV" id="i1Y-qB-TW3"/> <outlet property="emptyTrashButton" destination="szx-Hx-OrV" id="i1Y-qB-TW3"/>
<outlet property="everywhereButton" destination="hMB-2T-pBD" id="FEh-AQ-zSQ"/>
<outlet property="exitHistoryButton" destination="pqx-su-vAh" id="JmV-vC-F48"/> <outlet property="exitHistoryButton" destination="pqx-su-vAh" id="JmV-vC-F48"/>
<outlet property="filterLabelTextField" destination="6" id="60"/> <outlet property="filterLabelTextField" destination="6" id="60"/>
<outlet property="historyBar" destination="S8L-rB-h0h" id="6yZ-El-fVs"/> <outlet property="historyBar" destination="S8L-rB-h0h" id="6yZ-El-fVs"/>
<outlet property="historyLabel" destination="gGR-f0-dcr" id="slx-9D-8k8"/> <outlet property="historyLabel" destination="gGR-f0-dcr" id="slx-9D-8k8"/>
<outlet property="notesButton" destination="SaV-5p-jIX" id="sQc-nE-BOP"/>
<outlet property="passwordButton" destination="Uhl-ck-vVQ" id="I35-Nv-6jK"/>
<outlet property="titleButton" destination="O7W-cn-eUP" id="Vlg-KG-62R"/>
<outlet property="trashBar" destination="DXf-SC-gVG" id="3aZ-Xc-VDk"/> <outlet property="trashBar" destination="DXf-SC-gVG" id="3aZ-Xc-VDk"/>
<outlet property="urlButton" destination="Bn2-iY-mQ3" id="PNG-kv-PQN"/>
<outlet property="usernameButton" destination="0R1-PX-dgn" id="TWQ-1y-9cl"/>
<outlet property="view" destination="8MB-fC-M2Q" id="wYX-Cc-yoV"/> <outlet property="view" destination="8MB-fC-M2Q" id="wYX-Cc-yoV"/>
</connections> </connections>
</customObject> </customObject>
@@ -48,6 +54,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
</buttonCell> </buttonCell>
<connections>
<action selector="toggleSearchFlags:" target="-1" id="gUm-y4-CDb"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0R1-PX-dgn"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0R1-PX-dgn">
<rect key="frame" x="107" y="6" width="77" height="17"/> <rect key="frame" x="107" y="6" width="77" height="17"/>
@@ -56,6 +65,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
</buttonCell> </buttonCell>
<connections>
<action selector="toggleSearchFlags:" target="-1" id="DEi-hq-N39"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uhl-ck-vVQ"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uhl-ck-vVQ">
<rect key="frame" x="192" y="6" width="74" height="17"/> <rect key="frame" x="192" y="6" width="74" height="17"/>
@@ -64,6 +76,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
</buttonCell> </buttonCell>
<connections>
<action selector="toggleSearchFlags:" target="-1" id="xYd-Fp-jxn"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bn2-iY-mQ3"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bn2-iY-mQ3">
<rect key="frame" x="274" y="6" width="38" height="17"/> <rect key="frame" x="274" y="6" width="38" height="17"/>
@@ -72,6 +87,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
</buttonCell> </buttonCell>
<connections>
<action selector="toggleSearchFlags:" target="-1" id="Ykb-ye-FqF"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SaV-5p-jIX"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SaV-5p-jIX">
<rect key="frame" x="320" y="6" width="50" height="17"/> <rect key="frame" x="320" y="6" width="50" height="17"/>
@@ -80,6 +98,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
</buttonCell> </buttonCell>
<connections>
<action selector="toggleSearchFlags:" target="-1" id="cuN-5p-vZD"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hMB-2T-pBD"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hMB-2T-pBD">
<rect key="frame" x="378" y="6" width="87" height="17"/> <rect key="frame" x="378" y="6" width="87" height="17"/>

View File

@@ -14,19 +14,13 @@
@interface MPContextBarViewController : MPViewController @interface MPContextBarViewController : MPViewController
@property (weak) NSView *nextKeyView; @property (weak) IBOutlet NSButton *titleButton;
@property (weak) IBOutlet NSButton *usernameButton;
@property (weak) IBOutlet NSButton *passwordButton;
@property (weak) IBOutlet NSButton *urlButton;
@property (weak) IBOutlet NSButton *notesButton;
@property (weak) IBOutlet NSButton *everywhereButton;
- (void)registerNotificationsForDocument:(MPDocument *)document; - (void)registerNotificationsForDocument:(MPDocument *)document;
- (IBAction)toggleFilterSpace:(id)sender;
- (BOOL)showsFilter;
- (BOOL)showsHistory;
- (BOOL)showsTrash;
- (void)showFilter;
- (void)showHistory;
- (void)showTrash;
@end @end

View File

@@ -9,9 +9,12 @@
#import "MPContextBarViewController.h" #import "MPContextBarViewController.h"
#import "HNHGradientView.h" #import "HNHGradientView.h"
#import "KPKEntry.h" #import "KPKEntry.h"
#import "MPDocument+HistoryBrowsing.h"
#import "MPDocument+Search.h" #import "MPDocument+Search.h"
#import "NSButton+HNHTextColor.h" #import "NSButton+HNHTextColor.h"
#import "MPFlagsHelper.h"
#import "HNHCommon.h"
NSUInteger const MPContextBarViewControllerActiveFilterMenuItemTag = 1000; NSUInteger const MPContextBarViewControllerActiveFilterMenuItemTag = 1000;
@@ -22,13 +25,7 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
}; };
@interface MPContextBarViewController () { @interface MPContextBarViewController ()
@private
BOOL _delegateRespondsToDidChangeFilter;
BOOL _delegateRespondsToDidExitFilter;
BOOL _delegateRespondsToDidExitHistory;
BOOL _delegateRespondsToShouldEmptyTrash;
}
@property (nonatomic, assign) MPContextTab activeTab; @property (nonatomic, assign) MPContextTab activeTab;
@@ -52,17 +49,6 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
return self; return self;
} }
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
_delegateRespondsToDidExitFilter = NO;
_delegateRespondsToDidExitHistory = NO;
_delegateRespondsToShouldEmptyTrash = NO;
_delegateRespondsToDidChangeFilter = NO;
}
return self;
}
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
@@ -81,64 +67,47 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
self.emptyTrashButton.textColor = [NSColor whiteColor]; self.emptyTrashButton.textColor = [NSColor whiteColor];
if(self.nextKeyView) { NSInteger tags[] = { MPEntrySearchTitles, MPEntrySearchUsernames, MPEntrySearchPasswords, MPEntrySearchNotes, MPEntrySearchUrls };
[self.exitHistoryButton setNextKeyView:self.nextKeyView]; NSArray *buttons = @[self.titleButton, self.usernameButton, self.passwordButton, self.notesButton, self.urlButton ];
[self.emptyTrashButton setNextKeyView:self.nextKeyView]; for(NSUInteger iIndex = 0; iIndex < [buttons count]; iIndex++) {
[self.filterDoneButton setNextKeyView:self.nextKeyView]; [buttons[iIndex] setAction:@selector(toggleSearchFlags:)];
[buttons[iIndex] setTag:tags[iIndex]];
} }
[self _updateFilterButtons]; [self _updateFilterButtons];
} }
#pragma mark Properties #pragma mark Properties
- (void)showFilter { - (void)_didEnterSearch:(NSNotification *)notification {
/* Select text if already visible */ /* Select text if already visible */
self.activeTab = MPContextTabFilter; self.activeTab = MPContextTabFilter;
[self _updateFilterButtons]; [self _updateFilterButtons];
} }
- (void)showHistory { - (void)_didEnterHistory:(NSNotification *)notification {
self.activeTab = MPContextTabHistory; self.activeTab = MPContextTabHistory;
[self _updateBindings]; [self _updateBindings];
} }
- (void)showTrash { - (void)_showTrash {
self.activeTab = MPContextTabTrash; self.activeTab = MPContextTabTrash;
[self _updateBindings]; [self _updateBindings];
} }
- (BOOL)showsFilter {
return self.activeTab == MPContextTabFilter;
}
- (BOOL)showsHistory {
return self.activeTab == MPContextTabHistory;
}
- (BOOL)showsTrash {
return self.activeTab == MPContextTabTrash;
}
- (void)registerNotificationsForDocument:(MPDocument *)document { - (void)registerNotificationsForDocument:(MPDocument *)document {
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateFilterButtons) name:MPDocumentDidChangeSearchFlags object:document];
selector:@selector(_updateFilterButtons) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterSearch:) name:MPDocumentDidEnterSearchNotification object:document];
name:MPDocumentDidChangeSearchFlags [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterHistory:) name:MPDocumentDidEnterHistoryNotification object:document];
object:document];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(showFilter)
name:MPDocumentDidEnterSearchNotification
object:document];
} }
/* /*
- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector { - (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector {
if(commandSelector == @selector(insertNewline:)) { if(commandSelector == @selector(insertNewline:)) {
[self _didChangeFilter]; [self _didChangeFilter];
} }
return NO; return NO;
} }
*/ */
#pragma mark UI Helper #pragma mark UI Helper
- (void)_updateBindings { - (void)_updateBindings {
@@ -147,6 +116,12 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
- (void)_updateFilterButtons { - (void)_updateFilterButtons {
MPDocument *document = [[self windowController] document]; MPDocument *document = [[self windowController] document];
[self.everywhereButton setEnabled:NO];
[self.notesButton setState:HNHStateForBool(MPTestFlagInOptions(MPEntrySearchNotes, document.activeFlags))];
[self.passwordButton setState:HNHStateForBool(MPTestFlagInOptions(MPEntrySearchPasswords, document.activeFlags))];
[self.titleButton setState:HNHStateForBool(MPTestFlagInOptions(MPEntrySearchTitles, document.activeFlags))];
[self.urlButton setState:HNHStateForBool(MPTestFlagInOptions(MPEntrySearchUrls, document.activeFlags))];
[self.usernameButton setState:HNHStateForBool(MPTestFlagInOptions(MPEntrySearchUsernames, document.activeFlags))];
} }
@end @end

View File

@@ -12,6 +12,7 @@ FOUNDATION_EXPORT NSString *const MPDocumentDidEnterSearchNotification;
FOUNDATION_EXTERN NSString *const MPDocumentDidChangeSearchNotification; FOUNDATION_EXTERN NSString *const MPDocumentDidChangeSearchNotification;
FOUNDATION_EXPORT NSString *const MPDocumentDidChangeSearchFlags; FOUNDATION_EXPORT NSString *const MPDocumentDidChangeSearchFlags;
FOUNDATION_EXTERN NSString *const MPDocumentDidExitSearchNotification; FOUNDATION_EXTERN NSString *const MPDocumentDidExitSearchNotification;
FOUNDATION_EXPORT NSString *const MPDocumentDidChangeSearchResults;
@interface MPDocument (Search) @interface MPDocument (Search)
@@ -22,6 +23,6 @@ FOUNDATION_EXTERN NSString *const MPDocumentDidExitSearchNotification;
/* exits searching mode */ /* exits searching mode */
- (IBAction)exitSearch:(id)sender; - (IBAction)exitSearch:(id)sender;
/* called by the filter toggle buttons */ /* called by the filter toggle buttons */
- (IBAction)toggleFlags:(id)sender; - (IBAction)toggleSearchFlags:(id)sender;
@end @end

View File

@@ -42,11 +42,11 @@ NSString *const MPDocumentDidExitSearchNotification = @"com.hicknhack.macpass.
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidExitSearchNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidExitSearchNotification object:self];
} }
- (void)toggleFlags:(id)sender { - (void)toggleSearchFlags:(id)sender {
if(![sender respondsToSelector:@selector(tag)]) { if(![sender respondsToSelector:@selector(tag)]) {
return; // We nee to read the button tag return; // We need to read the button tag
} }
if([sender respondsToSelector:@selector(state)]) { if(![sender respondsToSelector:@selector(state)]) {
return; // We need to read the button state return; // We need to read the button state
} }
MPEntrySearchFlags toggleFlag = [sender tag]; MPEntrySearchFlags toggleFlag = [sender tag];
@@ -117,6 +117,10 @@ NSString *const MPDocumentDidExitSearchNotification = @"com.hicknhack.macpass.
return [allOptions objectsAtIndexes:indexes]; return [allOptions objectsAtIndexes:indexes];
} }
- (void)_updateSearch {
self.searchResult = [self entriesInDocument:self matching:self.searchString];
}
- (NSArray *)_filterPredicatesWithString:(NSString *)string{ - (NSArray *)_filterPredicatesWithString:(NSString *)string{
NSMutableArray *prediactes = [[NSMutableArray alloc] initWithCapacity:4]; NSMutableArray *prediactes = [[NSMutableArray alloc] initWithCapacity:4];

View File

@@ -80,6 +80,7 @@ typedef NS_OPTIONS(NSUInteger, MPEntrySearchFlags) {
@property (nonatomic, assign) MPEntrySearchFlags activeFlags; @property (nonatomic, assign) MPEntrySearchFlags activeFlags;
@property (nonatomic, copy) NSString *searchString; @property (nonatomic, copy) NSString *searchString;
@property (nonatomic, assign) BOOL hasSearch; @property (nonatomic, assign) BOOL hasSearch;
@property (nonatomic, strong) NSArray *searchResult;
+ (KPKVersion)versionForFileType:(NSString *)fileType; + (KPKVersion)versionForFileType:(NSString *)fileType;

View File

@@ -43,8 +43,4 @@ typedef NS_ENUM( NSUInteger, MPCopyContentTypeTag) {
- (void)copyURL:(id)sender; - (void)copyURL:(id)sender;
- (void)openURL:(id)sender; - (void)openURL:(id)sender;
/* History*/
- (IBAction)enterHistoryBrowser:(id)sender;
- (IBAction)exitHistoryBrowser:(id)sender;
@end @end

View File

@@ -123,8 +123,6 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
name:MPDidActivateViewNotification name:MPDidActivateViewNotification
object:_entryTable]; object:_entryTable];
/* Filter bar notifications */ /* Filter bar notifications */
self.contextBarViewController.delegate = self;
self.contextBarViewController.nextKeyView = self.entryTable;
[self _setupEntryMenu]; [self _setupEntryMenu];
NSTableColumn *parentColumn = [self.entryTable tableColumns][0]; NSTableColumn *parentColumn = [self.entryTable tableColumns][0];
@@ -202,7 +200,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
name:MPDocumentDidChangeSearchNotification name:MPDocumentDidChangeSearchNotification
object:document]; object:document];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(showFilter:) selector:@selector(_didEnterSearch:)
name:MPDocumentDidEnterSearchNotification name:MPDocumentDidEnterSearchNotification
object:document]; object:document];
@@ -212,6 +210,8 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
name:MPDocumentDidExitSearchNotification name:MPDocumentDidExitSearchNotification
object:document]; object:document];
[self.contextBarViewController registerNotificationsForDocument:document];
} }
#pragma mark NSTableViewDelgate #pragma mark NSTableViewDelgate
@@ -329,7 +329,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
- (void)_didBecomFirstResponder:(NSNotification *)notification { - (void)_didBecomFirstResponder:(NSNotification *)notification {
MPDocument *document = [[self windowController] document]; MPDocument *document = [[self windowController] document];
if(document.selectedEntry.parent == document.selectedGroup || [self.contextBarViewController showsFilter]) { if(document.selectedEntry.parent == document.selectedGroup || document.hasSearch) {
document.selectedItem = document.selectedEntry; document.selectedItem = document.selectedEntry;
} }
else { else {
@@ -338,9 +338,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
} }
#pragma mark MPDocumentSearchServiceNotifications #pragma mark MPDocumentSearchServiceNotifications
- (void)_updateSearchResults:(NSNotification *)notification { - (void)_updateSearchResults:(NSNotification *)notification {
if(!_isDisplayingContextBar || ![self.contextBarViewController showsFilter]) { [self _showContextBar];
[self showFilter:nil];
}
dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(backgroundQueue, ^{ dispatch_async(backgroundQueue, ^{
MPDocument *document = [[self windowController] document]; MPDocument *document = [[self windowController] document];
@@ -365,14 +363,12 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
[self _updateContextBar]; [self _updateContextBar];
} }
- (void)showFilter:(NSNotification *)notification { - (void)_didEnterSearch:(NSNotification *)notification {
[self.contextBarViewController showFilter];
[self _showContextBar]; [self _showContextBar];
} }
#pragma mark ContextBar #pragma mark ContextBar
- (void)_showTrashBar { - (void)_showTrashBar {
[self.contextBarViewController showTrash];
[self _showContextBar]; [self _showContextBar];
} }