diff --git a/MacPass/MPAppDelegate.h b/MacPass/MPAppDelegate.h
index d1d143a2..685a324c 100644
--- a/MacPass/MPAppDelegate.h
+++ b/MacPass/MPAppDelegate.h
@@ -14,4 +14,6 @@
- (IBAction) showMainWindow:(id)sender;
+- (NSString *)applicationName;
+
@end
\ No newline at end of file
diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m
index 322017fb..1342cabb 100644
--- a/MacPass/MPAppDelegate.m
+++ b/MacPass/MPAppDelegate.m
@@ -29,11 +29,15 @@
}
- (void)dealloc {
- self.settingsController = nil;
- self.mainWindowController = nil;
+ [_settingsController release];
+ [_mainWindowController release];
[super dealloc];
}
+- (NSString *)applicationName {
+ return [[NSBundle mainBundle] infoDictionary][@"CFBundleName"];
+}
+
#pragma mark Menu Actions
- (void)showMainWindow:(id)sender {
diff --git a/MacPass/MPMainWindowController.m b/MacPass/MPMainWindowController.m
index c9e9233c..f56a71c1 100644
--- a/MacPass/MPMainWindowController.m
+++ b/MacPass/MPMainWindowController.m
@@ -8,11 +8,13 @@
#import "MPMainWindowController.h"
#import "MPDatabaseController.h"
+#import "MPDatabaseDocument.h"
#import "MPPasswordInputController.h"
#import "MPEntryViewController.h"
#import "MPToolbarDelegate.h"
#import "MPOutlineViewController.h"
#import "MPMainWindowSplitViewDelegate.h"
+#import "MPAppDelegate.h"
#import "MPEntryEditController.h"
@interface MPMainWindowController ()
@@ -36,6 +38,7 @@
- (void)_collapseOutlineView;
- (void)_expandOutlineView;
- (void)_setContentViewController:(MPViewController *)viewController;
+- (void)_updateWindowTitle;
@end
@@ -80,6 +83,7 @@
- (void)windowDidLoad
{
[super windowDidLoad];
+ [self _updateWindowTitle];
[[self.welcomeText cell] setBackgroundStyle:NSBackgroundStyleRaised];
@@ -150,6 +154,17 @@
}
}
+- (void)_updateWindowTitle {
+ if([MPDatabaseController defaultController].database) {
+ NSString *appName = [(MPAppDelegate *)[NSApp delegate] applicationName];
+ NSString *openFile = [[MPDatabaseController defaultController].database.file lastPathComponent];
+ [self.window setTitle:[NSString stringWithFormat:@"%@ - %@", appName, openFile]];
+ }
+ else {
+ [self.window setTitle:[(MPAppDelegate *)[NSApp delegate] applicationName]];
+ }
+}
+
#pragma mark Actions
- (void)performFindPanelAction:(id)sender {
@@ -176,6 +191,7 @@
if(result == NSFileHandlingPanelOKButton) {
NSURL *file = [[openPanel URLs] lastObject];
self.passwordInputController.fileURL = file;
+ [self _collapseOutlineView];
[self _setContentViewController:self.passwordInputController];
}
}];
@@ -229,6 +245,7 @@
#pragma mark Notifications
- (void)didOpenDocument:(NSNotification *)notification {
+ [self _updateWindowTitle];
[self showEntries];
}
diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist
index f3066d84..717970bc 100644
--- a/MacPass/MacPass-Info.plist
+++ b/MacPass/MacPass-Info.plist
@@ -21,7 +21,7 @@
CFBundleSignature
????
CFBundleVersion
- 3B6
+ 3BB
LSMinimumSystemVersion
${MACOSX_DEPLOYMENT_TARGET}
NSHumanReadableCopyright