Changeset 1094 for trunk


Ignore:
Timestamp:
Nov 16, 2006, 10:03:51 PM (15 years ago)
Author:
livings124
Message:

warning if move folder doesn't exist, and a few releases

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1093 r1094  
    957957       
    958958        [alert runModal];
     959        [alert release];
    959960       
    960961        [torrents removeObjectAtIndex: 0];
  • trunk/macosx/MessageWindowController.m

    r1027 r1094  
    196196           
    197197            [alert runModal];
     198            [alert release];
    198199        }
    199200    }
  • trunk/macosx/Torrent.h

    r1093 r1094  
    9898- (BOOL) alertForRemainingDiskSpace;
    9999- (BOOL) alertForVolumeAvailable;
     100- (BOOL) alertForMoveVolumeAvailable;
    100101
    101102- (NSImage *)   icon;
  • trunk/macosx/Torrent.m

    r1093 r1094  
    170170        [fRemainingTimeString release];
    171171       
    172        
    173172        [fBitmap release];
    174173        free(fPieces);
     
    211210    if ([self justFinished])
    212211    {
     212        BOOL canMove = YES;
     213       
    213214        //move file from incomplete folder to download folder
    214         #warning check if volume exists
    215         if (fUseIncompleteFolder && ![[self downloadFolder] isEqualToString: fDownloadFolder])
     215        if (fUseIncompleteFolder && ![[self downloadFolder] isEqualToString: fDownloadFolder]
     216            && (canMove = [self alertForMoveVolumeAvailable]))
    216217        {
    217218            tr_torrentStop(fHandle);
     
    220221                tr_torrentSetFolder(fHandle, [fDownloadFolder UTF8String]);
    221222            tr_torrentStart(fHandle);
     223        }
     224       
     225        if (!canMove)
     226        {
     227            fUseIncompleteFolder = NO;
     228           
     229            [fDownloadFolder release];
     230            fDownloadFolder = fIncompleteFolder;
     231            fIncompleteFolder = nil;
    222232        }
    223233       
     
    550560        else
    551561            return YES;
     562       
     563        [alert release];
    552564    }
    553565    return YES;
     
    562574    NSString * volume = [[[pathComponents objectAtIndex: 0] stringByAppendingPathComponent:
    563575                    [pathComponents objectAtIndex: 1]] stringByAppendingPathComponent: [pathComponents objectAtIndex: 2]];
    564     NSString * volumeName = [pathComponents objectAtIndex: 2];
    565576   
    566577    /*NSLog(@"%@", [self downloadFolder]);
     
    569580    if (![[NSFileManager defaultManager] fileExistsAtPath: volume])
    570581    {
     582        NSString * volumeName = [pathComponents objectAtIndex: 2];
     583       
    571584        NSAlert * alert = [[NSAlert alloc] init];
    572585        [alert setMessageText: [NSString stringWithFormat:
     
    599612        }
    600613       
     614        [alert release];
     615       
    601616        return NO;
    602617    }
     
    608623{
    609624    NSString * folder = [[openPanel filenames] objectAtIndex: 0];
    610     NSLog(@"%@", folder);
    611625    if (code == NSOKButton)
    612626    {
     
    626640        [self startTransfer];
    627641        [self update];
     642       
     643        #warning reload inspector
    628644    }
    629645    else
     
    631647}
    632648
     649- (BOOL) alertForMoveVolumeAvailable
     650{
     651    NSArray * pathComponents = [fDownloadFolder pathComponents];
     652    if ([pathComponents count] < 3)
     653        return YES;
     654   
     655    NSString * volume = [[[pathComponents objectAtIndex: 0] stringByAppendingPathComponent:
     656                    [pathComponents objectAtIndex: 1]] stringByAppendingPathComponent: [pathComponents objectAtIndex: 2]];
     657   
     658    /*NSLog(@"%@", [self downloadFolder]);
     659    NSLog(@"Volume: %@", volume);*/
     660   
     661    if (![[NSFileManager defaultManager] fileExistsAtPath: volume])
     662    {
     663        NSString * volumeName = [pathComponents objectAtIndex: 2];
     664       
     665        NSAlert * alert = [[NSAlert alloc] init];
     666        [alert setMessageText: [NSString stringWithFormat:
     667                                NSLocalizedString(@"The volume for moving the completed \"%@\" cannot be found.",
     668                                    "Move volume cannot be found alert -> title"), [self name]]];
     669        [alert setInformativeText: [NSString stringWithFormat:
     670                        NSLocalizedString(@"The file will remain in its current location",
     671                                            "Move volume cannot be found alert -> message"), volumeName]];
     672        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Move volume cannot be found alert -> button")];
     673       
     674        [alert runModal];
     675        [alert release];
     676       
     677        return NO;
     678    }
     679   
     680    return YES;
     681}
    633682
    634683- (NSImage *) icon
Note: See TracChangeset for help on using the changeset viewer.