Mercurial > octave-nkf
diff libgui/src/main-window.cc @ 16635:25e418d23a4b
fix running files from file browser's context menu
* main-window.cc(run_file_in_terminal): new slot for run_file_signal
(run_file_callback): callback for running files after checking the path
* main-window.h: new functions run_file_in_terminal und run_file_callback)
* files-dock-widget.cc(constructor): connect signal to slot for running files
(contextmenu_run): emit run_file_signal with QFileInfo as parameter
* files-dock-widget.h: run_file_signal has QFileInfo as parameter
* file-editor-tab.cc: removed function run_file_callback
(run_file): get file info of current file and emit run_file_signal
(file_in_path): moved to octave_qt_link allowiung access from other widgets,
updated calls to this functions
* file-editor-tab.h: new run_file_signal with QFileInfo, removed functions
run_file_callback and file_in_path
* file-editor.cc(add_file_editor_tab): connect signal to slot for running files
* octave-qt-link.cc/h(file_in_path): moved from file-editor-tab and made static
author | Torsten <ttl@justmail.de> |
---|---|
date | Fri, 10 May 2013 21:01:02 +0200 |
parents | e13051d7a472 |
children | 3c2e457eeb72 |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Fri May 10 01:02:58 2013 +0100 +++ b/libgui/src/main-window.cc Fri May 10 21:01:02 2013 +0200 @@ -203,6 +203,12 @@ } void +main_window::run_file_in_terminal (const QFileInfo& info) +{ + octave_link::post_event (this, &main_window::run_file_callback, info); +} + +void main_window::handle_new_figure_request (void) { octave_link::post_event (this, &main_window::new_figure_callback); @@ -1459,6 +1465,17 @@ } void +main_window::run_file_callback (const QFileInfo& info) +{ + QString dir = info.absolutePath (); + QString function_name = info.fileName (); + function_name.chop (info.suffix ().length () + 1); + if (octave_qt_link::file_in_path (info.absoluteFilePath ().toStdString (), + dir.toStdString ())) + execute_command_callback (function_name.toStdString ()); +} + +void main_window::new_figure_callback (void) { Fbuiltin (ovl ("figure")); @@ -1561,3 +1578,4 @@ } +