修正在 macOS 10.13 beta 上無法叫出偏好設定的問題

修正根據請參考以下連結:
3241c7f688
This commit is contained in:
ovadmin 2017-09-05 12:05:50 +08:00 committed by Mengjuei
parent 77b622e7da
commit 9be64e0a48
3 changed files with 18 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@class PreferencesWindowController;
@class UpdateNotificationController; @class UpdateNotificationController;
@interface AppDelegate : NSObject <NSApplicationDelegate> @interface AppDelegate : NSObject <NSApplicationDelegate>
@ -42,11 +43,13 @@
NSWindow *_window; NSWindow *_window;
NSURLConnection *_updateCheckConnection; NSURLConnection *_updateCheckConnection;
NSMutableData *_receivingData; NSMutableData *_receivingData;
PreferencesWindowController *_preferencesWindowController;
UpdateNotificationController *_updateNotificationController; UpdateNotificationController *_updateNotificationController;
} }
- (void)checkForUpdate; - (void)checkForUpdate;
- (void)checkForUpdateForced:(BOOL)forced; - (void)checkForUpdateForced:(BOOL)forced;
- (void)showPreferences;
@property (assign, nonatomic) IBOutlet NSWindow *window; @property (assign, nonatomic) IBOutlet NSWindow *window;
@end @end

View File

@ -52,6 +52,7 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
- (void)dealloc - (void)dealloc
{ {
[_preferencesWindowController release];
[_updateCheckConnection release]; [_updateCheckConnection release];
[_updateNotificationController release]; [_updateNotificationController release];
[super dealloc]; [super dealloc];
@ -122,6 +123,15 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
[_updateCheckConnection start]; [_updateCheckConnection start];
} }
- (void)showPreferences
{
if (!_preferencesWindowController) {
_preferencesWindowController = [[PreferencesWindowController alloc] initWithWindowNibName:@"preferences"];
}
[[_preferencesWindowController window] center];
[[_preferencesWindowController window] orderFront:self];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{ {
[_receivingData release]; [_receivingData release];

View File

@ -1385,7 +1385,11 @@ public:
- (void)showPreferences:(id)sender - (void)showPreferences:(id)sender
{ {
// show the preferences panel, and also make the IME app itself the focus // show the preferences panel, and also make the IME app itself the focus
[super showPreferences:sender]; if ([IMKInputController instancesRespondToSelector:@selector(showPreferences:)]) {
[super showPreferences:sender];
} else {
[(AppDelegate *)[NSApp delegate] showPreferences];
}
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
} }