OSDN Git Service

Add logic to remember if the QToolBar for the main menu is hidden or visible. Also...
authorRandy Baumgarte <randy@fbn.cx>
Wed, 8 Sep 2010 12:27:29 +0000 (08:27 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Tue, 14 Sep 2010 10:24:45 +0000 (06:24 -0400)
shortcuts_sample.txt
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/gui/MainMenuBar.java

index db9afa4..a61f1e4 100644 (file)
@@ -47,6 +47,7 @@ View_Show_SavedSearches                               // Show the saved search tree
 View_Show_Trash                                        // Show the trash window
 View_Show_Editor_Button_Bar                    // Hide the editor button bar
 View_Show_Left_Side            F11             // Hide all left hand windows
+View_Toolbar                                   // Show/hide the toolbar
 
 Format_Bold                    Ctrl+B          // Bold (duh)
 Format_Underline               Ctrl+U          // Underline
index df96eac..4152b9b 100644 (file)
@@ -188,7 +188,7 @@ public class NeverNote extends QMainWindow{
     TableView                          noteTableView;                          //      List of notes (the widget).
 
     public BrowserWindow       browserWindow;                          // Window containing browser & labels
-    QToolBar                           toolBar;                                        // The tool bar under the menu
+    public QToolBar            toolBar;                                        // The tool bar under the menu
 //    QLineEdit                                searchField;                            // The search filter bar on the toolbar
     QComboBox                          searchField;                            // search filter bar on the toolbar;
     boolean                                    searchPerformed = false;        // Search was done?
@@ -1925,10 +1925,20 @@ public class NeverNote extends QMainWindow{
        searchPerformed = true;
        logger.log(logger.HIGH, "Leaving NeverNote.searchFieldChanged");
     }
+
+    // 
+    @SuppressWarnings("unused")
+       private void toolbarViewToggle() {
+       Global.saveWindowVisible("toolBar", toolBar.isHidden());
+    }
     // Build the window tool bar
     private void setupToolBar() {
        logger.log(logger.HIGH, "Entering NeverNote.setupToolBar");
-       toolBar = addToolBar(tr("toolBar"));    
+       toolBar = addToolBar(tr("Tool Bar"));   
+       
+       toolBar.setVisible(Global.isWindowVisible("toolBar"));
+       toolBar.toggleViewAction().changed.connect(this, "toolbarViewToggle()");
+       menuBar.setupToolBarVisible();
 
        prevButton = toolBar.addAction("Previous");
        QIcon prevIcon = new QIcon(iconPath+"back.png");
index a1b5e3f..375a5da 100644 (file)
@@ -667,6 +667,10 @@ public class MainMenuBar extends QMenuBar {
 \r
        }\r
 \r
+       public void setupToolBarVisible() {\r
+               viewMenu.addAction(parent.toolBar.toggleViewAction());\r
+               setupShortcut(parent.toolBar.toggleViewAction(), "View_Toolbar");\r
+       }\r
        \r
        private void setupShortcut(QAction action, String text) {\r
                if (!Global.shortcutKeys.containsAction(text))\r