OSDN Git Service

Fixed problem with refresh note
authorxVir <danil.skachkov@gmail.com>
Sat, 30 Oct 2010 15:49:31 +0000 (22:49 +0700)
committerxVir <danil.skachkov@gmail.com>
Sat, 30 Oct 2010 15:49:31 +0000 (22:49 +0700)
Enabled logging in stdout

src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/utilities/ApplicationLogger.java

index d944c26..a3e6bac 100644 (file)
@@ -2891,10 +2891,11 @@ public class NeverNote extends QMainWindow{
                if (currentNoteGuid == null) 
                        currentNoteGuid = new String();
                
+               //determine current note guid
                for (Note note : listManager.getNoteIndex()) {
                        tempNoteGuid = note.getGuid();
                        if (currentNoteGuid.equals(tempNoteGuid)) {
-                               saveCurrentNoteGuid = new String(tempNoteGuid);
+                               saveCurrentNoteGuid = tempNoteGuid;
                        }
                }
                
@@ -2905,12 +2906,13 @@ public class NeverNote extends QMainWindow{
                        browserWindow.setDisabled(true);
                } 
                
-               if (saveCurrentNoteGuid.equals("") && listManager.getNoteIndex().size() >0) {
-                       currentNoteGuid = listManager.getNoteIndex().get(listManager.getNoteIndex().size()-1).getGuid();
+               if (saveCurrentNoteGuid.equals("") && listManager.getNoteIndex().size() > 0) {
                        currentNote = listManager.getNoteIndex().get(listManager.getNoteIndex().size()-1);
+                       currentNoteGuid = currentNote.getGuid();
                        refreshEvernoteNote(true);
                } else {
-                       refreshEvernoteNote(false);
+                       //we can reload if note not dirty
+                       refreshEvernoteNote(!noteDirty);
                }
                reloadTagTree();
 
@@ -3507,6 +3509,7 @@ public class NeverNote extends QMainWindow{
                        browserWindow.setReadOnly(true);
                        return;
                }
+               
                if (!reload)
                        return;
                
index e6ef930..18e55f4 100644 (file)
@@ -50,7 +50,7 @@ public class ApplicationLogger {
         
 //        stdoutStream = new OutStream(new ByteArrayOutputStream(), name);
        stdoutPrintStream  = new PrintStream(fileStream);
-//     systemStdoutPrintStream = System.out;
+ //    systemStdoutPrintStream = System.out;
     }
 
 //    public List<String> getText() {
@@ -74,7 +74,8 @@ public class ApplicationLogger {
                         
                        stdoutPrintStream.println(sdf.format(cal.getTime()) +s);
 //             System.setOut(stdoutPrintStream);
-//             System.out.print(sdf.format(cal.getTime()) +s);
+                       //TODO comment logging to output
+               System.out.println(sdf.format(cal.getTime()) +s);
 //             System.setOut(systemStdoutPrintStream); 
        }
     }