# HG changeset patch # User Torsten # Date 1381528764 -7200 # Node ID 230ffaf80ac9b64accf5066846904fbc38d37bc5 # Parent 7945344506aea7b013daeda93791eda88020ae4e fix enabling copy, cut and run selection actions depending on selected text * file-editor-tab.cc(load_file): set _copy_available to false for a new file * file-editor.cc(handle_editor_state_changed): enable/disable run selection; (construct): initially disable copy, cut and run selection action; (check_actions): do not enable copy, cut and run selection action depending on number of tabs diff -r 7945344506ae -r 230ffaf80ac9 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Fri Oct 11 22:46:32 2013 +0200 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Oct 11 23:59:24 2013 +0200 @@ -940,6 +940,7 @@ _edit_area->setText (in.readAll ()); QApplication::restoreOverrideCursor (); + _copy_available = false; // no selection yet available set_file_name (fileName); update_window_title (false); // window title (no modification) _edit_area->setModified (false); // loaded file is not modified yet diff -r 7945344506ae -r 230ffaf80ac9 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Fri Oct 11 22:46:32 2013 +0200 +++ b/libgui/src/m-editor/file-editor.cc Fri Oct 11 23:59:24 2013 +0200 @@ -724,6 +724,7 @@ { _copy_action->setEnabled (copy_available); _cut_action->setEnabled (copy_available); + _context_run_action->setEnabled (copy_available); if (!file_name.isEmpty ()) { @@ -785,9 +786,11 @@ _copy_action = new QAction (QIcon (":/actions/icons/editcopy.png"), tr ("&Copy"), _tool_bar); + _copy_action->setEnabled (false); _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"), tr ("Cu&t"), _tool_bar); + _cut_action->setEnabled (false); _paste_action = new QAction (QIcon (":/actions/icons/editpaste.png"), @@ -817,7 +820,6 @@ _comment_selection_action = new QAction (tr ("&Comment"), _tool_bar); - _uncomment_selection_action = new QAction (tr ("&Uncomment"), _tool_bar); @@ -954,6 +956,7 @@ _context_run_action = _run_menu->addAction (QIcon (), tr ("Run &Selection"), this, SLOT (request_context_run (bool))); + _context_run_action->setEnabled (false); _menu_bar->addMenu (_run_menu); QMenu *_help_menu = new QMenu (tr ("&Help"), _menu_bar); @@ -1315,8 +1318,6 @@ _comment_selection_action->setEnabled (have_tabs); _uncomment_selection_action->setEnabled (have_tabs); - _copy_action->setEnabled (have_tabs); - _cut_action->setEnabled (have_tabs); _paste_action->setEnabled (have_tabs); _context_help_action->setEnabled (have_tabs); _context_doc_action->setEnabled (have_tabs); @@ -1327,10 +1328,10 @@ _next_bookmark_action->setEnabled (have_tabs); _previous_bookmark_action->setEnabled (have_tabs); _toggle_bookmark_action->setEnabled (have_tabs); + _remove_bookmark_action->setEnabled (have_tabs); _print_action->setEnabled (have_tabs); _run_action->setEnabled (have_tabs); - _context_run_action->setEnabled (have_tabs); _context_edit_action->setEnabled (have_tabs); _save_action->setEnabled (have_tabs);