From 22d0bd093926824070d33387d5bb39714ff24259 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 24 Aug 2011 11:14:39 +0100 Subject: [PATCH] Display details of any update failure in a message box instead of in the progress label on Mac. This matches the Windows UI and a message box provides more space for text details than a progress label. --- src/UpdateDialogCocoa.mm | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/UpdateDialogCocoa.mm b/src/UpdateDialogCocoa.mm index 3a2236d..69ae964 100644 --- a/src/UpdateDialogCocoa.mm +++ b/src/UpdateDialogCocoa.mm @@ -18,12 +18,18 @@ class UpdateDialogPrivate { public: + UpdateDialogPrivate() + : hadError(false) + { + } + UpdateDialogDelegate* delegate; NSAutoreleasePool* pool; NSWindow* window; NSButton* finishButton; NSTextField* progressLabel; NSProgressIndicator* progressBar; + bool hadError; }; @implementation UpdateDialogDelegate @@ -33,10 +39,18 @@ class UpdateDialogPrivate } - (void) reportUpdateError: (id)arg { + dialog->hadError = true; NSMutableString* message = [[NSMutableString alloc] init]; - [message appendString:@"There was a problem installing the update: "]; + [message appendString:@"There was a problem installing the update:\n"]; [message appendString:arg]; - [dialog->progressLabel setTitleWithMnemonic: message]; + + NSAlert* alert = [NSAlert + alertWithMessageText: @"Update Problem" + defaultButton: nil + alternateButton: nil + otherButton: nil + informativeTextWithFormat: message]; + [alert runModal]; [message release]; } - (void) reportUpdateProgress: (id)arg @@ -46,7 +60,19 @@ class UpdateDialogPrivate } - (void) reportUpdateFinished: (id)arg { - [dialog->progressLabel setTitleWithMnemonic:@"Updates installed. Click 'Finish' to restart the application."]; + NSMutableString* message = [[NSMutableString alloc] init]; + if (!dialog->hadError) + { + [message appendString:@"Updates installed."]; + } + else + { + [message appendString:@"Update failed."]; + } + + [message appendString:@" Click 'Finish' to restart the application."]; + [dialog->progressLabel setTitleWithMnemonic:message]; + [message release]; } @end