fix Quick Look from the file inspector

This commit is contained in:
Mitchell Livingston 2009-10-22 00:10:41 +00:00
parent 236bdc594f
commit 9c21268250
3 changed files with 14 additions and 15 deletions

View File

@ -318,7 +318,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
tr_bencDictAddReal(&settings, TR_PREFS_KEY_RATIO, [fDefaults floatForKey: @"RatioLimit"]);
tr_bencDictAddBool(&settings, TR_PREFS_KEY_RATIO_ENABLED, [fDefaults boolForKey: @"RatioCheck"]);
tr_bencDictAddBool(&settings, TR_PREFS_KEY_RPC_ENABLED, [fDefaults boolForKey: @"RPC"]);
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_PORT, [fDefaults integerForKey: @"RPCPort"]);
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_PORT, [fDefaults integerForKey: @"RPCPort"]);
tr_bencDictAddStr(&settings, TR_PREFS_KEY_RPC_USERNAME, [[fDefaults stringForKey: @"RPCUsername"] UTF8String]);
tr_bencDictAddBool(&settings, TR_PREFS_KEY_RPC_WHITELIST_ENABLED, [fDefaults boolForKey: @"RPCUseWhitelist"]);

View File

@ -1136,7 +1136,7 @@ typedef enum
{
FileListNode * item = [fileOutlineView itemAtRow: i];
if ([self canQuickLookFile: item])
[urlArray addObject: [torrent fileLocation: item]];
[urlArray addObject: [NSURL fileURLWithPath: [torrent fileLocation: item]]];
}
return urlArray;
@ -1665,7 +1665,7 @@ typedef enum
- (BOOL) canQuickLookFile: (FileListNode *) item
{
Torrent * torrent = [fTorrents objectAtIndex: 0];
return [torrent fileLocation: item] != nil && ([item isFolder] || [torrent fileProgress: item] >= 1.0);
return ([item isFolder] || [torrent fileProgress: item] >= 1.0) && [torrent fileLocation: item];
}
#warning doesn't like blank addresses

View File

@ -32,9 +32,9 @@
@interface Torrent (Private)
- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
downloadFolder: (NSString *) downloadFolder incompleteFolder: (NSString *) incompleteFolder
waitToStart: (NSNumber *) waitToStart
groupValue: (NSNumber *) groupValue;
groupValue: (NSNumber *) groupValue
legacyDownloadFolder: (NSString *) downloadFolder legacyIncompleteFolder: (NSString *) incompleteFolder;
- (void) createFileList;
- (void) insertPath: (NSMutableArray *) components forParent: (FileListNode *) parent fileSize: (uint64_t) size
@ -73,8 +73,8 @@ int trashDataFile(const char * filename)
lib: (tr_session *) lib
{
self = [self initWithPath: path hash: nil torrentStruct: NULL lib: lib
downloadFolder: location incompleteFolder: nil
waitToStart: nil groupValue: nil];
waitToStart: nil groupValue: nil
legacyDownloadFolder: location legacyIncompleteFolder: nil];
if (self)
{
@ -87,8 +87,8 @@ int trashDataFile(const char * filename)
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib
{
self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct lib: lib
downloadFolder: location incompleteFolder: nil
waitToStart: nil groupValue: nil];
waitToStart: nil groupValue: nil
legacyDownloadFolder: location legacyIncompleteFolder: nil];
return self;
}
@ -98,11 +98,11 @@ int trashDataFile(const char * filename)
self = [self initWithPath: [history objectForKey: @"InternalTorrentPath"]
hash: [history objectForKey: @"TorrentHash"]
torrentStruct: NULL lib: lib
downloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80
incompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80
? [history objectForKey: @"IncompleteFolder"] : nil
waitToStart: [history objectForKey: @"WaitToStart"]
groupValue: [history objectForKey: @"GroupValue"]];
groupValue: [history objectForKey: @"GroupValue"]
legacyDownloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80
legacyIncompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80
? [history objectForKey: @"IncompleteFolder"] : nil];
if (self)
{
@ -1546,9 +1546,9 @@ int trashDataFile(const char * filename)
@implementation Torrent (Private)
- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
downloadFolder: (NSString *) downloadFolder incompleteFolder: (NSString *) incompleteFolder
waitToStart: (NSNumber *) waitToStart
groupValue: (NSNumber *) groupValue
legacyDownloadFolder: (NSString *) downloadFolder legacyIncompleteFolder: (NSString *) incompleteFolder
{
if (!(self = [super init]))
return nil;
@ -1565,7 +1565,6 @@ int trashDataFile(const char * filename)
//set libtransmission settings for initialization
tr_ctor * ctor = tr_ctorNew(lib);
tr_ctorSetPaused(ctor, TR_FORCE, YES);
tr_ctorSetPeerLimit(ctor, TR_FALLBACK, [fDefaults integerForKey: @"PeersTorrent"]);
int result = TR_PARSE_ERR;
if (path)