Added correct window title

This commit is contained in:
michael starke
2013-03-03 14:01:35 +01:00
parent 7d6712536b
commit 54b8afdda4
4 changed files with 26 additions and 3 deletions

View File

@@ -14,4 +14,6 @@
- (IBAction) showMainWindow:(id)sender; - (IBAction) showMainWindow:(id)sender;
- (NSString *)applicationName;
@end @end

View File

@@ -29,11 +29,15 @@
} }
- (void)dealloc { - (void)dealloc {
self.settingsController = nil; [_settingsController release];
self.mainWindowController = nil; [_mainWindowController release];
[super dealloc]; [super dealloc];
} }
- (NSString *)applicationName {
return [[NSBundle mainBundle] infoDictionary][@"CFBundleName"];
}
#pragma mark Menu Actions #pragma mark Menu Actions
- (void)showMainWindow:(id)sender { - (void)showMainWindow:(id)sender {

View File

@@ -8,11 +8,13 @@
#import "MPMainWindowController.h" #import "MPMainWindowController.h"
#import "MPDatabaseController.h" #import "MPDatabaseController.h"
#import "MPDatabaseDocument.h"
#import "MPPasswordInputController.h" #import "MPPasswordInputController.h"
#import "MPEntryViewController.h" #import "MPEntryViewController.h"
#import "MPToolbarDelegate.h" #import "MPToolbarDelegate.h"
#import "MPOutlineViewController.h" #import "MPOutlineViewController.h"
#import "MPMainWindowSplitViewDelegate.h" #import "MPMainWindowSplitViewDelegate.h"
#import "MPAppDelegate.h"
#import "MPEntryEditController.h" #import "MPEntryEditController.h"
@interface MPMainWindowController () @interface MPMainWindowController ()
@@ -36,6 +38,7 @@
- (void)_collapseOutlineView; - (void)_collapseOutlineView;
- (void)_expandOutlineView; - (void)_expandOutlineView;
- (void)_setContentViewController:(MPViewController *)viewController; - (void)_setContentViewController:(MPViewController *)viewController;
- (void)_updateWindowTitle;
@end @end
@@ -80,6 +83,7 @@
- (void)windowDidLoad - (void)windowDidLoad
{ {
[super windowDidLoad]; [super windowDidLoad];
[self _updateWindowTitle];
[[self.welcomeText cell] setBackgroundStyle:NSBackgroundStyleRaised]; [[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 #pragma mark Actions
- (void)performFindPanelAction:(id)sender { - (void)performFindPanelAction:(id)sender {
@@ -176,6 +191,7 @@
if(result == NSFileHandlingPanelOKButton) { if(result == NSFileHandlingPanelOKButton) {
NSURL *file = [[openPanel URLs] lastObject]; NSURL *file = [[openPanel URLs] lastObject];
self.passwordInputController.fileURL = file; self.passwordInputController.fileURL = file;
[self _collapseOutlineView];
[self _setContentViewController:self.passwordInputController]; [self _setContentViewController:self.passwordInputController];
} }
}]; }];
@@ -229,6 +245,7 @@
#pragma mark Notifications #pragma mark Notifications
- (void)didOpenDocument:(NSNotification *)notification { - (void)didOpenDocument:(NSNotification *)notification {
[self _updateWindowTitle];
[self showEntries]; [self showEntries];
} }

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>3B6</string> <string>3BB</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>