diff libgui/src/main-window.cc @ 18711:9ef65c422f53 gui-release

use shortcut manager for the main news menu * main_window.cc (construct_news_menu): use add_action for the actions, (set_global_shortcuts): set/unset shortcuts * main-window.h: actions are class variables * shortcut-manager.cc (do_init_data): initialize the shortcuts in the news menu
author Torsten <ttl@justmail.de>
date Thu, 01 May 2014 13:24:27 +0200
parents 584b20e9112c
children f017240310fb
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Thu May 01 12:12:08 2014 +0200
+++ b/libgui/src/main-window.cc	Thu May 01 13:24:27 2014 +0200
@@ -1762,17 +1762,11 @@
 {
   QMenu *news_menu = p->addMenu (tr ("&News"));
 
-  QAction *release_notes_action
-    = news_menu->addAction (tr ("Release Notes"));
-
-  QAction *current_news_action
-    = news_menu->addAction (tr ("Community News"));
-
-  connect (release_notes_action, SIGNAL (triggered ()),
-           this, SLOT (display_release_notes ()));
-
-  connect (current_news_action, SIGNAL (triggered ()),
-           this, SLOT (load_and_display_community_news ()));
+  _release_notes_action = add_action (news_menu, QIcon (),
+            tr ("Release Notes"), SLOT (display_release_notes ()));
+
+  _current_news_action = add_action (news_menu, QIcon (),
+            tr ("Community News"), SLOT (load_and_display_community_news ()));
 }
 
 void
@@ -2273,6 +2267,9 @@
       shortcut_manager::set_shortcut (_developer_action, "main_help:developer");
       shortcut_manager::set_shortcut (_about_octave_action, "main_help:about");
 
+      // news menu
+      shortcut_manager::set_shortcut (_release_notes_action, "main_news:release_notes");
+      shortcut_manager::set_shortcut (_current_news_action, "main_news:community_news");
     }
   else
     {
@@ -2309,6 +2306,10 @@
       _contribute_action->setShortcut (no_key);
       _developer_action->setShortcut (no_key);
       _about_octave_action->setShortcut (no_key);
+
+      // news menu
+      _release_notes_action->setShortcut (no_key);
+      _current_news_action->setShortcut (no_key);
     }
 
 }