Add a debug menu item for checking updates
This commit is contained in:
parent
67a23355ec
commit
b56508c55c
|
@ -46,6 +46,7 @@
|
|||
}
|
||||
|
||||
- (void)checkForUpdate;
|
||||
- (void)checkForUpdateForced:(BOOL)forced;
|
||||
|
||||
@property (assign, nonatomic) IBOutlet NSWindow *window;
|
||||
@end
|
||||
|
|
|
@ -70,6 +70,11 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
|||
}
|
||||
|
||||
- (void)checkForUpdate
|
||||
{
|
||||
[self checkForUpdateForced:NO];
|
||||
}
|
||||
|
||||
- (void)checkForUpdateForced:(BOOL)forced
|
||||
{
|
||||
if (_updateCheckConnection) {
|
||||
// busy
|
||||
|
@ -77,14 +82,16 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
|||
}
|
||||
|
||||
// time for update?
|
||||
NSDate *now = [NSDate date];
|
||||
NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:kNextUpdateCheckDateKey];
|
||||
if (![date isKindOfClass:[NSDate class]]) {
|
||||
date = now;
|
||||
}
|
||||
if (!forced) {
|
||||
NSDate *now = [NSDate date];
|
||||
NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:kNextUpdateCheckDateKey];
|
||||
if (![date isKindOfClass:[NSDate class]]) {
|
||||
date = now;
|
||||
}
|
||||
|
||||
if ([now compare:date] == NSOrderedAscending) {
|
||||
return;
|
||||
if ([now compare:date] == NSOrderedAscending) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NSDate *nextUpdateDate = [NSDate dateWithTimeInterval:kNextCheckInterval sinceDate:[NSDate date]];
|
||||
|
|
|
@ -234,6 +234,11 @@ public:
|
|||
}
|
||||
#endif //DEBUG
|
||||
|
||||
#if DEBUG
|
||||
NSMenuItem *updateCheckItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Check for Updates…", @"") action:@selector(checkForUpdate:) keyEquivalent:@""] autorelease];
|
||||
[menu addItem:updateCheckItem];
|
||||
#endif
|
||||
|
||||
NSMenuItem *aboutMenuItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"About McBopomofo…", @"") action:@selector(showAbout:) keyEquivalent:@""] autorelease];
|
||||
[menu addItem:aboutMenuItem];
|
||||
|
||||
|
@ -1360,6 +1365,11 @@ public:
|
|||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
- (void)checkForUpdate:(id)sender
|
||||
{
|
||||
[(AppDelegate *)[[NSApplication sharedApplication] delegate] checkForUpdateForced:YES];
|
||||
}
|
||||
|
||||
- (void)showAbout:(id)sender
|
||||
{
|
||||
[[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
|
||||
|
|
|
@ -25,3 +25,5 @@
|
|||
/* No comment provided by engineer. */
|
||||
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "You are running version %1$@ (%2$@), and the new version %3$@ (%4$@) is now available.\n\nVisit the website to download it?";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Check for Updates…" = "Check for Updates…";
|
||||
|
|
|
@ -24,3 +24,6 @@
|
|||
|
||||
/* No comment provided by engineer. */
|
||||
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "目前的輸入法版本是 %1$@ 版 (%2$@),目前最新版本已經到第 %3$@ 版 (%4$@)。\n\n是否要前往輸入法網站,下載最新版本?";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Check for Updates…" = "檢查是否有新版…";
|
||||
|
|
Loading…
Reference in New Issue