changeset 17636:230ffaf80ac9

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
author Torsten <ttl@justmail.de>
date Fri, 11 Oct 2013 23:59:24 +0200
parents 7945344506ae
children b30bb9bb05c8
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor.cc
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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);