Skip to content

Commit

Permalink
Fixes for both issues 27 and 22 re-wrote setArchiveIcon. Has a bug wh…
Browse files Browse the repository at this point in the history
…ere users are prompted to select a page even if the page is not part of an archive.
  • Loading branch information
Alexander Rauchfuss committed Aug 5, 2009
1 parent b858624 commit e1912a3
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions Session/TSSTSessionWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -831,17 +831,21 @@ - (IBAction)goToPage:(id)sender

- (IBAction)setArchiveIcon:(id)sender
{
TSSTPage * currentPage = [[pageController selectedObjects] objectAtIndex: 0];
TSSTManagedGroup * currentGroup = [currentPage valueForKey: @"group"];
if(currentGroup == [currentGroup topLevelGroup])
int selection = [pageView selectPage];
if(selection != -1)
{
int selection = [pageView selectPage];
if(selection != -1)
int index = [pageController selectionIndex];
index += selection;
TSSTPage * selectedPage = [[pageController arrangedObjects] objectAtIndex: index];
TSSTManagedGroup * selectedGroup = [selectedPage valueForKey: @"group"];
/* Makes sure that the group is both an archive and not nested */
if([selectedGroup class] == [TSSTManagedArchive class] &&
selectedGroup == [selectedGroup topLevelGroup] &&
![[selectedPage valueForKey: @"text"] boolValue])
{
int coverIndex = [[currentPage valueForKey: @"index"] intValue];
coverIndex += selection;
XADString * coverName = [(XADArchive *)[currentGroup instance] rawNameOfEntry: coverIndex];
NSString * archivePath = [[currentGroup valueForKey: @"path"] stringByStandardizingPath];
int coverIndex = [[selectedPage valueForKey: @"index"] intValue];
XADString * coverName = [(XADArchive *)[selectedGroup instance] rawNameOfEntry: coverIndex];
NSString * archivePath = [[selectedGroup valueForKey: @"path"] stringByStandardizingPath];
[UKXattrMetadataStore setString: [coverName stringWithEncoding: NSNonLossyASCIIStringEncoding]
forKey: @"QCCoverName"
atPath: archivePath
Expand All @@ -854,9 +858,7 @@ - (IBAction)setArchiveIcon:(id)sender



/* This is an archive only method.
Finds the index of the page within an archive and then extracts
it to a location designated by the user. */
/* Saves the selected page to a user specified location. */
- (IBAction)extractPage:(id)sender
{
/* selectpage returns prompts the user for which page they wish to use.
Expand Down Expand Up @@ -1612,12 +1614,6 @@ - (float)toolbarHeight
}


- (void)toolbarDidRemoveItem:(NSNotification *)notification
{
NSToolbarItem * item = [[notification userInfo] objectForKey: @"item"];
}


- (void)toolbarWillAddItem:(NSNotification *)notification
{
NSToolbarItem * item = [[notification userInfo] objectForKey: @"item"];
Expand Down

0 comments on commit e1912a3

Please sign in to comment.