If duplicating the active tab’s document then we open the duplicate

This commit is contained in:
Allan Odgaard
2016-08-24 23:58:35 +02:00
parent 0c08c608fe
commit 0b15e58844

View File

@@ -703,6 +703,17 @@ namespace
[self.window makeFirstResponder:oldFirstResponder];
}
- (void)fileBrowserDidDuplicateAtURLs:(NSNotification*)aNotification
{
NSDictionary* userInfo = [aNotification userInfo];
NSDictionary* urls = userInfo[OakFileBrowserURLMapKey];
for(NSURL* url in urls)
{
if([url.path isEqualToString:self.documentPath])
[self openItems:@[ @{ @"path" : [urls[url] path] } ] closingOtherTabs:NO];
}
}
+ (void)saveSessionAndDetachBackups
{
BOOL restoresSession = ![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableSessionRestoreKey];
@@ -1906,6 +1917,8 @@ namespace
[self updateFileBrowserStatus:self];
if(self.layoutView.tabsAboveDocument)
[self.tabBarView expand];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fileBrowserDidDuplicateAtURLs:) name:OakFileBrowserDidDuplicateURLs object:_fileBrowser];
}
if(!makeVisibleFlag && [[self.window firstResponder] isKindOfClass:[NSView class]] && [(NSView*)[self.window firstResponder] isDescendantOf:self.layoutView.fileBrowserView])