Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

Reload filetree after save #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/KBrowserWindowController.h
Expand Up @@ -31,4 +31,5 @@

- (BOOL)openFileDirectoryAtURL:(NSURL *)absoluteURL error:(NSError **)outError;

- (BOOL)reopenDirectoryIfOpen;
@end
9 changes: 8 additions & 1 deletion src/KBrowserWindowController.mm
Expand Up @@ -261,7 +261,6 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item {
return y;
}


#pragma mark -
#pragma mark Notifications

Expand Down Expand Up @@ -436,4 +435,12 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}

- (BOOL)reopenDirectoryIfOpen {
NSURL *absoluteURL = ((KToolbarController *)toolbarController_).directoryURL;
if (absoluteURL) {
NSError *error = nil;
return [self openFileDirectoryAtURL:absoluteURL error:&error];
}
}

@end
4 changes: 4 additions & 0 deletions src/KDocument.mm
Expand Up @@ -1742,6 +1742,10 @@ - (BOOL)saveToURL:(NSURL*)absoluteURL
// TODO(rsms): guess syntax/language
}

// We need to reload the file tree in the sidebar, because we may have
// created a new file (if it was "saved as").
[self.windowController reopenDirectoryIfOpen];

// unfreeze tab
if (tabWasEditable)
self.isEditable = YES;
Expand Down
1 change: 0 additions & 1 deletion src/KFileTreeController.mm
Expand Up @@ -157,7 +157,6 @@ - (NSTreeNode*)treeNodeFromDirectoryAtPath:(NSString*)path
});
}*/


#pragma mark -
#pragma mark NSOutlineViewDataSource methods

Expand Down