OSDN Git Service

Prevent note titles from ending with a space and remove file attachment restriction.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 7 Sep 2011 18:26:03 +0000 (14:26 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Wed, 7 Sep 2011 18:26:03 +0000 (14:26 -0400)
src/cx/fbn/nevernote/gui/BrowserWindow.java

index 9797e08..052bad6 100644 (file)
@@ -2039,9 +2039,9 @@ 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());\r
-               currentNote.setTitle(titleLabel.text());\r
-               saveNoteTitle = titleLabel.text();\r
+               noteSignal.titleChanged.emit(currentNote.getGuid(), titleLabel.text().trim());\r
+               currentNote.setTitle(titleLabel.text().trim());\r
+               saveNoteTitle = titleLabel.text().trim();\r
                checkNoteTitle();\r
        }\r
 \r
                checkNoteTitle();\r
        }\r
 \r
@@ -2293,10 +2293,9 @@ public class BrowserWindow extends QWidget {
                                handleLocalImageURLPaste(mime, mimeType);\r
                                return;\r
                        }\r
                                handleLocalImageURLPaste(mime, mimeType);\r
                                return;\r
                        }\r
-                       String[] type = mimeType.split("/");\r
-                       boolean valid = validAttachment(type[1]);\r
+\r
                        boolean smallEnough = checkFileAttachmentSize(url);\r
                        boolean smallEnough = checkFileAttachmentSize(url);\r
-                       if (smallEnough && valid\r
+                       if (smallEnough \r
                                        && url.substring(0, 5).equalsIgnoreCase("file:")\r
                                        && !mimeType.substring(0, 5).equalsIgnoreCase("image")) {\r
                                handleLocalAttachment(mime, mimeType);\r
                                        && url.substring(0, 5).equalsIgnoreCase("file:")\r
                                        && !mimeType.substring(0, 5).equalsIgnoreCase("image")) {\r
                                handleLocalAttachment(mime, mimeType);\r
@@ -2516,29 +2515,7 @@ public class BrowserWindow extends QWidget {
        return "attachment.png";\r
     }\r
 \r
        return "attachment.png";\r
     }\r
 \r
-       // Check if the account supports this type of attachment\r
-       private boolean validAttachment(String type) {\r
-               if (Global.isPremium())\r
-                       return true;\r
-               if (type.equalsIgnoreCase("JPG"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("PNG"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("GIF"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("MP3"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("WAV"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("AMR"))\r
-                       return true;\r
-               if (type.equalsIgnoreCase("PDF"))\r
-                       return true;\r
-               String error = tr("Non-premium accounts can only attach JPG, PNG, GIF, MP3, WAV, AMR, or PDF files.");\r
-               QMessageBox.information(this, tr("Non-Premium Account"), error);\r
 \r
 \r
-               return false;\r
-       }\r
 \r
        // Check the file attachment to be sure it isn't over 25 mb\r
        private boolean checkFileAttachmentSize(String url) {\r
 \r
        // Check the file attachment to be sure it isn't over 25 mb\r
        private boolean checkFileAttachmentSize(String url) {\r