Fixed #143 Save now uses dots only when prompt will be displayed

This commit is contained in:
michael starke
2014-02-12 12:51:34 +01:00
parent 4f55d93451
commit b82bc8c9e9
6 changed files with 24 additions and 2 deletions

View File

@@ -297,7 +297,11 @@
</menuItem>
</items>
</menu>
<customObject id="494" customClass="MPAppDelegate"/>
<customObject id="494" customClass="MPAppDelegate">
<connections>
<outlet property="saveMenuItem" destination="75" id="dsN-Im-4eZ"/>
</connections>
</customObject>
<customObject id="420" customClass="NSFontManager"/>
<customObject id="EpI-0u-HQc" customClass="SUUpdater"/>
</objects>

View File

@@ -22,10 +22,11 @@
#import <Cocoa/Cocoa.h>
@interface MPAppDelegate : NSObject <NSApplicationDelegate>
@interface MPAppDelegate : NSObject <NSApplicationDelegate, NSMenuDelegate>
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
@property (strong) IBOutlet NSWindow *welcomeWindow;
@property (weak) IBOutlet NSMenuItem *saveMenuItem;
- (IBAction)showPreferences:(id)sender;
- (IBAction)showPasswordCreator:(id)sender;

View File

@@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.