Changeset 291


Ignore:
Timestamp:
Jun 8, 2006, 4:40:45 AM (16 years ago)
Author:
livings124
Message:

Initial support of moving torrent files in Mac version. Some things are incomplete and it's not yet guaranteed to work (in other words, only I should be even trying to use it).

Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/save_torrent_files/Transmission.xcodeproj/project.pbxproj

    r274 r291  
    8181                A2173E1C0A33C1B300B0D8AB /* ActionButtonPressed.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2173E1B0A33C1B300B0D8AB /* ActionButtonPressed.tiff */; };
    8282                A21DFF100A292B2B007C5F76 /* Transfers.png in Resources */ = {isa = PBXBuildFile; fileRef = A21DFF0F0A292B2B007C5F76 /* Transfers.png */; };
    83                 A2495B6D0A2F697C0098B31F /* ResumeSelected.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2495B6B0A2F697C0098B31F /* ResumeSelected.tiff */; };
    84                 A2495B6E0A2F697D0098B31F /* PauseSelected.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2495B6C0A2F697C0098B31F /* PauseSelected.tiff */; };
    8583                A2519D490A2FADFC00479D0C /* SmoothAquaView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2519D470A2FADFC00479D0C /* SmoothAquaView.m */; };
    8684                A2519D4A0A2FADFC00479D0C /* SmoothAquaView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2519D480A2FADFC00479D0C /* SmoothAquaView.h */; };
     
    9593                A2D5CCFD0A2661590089A8C2 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2D5CCFC0A2661590089A8C2 /* Sparkle.framework */; };
    9694                A2D5CD100A2661610089A8C2 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2D5CCFC0A2661590089A8C2 /* Sparkle.framework */; };
     95                A2DB22970A37CA4200489FF1 /* PauseSelected.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2DB22950A37CA4200489FF1 /* PauseSelected.png */; };
     96                A2DB22980A37CA4200489FF1 /* ResumeSelected.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2DB22960A37CA4200489FF1 /* ResumeSelected.png */; };
    9797                A2F40AE40A361C00006B8288 /* Transmission.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D2784360905709500687951 /* Transmission.icns */; };
    9898                A2F8951F0A2D4BA500ED2127 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = A2F8951E0A2D4BA500ED2127 /* Credits.rtf */; };
     
    123123                        dstSubfolderSpec = 10;
    124124                        files = (
     125                                A2DB22970A37CA4200489FF1 /* PauseSelected.png in CopyFiles */,
     126                                A2DB22980A37CA4200489FF1 /* ResumeSelected.png in CopyFiles */,
    125127                        );
    126128                        runOnlyForDeploymentPostprocessing = 0;
     
    220222                4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
    221223                4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
    222                 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
     224                4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
    223225                4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
    224226                4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
     
    248250                A2173E1B0A33C1B300B0D8AB /* ActionButtonPressed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ActionButtonPressed.tiff; path = macosx/Images/ActionButtonPressed.tiff; sourceTree = "<group>"; };
    249251                A21DFF0F0A292B2B007C5F76 /* Transfers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Transfers.png; path = macosx/Images/Transfers.png; sourceTree = "<group>"; };
    250                 A2495B6B0A2F697C0098B31F /* ResumeSelected.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = ResumeSelected.tiff; path = macosx/Images/ResumeSelected.tiff; sourceTree = "<group>"; };
    251                 A2495B6C0A2F697C0098B31F /* PauseSelected.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = PauseSelected.tiff; path = macosx/Images/PauseSelected.tiff; sourceTree = "<group>"; };
    252252                A2519D470A2FADFC00479D0C /* SmoothAquaView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SmoothAquaView.m; path = macosx/SmoothAquaView.m; sourceTree = "<group>"; };
    253253                A2519D480A2FADFC00479D0C /* SmoothAquaView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SmoothAquaView.h; path = macosx/SmoothAquaView.h; sourceTree = "<group>"; };
     
    262262                A2C655640A04FEDC00E9FD82 /* BottomBorder.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BottomBorder.tiff; path = macosx/Images/BottomBorder.tiff; sourceTree = "<group>"; };
    263263                A2D5CCFC0A2661590089A8C2 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
     264                A2DB22950A37CA4200489FF1 /* PauseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseSelected.png; path = macosx/Images/PauseSelected.png; sourceTree = "<group>"; };
     265                A2DB22960A37CA4200489FF1 /* ResumeSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeSelected.png; path = macosx/Images/ResumeSelected.png; sourceTree = "<group>"; };
    264266                A2F8951E0A2D4BA500ED2127 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = Credits.rtf; path = macosx/Credits.rtf; sourceTree = "<group>"; };
    265267/* End PBXFileReference section */
     
    353355                        children = (
    354356                                A2F8951E0A2D4BA500ED2127 /* Credits.rtf */,
    355                                 A2495B6B0A2F697C0098B31F /* ResumeSelected.tiff */,
    356                                 A2495B6C0A2F697C0098B31F /* PauseSelected.tiff */,
     357                                A2DB22950A37CA4200489FF1 /* PauseSelected.png */,
     358                                A2DB22960A37CA4200489FF1 /* ResumeSelected.png */,
    357359                                A21DFF0F0A292B2B007C5F76 /* Transfers.png */,
    358360                                A27A53640A06AED200E1F16F /* StatusBorder.tiff */,
     
    620622                                A2912C540A2956E80097A0CA /* PrefsWindow.nib in Resources */,
    621623                                A2F8951F0A2D4BA500ED2127 /* Credits.rtf in Resources */,
    622                                 A2495B6D0A2F697C0098B31F /* ResumeSelected.tiff in Resources */,
    623                                 A2495B6E0A2F697D0098B31F /* PauseSelected.tiff in Resources */,
    624624                                A2173E1C0A33C1B300B0D8AB /* ActionButtonPressed.tiff in Resources */,
    625625                                A28DBADC0A33C1D800F4B4A7 /* ActionButton.tiff in Resources */,
  • trunk/macosx/Controller.h

    r272 r291  
    9797
    9898- (void) removeTorrent:                 (id) sender;
    99 - (void) removeTorrentDeleteTorrent:    (id) sender;
    10099- (void) removeTorrentDeleteData:       (id) sender;
    101 - (void) removeTorrentDeleteBoth:       (id) sender;
    102100- (void) removeTorrentWithIndex:        (NSIndexSet *) indexSet
    103                 deleteTorrent:          (BOOL) deleteTorrent
    104101                deleteData:             (BOOL) deleteData;
    105102               
     
    107104                        contextInfo: (NSDictionary *) dict;
    108105- (void) confirmRemoveTorrents: (NSArray *) torrents
    109             deleteTorrent: (BOOL) deleteTorrent
    110106            deleteData: (BOOL) deleteData;
    111107
  • trunk/macosx/Controller.m

    r286 r291  
    525525
    526526- (void) removeTorrentWithIndex: (NSIndexSet *) indexSet
    527                   deleteTorrent: (BOOL) deleteTorrent
    528527                     deleteData: (BOOL) deleteData
    529528{
     
    541540        NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
    542541            torrents, @"Torrents",
    543             [NSNumber numberWithBool: deleteTorrent], @"DeleteTorrent",
    544542            [NSNumber numberWithBool: deleteData], @"DeleteData",
    545543            nil];
     
    573571    {
    574572        [self confirmRemoveTorrents: torrents
    575                 deleteTorrent: deleteTorrent
    576573                deleteData: deleteData];
    577574    }
     
    584581
    585582    NSArray * torrents = [dict objectForKey: @"Torrents"];
    586     BOOL deleteTorrent = [[dict objectForKey: @"DeleteTorrent"] boolValue];
    587583    BOOL deleteData = [[dict objectForKey: @"DeleteData"] boolValue];
    588584    [dict release];
     
    591587    {
    592588        [self confirmRemoveTorrents: torrents
    593             deleteTorrent: deleteTorrent
    594589            deleteData: deleteData];
    595590    }
     
    599594
    600595- (void) confirmRemoveTorrents: (NSArray *) torrents
    601             deleteTorrent: (BOOL) deleteTorrent
    602596            deleteData: (BOOL) deleteData
    603597{
     
    610604        if( deleteData )
    611605            [torrent trashData];
    612            
    613         if( deleteTorrent )
    614             [torrent trashTorrent];
    615 
     606
     607        [torrent removeForever];
    616608        [fTorrents removeObject: torrent];
    617609    }
     
    626618- (void) removeTorrent: (id) sender
    627619{
    628     [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: NO deleteData: NO];
    629 }
    630 
    631 - (void) removeTorrentDeleteTorrent: (id) sender
    632 {
    633     [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: YES deleteData: NO];
     620    [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteData: NO];
    634621}
    635622
    636623- (void) removeTorrentDeleteData: (id) sender
    637624{
    638     [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: NO deleteData: YES];
    639 }
    640 
    641 - (void) removeTorrentDeleteBoth: (id) sender
    642 {
    643     [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: YES deleteData: YES];
     625    [self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteData: YES];
    644626}
    645627
     
    12101192
    12111193    //enable remove items
    1212     if (action == @selector(removeTorrent:)
    1213         || action == @selector(removeTorrentDeleteTorrent:)
    1214         || action == @selector(removeTorrentDeleteData:)
    1215         || action == @selector(removeTorrentDeleteBoth:))
     1194    if (action == @selector(removeTorrent:) || action == @selector(removeTorrentDeleteData:))
    12161195    {
    12171196        BOOL active = NO;
  • trunk/macosx/Defaults.plist

    r272 r291  
    1919        <key>CheckUpload</key>
    2020        <true/>
     21        <key>DeleteOriginalTorrent</key>
     22        <false/>
    2123        <key>DownloadChoice</key>
    2224        <string>Constant</string>
     
    4143        <key>SUScheduledCheckInterval</key>
    4244        <integer>86400</integer>
     45        <key>SavePrivateTorrent</key>
     46        <true/>
    4347        <key>ShowInspector</key>
    4448        <false/>
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r272 r291  
    1010                openShowSheet = id;
    1111                removeTorrent = id;
    12                 removeTorrentDeleteBoth = id;
    1312                removeTorrentDeleteData = id;
    14                 removeTorrentDeleteTorrent = id;
    1513                resumeAllTorrents = id;
    1614                resumeTorrent = id;
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r276 r291  
    3030        <key>IBOpenObjects</key>
    3131        <array>
     32                <integer>29</integer>
     33                <integer>1480</integer>
    3234                <integer>21</integer>
    33                 <integer>1480</integer>
    3435        </array>
    3536        <key>IBSystem Version</key>
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r272 r291  
    1111                setLimit = id;
    1212                setLimitCheck = id;
     13                setMoveTorrent = id;
    1314                setPort = id;
    1415                setRatio = id;
     
    2324                fBadgeDownloadRateCheck = NSButton;
    2425                fBadgeUploadRateCheck = NSButton;
     26                fCopyTorrentCheck = NSButton;
     27                fDeleteOriginalTorrentCheck = NSButton;
    2528                fDownloadCheck = NSButton;
    2629                fDownloadField = NSTextField;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r272 r291  
    88        <dict>
    99                <key>28</key>
    10                 <string>347 472 462 212 0 0 1152 842 </string>
     10                <string>345 472 462 212 0 0 1152 842 </string>
    1111                <key>41</key>
    12                 <string>345 461 462 234 0 0 1152 842 </string>
     12                <string>262 506 462 274 0 0 1152 842 </string>
    1313                <key>66</key>
    1414                <string>347 526 462 104 0 0 1152 842 </string>
  • trunk/macosx/PrefsController.h

    r272 r291  
    3737    IBOutlet NSButton       * fQuitCheck, * fRemoveCheck,
    3838                            * fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
    39                             * fAutoStartCheck;                           
     39                            * fAutoStartCheck, * fCopyTorrentCheck, * fDeleteOriginalTorrentCheck;
    4040    IBOutlet NSPopUpButton  * fUpdatePopUp;
    4141
     
    5959- (void) checkUpdate;
    6060- (void) setAutoStart:          (id) sender;
     61- (void) setMoveTorrent:        (id) sender;
    6162- (void) setDownloadLocation:   (id) sender;
    6263- (void) folderSheetShow:       (id) sender;
  • trunk/macosx/PrefsController.m

    r272 r291  
    117117    int uploadLimit = [fDefaults integerForKey: @"UploadLimit"];
    118118   
    119     [fUploadCheck setState: checkUpload ? NSOnState : NSOffState];
     119    [fUploadCheck setState: checkUpload];
    120120    [fUploadField setIntValue: uploadLimit];
    121121    [fUploadField setEnabled: checkUpload];
     
    127127    int downloadLimit = [fDefaults integerForKey: @"DownloadLimit"];
    128128   
    129     [fDownloadCheck setState: checkDownload ? NSOnState : NSOffState];
     129    [fDownloadCheck setState: checkDownload];
    130130    [fDownloadField setIntValue: downloadLimit];
    131131    [fDownloadField setEnabled: checkDownload];
     
    135135    //set ratio limit
    136136    BOOL ratioCheck = [fDefaults boolForKey: @"RatioCheck"];
    137     [fRatioCheck setState: ratioCheck ? NSOnState : NSOffState];
     137    [fRatioCheck setState: ratioCheck];
    138138    [fRatioField setEnabled: ratioCheck];
    139139    [fRatioField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
    140140   
    141141    //set remove and quit prompts
    142     [fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"] ?
    143         NSOnState : NSOffState];
    144     [fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"] ?
    145         NSOnState : NSOffState];
     142    [fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"]];
     143    [fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"]];
    146144
    147145    //set dock badging
     
    151149    //set auto start
    152150    [fAutoStartCheck setState: [fDefaults boolForKey: @"AutoStartDownload"]];
     151   
     152    //set private torrents
     153    BOOL copyTorrents = [fDefaults boolForKey: @"SavePrivateTorrent"];
     154    [fCopyTorrentCheck setState: copyTorrents];
     155   
     156    [fDeleteOriginalTorrentCheck setEnabled: copyTorrents];
     157    [fDeleteOriginalTorrentCheck setState: [fDefaults boolForKey: @"DeleteOriginalTorrent"]];
    153158
    154159    //set update check
     
    418423{
    419424    [fDefaults setBool: [sender state] forKey: @"AutoStartDownload"];
     425}
     426
     427- (void) setMoveTorrent: (id) sender
     428{
     429    int state = [sender state];
     430    if (sender == fCopyTorrentCheck)
     431    {
     432        [fDefaults setBool: state forKey: @"SavePrivateTorrent"];
     433       
     434        [fDeleteOriginalTorrentCheck setEnabled: state];
     435        if (state == NSOffState)
     436        {
     437            [fDeleteOriginalTorrentCheck setState: NSOffState];
     438            [fDefaults setBool: NO forKey: @"DeleteOriginalTorrent"];
     439        }
     440    }
     441    else
     442        [fDefaults setBool: state forKey: @"DeleteOriginalTorrent"];
    420443}
    421444
  • trunk/macosx/Torrent.h

    r272 r291  
    3636    tr_info_t    * fInfo;
    3737    tr_stat_t    * fStat;
     38   
    3839    BOOL         fResumeOnWake;
    3940    NSDate       * fDate;
     41   
     42    BOOL        fPrivateSaved;
    4043
    4144    NSUserDefaults  * fDefaults;
     
    5659- (void)       getAvailability: (int8_t *) tab size: (int) size;
    5760
    58 - (void)       update;
    59 - (void)       start;
    60 - (void)       stop;
    61 - (void)       sleep;
    62 - (void)       wakeUp;
     61- (void)        update;
     62- (void)        start;
     63- (void)        stop;
     64- (void)        removeForever;
     65- (void)        sleep;
     66- (void)        wakeUp;
    6367
    6468- (float)       ratio;
     
    6973
    7074- (void)        reveal;
    71 - (void)        trashTorrent;
    7275- (void)        trashData;
    7376
  • trunk/macosx/Torrent.m

    r283 r291  
    2929@interface Torrent (Private)
    3030
    31 - (void) trashPath: (NSString *) path;
    3231- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib date: (NSDate *) date
    3332        stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
     33- (id) initWithHash: (NSString *) hashString lib: (tr_handle_t *) lib date: (NSDate *) date
     34        stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
     35- (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
     36            stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
     37
     38- (void) trashPath: (NSString *) path;
    3439
    3540@end
     
    4045- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
    4146{
    42     return [self initWithPath: path lib: lib
    43             date: nil stopRatioSetting: nil
    44             ratioLimit: nil];
     47    id torrent = [self initWithPath: path lib: lib
     48                    date: nil stopRatioSetting: nil
     49                    ratioLimit: nil];
     50    NSLog(path);
     51    if (fPrivateSaved && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
     52        [self trashPath: path];
     53   
     54    return torrent;
    4555}
    4656
    4757- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib
    4858{
    49     self = [self initWithPath: [history objectForKey: @"TorrentPath"]
     59    NSNumber * privateCopy;
     60    if ((privateCopy = [history objectForKey: @"PrivateCopy"]) && [privateCopy boolValue])
     61        self = [self initWithHash: [history objectForKey: @"TorrentHash"]
     62            lib: lib date: [history objectForKey: @"Date"]
     63            stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
     64            ratioLimit: [history objectForKey: @"RatioLimit"]];
     65    else
     66        self = [self initWithPath: [history objectForKey: @"TorrentPath"]
    5067            lib: lib date: [history objectForKey: @"Date"]
    5168            stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
     
    6986- (NSDictionary *) history
    7087{
    71     return [NSDictionary dictionaryWithObjectsAndKeys:
    72             [self torrentLocation], @"TorrentPath",
    73             [self downloadFolder], @"DownloadFolder",
    74             [self isActive] ? @"NO" : @"YES", @"Paused",
    75             [self date], @"Date",
    76             [NSNumber numberWithInt: fStopRatioSetting], @"StopRatioSetting",
    77             [NSNumber numberWithFloat: fRatioLimit], @"RatioLimit", nil];
     88    NSMutableDictionary * history = [NSMutableDictionary dictionaryWithObjectsAndKeys:
     89                    [NSNumber numberWithBool: fPrivateSaved], @"PrivateCopy",
     90                    [self downloadFolder], @"DownloadFolder",
     91                    [self isActive] ? @"NO" : @"YES", @"Paused",
     92                    [self date], @"Date",
     93                    [NSNumber numberWithInt: fStopRatioSetting], @"StopRatioSetting",
     94                    [NSNumber numberWithFloat: fRatioLimit], @"RatioLimit", nil];
     95           
     96    if (fPrivateSaved)
     97        [history setObject: [self torrentLocation] forKey: @"TorrentPath"];
     98    else
     99        [history setObject: [self hashString] forKey: @"TorrentHash"];
     100   
     101    return history;
    78102}
    79103
     
    213237}
    214238
     239- (void) removeForever
     240{
     241    tr_torrentRemoveSaved(fHandle);
     242}
     243
    215244- (void) sleep
    216245{
     
    262291}
    263292
    264 - (void) trashTorrent
    265 {
    266     [self trashPath: [self torrentLocation]];
    267 }
    268 
    269293- (void) trashData
    270294{
     
    315339- (NSString *) hashString
    316340{
    317     NSMutableString * string = [NSMutableString
     341    /*NSMutableString * string = [NSMutableString
    318342        stringWithCapacity: SHA_DIGEST_LENGTH];
    319343    int i;
     
    322346        [string appendFormat: @"%02x", fInfo->hash[i]];
    323347    }
    324     return string;
     348    return string;*/
     349   
     350    return [NSString stringWithUTF8String: fInfo->hashString];
    325351}
    326352
    327353- (NSString *) torrentLocation
    328354{
    329     return [NSString stringWithUTF8String: fInfo->torrent];;
     355    return [NSString stringWithUTF8String: fInfo->torrent];
    330356}
    331357
     
    488514
    489515    fLib = lib;
     516    fDefaults = [NSUserDefaults standardUserDefaults];
     517
     518    fPrivateSaved = [fDefaults boolForKey: @"SavePrivateTorrent"];
    490519
    491520    int error;
    492     if (!path || !(fHandle = tr_torrentInit(fLib, [path UTF8String], &error)))
     521    if (!path || !(fHandle = tr_torrentInit(fLib, [path UTF8String],
     522                    fPrivateSaved ? TR_FSAVEPRIVATE : 0, &error)))
    493523    {
    494524        [self release];
     
    496526    }
    497527   
     528    return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
     529}
     530
     531- (id) initWithHash: (NSString *) hashString lib: (tr_handle_t *) lib date: (NSDate *) date
     532        stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit
     533{
     534    if (!(self = [super init]))
     535        return nil;
     536
     537    fLib = lib;
     538    fDefaults = [NSUserDefaults standardUserDefaults];
     539   
     540    fPrivateSaved = YES;
     541
     542    int error;
     543    if (!hashString || !(fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], TR_FSAVEPRIVATE, &error)))
     544    {
     545        [self release];
     546        return nil;
     547    }
     548   
     549    return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
     550}
     551
     552- (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
     553            stopRatioSetting ratioLimit: (NSNumber *) ratioLimit
     554{
    498555    fInfo = tr_torrentInfo( fHandle );
    499    
    500     fDefaults = [NSUserDefaults standardUserDefaults];
    501556
    502557    fDate = date ? [date retain] : [[NSDate alloc] init];
     
    518573    return self;
    519574}
     575
    520576
    521577- (void) trashPath: (NSString *) path
Note: See TracChangeset for help on using the changeset viewer.