diff --git a/build.py b/build.py index 817eff51..e5c77476 100644 --- a/build.py +++ b/build.py @@ -69,7 +69,8 @@ def build_xibless(edition): xibless.generate('cocoa/base/ui/directory_panel.py', 'cocoa/autogen/DirectoryPanel_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/prioritize_dialog.py', 'cocoa/autogen/PrioritizeDialog_UI', localizationTable='Localizable') xibless.generate('cocoa/base/ui/result_window.py', 'cocoa/autogen/ResultWindow_UI', localizationTable='Localizable') - xibless.generate('cocoa/base/ui/main_menu.py', 'cocoa/autogen/MainMenu_UI', localizationTable='Localizable') + xibless.generate('cocoa/base/ui/main_menu.py', 'cocoa/autogen/MainMenu_UI', + localizationTable='Localizable', args={'edition': edition}) xibless.generate('cocoa/base/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI', localizationTable='Localizable', args={'edition': edition}) if edition == 'pe': diff --git a/cocoa/base/ui/main_menu.py b/cocoa/base/ui/main_menu.py index d56fa2cf..cd40cdba 100644 --- a/cocoa/base/ui/main_menu.py +++ b/cocoa/base/ui/main_menu.py @@ -1,5 +1,6 @@ ownerclass = 'AppDelegateBase' ownerimport = 'AppDelegateBase.h' +edition = args.get('edition', 'se') result = Menu("") appMenu = result.addMenu("dupeGuru") @@ -29,6 +30,8 @@ fileMenu.addItem("Load Results...", Action(None, 'loadResults'), 'cmd+o') owner.recentResultsMenu = fileMenu.addMenu("Load Recent Results") fileMenu.addItem("Save Results...", Action(None, 'saveResults'), 'cmd+s') fileMenu.addItem("Export Results to XHTML", Action(None, 'exportToXHTML'), 'cmd+shift+e') +if edition == 'pe': + fileMenu.addItem("Clear Picture Cache", Action(owner, 'clearPictureCache'), 'cmd+shift+p') editMenu.addItem("Mark All", Action(None, 'markAll'), 'cmd+a') editMenu.addItem("Mark None", Action(None, 'markNone'), 'cmd+shift+a') diff --git a/cocoa/pe/AppDelegate.h b/cocoa/pe/AppDelegate.h index 1da75027..b528eeef 100644 --- a/cocoa/pe/AppDelegate.h +++ b/cocoa/pe/AppDelegate.h @@ -10,4 +10,5 @@ http://www.hardcoded.net/licenses/bsd_license #import "AppDelegateBase.h" @interface AppDelegate : AppDelegateBase {} +- (void)clearPictureCache; @end diff --git a/cocoa/pe/AppDelegate.m b/cocoa/pe/AppDelegate.m index f67cb9eb..42626b43 100644 --- a/cocoa/pe/AppDelegate.m +++ b/cocoa/pe/AppDelegate.m @@ -67,14 +67,8 @@ http://www.hardcoded.net/licenses/bsd_license return [[DetailsPanelPE alloc] initWithApp:model]; } -//Delegate -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification +- (void)clearPictureCache { - // index 2 is just after "Clear Ingore List" - NSMenuItem *mi = [actionsMenu insertItemWithTitle:TR(@"Clear Picture Cache") - action:@selector(clearPictureCache:) keyEquivalent:@"P" atIndex:2]; - [mi setTarget:[self resultWindow]]; - [mi setKeyEquivalentModifierMask:NSCommandKeyMask|NSShiftKeyMask]; - [super applicationDidFinishLaunching:aNotification]; + [(ResultWindow *)[self resultWindow] clearPictureCache]; } @end diff --git a/cocoa/pe/ResultWindow.h b/cocoa/pe/ResultWindow.h index 25edc81c..a3015c4e 100644 --- a/cocoa/pe/ResultWindow.h +++ b/cocoa/pe/ResultWindow.h @@ -10,5 +10,5 @@ http://www.hardcoded.net/licenses/bsd_license #import "../base/ResultWindow.h" @interface ResultWindow : ResultWindowBase {} -- (IBAction)clearPictureCache:(id)sender; +- (void)clearPictureCache; @end diff --git a/cocoa/pe/ResultWindow.m b/cocoa/pe/ResultWindow.m index 36567324..c7bca078 100644 --- a/cocoa/pe/ResultWindow.m +++ b/cocoa/pe/ResultWindow.m @@ -48,7 +48,7 @@ http://www.hardcoded.net/licenses/bsd_license } /* Actions */ -- (IBAction)clearPictureCache:(id)sender +- (void)clearPictureCache { NSString *msg = TR(@"Do you really want to remove all your cached picture analysis?"); if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO