Setup scope attributes for untitled documents

These are based on the potential save directory (i.e. the one showing in the file browser) and ensures pressing ⌥⌘N gives the new document proper project and SCM scopes (so ⌘Y and ⌘B works as expected).

This fixes issue #367.
This commit is contained in:
Allan Odgaard
2012-09-18 17:29:33 +02:00
parent 5e453d1172
commit 79b0f7a14a

View File

@@ -118,6 +118,7 @@ OAK_DEBUG_VAR(DocumentController);
@interface DocumentController ()
@property (nonatomic, retain) OakFilterWindowController* filterWindowController;
@property (nonatomic, retain) NSString* pathAttributes;
@end
@interface OakUnhideHelper : NSObject
@@ -534,6 +535,7 @@ OAK_DEBUG_VAR(DocumentController);
self.windowTitle = [NSString stringWithCxxString:settings.get(kSettingsWindowTitleKey, doc->display_name())];
self.representedFile = [NSString stringWithCxxString:doc->path()];
self.isDocumentEdited = doc->is_modified();
self.pathAttributes = [NSString stringWithCxxString:file::path_attributes(doc->path(), docDirectory)];
}
- (void)updateProxyIcon
@@ -620,14 +622,7 @@ OAK_DEBUG_VAR(DocumentController);
- (NSString*)scopeAttributes
{
if(selectedTabIndex >= documentTabs.size())
{
fprintf(stderr, "*** error: selected tab out of bounds: %zu >= %zu\n", selectedTabIndex, documentTabs.size());
return nil;
}
document::document_ptr doc = [self selectedDocument];
return doc ? [NSString stringWithCxxString:doc->path_attributes()] : nil;
return self.pathAttributes;
}
// =============================