mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 05:52:58 +00:00
hide fix autotype menu item, show only if alternat-key is pressed when opening the menu (no live update!)
This commit is contained in:
@@ -115,7 +115,7 @@
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="FVA-Cn-g79"/>
|
||||
<menuItem title="Fix Autotype…" id="nx7-Vf-LiD">
|
||||
<menuItem title="Fix Autotype…" hidden="YES" id="nx7-Vf-LiD">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="fixAutotype:" target="-1" id="eVm-am-dL6"/>
|
||||
@@ -356,6 +356,7 @@ CA
|
||||
</menu>
|
||||
<customObject id="494" customClass="MPAppDelegate">
|
||||
<connections>
|
||||
<outlet property="fixAutotypeMenuItem" destination="nx7-Vf-LiD" id="5n1-bG-JxJ"/>
|
||||
<outlet property="saveMenuItem" destination="75" id="dsN-Im-4eZ"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
|
||||
@@ -31,6 +31,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
|
||||
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
|
||||
@property (strong) IBOutlet NSWindow *welcomeWindow;
|
||||
@property (weak) IBOutlet NSMenuItem *saveMenuItem;
|
||||
@property (weak) IBOutlet NSMenuItem *fixAutotypeMenuItem;
|
||||
|
||||
@property (nonatomic, assign) BOOL isAllowedToStoreKeyFile;
|
||||
|
||||
@@ -48,4 +49,4 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
|
||||
|
||||
- (void)lockAllDocuments;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -174,13 +174,15 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
||||
#pragma mark -
|
||||
#pragma mark NSMenuDelegate
|
||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||
if([self.saveMenuItem menu] != menu) {
|
||||
return; // wrong menu
|
||||
if(menu == self.saveMenuItem.menu) {
|
||||
MPDocument *document = [NSDocumentController sharedDocumentController].currentDocument;
|
||||
BOOL displayDots = (document.fileURL == nil || !document.compositeKey.hasPasswordOrKeyFile);
|
||||
NSString *saveTitle = displayDots ? NSLocalizedString(@"SAVE_WITH_DOTS", "") : NSLocalizedString(@"SAVE", "");
|
||||
self.saveMenuItem.title = saveTitle;
|
||||
}
|
||||
if(menu == self.fixAutotypeMenuItem.menu) {
|
||||
self.fixAutotypeMenuItem.hidden = !(NSEvent.modifierFlags & NSAlternateKeyMask);
|
||||
}
|
||||
MPDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
BOOL displayDots = (document.fileURL == nil || !document.compositeKey.hasPasswordOrKeyFile);
|
||||
NSString *saveTitle = displayDots ? NSLocalizedString(@"SAVE_WITH_DOTS", "") : NSLocalizedString(@"SAVE", "");
|
||||
[self.saveMenuItem setTitle:saveTitle];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -300,7 +302,7 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
||||
[documentController openDocumentWithContentsOfURL:documentUrl
|
||||
display:YES
|
||||
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
|
||||
|
||||
|
||||
if(error != nil){
|
||||
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
@@ -313,7 +315,7 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
||||
if(document == nil){
|
||||
[self _showWelcomeWindow];
|
||||
}
|
||||
|
||||
|
||||
}];
|
||||
}
|
||||
return isFileURL;
|
||||
|
||||
Reference in New Issue
Block a user