Merge branch 'master' of ssh://gitweb/git/desktop/standalone-updater

This commit is contained in:
Robert Knight 2011-08-24 11:45:05 +01:00
commit a2ea1841b3
3 changed files with 34 additions and 6 deletions

View file

@ -195,7 +195,7 @@ void ProcessUtils::runElevatedMac(const std::string& executable,
char** argv; char** argv;
argv = (char**) malloc(sizeof(char*) * args.size() + 1); argv = (char**) malloc(sizeof(char*) * args.size() + 1);
int i = 0; unsigned int i = 0;
for (std::list<std::string>::const_iterator iter = args.begin(); iter != args.end(); iter++) for (std::list<std::string>::const_iterator iter = args.begin(); iter != args.end(); iter++)
{ {
argv[i] = strdup(iter->c_str()); argv[i] = strdup(iter->c_str());

View file

@ -18,12 +18,18 @@
class UpdateDialogPrivate class UpdateDialogPrivate
{ {
public: public:
UpdateDialogPrivate()
: hadError(false)
{
}
UpdateDialogDelegate* delegate; UpdateDialogDelegate* delegate;
NSAutoreleasePool* pool; NSAutoreleasePool* pool;
NSWindow* window; NSWindow* window;
NSButton* finishButton; NSButton* finishButton;
NSTextField* progressLabel; NSTextField* progressLabel;
NSProgressIndicator* progressBar; NSProgressIndicator* progressBar;
bool hadError;
}; };
@implementation UpdateDialogDelegate @implementation UpdateDialogDelegate
@ -33,10 +39,19 @@ class UpdateDialogPrivate
} }
- (void) reportUpdateError: (id)arg - (void) reportUpdateError: (id)arg
{ {
NSMutableString* message; dialog->hadError = true;
[message appendString:@"There was a problem installing the update: "]; NSMutableString* message = [[NSMutableString alloc] init];
[message appendString:@"There was a problem installing the update:\n"];
[message appendString:arg]; [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 - (void) reportUpdateProgress: (id)arg
{ {
@ -45,7 +60,19 @@ class UpdateDialogPrivate
} }
- (void) reportUpdateFinished: (id)arg - (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 @end
@ -120,6 +147,7 @@ void UpdateDialogCocoa::updateError(const std::string& errorMessage)
bool UpdateDialogCocoa::updateRetryCancel(const std::string& message) bool UpdateDialogCocoa::updateRetryCancel(const std::string& message)
{ {
// TODO // TODO
return false;
} }
void UpdateDialogCocoa::updateProgress(int percentage) void UpdateDialogCocoa::updateProgress(int percentage)

View file

@ -43,7 +43,7 @@ UpdateInstaller::Mode stringToMode(const std::string& modeStr)
void UpdaterOptions::parseOldFormatArg(const std::string& arg, std::string* key, std::string* value) void UpdaterOptions::parseOldFormatArg(const std::string& arg, std::string* key, std::string* value)
{ {
unsigned int pos = arg.find('='); size_t pos = arg.find('=');
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
*key = arg.substr(0,pos); *key = arg.substr(0,pos);