mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 07:02:39 +00:00
Fixed #282 Search now gets stored correclty and is respected while performing a search
This commit is contained in:
@@ -76,18 +76,10 @@
|
|||||||
</button>
|
</button>
|
||||||
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="229">
|
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="229">
|
||||||
<rect key="frame" x="18" y="128" width="222" height="26"/>
|
<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"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="menu"/>
|
<font key="font" metaFont="menu"/>
|
||||||
<menu key="menu" title="OtherViews" id="231">
|
<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>
|
|
||||||
</popUpButtonCell>
|
</popUpButtonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="nextKeyView" destination="240" id="XsX-U5-uZd"/>
|
<outlet property="nextKeyView" destination="240" id="XsX-U5-uZd"/>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
|||||||
if(MPIsFlagSetInOptions(MPEntrySearchDoublePasswords, self.searchContext.searchFlags)) {
|
if(MPIsFlagSetInOptions(MPEntrySearchDoublePasswords, self.searchContext.searchFlags)) {
|
||||||
__block NSMutableDictionary *passwordToEntryMap = [[NSMutableDictionary alloc] initWithCapacity:100];
|
__block NSMutableDictionary *passwordToEntryMap = [[NSMutableDictionary alloc] initWithCapacity:100];
|
||||||
/* Build up a usage map */
|
/* 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;
|
KPKEntry *entry = obj;
|
||||||
/* skip entries without passwords */
|
/* skip entries without passwords */
|
||||||
if([entry.password length] > 0) {
|
if([entry.password length] > 0) {
|
||||||
@@ -144,16 +144,16 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
|||||||
KPKNode *node = evaluatedObject;
|
KPKNode *node = evaluatedObject;
|
||||||
return node.timeInfo.isExpired;
|
return node.timeInfo.isExpired;
|
||||||
}];
|
}];
|
||||||
return [[self.root childEntries] filteredArrayUsingPredicate:expiredPredicate];
|
return [[self.root searchableChildEntries] filteredArrayUsingPredicate:expiredPredicate];
|
||||||
}
|
}
|
||||||
/* Filter using predicates */
|
/* Filter using predicates */
|
||||||
NSArray *predicates = [self _filterPredicatesWithString:self.searchContext.searchString];
|
NSArray *predicates = [self _filterPredicatesWithString:self.searchContext.searchString];
|
||||||
if(predicates) {
|
if(predicates) {
|
||||||
NSPredicate *fullFilter = [NSCompoundPredicate orPredicateWithSubpredicates:predicates];
|
NSPredicate *fullFilter = [NSCompoundPredicate orPredicateWithSubpredicates:predicates];
|
||||||
return [[self.root childEntries] filteredArrayUsingPredicate:fullFilter];
|
return [[self.root searchableChildEntries] filteredArrayUsingPredicate:fullFilter];
|
||||||
}
|
}
|
||||||
/* No filter, just return everything */
|
/* No filter, just return everything */
|
||||||
return [self.root childEntries];
|
return [self.root searchableChildEntries];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)_filterPredicatesWithString:(NSString *)string{
|
- (NSArray *)_filterPredicatesWithString:(NSString *)string{
|
||||||
|
|||||||
@@ -58,16 +58,28 @@
|
|||||||
[[self view] layoutSubtreeIfNeeded];
|
[[self view] layoutSubtreeIfNeeded];
|
||||||
|
|
||||||
NSMenu *autotypeMenu = self.autotypePopupButton.menu;
|
NSMenu *autotypeMenu = self.autotypePopupButton.menu;
|
||||||
NSMenuItem *inheritItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_INHERIT", "") action:NULL keyEquivalent:@""];
|
NSMenuItem *inheritAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_INHERIT", "") action:NULL keyEquivalent:@""];
|
||||||
inheritItem.tag = KPKInherit;
|
inheritAutotype.tag = KPKInherit;
|
||||||
NSMenuItem *yesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_YES", "") action:NULL keyEquivalent:@""];
|
NSMenuItem *enableAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_YES", "") action:NULL keyEquivalent:@""];
|
||||||
yesItem.tag = KPKInheritYES;
|
enableAutotype.tag = KPKInheritYES;
|
||||||
NSMenuItem *noItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_NO", "") action:NULL keyEquivalent:@""];
|
NSMenuItem *disableAutotype = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOTYPE_NO", "") action:NULL keyEquivalent:@""];
|
||||||
noItem.tag = KPKInheritNO;
|
disableAutotype.tag = KPKInheritNO;
|
||||||
|
|
||||||
[autotypeMenu addItem:inheritItem];
|
[autotypeMenu addItem:inheritAutotype];
|
||||||
[autotypeMenu addItem:yesItem];
|
[autotypeMenu addItem:enableAutotype];
|
||||||
[autotypeMenu addItem:noItem];
|
[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) {
|
void(^copyBlock)(NSTextField *textField) = ^void(NSTextField *textField) {
|
||||||
|
|||||||
@@ -8,15 +8,6 @@
|
|||||||
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
||||||
"231.title" = "OtherViews";
|
"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"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
|
||||||
"243.title" = "OtherViews";
|
"243.title" = "OtherViews";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -8,15 +8,6 @@
|
|||||||
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
||||||
"231.title" = "OtherViews";
|
"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"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
|
||||||
"243.title" = "OtherViews";
|
"243.title" = "OtherViews";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -8,15 +8,6 @@
|
|||||||
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
||||||
"231.title" = "OtherViews";
|
"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"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
|
||||||
"243.title" = "OtherViews";
|
"243.title" = "OtherViews";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -8,15 +8,6 @@
|
|||||||
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
||||||
"231.title" = "OverigeViews";
|
"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"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
|
||||||
"243.title" = "OverigeViews";
|
"243.title" = "OverigeViews";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -8,15 +8,6 @@
|
|||||||
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "231"; */
|
||||||
"231.title" = "OtherViews";
|
"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"; */
|
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "243"; */
|
||||||
"243.title" = "OtherViews";
|
"243.title" = "OtherViews";
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user