Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor.cc @ 15312:d81105896288
m-editor: open a new file from the directory of the last active tab
* file-editor-tab.cc, file-editor-tab.h: new get_file_name method & open_file with a directory
* file-editor.cc: request_open_file with the path to the last active file
author | Thorsten Liebig <thorsten.liebig@gmx.de> |
---|---|
date | Tue, 04 Sep 2012 22:34:48 +0200 |
parents | ae9079bbc627 |
children | 67ef63ead023 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -98,11 +98,16 @@ void file_editor::request_open_file () { + file_editor_tab *current_tab = active_editor_tab (); file_editor_tab *fileEditorTab = new file_editor_tab (this); if (fileEditorTab) { add_file_editor_tab (fileEditorTab); - if (!fileEditorTab->open_file ()) + QString dir = QDir::currentPath (); + // get the filename of the last active tab to open a new file from there + if (current_tab) + dir = QDir::cleanPath (current_tab->get_file_name ()); + if (!fileEditorTab->open_file (dir)) { // If no file was loaded, remove the tab again. _tab_widget->removeTab (_tab_widget->indexOf (fileEditorTab));