From b82bc8c9e924b40bfe6428f518b56f71f04b35b1 Mon Sep 17 00:00:00 2001 From: michael starke Date: Wed, 12 Feb 2014 12:51:34 +0100 Subject: [PATCH] Fixed #143 Save now uses dots only when prompt will be displayed --- MacPass/Base.lproj/MainMenu.xib | 6 +++++- MacPass/MPAppDelegate.h | 3 ++- MacPass/MPAppDelegate.m | 17 +++++++++++++++++ MacPass/de.lproj/Localizable.strings | Bin 8384 -> 8450 bytes MacPass/en.lproj/Localizable.strings | Bin 8094 -> 8150 bytes MacPass/fr.lproj/Localizable.strings | Bin 7638 -> 7736 bytes 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/MacPass/Base.lproj/MainMenu.xib b/MacPass/Base.lproj/MainMenu.xib index 0b417055..e51d6638 100644 --- a/MacPass/Base.lproj/MainMenu.xib +++ b/MacPass/Base.lproj/MainMenu.xib @@ -297,7 +297,11 @@ - + + + + + diff --git a/MacPass/MPAppDelegate.h b/MacPass/MPAppDelegate.h index f5af5858..fcbab992 100644 --- a/MacPass/MPAppDelegate.h +++ b/MacPass/MPAppDelegate.h @@ -22,10 +22,11 @@ #import -@interface MPAppDelegate : NSObject +@interface MPAppDelegate : NSObject @property (strong) IBOutlet NSWindow *passwordCreatorWindow; @property (strong) IBOutlet NSWindow *welcomeWindow; +@property (weak) IBOutlet NSMenuItem *saveMenuItem; - (IBAction)showPreferences:(id)sender; - (IBAction)showPasswordCreator:(id)sender; diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m index e9b190f1..b53527ca 100644 --- a/MacPass/MPAppDelegate.m +++ b/MacPass/MPAppDelegate.m @@ -33,6 +33,9 @@ #import "MPAutotypeDaemon.h" #import "MPDocumentWindowController.h" +#import "MPDocument.h" +#import "KPKCompositeKey.h" + @interface MPAppDelegate () { @private MPServerDaemon *serverDaemon; @@ -60,6 +63,10 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; } +- (void)awakeFromNib { + [[self.saveMenuItem menu] setDelegate:self]; +} + - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { if(!flag) { BOOL reopen = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch]; @@ -199,4 +206,14 @@ return isFileURL; } +#pragma mark NSMenuDelegate +- (void)menuNeedsUpdate:(NSMenu *)menu { + if([self.saveMenuItem menu] != 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 setTitle:saveTitle]; +} @end diff --git a/MacPass/de.lproj/Localizable.strings b/MacPass/de.lproj/Localizable.strings index eb89ccd7c26a3fa624fbee802193fc6f5408551f..f170c5a7e189ef9fcebc5c1b4bc1baf8098b9285 100644 GIT binary patch delta 47 zcmX@$*yOZf6OW`LLl}cALp(z`gC|1>g9ni1!r%{N1y6n`CC!q@pr){S1&@RX03k&S AQ2+n{ delta 12 TcmZp2I^eir6VK)^JbWSmB@6`# diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index 0b198700b4576d8a699731d5274d7c7f8ea55976..7af4beacc17cb7a925b469ede3cac0880be2f630 100644 GIT binary patch delta 59 zcmbPdf6abF5RaZCLl}cALp(z`gC|1>g9ni1!r%{N1v4lyC@|Opu@aD-$WX?R%AlsO J*@Guc7yx?03q=3` delta 12 Tcmca+KhJ(c5YOf=9v@)a(ID;oc2!jWZ<-*_(WCc&= Pl@w=EQ`juPdrSZTv1trv delta 12 TcmdmCbIp2#1n=f5-hBc9BR>S=