# HG changeset patch
# User Daniel J Sebald <daniel.sebald@ieee.org>
# Date 1359614789 21600
# Node ID 5f2a47465f8aa248ad7dd48a8a75b8c8a8cb65a1
# Parent  47a4c92924a70ae18d2481dc62b52b41b922b6f3
Add access to documentation and to online html page via Help menu

* main-window.cc, main-window.h (main_window::open_online_documentation_page):
Add for calling online documentation page at GNU website.
(main_window::construct): Add "Documentation" item to Help menu with submenu
consisting of "On Disk" and "Online". Switch around order of "Agora" and
"Octave Forge".  Connect open_online_documentation_page to menu "Online"
trigger and focus_documentation to menu "On Disk" trigger.

diff -r 47a4c92924a7 -r 5f2a47465f8a libgui/src/main-window.cc
--- a/libgui/src/main-window.cc	Tue Jan 29 18:24:16 2013 +0100
+++ b/libgui/src/main-window.cc	Thu Jan 31 00:46:29 2013 -0600
@@ -170,24 +170,30 @@
 }
 
 void
+main_window::open_online_documentation_page ()
+{
+  QDesktopServices::openUrl (QUrl ("http://gnu.org/software/octave/doc/interpreter"));
+}
+
+void
 main_window::open_bug_tracker_page ()
 {
   QDesktopServices::openUrl (QUrl ("http://bugs.octave.org"));
 }
 
 void
+main_window::open_octave_forge_page ()
+{
+  QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
+}
+
+void
 main_window::open_agora_page ()
 {
   QDesktopServices::openUrl (QUrl ("http://agora.octave.org/"));
 }
 
 void
-main_window::open_octave_forge_page ()
-{
-  QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
-}
-
-void
 main_window::process_settings_dialog_request ()
 {
   settings_dialog *settingsDialog = new settings_dialog (this);
@@ -719,13 +725,13 @@
   QAction *open_action
     = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open..."));
   open_action->setShortcut (Qt::ControlModifier + Qt::Key_O);
-
   QAction *close_command_window_action
     = file_menu->addAction (tr ("Close Command Window"));
   close_command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_W);
   close_command_window_action->setEnabled (false); // TODO: Make this work.
 
-  file_menu->addSeparator ();
+  file_menu->addSeparator (); /////
+
   QAction *import_data_action
     = file_menu->addAction (tr ("Import Data..."));
   import_data_action->setEnabled (false); // TODO: Make this work.
@@ -733,12 +739,15 @@
   QAction *save_workspace_action
     = file_menu->addAction (tr ("Save Workspace..."));
   save_workspace_action->setShortcut (Qt::ControlModifier + Qt::Key_S);
-  file_menu->addSeparator ();
+
+  file_menu->addSeparator (); /////
 
   QAction *preferences_action
     = file_menu->addAction (QIcon(":/actions/icons/configure.png"),
                             tr ("Preferences..."));
-  file_menu->addSeparator ();
+
+  file_menu->addSeparator (); /////
+
   QAction *page_setup_action
     = file_menu->addAction (tr ("Page Setup..."));
   page_setup_action->setEnabled (false); // TODO: Make this work.
@@ -750,7 +759,8 @@
     = file_menu->addAction (tr ("Print Selection..."));
   print_selection_action->setEnabled (false); // TODO: Make this work.
 
-  file_menu->addSeparator ();
+  file_menu->addSeparator (); /////
+
   QAction *exit_action = file_menu->addAction (tr ("Exit"));
   exit_action->setShortcut (Qt::ControlModifier + Qt::Key_Q);
 
@@ -763,7 +773,8 @@
   QAction *redo_action
     = edit_menu->addAction (QIcon(":/actions/icons/redo.png"), tr ("Redo"));
   redo_action->setShortcut (QKeySequence::Redo);
-  edit_menu->addSeparator ();
+
+  edit_menu->addSeparator (); /////
 
   QAction *cut_action
     = edit_menu->addAction (QIcon(":/actions/icons/editcut.png"), tr ("Cut"));
@@ -780,7 +791,8 @@
   QAction *paste_to_workspace_action
     = edit_menu->addAction (tr ("Paste To Workspace..."));
   paste_to_workspace_action->setEnabled (false); // TODO: Make this work.
-  edit_menu->addSeparator ();
+
+  edit_menu->addSeparator (); /////
 
   QAction *select_all_action
     = edit_menu->addAction (tr ("Select All"));
@@ -789,7 +801,8 @@
     = edit_menu->addAction (tr ("Delete"));
   delete_action->setShortcut (Qt::Key_Delete);
   delete_action->setEnabled (false); // TODO: Make this work.
-  edit_menu->addSeparator ();
+
+  edit_menu->addSeparator (); /////
 
   QAction *find_action
     = edit_menu->addAction (tr ("Find..."));
@@ -799,7 +812,8 @@
   find_files_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
                                   + Qt::Key_F);
   find_files_action->setEnabled (false); // TODO: Make this work.
-  edit_menu->addSeparator ();
+
+  edit_menu->addSeparator (); /////
 
   QAction *clear_command_window_action
     = edit_menu->addAction (tr ("Clear Command Window"));
@@ -843,9 +857,9 @@
 #endif
   _debug_continue->setShortcut (Qt::Key_F5);
 
-  _debug_menu->addSeparator ();
+  _debug_menu->addSeparator (); /////
 #ifdef HAVE_QSCINTILLA
-  _file_editor->debug_menu ()->addSeparator ();
+  _file_editor->debug_menu ()->addSeparator (); /////
 #endif
 
   _debug_quit = _debug_menu->addAction (QIcon (":/actions/icons/db_stop.png"), tr ("Exit Debug Mode"));
@@ -896,7 +910,7 @@
   show_documentation_action->setCheckable (true);
   show_documentation_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
                                           + Qt::Key_5);
-  window_menu->addSeparator ();
+  window_menu->addSeparator (); /////
 
   QAction * command_window_action
     = window_menu->addAction (tr ("Command Window"));
@@ -922,20 +936,31 @@
     = window_menu->addAction (tr ("Documentation"));
   documentation_action->setShortcut (Qt::ControlModifier + Qt::Key_5);
 
-  window_menu->addSeparator ();
+  window_menu->addSeparator (); /////
+
   QAction * reset_windows_action
     = window_menu->addAction (tr ("Reset Windows"));
   reset_windows_action->setEnabled (false); // TODO: Make this work.
 
   // Help menu
   QMenu *   help_menu = menuBar ()->addMenu (tr ("&Help"));
+  QMenu * documentation_menu
+    = help_menu->addMenu (tr ("Documentation"));
+  QAction * ondisk_documentation_action
+    = documentation_menu->addAction (tr ("On Disk"));
+  QAction * online_documentation_action
+    = documentation_menu->addAction (tr ("Online"));
+
+  help_menu->addSeparator (); /////
+
   QAction * report_bug_action
     = help_menu->addAction (tr ("Report Bug"));
+  QAction * octave_forge_action
+    = help_menu->addAction (tr ("Visit Octave Forge"));
   QAction * agora_action
     = help_menu->addAction (tr ("Visit Agora"));
-  QAction * octave_forge_action
-    = help_menu->addAction (tr ("Visit Octave Forge"));
-  help_menu->addSeparator ();
+
+  help_menu->addSeparator (); /////
 
   QAction * about_octave_action
     = help_menu->addAction (tr ("About Octave"));
@@ -945,13 +970,17 @@
   main_tool_bar->setObjectName ("MainToolBar");
   main_tool_bar->addAction (new_script_action);
   main_tool_bar->addAction (open_action);
-  main_tool_bar->addSeparator ();
+
+  main_tool_bar->addSeparator (); /////
+
   main_tool_bar->addAction (cut_action);
   main_tool_bar->addAction (copy_action);
   main_tool_bar->addAction (paste_action);
   main_tool_bar->addAction (undo_action);
   main_tool_bar->addAction (redo_action);
-  main_tool_bar->addSeparator ();
+
+  main_tool_bar->addSeparator (); /////
+
   // addWidget takes ownership of the objects so there is no
   // need to delete these upon destroying this main_window.
   main_tool_bar->addWidget (new QLabel (tr ("Current Directory:")));
@@ -969,12 +998,14 @@
            this,                        SLOT   (new_file ()));
   connect (open_action,                 SIGNAL (triggered ()),
            this,                        SLOT   (open_file ()));
+  connect (online_documentation_action, SIGNAL (triggered ()),
+           this,                        SLOT   (open_online_documentation_page ()));
   connect (report_bug_action,           SIGNAL (triggered ()),
            this,                        SLOT   (open_bug_tracker_page ()));
+  connect (octave_forge_action,         SIGNAL (triggered ()),
+           this,                        SLOT   (open_octave_forge_page ()));
   connect (agora_action,                SIGNAL (triggered ()),
            this,                        SLOT   (open_agora_page ()));
-  connect (octave_forge_action,         SIGNAL (triggered ()),
-           this,                        SLOT   (open_octave_forge_page ()));
   connect (about_octave_action,         SIGNAL (triggered ()),
            this,                        SLOT   (show_about_octave ()));
   connect (show_command_window_action,  SIGNAL (toggled (bool)),
@@ -1016,6 +1047,8 @@
            this,                        SLOT (focus_editor ()));
   connect (documentation_action,        SIGNAL (triggered ()),
            this,                        SLOT (focus_documentation ()));
+  connect (ondisk_documentation_action, SIGNAL (triggered ()),
+           this,                        SLOT (focus_documentation ()));
 
   connect (reset_windows_action,        SIGNAL (triggered ()),
            this,                        SLOT   (reset_windows ()));
diff -r 47a4c92924a7 -r 5f2a47465f8a libgui/src/main-window.h
--- a/libgui/src/main-window.h	Tue Jan 29 18:24:16 2013 +0100
+++ b/libgui/src/main-window.h	Thu Jan 31 00:46:29 2013 -0600
@@ -86,9 +86,10 @@
   void new_file ();
   void open_file ();
   void open_file (const QString& file_name);
+  void open_online_documentation_page ();
   void open_bug_tracker_page ();
+  void open_octave_forge_page ();
   void open_agora_page ();
-  void open_octave_forge_page ();
   void process_settings_dialog_request ();
   void show_about_octave ();
   void notice_settings ();
