Fixed #282 Search now gets stored correclty and is respected while performing a search

This commit is contained in:
michael starke
2014-12-08 19:05:58 +01:00
parent 92c1981668
commit bc03d8ef32
13 changed files with 27 additions and 68 deletions

View File

@@ -76,18 +76,10 @@
</button>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="229">
<rect key="frame" x="18" y="128" width="222" height="26"/>
<popUpButtonCell key="cell" type="push" title="Exclude from Search" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="1" imageScaling="proportionallyDown" inset="2" selectedItem="234" id="230">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="230">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="231">
<items>
<menuItem title="Inherit Search Settings" tag="-1" id="232">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Include in Search" id="233"/>
<menuItem title="Exclude from Search" state="on" tag="1" id="234"/>
</items>
</menu>
<menu key="menu" title="OtherViews" id="231"/>
</popUpButtonCell>
<connections>
<outlet property="nextKeyView" destination="240" id="XsX-U5-uZd"/>

View File

@@ -116,7 +116,7 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
if(MPIsFlagSetInOptions(MPEntrySearchDoublePasswords, self.searchContext.searchFlags)) {
__block NSMutableDictionary *passwordToEntryMap = [[NSMutableDictionary alloc] initWithCapacity:100];
/* Build up a usage map */
[[self.root childEntries] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[[self.root searchableChildEntries] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
KPKEntry *entry = obj;
/* skip entries without passwords */
if([entry.password length] > 0) {
@@ -144,16 +144,16 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
KPKNode *node = evaluatedObject;
return node.timeInfo.isExpired;
}];
return [[self.root childEntries] filteredArrayUsingPredicate:expiredPredicate];
return [[self.root searchableChildEntries] filteredArrayUsingPredicate:expiredPredicate];
}
/* Filter using predicates */
NSArray *predicates = [self _filterPredicatesWithString:self.searchContext.searchString];
if(predicates) {
NSPredicate *fullFilter = [NSCompoundPredicate orPredicateWithSubpredicates:predicates];
return [[self.root childEntries] filteredArrayUsingPredicate:fullFilter];
return [[self.root searchableChildEntries] filteredArrayUsingPredicate:fullFilter];
}
/* No filter, just return everything */
return [self.root childEntries];
return [self.root searchableChildEntries];
}
- (NSArray *)_filterPredicatesWithString:(NSString *)string{

View File

@@ -58,17 +58,29 @@
[[self view] layoutSubtreeIfNeeded];
NSMenu *autotypeMenu = self.autotypePopupButton.menu;
NSMenuItem *inheritItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_INHERIT", "") action:NULL keyEquivalent:@""];
inheritItem.tag = KPKInherit;
NSMenuItem *yesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_YES", "") action:NULL keyEquivalent:@""];
yesItem.tag = KPKInheritYES;
NSMenuItem *noItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_NO", "") action:NULL keyEquivalent:@""];
noItem.tag = KPKInheritNO;
NSMenuItem *inheritAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_INHERIT", "") action:NULL keyEquivalent:@""];
inheritAutotype.tag = KPKInherit;
NSMenuItem *enableAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_YES", "") action:NULL keyEquivalent:@""];
enableAutotype.tag = KPKInheritYES;
NSMenuItem *disableAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_NO", "") action:NULL keyEquivalent:@""];
disableAutotype.tag = KPKInheritNO;
[autotypeMenu addItem:inheritItem];
[autotypeMenu addItem:yesItem];
[autotypeMenu addItem:noItem];
[autotypeMenu addItem:inheritAutotype];
[autotypeMenu addItem:enableAutotype];
[autotypeMenu addItem:disableAutotype];
NSMenu *searchMenu = self.searchPopupButton.menu;
NSMenuItem *inheritSearch = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"SEARCH_INHERIT", "") action:NULL keyEquivalent:@""];
inheritSearch.tag = KPKInherit;
NSMenuItem *includeInSearch = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"SEARCH_YES", "") action:NULL keyEquivalent:@""];
includeInSearch.tag = KPKInheritYES;
NSMenuItem *excludeFromSearch = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"SEARCH_NO", "") action:NULL keyEquivalent:@""];
excludeFromSearch.tag = KPKInheritNO;
[searchMenu addItem:inheritSearch];
[searchMenu addItem:includeInSearch];
[searchMenu addItem:excludeFromSearch];
/*
void(^copyBlock)(NSTextField *textField) = ^void(NSTextField *textField) {
[[MPPasteBoardController defaultController] copyObjects:@[ textField.stringValue ]];

View File

@@ -8,15 +8,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
"231.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "Inherit Search Settings"; ObjectID = "232"; */
"232.title" = "Inherit Search Settings";
/* Class = "NSMenuItem"; title = "Include in Search"; ObjectID = "233"; */
"233.title" = "Include in Search";
/* Class = "NSMenuItem"; title = "Exclude from Search"; ObjectID = "234"; */
"234.title" = "Exclude from Search";
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
"243.title" = "OtherViews";

Binary file not shown.

View File

@@ -8,15 +8,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
"231.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "Inherit Search Settings"; ObjectID = "232"; */
"232.title" = "Inherit Search Settings";
/* Class = "NSMenuItem"; title = "Include in Search"; ObjectID = "233"; */
"233.title" = "Include in Search";
/* Class = "NSMenuItem"; title = "Exclude from Search"; ObjectID = "234"; */
"234.title" = "Exclude from Search";
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
"243.title" = "OtherViews";

Binary file not shown.

View File

@@ -8,15 +8,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
"231.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "Inherit Search Settings"; ObjectID = "232"; */
"232.title" = "Inherit Search Settings";
/* Class = "NSMenuItem"; title = "Include in Search"; ObjectID = "233"; */
"233.title" = "Include in Search";
/* Class = "NSMenuItem"; title = "Exclude from Search"; ObjectID = "234"; */
"234.title" = "Exclude from Search";
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
"243.title" = "OtherViews";

Binary file not shown.

View File

@@ -8,15 +8,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
"231.title" = "OverigeViews";
/* Class = "NSMenuItem"; title = "Inherit Search Settings"; ObjectID = "232"; */
"232.title" = "Erf Zoekinstellingen";
/* Class = "NSMenuItem"; title = "Include in Search"; ObjectID = "233"; */
"233.title" = "Insluiten in Zoeken";
/* Class = "NSMenuItem"; title = "Exclude from Search"; ObjectID = "234"; */
"234.title" = "Uitsluiten van Zoeken";
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
"243.title" = "OverigeViews";

Binary file not shown.

View File

@@ -8,15 +8,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
"231.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "Inherit Search Settings"; ObjectID = "232"; */
"232.title" = "继承搜索设置";
/* Class = "NSMenuItem"; title = "Include in Search"; ObjectID = "233"; */
"233.title" = "包含在搜索中";
/* Class = "NSMenuItem"; title = "Exclude from Search"; ObjectID = "234"; */
"234.title" = "不包含在搜索中";
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
"243.title" = "OtherViews";