Skip to content

Commit

Permalink
Fixing depreciated calls
Browse files Browse the repository at this point in the history
Wish all file handling was in URLs not this mixed bag.
Added a fast enum to convert url output of an open panel to paths.
  • Loading branch information
arauchfuss committed Jul 27, 2013
1 parent e67d275 commit 87447fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Session/TSSTSessionWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,10 @@ - (void)extractPageWithSelection:(NSInteger)selection
NSSavePanel * savePanel = [NSSavePanel savePanel];
[savePanel setTitle: @"Extract Page"];
[savePanel setPrompt: @"Extract"];
if(NSOKButton == [savePanel runModalForDirectory: nil file: [selectedPage name]])
[savePanel setNameFieldStringValue: [selectedPage name]];
if(NSOKButton == [savePanel runModal])
{
[[selectedPage pageData] writeToFile: [savePanel filename] atomically: YES];
[[selectedPage pageData] writeToURL: [savePanel URL] atomically: YES];
}
}
}
Expand Down
20 changes: 17 additions & 3 deletions SimpleComicAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -715,13 +715,27 @@ - (IBAction)addPages:(id)sender
NSOpenPanel * addPagesModal = [NSOpenPanel openPanel];
[addPagesModal setAllowsMultipleSelection: YES];
[addPagesModal setCanChooseDirectories: YES];

NSMutableArray * filePaths;
NSArray * fileURLs;
NSURL * fileURL;
NSString * filePath;

NSMutableArray * allAllowedFilesExtensions = [NSMutableArray arrayWithArray: [TSSTManagedArchive archiveExtensions]];
[allAllowedFilesExtensions addObjectsFromArray: [TSSTPage imageExtensions]];
[addPagesModal setAllowedFileTypes:allAllowedFilesExtensions];


if([addPagesModal runModalForTypes: allAllowedFilesExtensions] != NSCancelButton)
if([addPagesModal runModal] != NSCancelButton)
{
TSSTManagedSession * session = [self newSessionWithFiles: [addPagesModal filenames]];
filePaths = [NSMutableArray new];
fileURLs = [addPagesModal URLs];

for (fileURL in fileURLs) {
filePath = [fileURL path];
[filePaths addObject:filePath];
}

TSSTManagedSession * session = [self newSessionWithFiles: filePaths];
[self windowForSession: session];
}
}
Expand Down

0 comments on commit 87447fc

Please sign in to comment.