Fixed updating search results when query is no match or element deleted.
[FIXED] Make search results empty when no results. [FIXED] Update search results upon deletion.
This commit is contained in:
parent
658d710847
commit
4184f609d6
Binary file not shown.
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Crashlytics</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.crashlytics.ios</string>
|
||||
<string>com.crashlytics.sdk.mac</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
@ -15,16 +15,16 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1.6</string>
|
||||
<string>2.1.2</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>iPhoneOS</string>
|
||||
<string>macosx</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>21</string>
|
||||
<string>9</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<string>macosx</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>4.0</string>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -205,6 +205,8 @@
|
||||
MPElementEntity *element = [self.representedObject entityInContext:context];
|
||||
[context deleteObject:element];
|
||||
[context saveToStore];
|
||||
|
||||
[((MPPasswordWindowController *)self.collectionView.window.windowController) updateElements];
|
||||
}];
|
||||
break;
|
||||
}
|
||||
|
@ -18,4 +18,6 @@
|
||||
@property(nonatomic, weak) IBOutlet NSTextField *userLabel;
|
||||
@property(nonatomic, weak) IBOutlet NSCollectionView *siteCollectionView;
|
||||
|
||||
- (void)updateElements;
|
||||
|
||||
@end
|
||||
|
@ -178,14 +178,17 @@
|
||||
}
|
||||
if (contextInfo == MPAlertCreateSite) {
|
||||
switch (returnCode) {
|
||||
case NSAlertDefaultReturn: {
|
||||
case NSAlertFirstButtonReturn: {
|
||||
// "Create" button.
|
||||
[[MPMacAppDelegate get] addElementNamed:[self.siteField stringValue] completion:^(MPElementEntity *element) {
|
||||
if (element) {
|
||||
if (element)
|
||||
[self updateElements];
|
||||
}
|
||||
}];
|
||||
break;
|
||||
}
|
||||
case NSAlertThirdButtonReturn:
|
||||
// "Cancel" button.
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -345,23 +348,35 @@
|
||||
|
||||
NSError *error = nil;
|
||||
NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error];
|
||||
if (!siteResults)
|
||||
if (!siteResults) {
|
||||
err(@"While fetching elements for completion: %@", error);
|
||||
else if ([siteResults count]) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableArray *newElements = [NSMutableArray arrayWithCapacity:[siteResults count]];
|
||||
for (MPElementEntity *element in siteResults)
|
||||
[newElements addObject:[[MPElementModel alloc] initWithEntity:element]];
|
||||
self.elements = newElements;
|
||||
if (!self.selectedElement && [newElements count])
|
||||
self.elementSelectionIndexes = [NSIndexSet indexSetWithIndex:0];
|
||||
}
|
||||
if (!self.selectedElement)
|
||||
self.elementSelectionIndexes = [newElements count]? [NSIndexSet indexSetWithIndex:0]: nil;
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSUInteger)selectedIndex {
|
||||
|
||||
if (!self.elementSelectionIndexes)
|
||||
return NSNotFound;
|
||||
NSUInteger selectedIndex = self.elementSelectionIndexes.firstIndex;
|
||||
if (selectedIndex >= self.elements.count)
|
||||
return NSNotFound;
|
||||
|
||||
return selectedIndex;
|
||||
}
|
||||
|
||||
- (NSBox *)selectedView {
|
||||
|
||||
NSUInteger selectedIndex = self.elementSelectionIndexes.firstIndex;
|
||||
if (selectedIndex == NSNotFound || selectedIndex >= self.elements.count)
|
||||
NSUInteger selectedIndex = [self selectedIndex];
|
||||
if (selectedIndex == NSNotFound)
|
||||
return nil;
|
||||
|
||||
return (NSBox *)[self.siteCollectionView itemAtIndex:selectedIndex].view;
|
||||
@ -369,10 +384,11 @@
|
||||
|
||||
- (MPElementModel *)selectedElement {
|
||||
|
||||
if (!self.elementSelectionIndexes.count)
|
||||
NSUInteger selectedIndex = [self selectedIndex];
|
||||
if (selectedIndex == NSNotFound)
|
||||
return nil;
|
||||
|
||||
return (MPElementModel *)self.elements[self.elementSelectionIndexes.firstIndex];
|
||||
return (MPElementModel *)self.elements[selectedIndex];
|
||||
}
|
||||
|
||||
- (void)setSelectedElement:(MPElementModel *)element {
|
||||
|
@ -1978,7 +1978,7 @@
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = MasterPassword.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer: Maarten Billemont (DWGU95U4ZD)";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
GCC_PREFIX_HEADER = "MasterPassword-Prefix.pch";
|
||||
INFOPLIST_FILE = "MasterPassword-Info.plist";
|
||||
|
@ -4,11 +4,11 @@
|
||||
<dict>
|
||||
<key>com.apple.developer.ubiquity-container-identifiers</key>
|
||||
<array>
|
||||
<string>$(TeamIdentifierPrefix)com.lyndir.lhunath.MasterPassword.Mac</string>
|
||||
<string>$(TeamIdentifierPrefix)com.lyndir.lhunath.MasterPassword.shared</string>
|
||||
<string>HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.Mac</string>
|
||||
<string>HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared</string>
|
||||
</array>
|
||||
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
|
||||
<string>$(TeamIdentifierPrefix)com.lyndir.lhunath.MasterPassword.shared</string>
|
||||
<string>HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared</string>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
Loading…
Reference in New Issue
Block a user