diff --git a/External/UbiquityStoreManager b/External/UbiquityStoreManager index f2341a29..174f955e 160000 --- a/External/UbiquityStoreManager +++ b/External/UbiquityStoreManager @@ -1 +1 @@ -Subproject commit f2341a290e66796df0e7b555a24e33f5470ff7f5 +Subproject commit 174f955efa883b58d37bc8b2ee93142e98c64f81 diff --git a/MasterPassword/ObjC/Mac/MPMacAppDelegate.m b/MasterPassword/ObjC/Mac/MPMacAppDelegate.m index 1a048216..44507644 100644 --- a/MasterPassword/ObjC/Mac/MPMacAppDelegate.m +++ b/MasterPassword/ObjC/Mac/MPMacAppDelegate.m @@ -224,10 +224,13 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven __weak id weakSelf = self; [self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { [weakSelf updateMenuItems]; - } forKeyPath:@"key" options:NSKeyValueObservingOptionInitial context:nil]; + } forKeyPath:@"key" options:0 context:nil]; [self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { [weakSelf updateMenuItems]; - } forKeyPath:@"activeUser" options:NSKeyValueObservingOptionInitial context:nil]; + } forKeyPath:@"activeUser" options:0 context:nil]; + [self addObserverBlock:^(NSString *keyPath, id object, NSDictionary *change, void *context) { + [weakSelf updateMenuItems]; + } forKeyPath:@"storeManager.cloudAvailable" options:0 context:nil]; // Status item. self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; @@ -358,6 +361,15 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven } self.useICloudItem.state = self.storeManager.cloudEnabled? NSOnState: NSOffState; + self.useICloudItem.enabled = self.storeManager.cloudAvailable; + if (self.storeManager.cloudAvailable) { + self.useICloudItem.title = @"Use iCloud"; + self.useICloudItem.toolTip = nil; + } + else { + self.useICloudItem.title = @"Use iCloud (Unavailable)"; + self.useICloudItem.toolTip = @"iCloud is not set up for your Mac user."; + } } - (IBAction)showPasswordWindow:(id)sender { diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m index 7cff0432..7b9be2d1 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m @@ -60,8 +60,11 @@ }]; [[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillCloseNotification object:self.window queue:nil usingBlock:^(NSNotification *note) { - [NSApp endSheet:[self.window attachedSheet]]; - [[NSApplication sharedApplication] hide:nil]; + NSWindow *sheet = [self.window attachedSheet]; + if (sheet) + [NSApp endSheet:sheet]; + + [NSApp hide:nil]; }]; [[NSNotificationCenter defaultCenter] addObserverForName:MPSignedOutNotification object:nil queue:nil usingBlock:^(NSNotification *note) { @@ -201,6 +204,7 @@ NSString *password = [(NSSecureTextField *)alert.accessoryView stringValue]; [MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) { MPUserEntity *activeUser = [[MPMacAppDelegate get] activeUserInContext:moc]; + NSString *userName = activeUser.name; BOOL success = [[MPMacAppDelegate get] signInAsUser:activeUser saveInContext:moc usingMasterPassword:password]; self.inProgress = NO; @@ -212,7 +216,7 @@ self.contentContainer.alphaValue = 1; else { [[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey : PearlString( @"Incorrect master password for user %@", activeUser.name ) + NSLocalizedDescriptionKey : PearlString( @"Incorrect master password for user %@", userName ) }]] beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:MPAlertIncorrectMP]; }