OSDN Git Service

Correct problem with title label being updated from first line of text incorrectly.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 21 Dec 2011 15:49:25 +0000 (10:49 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Wed, 21 Dec 2011 15:49:25 +0000 (10:49 -0500)
src/cx/fbn/nevernote/gui/BrowserWindow.java

index 7510af5..d90d8dd 100644 (file)
@@ -2037,9 +2037,12 @@ public class BrowserWindow extends QWidget {
                        return;\r
                \r
                // If we have a real change, we need to save it.\r
                        return;\r
                \r
                // If we have a real change, we need to save it.\r
-               noteSignal.titleChanged.emit(currentNote.getGuid(), titleLabel.text().trim());\r
-               currentNote.setTitle(titleLabel.text().trim());\r
-               saveNoteTitle = titleLabel.text().trim();\r
+               String text = titleLabel.text().trim();\r
+               if (text.equals("")) \r
+                       text = tr("Untitled Note");\r
+               noteSignal.titleChanged.emit(currentNote.getGuid(), text);\r
+               currentNote.setTitle(text);\r
+               saveNoteTitle = text;\r
                checkNoteTitle();\r
        }\r
 \r
                checkNoteTitle();\r
        }\r
 \r
@@ -2145,6 +2148,8 @@ public class BrowserWindow extends QWidget {
                if (saveNoteTitle == null)\r
                        saveNoteTitle = new String();\r
                text = text.trim();\r
                if (saveNoteTitle == null)\r
                        saveNoteTitle = new String();\r
                text = text.trim();\r
+               if (!saveNoteTitle.trim().equals("") && !saveNoteTitle.trim().equals("Untitled Note"))\r
+                       text = saveNoteTitle.trim();\r
                int newLine = text.indexOf("\n");\r
                if (newLine > 0)\r
                        text = text.substring(0,newLine);\r
                int newLine = text.indexOf("\n");\r
                if (newLine > 0)\r
                        text = text.substring(0,newLine);\r