diff options
-rw-r--r-- | macosx/HBPreset.m | 7 | ||||
-rw-r--r-- | macosx/HBPresetsViewController.m | 5 | ||||
-rw-r--r-- | macosx/HBTreeNode.h | 2 | ||||
-rw-r--r-- | macosx/HBTreeNode.m | 14 |
4 files changed, 20 insertions, 8 deletions
diff --git a/macosx/HBPreset.m b/macosx/HBPreset.m index 314704205..4fcb82495 100644 --- a/macosx/HBPreset.m +++ b/macosx/HBPreset.m @@ -192,16 +192,11 @@ - (id)copyWithZone:(NSZone *)zone { - HBPreset *node = [[self class] allocWithZone:zone]; + HBPreset *node = [super copyWithZone:zone]; node->_name = [self.name copy]; node->_content = [self.content copy]; node->_presetDescription = [self.presetDescription copy]; - for (HBPreset *children in self.children) - { - [node.children addObject:[children copy]]; - } - return node; } diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m index 371b0d8d5..2b5be6d84 100644 --- a/macosx/HBPresetsViewController.m +++ b/macosx/HBPresetsViewController.m @@ -88,10 +88,12 @@ - (IBAction)exportPreset:(id)sender { // Find the current selection, it can be a folder too. - HBPreset *selectedPreset = [[self.treeController selectedObjects] firstObject]; + HBPreset *selectedPreset = [[[self.treeController selectedObjects] firstObject] copy]; // Open a panel to let the user choose where and how to save the export file NSSavePanel *panel = [NSSavePanel savePanel]; + panel.title = NSLocalizedString(@"Export presets", nil); + // We get the current file name and path from the destination field here NSURL *defaultExportDirectory = [[NSURL fileURLWithPath:NSHomeDirectory()] URLByAppendingPathComponent:@"Desktop"]; panel.directoryURL = defaultExportDirectory; @@ -112,6 +114,7 @@ - (IBAction)importPreset:(id)sender { NSOpenPanel *panel = [NSOpenPanel openPanel]; + panel.title = NSLocalizedString(@"Import presets", nil); panel.allowsMultipleSelection = YES; panel.canChooseFiles = YES; panel.canChooseDirectories = NO; diff --git a/macosx/HBTreeNode.h b/macosx/HBTreeNode.h index 52fa0aa37..b4c93f40e 100644 --- a/macosx/HBTreeNode.h +++ b/macosx/HBTreeNode.h @@ -23,7 +23,7 @@ /** * HBTreeNode */ -@interface HBTreeNode : NSObject +@interface HBTreeNode : NSObject <NSCopying> // NSTreeController required properties @property (nonatomic, readonly) NSMutableArray *children; diff --git a/macosx/HBTreeNode.m b/macosx/HBTreeNode.m index 786e9500b..e02d3e70f 100644 --- a/macosx/HBTreeNode.m +++ b/macosx/HBTreeNode.m @@ -18,6 +18,20 @@ return self; } +- (id)copyWithZone:(NSZone *)zone +{ + HBTreeNode *node = [[self class] allocWithZone:zone]; + node->_children = [[NSMutableArray alloc] init]; + node->_isLeaf = self.isLeaf; + + for (HBTreeNode *children in self.children) + { + [node.children addObject:[children copy]]; + } + + return node; +} + - (NSUInteger)countOfChildren { return self.children.count; |