~ubuntu-branches/ubuntu/jaunty/transmission/jaunty-security

« back to all changes in this revision

Viewing changes to macosx/CreatorWindowController.m

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2008-11-28 15:33:48 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20081128153348-it70trfnxiroblmc
Tags: 1.40-0ubuntu1
* New upstream release (LP: #302672)
  - Tracker communication uses fewer resources
  - More accurate bandwidth limits
  - Reduce disk fragmentation by preallocating files (LP: #287726)
  - Stability, security and performance improvements to the RPC /
    Web UI server (closes LP: #290423)
  - Support compression when serving Web UI and RPC responses
  - Simplify the RPC whitelist
  - Fix bug that prevented handshakes with encrypted BitComet peers
  - Fix 1.3x bug that could re-download some data unnecessarily
    (LP: #295040)
  - Option to automatically update the blocklist weekly
  - Added off-hour bandwidth scheduling
  - Simplify file/priority selection in the details dialog
  - Fix a couple of crashes
  - New / updated translations
  - Don't inhibit hibernation by default (LP: #292929)
  - Use "close" animation when sending to notification area (LP: #130811)
  - Fix resize problems (LP: #269872)
  - Support "--version" option when launching from command line
    (LP: #292011)
  - Correctly parse announce URLs that have leading or trailing
    spaces (LP: #262411)
  - Display an error when "Open Torrent" fails (LP: #281463)
* Dropped 10_fix_crasher_from_upstream.dpatch: Fix is in this
  upstream release.
* debian/control: Don't just build-depend on libcurl-dev, which is
  a virtual package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: CreatorWindowController.m 6571 2008-08-18 00:01:12Z livings124 $
 
2
 * $Id: CreatorWindowController.m 7032 2008-11-04 01:31:24Z livings124 $
3
3
 *
4
4
 * Copyright (c) 2007-2008 Transmission authors and contributors
5
5
 *
25
25
#import "CreatorWindowController.h"
26
26
#import "NSApplicationAdditions.h"
27
27
#import "NSStringAdditions.h"
28
 
#include "utils.h" //tr_httpIsValidURL
 
28
#import "utils.h" //tr_httpIsValidURL
29
29
 
30
30
#define TRACKER_ADD_TAG 0
31
31
#define TRACKER_REMOVE_TAG 1
34
34
 
35
35
+ (NSString *) chooseFile;
36
36
- (void) updateEnableOpenCheckForTrackers;
37
 
- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
 
37
- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) info;
38
38
 
39
 
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo;
 
39
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo;
40
40
- (void) createReal;
41
41
- (void) checkProgress;
42
 
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
 
42
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (NSInteger) code contextInfo: (void *) info;
43
43
 
44
44
@end
45
45
 
125
125
        }
126
126
        
127
127
        //remove potentially invalid addresses
128
 
        NSInteger i;
129
 
        for (i = [fTrackers count]-1; i >= 0; i--)
 
128
        for (NSInteger i = [fTrackers count]-1; i >= 0; i--)
130
129
        {
131
130
            if (!tr_httpIsValidURL([[fTrackers objectAtIndex: i] UTF8String]))
132
131
                [fTrackers removeObjectAtIndex: i];
155
154
    if (multifile)
156
155
    {
157
156
        NSString * fileString;
158
 
        int count = fInfo->fileCount;
 
157
        NSInteger count = fInfo->fileCount;
159
158
        if (count != 1)
160
159
            fileString = [NSString stringWithFormat: NSLocalizedString(@"%d files", "Create torrent -> info"), count];
161
160
        else
300
299
        [fTrackers addObject: @""];
301
300
        [fTrackerTable reloadData];
302
301
        
303
 
        int row = [fTrackers count] - 1;
 
302
        NSInteger row = [fTrackers count] - 1;
304
303
        [fTrackerTable selectRow: row byExtendingSelection: NO];
305
304
        [fTrackerTable editColumn: 0 row: row withEvent: nil select: YES];
306
305
    }
311
310
{
312
311
    NSString * tracker = (NSString *)object;
313
312
    
 
313
    tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
 
314
    
314
315
    if ([tracker rangeOfString: @"://"].location == NSNotFound)
315
316
        tracker = [@"http://" stringByAppendingString: tracker];
316
317
    
362
363
    [fOpenCheck setState: (fOpenTorrent && hasTracker) ? NSOnState : NSOffState];
363
364
}
364
365
 
365
 
- (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (void *) info
 
366
- (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (void *) info
366
367
{
367
368
    if (code == NSOKButton)
368
369
    {
374
375
    }
375
376
}
376
377
 
377
 
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo
 
378
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
378
379
{
379
380
    if (([NSApp isOnLeopardOrBetter] ? [[alert suppressionButton] state] == NSOnState : returnCode == NSAlertThirdButtonReturn))
380
381
        [[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningCreatorBlankAddress"];
391
392
    if ([[NSFileManager defaultManager] fileExistsAtPath: fLocation])
392
393
    {
393
394
        NSArray * pathComponents = [fLocation pathComponents];
394
 
        int count = [pathComponents count];
 
395
        NSInteger count = [pathComponents count];
395
396
        
396
397
        NSAlert * alert = [[[NSAlert alloc] init] autorelease];
397
398
        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> file already exists warning -> button")];
411
412
    //parse non-empty tracker strings
412
413
    tr_tracker_info * trackerInfo = tr_new0(tr_tracker_info, [fTrackers count]);
413
414
    
414
 
    NSUInteger i;
415
 
    for (i = 0; i < [fTrackers count]; i++)
 
415
    for (NSUInteger i = 0; i < [fTrackers count]; i++)
416
416
        trackerInfo[i].announce = (char *)[[fTrackers objectAtIndex: i] UTF8String];
417
417
    
418
418
    //store values
482
482
        {
483
483
            fStarted = YES;
484
484
            
 
485
            [fProgressView setHidden: YES];
 
486
            
485
487
            NSWindow * window = [self window];
486
488
            
487
489
            NSRect windowRect = [window frame];
488
 
            float difference = [fProgressView frame].size.height - [[window contentView] frame].size.height;
 
490
            CGFloat difference = [fProgressView frame].size.height - [[window contentView] frame].size.height;
489
491
            windowRect.origin.y -= difference;
490
492
            windowRect.size.height += difference;
491
493
            
492
494
            //don't allow vertical resizing
493
 
            float height = windowRect.size.height;
 
495
            CGFloat height = windowRect.size.height;
494
496
            [window setMinSize: NSMakeSize([window minSize].width, height)];
495
497
            [window setMaxSize: NSMakeSize([window maxSize].width, height)];
496
498
            
503
505
    }
504
506
}
505
507
 
506
 
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info
 
508
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (NSInteger) code contextInfo: (void *) info
507
509
{
508
510
    [[alert window] orderOut: nil];
509
511
    [[self window] close];