OSDN Git Service

Change generation of files/paths in home dir to use FileManager
authorNick Clarke <memorius@gmail.com>
Mon, 19 Jul 2010 15:04:18 +0000 (03:04 +1200)
committerRandy Baumgarte <randy@fbn.cx>
Fri, 23 Jul 2010 09:31:06 +0000 (05:31 -0400)
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/ConfigDialog.java
src/cx/fbn/nevernote/gui/ShortcutKeys.java

index 3153cd9..7af20d5 100644 (file)
@@ -873,7 +873,8 @@ public class NeverNote extends QMainWindow{
 */
        }
        private void unlockApplication() {
 */
        }
        private void unlockApplication() {
-               String fileName = Global.currentDir +"nevernote.lock";
+               // NFC TODO: should this be removed? Looks like H2 now handles the locking, which it will clean up itself. See #lockApplication.
+               String fileName = Global.getFileManager().getHomeDirPath("nevernote.lock");
                if (QFile.exists(fileName)) {
                        QFile.remove(fileName);
                }
                if (QFile.exists(fileName)) {
                        QFile.remove(fileName);
                }
@@ -1846,7 +1847,7 @@ public class NeverNote extends QMainWindow{
                QTextEdit textBox = new QTextEdit();
                layout.addWidget(textBox);
                textBox.setReadOnly(true);
                QTextEdit textBox = new QTextEdit();
                layout.addWidget(textBox);
                textBox.setReadOnly(true);
-               QFile file = new QFile(Global.getDirectoryPath()+"release.txt");
+               QFile file = new QFile(Global.getFileManager().getHomeDirPath("release.txt"));
                if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly,
                 QIODevice.OpenModeFlag.Text)))
                        return;
                if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly,
                 QIODevice.OpenModeFlag.Text)))
                        return;
@@ -2238,7 +2239,7 @@ public class NeverNote extends QMainWindow{
        
        AESEncrypter aes = new AESEncrypter();
        try {
        
        AESEncrypter aes = new AESEncrypter();
        try {
-                       aes.decrypt(new FileInputStream(Global.getDirectoryPath()+"secure.txt"));
+                       aes.decrypt(new FileInputStream(Global.getFileManager().getHomeDirFile("secure.txt")));
                } catch (FileNotFoundException e) {
                        // File not found, so we'll just get empty strings anyway. 
                }
                } catch (FileNotFoundException e) {
                        // File not found, so we'll just get empty strings anyway. 
                }
index a4b8eea..ab985b8 100644 (file)
@@ -136,7 +136,7 @@ public class ConfigDialog extends QDialog {
                Global.setTagBehavior(appearancePage.getTagBehavior());\r
        FileOutputStream out = null;\r
                try {\r
                Global.setTagBehavior(appearancePage.getTagBehavior());\r
        FileOutputStream out = null;\r
                try {\r
-                       out = new FileOutputStream(Global.getDirectoryPath()+"secure.txt");\r
+                       out = new FileOutputStream(Global.getFileManager().getHomeDirFile("secure.txt"));\r
                } catch (FileNotFoundException e) {\r
                        // if it isn't found we'll write it.\r
                }\r
                } catch (FileNotFoundException e) {\r
                        // if it isn't found we'll write it.\r
                }\r
@@ -278,7 +278,7 @@ public class ConfigDialog extends QDialog {
                if (Global.username.equalsIgnoreCase("") || Global.password.equalsIgnoreCase("")) {\r
                AESEncrypter aes = new AESEncrypter();\r
                try {\r
                if (Global.username.equalsIgnoreCase("") || Global.password.equalsIgnoreCase("")) {\r
                AESEncrypter aes = new AESEncrypter();\r
                try {\r
-                               aes.decrypt(new FileInputStream(Global.getDirectoryPath()+"secure.txt"));\r
+                               aes.decrypt(new FileInputStream(Global.getFileManager().getHomeDirFile("secure.txt")));\r
                        } catch (FileNotFoundException e) {\r
                                // File not found, so we'll just get empty strings anyway. \r
                        }\r
                        } catch (FileNotFoundException e) {\r
                                // File not found, so we'll just get empty strings anyway. \r
                        }\r
index 8adc9a8..920f560 100644 (file)
@@ -273,7 +273,7 @@ public class ShortcutKeys {
        \r
        // Read in the custom keys (if they exist)\r
        private void loadCustomKeys() {\r
        \r
        // Read in the custom keys (if they exist)\r
        private void loadCustomKeys() {\r
-               File file = new File(Global.getDirectoryPath()+"shortcuts.txt");\r
+               File file = Global.getFileManager().getHomeDirFile("shortcuts.txt");\r
                try {\r
                        Scanner scanner = new Scanner(file);\r
                        while ( scanner.hasNextLine() ){\r
                try {\r
                        Scanner scanner = new Scanner(file);\r
                        while ( scanner.hasNextLine() ){\r