2009-08-05 08:59:46 +00:00
|
|
|
/*
|
2010-01-01 20:11:34 +00:00
|
|
|
Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
|
|
|
|
This software is licensed under the "HS" License as described in the "LICENSE" file,
|
|
|
|
which should be included with this package. The terms are also available at
|
|
|
|
http://www.hardcoded.net/licenses/hs_license
|
|
|
|
*/
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
#import "DirectoryPanel.h"
|
|
|
|
#import "ProgressController.h"
|
|
|
|
|
|
|
|
static NSString* jobAddIPhoto = @"jobAddIPhoto";
|
|
|
|
|
2010-02-05 16:05:00 +00:00
|
|
|
@implementation DirectoryPanelPE
|
2009-06-01 09:55:11 +00:00
|
|
|
- (id)initWithParentApp:(id)aParentApp
|
|
|
|
{
|
|
|
|
self = [super initWithParentApp:aParentApp];
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)addiPhoto:(id)sender
|
|
|
|
{
|
|
|
|
[[ProgressController mainProgressController] setJobDesc:@"Adding iPhoto Library..."];
|
|
|
|
[[ProgressController mainProgressController] setJobId:jobAddIPhoto];
|
|
|
|
[[ProgressController mainProgressController] showSheetForParent:[self window]];
|
|
|
|
[self addDirectory:@"iPhoto Library"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)popupAddDirectoryMenu:(id)sender
|
|
|
|
{
|
|
|
|
NSMenu *m = [addButtonPopUp menu];
|
|
|
|
while ([m numberOfItems] > 0)
|
|
|
|
[m removeItemAtIndex:0];
|
|
|
|
NSMenuItem *mi = [m addItemWithTitle:@"Add New Directory..." action:@selector(askForDirectory:) keyEquivalent:@""];
|
|
|
|
[mi setTarget:self];
|
|
|
|
mi = [m addItemWithTitle:@"Add iPhoto Directory" action:@selector(addiPhoto:) keyEquivalent:@""];
|
|
|
|
[mi setTarget:self];
|
|
|
|
[m addItem:[NSMenuItem separatorItem]];
|
|
|
|
[_recentDirectories fillMenu:m];
|
|
|
|
[addButtonPopUp selectItem:nil];
|
|
|
|
[[addButtonPopUp cell] performClickWithFrame:[sender frame] inView:[sender superview]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)jobCompleted:(NSNotification *)aNotification
|
|
|
|
{
|
2010-02-10 11:07:31 +00:00
|
|
|
if ([[ProgressController mainProgressController] jobId] == jobAddIPhoto) {
|
|
|
|
[outlineView reloadData];
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|