Mercurial > hg > octave-terminal
changeset 15314:67ef63ead023
Merge in Thorsten Liebig's changes
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 06 Sep 2012 13:04:48 -0400 |
parents | 34ae358bd566 (diff) de9bfcf637df (current diff) |
children | 35fe4b9909a8 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc |
diffstat | 4 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/contributors.in +++ b/doc/interpreter/contributors.in @@ -97,6 +97,7 @@ Ryan Hinton Roman Hodek A. Scottedward Hodel +Júlio Hoffimann Richard Allan Holcombe Tom Holroyd David Hoover @@ -189,6 +190,7 @@ Peter O'Gorman Thorsten Ohl Arno Onken +Valentin Ortega-Clavero Luis F. Ortiz Scott Pakin Gabriele Pannocchia @@ -295,6 +297,3 @@ Michael Zeising Federico Zenith Alex Zvoleff -Valentin Ortega-Clavero -Jacob Dawid -Júlio Hoffimann
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -603,13 +603,14 @@ } bool -file_editor_tab::open_file () +file_editor_tab::open_file (QString dir) { QString openFileName; QFileDialog fileDialog(this); fileDialog.setNameFilter(SAVE_FILE_FILTER); fileDialog.setAcceptMode(QFileDialog::AcceptOpen); fileDialog.setViewMode(QFileDialog::Detail); + fileDialog.setDirectory(dir); if (fileDialog.exec () == QDialog::Accepted) { openFileName = fileDialog.selectedFiles().at(0);
--- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -64,7 +64,7 @@ void set_modified (bool modified = true); - bool open_file (); + bool open_file (const QString& dir = QString ()); void load_file (const QString& fileName); void new_file (); bool save_file (); @@ -73,6 +73,7 @@ void run_file (); void file_has_changed (const QString& fileName); + QString get_file_name () const {return _file_name;} signals: void file_name_changed (const QString& fileName);
--- 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));