Mercurial > octave-nkf
diff libgui/src/main-window.cc @ 16519:3e8fd0c479b4
Add find files implemtation to main window menu
* libgui/src/find-files-dialog.cc, libgui/src/find-files-dialog.h,
libgui/src/find-files-model.cc, libgui/src/find-files-model.h:
New files.
* libgui/src/main-window.cc, libgui/src/main-window.h
(main-window::main-window): Initialize find_files_dlg.
Connect Find files menu.
(main_window::find_files): New function.
(main_window::find_files_finished): New function.
* libgui/src/module.mk: Update file lists.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Mon, 15 Apr 2013 02:06:00 -0400 |
parents | 59dbdaeeea40 |
children | e192525236ad |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Sun Apr 14 21:34:47 2013 +0200 +++ b/libgui/src/main-window.cc Mon Apr 15 02:06:00 2013 -0400 @@ -74,6 +74,7 @@ doc_browser_window (new documentation_dock_widget (this)), editor_window (create_default_editor (this)), workspace_window (new workspace_view (this)), + find_files_dlg (0), _octave_main_thread (0), _octave_qt_link (0) { @@ -94,6 +95,11 @@ delete history_window; delete status_bar; delete _workspace_model; + if (find_files_dlg) + { + delete find_files_dlg; + find_files_dlg = 0; + } delete _octave_main_thread; delete _octave_qt_link; } @@ -960,7 +966,6 @@ QAction *find_files_action = edit_menu->addAction (tr ("Find Files...")); find_files_action->setShortcut (ctrl_shift + Qt::Key_F); - find_files_action->setEnabled (false); // TODO: Make this work. edit_menu->addSeparator (); @@ -979,6 +984,9 @@ connect (_paste_action, SIGNAL (triggered()), command_window, SLOT (pasteClipboard ())); + connect (find_files_action, SIGNAL (triggered()), + this, SLOT (find_files ())); + connect (clear_command_window_action, SIGNAL (triggered ()), this, SLOT (handle_clear_command_window_request ())); @@ -1403,3 +1411,41 @@ { Fquit (); } + +void +main_window::find_files(const QString &start_dir) +{ + + if (! find_files_dlg) + { + find_files_dlg = new find_files_dialog (this); + + connect (find_files_dlg, SIGNAL (finished (int)), + this, SLOT (find_files_finished (int))); + + connect (find_files_dlg, SIGNAL (dir_selected(const QString &)), + file_browser_window, SLOT(set_current_directory(const QString&))); + + connect (find_files_dlg, SIGNAL (file_selected(const QString &)), + this, SLOT(open_file(const QString &))); + + find_files_dlg->setWindowModality (Qt::NonModal); + } + + if (! find_files_dlg->isVisible ()) + { + find_files_dlg->show (); + } + + find_files_dlg->set_search_dir(start_dir); + + find_files_dlg->activateWindow (); + +} + +void +main_window::find_files_finished(int button) +{ + +} +