From 48e3796f877bbbbbc9036b0180b3eb728e9f990b Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Fri, 7 Feb 2014 19:52:56 +0700 Subject: [PATCH] Add delete action to Open Favorites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This only works for Recent Projects (not Favorites). Also, the key equivalent for this is ⌘⌫. The Edit → Delete menu item will not work (as it’s being sent to the input field). --- Applications/TextMate/src/Favorites.mm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Applications/TextMate/src/Favorites.mm b/Applications/TextMate/src/Favorites.mm index 2fa0f6c7..a2114d7d 100644 --- a/Applications/TextMate/src/Favorites.mm +++ b/Applications/TextMate/src/Favorites.mm @@ -2,6 +2,7 @@ #import #import #import +#import #import #import #import @@ -223,6 +224,29 @@ static NSUInteger const kOakSourceIndexFavorites = 1; [super accept:sender]; } +- (void)delete:(id)sender +{ + NSArray* items = self.selectedItems; + if(!items.count) + return; + + for(NSDictionary* item in items) + { + NSString* path = item[@"path"]; + if(self.sourceIndex == kOakSourceIndexRecentProjects) + { + KVDB* db = [self sharedProjectStateDB]; + [db removeObjectForKey:path]; + } + else if(self.sourceIndex == kOakSourceIndexFavorites) + { + NSLog(@"%s %@", sel_getName(_cmd), path); + } + } + [self loadItems:self]; + OakPlayUISound(OakSoundDidTrashItemUISound); +} + - (void)takeSourceIndexFrom:(id)sender { if([sender respondsToSelector:@selector(tag)])