mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 12:52:21 +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>
|
</menu>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="FVA-Cn-g79"/>
|
<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"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="fixAutotype:" target="-1" id="eVm-am-dL6"/>
|
<action selector="fixAutotype:" target="-1" id="eVm-am-dL6"/>
|
||||||
@@ -356,6 +356,7 @@ CA
|
|||||||
</menu>
|
</menu>
|
||||||
<customObject id="494" customClass="MPAppDelegate">
|
<customObject id="494" customClass="MPAppDelegate">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="fixAutotypeMenuItem" destination="nx7-Vf-LiD" id="5n1-bG-JxJ"/>
|
||||||
<outlet property="saveMenuItem" destination="75" id="dsN-Im-4eZ"/>
|
<outlet property="saveMenuItem" destination="75" id="dsN-Im-4eZ"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
|
|||||||
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
|
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
|
||||||
@property (strong) IBOutlet NSWindow *welcomeWindow;
|
@property (strong) IBOutlet NSWindow *welcomeWindow;
|
||||||
@property (weak) IBOutlet NSMenuItem *saveMenuItem;
|
@property (weak) IBOutlet NSMenuItem *saveMenuItem;
|
||||||
|
@property (weak) IBOutlet NSMenuItem *fixAutotypeMenuItem;
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL isAllowedToStoreKeyFile;
|
@property (nonatomic, assign) BOOL isAllowedToStoreKeyFile;
|
||||||
|
|
||||||
@@ -48,4 +49,4 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
|
|||||||
|
|
||||||
- (void)lockAllDocuments;
|
- (void)lockAllDocuments;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -174,13 +174,15 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark NSMenuDelegate
|
#pragma mark NSMenuDelegate
|
||||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||||
if([self.saveMenuItem menu] != menu) {
|
if(menu == self.saveMenuItem.menu) {
|
||||||
return; // wrong 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 -
|
#pragma mark -
|
||||||
@@ -300,7 +302,7 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
|||||||
[documentController openDocumentWithContentsOfURL:documentUrl
|
[documentController openDocumentWithContentsOfURL:documentUrl
|
||||||
display:YES
|
display:YES
|
||||||
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
|
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
|
||||||
|
|
||||||
if(error != nil){
|
if(error != nil){
|
||||||
|
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
@@ -313,7 +315,7 @@ NSString *const MPHelpURLKey = @"MPHelpURL";
|
|||||||
if(document == nil){
|
if(document == nil){
|
||||||
[self _showWelcomeWindow];
|
[self _showWelcomeWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
return isFileURL;
|
return isFileURL;
|
||||||
|
|||||||
Reference in New Issue
Block a user