UITreeView minor fix.

ecode: Remember last opened folder file.
This commit is contained in:
Martín Lucas Golini
2022-01-16 17:42:19 -03:00
parent 12265f0cac
commit 7667d58076
3 changed files with 8 additions and 2 deletions

View File

@@ -134,12 +134,15 @@ void App::onDocumentModified( UICodeEditor* editor, TextDocument& ) {
}
void App::openFileDialog() {
UIFileDialog* dialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*", "." );
UIFileDialog* dialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*",
mLastFileFolder.empty() ? "." : mLastFileFolder );
dialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
dialog->setTitle( "Open File" );
dialog->setCloseShortcut( KEY_ESCAPE );
dialog->addEventListener( Event::OpenFile, [&]( const Event* event ) {
loadFileFromPath( event->getNode()->asType<UIFileDialog>()->getFullPath() );
auto file = event->getNode()->asType<UIFileDialog>()->getFullPath();
mLastFileFolder = FileSystem::fileRemoveFileName( file );
loadFileFromPath( file );
} );
dialog->addEventListener( Event::OnWindowClose, [&]( const Event* ) {
if ( mEditorSplitter && mEditorSplitter->getCurEditor() &&