From 4821523415b43b9b89ea55374dcd2c5f3eac0817 Mon Sep 17 00:00:00 2001 From: "hwaara%gmail.com" Date: Sat, 27 May 2006 08:51:05 +0000 Subject: [PATCH] Download completed message reports size as '?' if size was unknown whilst downloading. r=kreeger, sr=pink. Patch by Bruce Davidson (mozilla@transoceanic.org.uk) --- camino/src/download/ProgressViewController.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/camino/src/download/ProgressViewController.mm b/camino/src/download/ProgressViewController.mm index f4b50024474f..9dc83e03b9eb 100644 --- a/camino/src/download/ProgressViewController.mm +++ b/camino/src/download/ProgressViewController.mm @@ -439,6 +439,15 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void statusString = NSLocalizedString(@"DownloadInterrupted", nil); } else { + // If the download size was not known then lookup size from the file we downloaded + if (mDownloadSize < 0) { + [self checkFileExists]; + if (mFileExists) { + NSDictionary* fattrs = [[NSFileManager defaultManager] fileAttributesAtPath:mDestPath traverseLink:NO]; + mDownloadSize = (long long) [fattrs fileSize]; + } + } + statusString = [NSString stringWithFormat:NSLocalizedString(@"DownloadCompleted", nil), [[self class] formatTime:(int)mDownloadTime], [[self class] formatBytes:mDownloadSize]]; }