OSDN Git Service

Add option to start minimized.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 6 Oct 2010 16:06:28 +0000 (12:06 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 10 Oct 2010 14:03:55 +0000 (10:03 -0400)
src/cx/fbn/nevernote/Global.java
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/ConfigAppearancePage.java
src/cx/fbn/nevernote/dialog/ConfigDialog.java

index 654053b..02ec7e8 100644 (file)
@@ -656,6 +656,23 @@ public class Global {
                        settings.setValue("verifyDelete", "false");\r
                settings.endGroup();\r
     }\r
+    public static boolean startMinimized() {\r
+               settings.beginGroup("General");\r
+               String text = (String)settings.value("startMinimized", "false");\r
+               settings.endGroup();\r
+               if (text.equalsIgnoreCase("true"))\r
+                       return true;\r
+               else\r
+                       return false;           \r
+    }\r
+    public static void setStartMinimized(boolean val) {\r
+               settings.beginGroup("General");\r
+               if (val)\r
+                       settings.setValue("startMinimized", "true");\r
+               else\r
+                       settings.setValue("startMinimized", "false");\r
+               settings.endGroup();\r
+    }\r
     public static boolean synchronizeDeletedContent() {\r
                settings.beginGroup("General");\r
                String text = (String)settings.value("syncDeletedContent", "false");\r
index f1f4b86..f42365f 100644 (file)
@@ -635,10 +635,15 @@ public class NeverNote extends QMainWindow{
         NeverNote application = new NeverNote(dbConn);
 
                application.setAttribute(WidgetAttribute.WA_DeleteOnClose, true);
-               if (Global.wasWindowMaximized())
-                       application.showMaximized();
-               else
-                       application.show();
+               if (Global.startMinimized()) 
+                       application.showMinimized();
+               else {
+                       if (Global.wasWindowMaximized())
+                               application.showMaximized();
+                       else
+                               application.show();
+               }
+               
                if (showSplash)
                        splash.finish(application);
                QApplication.exec();
@@ -3534,6 +3539,7 @@ public class NeverNote extends QMainWindow{
                browserWindow.centerAlignAction.setVisible(Global.isEditorButtonVisible("alignCenter"));
                browserWindow.rightAlignAction.setVisible(Global.isEditorButtonVisible("alignRight"));
                browserWindow.spellCheckAction.setVisible(Global.isEditorButtonVisible("spellCheck"));
+               browserWindow.todoAction.setVisible(Global.isEditorButtonVisible("todo"));
     }
     private void duplicateNote(String guid) {
                
index 3fc2de4..39aedab 100644 (file)
@@ -48,6 +48,7 @@ public class ConfigAppearancePage extends QWidget {
        private final QCheckBox pdfPreview;\r
        private final QCheckBox newNoteWithTags;\r
        private final QCheckBox mimicEvernote;\r
+       private final QCheckBox startMinimized;\r
        private final QSpinBox autoSaveInterval;\r
        \r
        private final List<String> tformats;\r
@@ -123,6 +124,7 @@ public class ConfigAppearancePage extends QWidget {
                showSplashScreen = new QCheckBox(tr("Show Splash Screen on Startup"));\r
                showTrayIcon = new QCheckBox(tr("Show Tray Icon"));\r
                verifyDelete = new QCheckBox(tr("Verify Deletes"));\r
+               startMinimized = new QCheckBox(tr("Start Minimized"));\r
                pdfPreview = new QCheckBox(tr("Display PDF Documents Inline"));\r
                newNoteWithTags = new QCheckBox(tr("Create New Notes With Selected Tags"));\r
                \r
@@ -140,6 +142,7 @@ public class ConfigAppearancePage extends QWidget {
                mainLayout.addWidget(tagBehaviorGroup);\r
                mainLayout.addWidget(mimicEvernote); \r
                mainLayout.addWidget(showTrayIcon);\r
+               mainLayout.addWidget(startMinimized);\r
                mainLayout.addWidget(showSplashScreen);\r
                mainLayout.addWidget(verifyDelete);\r
                mainLayout.addWidget(pdfPreview);\r
@@ -312,6 +315,17 @@ public class ConfigAppearancePage extends QWidget {
                mimicEvernote.setChecked(val);\r
        }\r
 \r
+       \r
+       //*****************************************\r
+       //* Mimic Evernote Selection\r
+       //*****************************************\r
+       public boolean getStartMinimized() {\r
+               return startMinimized.isChecked();\r
+       }\r
+       public void setStartMinimized(boolean val) {\r
+               startMinimized.setChecked(val);\r
+       }\r
+\r
 \r
        //*****************************************\r
        //* Create Note With Selected Tags\r
index 81ba193..339daba 100644 (file)
@@ -130,6 +130,7 @@ public class ConfigDialog extends QDialog {
                }\r
                Global.setShowTrayIcon(appearancePage.getShowTrayIcon());\r
                Global.setVerifyDelete(appearancePage.getVerifyDelete());\r
+               Global.setStartMinimized(appearancePage.getStartMinimized());\r
                Global.setSynchronizeOnClose(connectionPage.getSynchronizeOnClose());\r
                Global.setSynchronizeDeletedContent(connectionPage.getSynchronizeDeletedContent());\r
                Global.setTagBehavior(appearancePage.getTagBehavior());\r
@@ -258,6 +259,7 @@ public class ConfigDialog extends QDialog {
                connectionPage.setSynchronizeOnClose(Global.synchronizeOnClose());\r
                connectionPage.setSyncronizeDeletedContent(Global.synchronizeDeletedContent());\r
                appearancePage.setVerifyDelete(Global.verifyDelete());\r
+               appearancePage.setStartMinimized(Global.startMinimized());\r
                appearancePage.setPdfPreview(Global.pdfPreview());\r
                appearancePage.setNewNoteWithTags(Global.newNoteWithSelectedTags());\r
                appearancePage.setShowSplashScreen(Global.isWindowVisible("SplashScreen"));\r