changeset 16981:e86df0d43309

make ctrl-w available for readline in the gui terminal * file-etior.cc(construct): save close action into class variable, call set_shortcuts after initiallization of all calss wide actions (set_shortcuts): add close action * file-editor.h: add new action _close_action
author Torsten <ttl@justmail.de>
date Sun, 14 Jul 2013 11:55:58 +0200
parents 1909e1ed63e6
children badc46a0a230
files libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Sat Jul 13 22:25:59 2013 -0700
+++ b/libgui/src/m-editor/file-editor.cc	Sun Jul 14 11:55:58 2013 +0200
@@ -819,9 +819,6 @@
   _copy_action->setEnabled (false);
   _cut_action->setEnabled (false);
 
-  // shortcuts
-  set_shortcuts (true);
-
   _run_action->setShortcutContext (Qt::WindowShortcut);
   _save_action->setShortcutContext (Qt::WindowShortcut);
   _save_as_action->setShortcutContext (Qt::WindowShortcut);
@@ -874,11 +871,10 @@
   fileMenu->addAction (_save_as_action);
 
   fileMenu->addSeparator ();
-  fileMenu->addAction (QIcon::fromTheme("window-close",
-                                      QIcon (":/actions/icons/fileclose.png")),
-                       tr ("&Close"),
-                       this, SLOT (request_close_file (bool)),
-                             QKeySequence::Close);
+  _close_action =
+      fileMenu->addAction (QIcon::fromTheme("window-close",
+                                  QIcon (":/actions/icons/fileclose.png")),
+                       tr ("&Close"), this, SLOT (request_close_file (bool)));
   fileMenu->addAction (QIcon::fromTheme("window-close",
                                       QIcon (":/actions/icons/fileclose.png")),
                        tr ("Close All"),
@@ -928,6 +924,10 @@
   _run_menu->addAction (_run_action);
   _menu_bar->addMenu (_run_menu);
 
+  // shortcuts
+  set_shortcuts (true);
+
+  // layout
   QVBoxLayout *vbox_layout = new QVBoxLayout ();
   vbox_layout->addWidget (_menu_bar);
   vbox_layout->addWidget (_tool_bar);
@@ -936,6 +936,7 @@
   editor_widget->setLayout (vbox_layout);
   setWidget (editor_widget);
 
+  // signals
   connect (main_win (), SIGNAL (new_file_signal (const QString&)),
            this, SLOT (request_new_file (const QString&)));
 
@@ -1210,6 +1211,7 @@
 
       _save_action->setShortcut (QKeySequence::Save);
       _save_as_action->setShortcut (QKeySequence::SaveAs);
+      _close_action->setShortcut (QKeySequence::Close);
 
       _redo_action->setShortcut (QKeySequence::Redo);
       _undo_action->setShortcut (QKeySequence::Undo);
@@ -1237,6 +1239,7 @@
 
       _save_action->setShortcut (no_key);
       _save_as_action->setShortcut (no_key);
+      _close_action->setShortcut (no_key);
 
       _redo_action->setShortcut (no_key);
       _undo_action->setShortcut (no_key);
--- a/libgui/src/m-editor/file-editor.h	Sat Jul 13 22:25:59 2013 -0700
+++ b/libgui/src/m-editor/file-editor.h	Sun Jul 14 11:55:58 2013 +0200
@@ -202,6 +202,7 @@
 
   QAction *_save_action;
   QAction *_save_as_action;
+  QAction *_close_action;
 
   QAction *_redo_action;
   QAction *_undo_action;