Permalink
Browse files

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.
  • Loading branch information...
1 parent 658d710 commit 4184f609d63b43101026153a69d31e7e9125f44f @lhunath lhunath committed Mar 1, 2014
Binary file not shown.
@@ -7,24 +7,24 @@
<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>
<string>Crashlytics</string>
<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 @@ - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInf
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 @@ - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInf
}
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,34 +348,47 @@ - (void)updateElements {
NSError *error = nil;
NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error];
- if (!siteResults)
- err(@"While fetching elements for completion: %@", error);
- else if ([siteResults count]) {
- 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 (!siteResults) {
+ err(@"While fetching elements for completion: %@", error);
+ return;
}
+
+ NSMutableArray *newElements = [NSMutableArray arrayWithCapacity:[siteResults count]];
+ for (MPElementEntity *element in siteResults)
+ [newElements addObject:[[MPElementModel alloc] initWithEntity:element]];
+ self.elements = newElements;
+ if (!self.selectedElement)
+ self.elementSelectionIndexes = [newElements count]? [NSIndexSet indexSetWithIndex:0]: nil;
}];
}
-- (NSBox *)selectedView {
+- (NSUInteger)selectedIndex {
+ if (!self.elementSelectionIndexes)
+ return NSNotFound;
NSUInteger selectedIndex = self.elementSelectionIndexes.firstIndex;
- if (selectedIndex == NSNotFound || selectedIndex >= self.elements.count)
+ if (selectedIndex >= self.elements.count)
+ return NSNotFound;
+
+ return selectedIndex;
+}
+
+- (NSBox *)selectedView {
+
+ NSUInteger selectedIndex = [self selectedIndex];
+ if (selectedIndex == NSNotFound)
return nil;
return (NSBox *)[self.siteCollectionView itemAtIndex:selectedIndex].view;
}
- (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>

0 comments on commit 4184f60

Please sign in to comment.