OSDN Git Service

Fix logic that caused a note's title to be pulled from the text when it is not manual...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / BrowserWindow.java
index 8ac0cc5..ac9bd98 100644 (file)
@@ -533,9 +533,10 @@ public class BrowserWindow extends QWidget {
                browser.page().mainFrame().setTextSizeMultiplier(Global.getTextSizeMultiplier());\r
                browser.page().mainFrame().setZoomFactor(Global.getZoomFactor());\r
                \r
-                previewPageList = new HashMap<String,Integer>();\r
+               previewPageList = new HashMap<String,Integer>();\r
                \r
                browser.page().microFocusChanged.connect(this, "microFocusChanged()");\r
+               \r
                logger.log(logger.HIGH, "Browser setup complete");\r
        }\r
 \r
@@ -1582,7 +1583,7 @@ public class BrowserWindow extends QWidget {
        // Check the note title\r
        private void checkNoteTitle() {\r
                String text = browser.page().currentFrame().toPlainText();\r
-               if (saveNoteTitle.trim().equals("")) {\r
+               if (saveNoteTitle.trim().equals("") || saveNoteTitle.trim().equals("Untitled Note")) {\r
                        int newLine = text.indexOf("\n");\r
                        if (newLine > 0) {\r
                                text = text.substring(0, newLine);\r
@@ -1590,13 +1591,15 @@ public class BrowserWindow extends QWidget {
                                        text = tr("Untitled Note");\r
                                titleLabel.setText(text);\r
                        } else {\r
-                               if (text.length() > 20)\r
-                                       titleLabel.setText(text.substring(0, 20));\r
+                               if (text.length() > Constants.EDAM_NOTE_TITLE_LEN_MAX)\r
+                                       titleLabel.setText(text.substring(0, Constants.EDAM_NOTE_TITLE_LEN_MAX));\r
                                else {\r
+                                       titleLabel.blockSignals(true);\r
                                        if (text.trim().equals(""))\r
                                                titleLabel.setText(tr("Untitled Note"));\r
                                        else\r
                                                titleLabel.setText(text);\r
+                                       titleLabel.blockSignals(false);\r
                                }\r
                        }\r
                        noteSignal.titleChanged.emit(currentNote.getGuid(), titleLabel\r