OSDN Git Service

- Correct issue with importing when not a premium member.
authorRandy Baumgarte <randy@fbn.cx>
Sat, 25 Aug 2012 18:41:17 +0000 (14:41 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sat, 25 Aug 2012 18:41:17 +0000 (14:41 -0400)
- Added more debugging information to try and fix a sync issue
- Removed accounting information that isn't available with OAuth
- Prep work for 1.3 build.

package_scripts/deb/amd64/control
package_scripts/deb/i386/control
src/cx/fbn/nevernote/Global.java
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/AccountDialog.java
src/cx/fbn/nevernote/sql/NoteResourceTable.java
src/cx/fbn/nevernote/sql/NoteTable.java
src/cx/fbn/nevernote/sql/SyncTable.java
src/cx/fbn/nevernote/threads/SyncRunner.java
src/cx/fbn/nevernote/utilities/FileImporter.java

index ad88a3a..d478791 100644 (file)
@@ -4,7 +4,7 @@ Section: x11
 Priority: optional
 Architecture: amd64
 Installed-Size: 133120
 Priority: optional
 Architecture: amd64
 Installed-Size: 133120
-Depends: openjdk-6-jre | openjdk-6-jdk | sun-java6-jdk | sun-java6-jre | java6-sdk | java6-runtime | default-jre
+Depends: openjdk-6-jre | openjdk-6-jdk | sun-java6-jdk | sun-java6-jre | java6-sdk | java6-runtime | default-jre, libssl (>=0.9.8)
 Maintainer: Randy Baumgarte <randy@fbn.cx>
 Description: Open Source Evernote client.
  NixNote is a client for the Evernote service (www.evernote.com).  It
 Maintainer: Randy Baumgarte <randy@fbn.cx>
 Description: Open Source Evernote client.
  NixNote is a client for the Evernote service (www.evernote.com).  It
index 94c86a6..d2cd5c9 100644 (file)
@@ -4,7 +4,7 @@ Section: x11
 Priority: optional
 Architecture: i386
 Installed-Size: 133120
 Priority: optional
 Architecture: i386
 Installed-Size: 133120
-Depends: openjdk-6-jre | openjdk-6-jdk | sun-java6-jdk | sun-java6-jre | java6-sdk | java6-runtime | default-jre
+Depends: openjdk-6-jre | openjdk-6-jdk | sun-java6-jdk | sun-java6-jre | java6-sdk | java6-runtime | default-jre, libssl (>=0.9.8)
 Maintainer: Randy Baumgarte <randy@fbn.cx>
 Description: Open Source Evernote client.
  NixNote is a client for the Evernote service (www.evernote.com).  It
 Maintainer: Randy Baumgarte <randy@fbn.cx>
 Description: Open Source Evernote client.
  NixNote is a client for the Evernote service (www.evernote.com).  It
index 02edff2..e395575 100644 (file)
@@ -63,7 +63,7 @@ import cx.fbn.nevernote.utilities.Pair;
 \r
 public class Global {\r
        // Set current version and the known versions.\r
 \r
 public class Global {\r
        // Set current version and the known versions.\r
-       public static String version = "1.2";\r
+       public static String version = "1.3";\r
        public static String[] validVersions = {"1.2", "1.1", "1.0", "0.99", "0.98", "0.97", "0.96"};\r
     public static String username = ""; \r
     //public static String password = "";     \r
        public static String[] validVersions = {"1.2", "1.1", "1.0", "0.99", "0.98", "0.97", "0.96"};\r
     public static String username = ""; \r
     //public static String password = "";     \r
index 2987cf6..5ec756e 100644 (file)
@@ -1137,16 +1137,17 @@ public class NeverNote extends QMainWindow{
        public void setMessage(String s) {
                logger.log(logger.HIGH, "Entering NeverNote.setMessage");
                
        public void setMessage(String s) {
                logger.log(logger.HIGH, "Entering NeverNote.setMessage");
                
-               statusBar.show();
-               logger.log(logger.HIGH, "Message: " +s);
-               statusBar.showMessage(s);
-               emitLog.add(s);
-               
-
-               messageTimer.stop();
-               messageTimer.setSingleShot(true);
-               messageTimer.start();
+               if (statusBar != null) {
+                       statusBar.show();
+                       logger.log(logger.HIGH, "Message: " +s);
+                       statusBar.showMessage(s);
+                       emitLog.add(s);
                
                
+                       messageTimer.stop();
+                       messageTimer.setSingleShot(true);
+                       messageTimer.start();
+               }
+                       
                
                logger.log(logger.HIGH, "Leaving NeverNote.setMessage");
        }
                
                logger.log(logger.HIGH, "Leaving NeverNote.setMessage");
        }
@@ -2757,8 +2758,8 @@ public class NeverNote extends QMainWindow{
                QMessageBox.about(this, 
                                                tr("About NixNote"),
                                                tr("<h4><center><b>NixNote</b></center></h4><hr><center>Version ")
                QMessageBox.about(this, 
                                                tr("About NixNote"),
                                                tr("<h4><center><b>NixNote</b></center></h4><hr><center>Version ")
-                                               //+Global.version
-                                               +"1.2.120724"
+                                               +Global.version
+                                               //+"1.2.120724"
                                                +tr("<hr>"
                                                                +"Open Source Evernote Client.<br><br>" 
                                                                +"Licensed under GPL v2.  <br><hr><br>"
                                                +tr("<hr>"
                                                                +"Open Source Evernote Client.<br><br>" 
                                                                +"Licensed under GPL v2.  <br><hr><br>"
@@ -6106,12 +6107,26 @@ public class NeverNote extends QMainWindow{
                
 //             importKeepWatcher.addPath(records.get(i).folder.replace('\\', '/'));
                for (int i=0; i<records.size(); i++) {
                
 //             importKeepWatcher.addPath(records.get(i).folder.replace('\\', '/'));
                for (int i=0; i<records.size(); i++) {
+                       logger.log(logger.LOW, "Adding file monitor: " +records.get(i).folder);
                        if (records.get(i).keep) 
                                importKeepWatcher.addPath(records.get(i).folder);
                        else
                                importDeleteWatcher.addPath(records.get(i).folder);
                }
                
                        if (records.get(i).keep) 
                                importKeepWatcher.addPath(records.get(i).folder);
                        else
                                importDeleteWatcher.addPath(records.get(i).folder);
                }
                
+               logger.log(logger.EXTREME, "List of directories being watched (kept)...");
+               List<String> monitorDelete = importKeepWatcher.directories();
+               for (int i=0; i<monitorDelete.size(); i++) {
+                       logger.log(logger.EXTREME, monitorDelete.get(i));
+               }
+               logger.log(logger.EXTREME, "<end of list>");
+               logger.log(logger.EXTREME, "List of directories being watched (delete)...");
+               monitorDelete = importDeleteWatcher.directories();
+               for (int i=0; i<monitorDelete.size(); i++) {
+                       logger.log(logger.EXTREME, monitorDelete.get(i));
+               }
+               logger.log(logger.EXTREME, "<end of list>");
+               
                importKeepWatcher.directoryChanged.connect(this, "folderImportKeep(String)");
                importDeleteWatcher.directoryChanged.connect(this, "folderImportDelete(String)");
                
                importKeepWatcher.directoryChanged.connect(this, "folderImportKeep(String)");
                importDeleteWatcher.directoryChanged.connect(this, "folderImportDelete(String)");
                
@@ -6128,6 +6143,8 @@ public class NeverNote extends QMainWindow{
                        }
                }
        }
                        }
                }
        }
+       
+       // Menu folderImport action triggered
        public void folderImport() {
                List<WatchFolderRecord> recs = conn.getWatchFolderTable().getAll();
                WatchFolder dialog = new WatchFolder(recs, listManager.getNotebookIndex());
        public void folderImport() {
                List<WatchFolderRecord> recs = conn.getWatchFolderTable().getAll();
                WatchFolder dialog = new WatchFolder(recs, listManager.getNotebookIndex());
@@ -6161,8 +6178,9 @@ public class NeverNote extends QMainWindow{
                setupFolderImports();
        }
        
                setupFolderImports();
        }
        
+       
        public void folderImportKeep(String dirName) throws NoSuchAlgorithmException {
        public void folderImportKeep(String dirName) throws NoSuchAlgorithmException {
-               
+               logger.log(logger.LOW, "Inside folderImportKeep");
                String whichOS = System.getProperty("os.name");
                if (whichOS.contains("Windows")) 
                        dirName = dirName.replace('/','\\');
                String whichOS = System.getProperty("os.name");
                if (whichOS.contains("Windows")) 
                        dirName = dirName.replace('/','\\');
@@ -6174,40 +6192,44 @@ public class NeverNote extends QMainWindow{
                String notebook = conn.getWatchFolderTable().getNotebook(dirName);
 
                for (int i=0; i<list.size(); i++){
                String notebook = conn.getWatchFolderTable().getNotebook(dirName);
 
                for (int i=0; i<list.size(); i++){
-                       
+                       logger.log(logger.LOW, "File found: " +list.get(i).fileName());
                        boolean redundant = false;
                        // Check if we've already imported this one or if it existed before
                        for (int j=0; j<importedFiles.size(); j++) {
                        boolean redundant = false;
                        // Check if we've already imported this one or if it existed before
                        for (int j=0; j<importedFiles.size(); j++) {
+                               logger.log(logger.LOW, "redundant file list: " +list.get(i).absoluteFilePath());
                                if (importedFiles.get(j).equals(list.get(i).absoluteFilePath()))
                                        redundant = true;
                        }
                        
                                if (importedFiles.get(j).equals(list.get(i).absoluteFilePath()))
                                        redundant = true;
                        }
                        
+                       logger.log(logger.LOW, "Checking if redundant: " +redundant);
                        if (!redundant) {
                                importer.setFileInfo(list.get(i));
                                importer.setFileName(list.get(i).absoluteFilePath());
                        
                        
                        if (!redundant) {
                                importer.setFileInfo(list.get(i));
                                importer.setFileName(list.get(i).absoluteFilePath());
                        
                        
+                               logger.log(logger.LOW, "File importing is a file: " +list.get(i).isFile());
+                               logger.log(logger.LOW, "File importing is a valid: " +importer.isValidType());
                                if (list.get(i).isFile() && importer.isValidType()) {
                        
                                        if (!importer.importFile()) {
                                                // If we can't get to the file, it is probably locked.  We'll try again later.
                                                logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
                                                importFilesKeep.add(list.get(i).absoluteFilePath());
                                if (list.get(i).isFile() && importer.isValidType()) {
                        
                                        if (!importer.importFile()) {
                                                // If we can't get to the file, it is probably locked.  We'll try again later.
                                                logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
                                                importFilesKeep.add(list.get(i).absoluteFilePath());
-                                               return;
+                                       } else {
+
+                                               Note newNote = importer.getNote();
+                                               newNote.setNotebookGuid(notebook);
+                                               newNote.setTitle(dir.at(i));
+                                               NoteMetadata metadata = new NoteMetadata();
+                                               metadata.setDirty(true);
+                                               metadata.setGuid(newNote.getGuid());
+                                               listManager.addNote(newNote, metadata);
+                                               conn.getNoteTable().addNote(newNote, true);
+                                               noteTableView.insertRow(newNote, metadata, true, -1);
+                                               listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
+                                               listManager.countNotebookResults(listManager.getNoteIndex());
+                                               importedFiles.add(list.get(i).absoluteFilePath());
                                        }
                                        }
-
-                                       Note newNote = importer.getNote();
-                                       newNote.setNotebookGuid(notebook);
-                                       newNote.setTitle(dir.at(i));
-                                       NoteMetadata metadata = new NoteMetadata();
-                                       metadata.setDirty(true);
-                                       metadata.setGuid(newNote.getGuid());
-                                       listManager.addNote(newNote, metadata);
-                                       conn.getNoteTable().addNote(newNote, true);
-                                       noteTableView.insertRow(newNote, metadata, true, -1);
-                                       listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
-                                       listManager.countNotebookResults(listManager.getNoteIndex());
-                                       importedFiles.add(list.get(i).absoluteFilePath());
                                }
                        }
                }
                                }
                        }
                }
@@ -6216,7 +6238,7 @@ public class NeverNote extends QMainWindow{
        }
        
        public void folderImportDelete(String dirName) {
        }
        
        public void folderImportDelete(String dirName) {
-               
+               logger.log(logger.LOW, "Inside folderImportDelete");
                String whichOS = System.getProperty("os.name");
                if (whichOS.contains("Windows")) 
                        dirName = dirName.replace('/','\\');
                String whichOS = System.getProperty("os.name");
                if (whichOS.contains("Windows")) 
                        dirName = dirName.replace('/','\\');
@@ -6227,30 +6249,33 @@ public class NeverNote extends QMainWindow{
                String notebook = conn.getWatchFolderTable().getNotebook(dirName);
                
                for (int i=0; i<list.size(); i++){
                String notebook = conn.getWatchFolderTable().getNotebook(dirName);
                
                for (int i=0; i<list.size(); i++){
+                       logger.log(logger.LOW, "File found: " +list.get(i).fileName());
                        importer.setFileInfo(list.get(i));
                        importer.setFileName(list.get(i).absoluteFilePath());
                        
                        importer.setFileInfo(list.get(i));
                        importer.setFileName(list.get(i).absoluteFilePath());
                        
+                       logger.log(logger.LOW, "File importing is a file: " +list.get(i).isFile());
+                       logger.log(logger.LOW, "File importing is a valid: " +importer.isValidType());
                        if (list.get(i).isFile() && importer.isValidType()) {
                
                                if (!importer.importFile()) {
                                        // If we can't get to the file, it is probably locked.  We'll try again later.
                                        logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
                                        importFilesKeep.add(list.get(i).absoluteFilePath());
                        if (list.get(i).isFile() && importer.isValidType()) {
                
                                if (!importer.importFile()) {
                                        // If we can't get to the file, it is probably locked.  We'll try again later.
                                        logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
                                        importFilesKeep.add(list.get(i).absoluteFilePath());
-                                       return;
-                               }
+                               } else {
                
                
-                               Note newNote = importer.getNote();
-                               newNote.setNotebookGuid(notebook);
-                               newNote.setTitle(dir.at(i));
-                               NoteMetadata metadata = new NoteMetadata();
-                               metadata.setDirty(true);
-                               metadata.setGuid(newNote.getGuid());
-                               listManager.addNote(newNote, metadata);
-                               conn.getNoteTable().addNote(newNote, true);
-                               noteTableView.insertRow(newNote, metadata, true, -1);
-                               listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
-                               listManager.countNotebookResults(listManager.getNoteIndex());
-                               dir.remove(dir.at(i));
+                                       Note newNote = importer.getNote();
+                                       newNote.setNotebookGuid(notebook);
+                                       newNote.setTitle(dir.at(i));
+                                       NoteMetadata metadata = new NoteMetadata();
+                                       metadata.setDirty(true);
+                                       metadata.setGuid(newNote.getGuid());
+                                       listManager.addNote(newNote, metadata);
+                                       conn.getNoteTable().addNote(newNote, true);
+                                       noteTableView.insertRow(newNote, metadata, true, -1);
+                                       listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
+                                       listManager.countNotebookResults(listManager.getNoteIndex());
+                                       dir.remove(dir.at(i));
+                               }
                        }
                }
        }
                        }
                }
        }
index 9be49b7..527b286 100644 (file)
@@ -22,24 +22,13 @@ package cx.fbn.nevernote.dialog;
 \r
 import java.text.SimpleDateFormat;\r
 \r
 \r
 import java.text.SimpleDateFormat;\r
 \r
-import com.evernote.edam.type.UserAttributes;\r
-import com.trolltech.qt.gui.QApplication;\r
-import com.trolltech.qt.gui.QColor;\r
 import com.trolltech.qt.gui.QDialog;\r
 import com.trolltech.qt.gui.QDialog;\r
-import com.trolltech.qt.gui.QFontMetrics;\r
-import com.trolltech.qt.gui.QFrame;\r
 import com.trolltech.qt.gui.QGridLayout;\r
 import com.trolltech.qt.gui.QGroupBox;\r
 import com.trolltech.qt.gui.QHBoxLayout;\r
 import com.trolltech.qt.gui.QIcon;\r
 import com.trolltech.qt.gui.QLabel;\r
 import com.trolltech.qt.gui.QGridLayout;\r
 import com.trolltech.qt.gui.QGroupBox;\r
 import com.trolltech.qt.gui.QHBoxLayout;\r
 import com.trolltech.qt.gui.QIcon;\r
 import com.trolltech.qt.gui.QLabel;\r
-import com.trolltech.qt.gui.QPalette;\r
-import com.trolltech.qt.gui.QPalette.ColorRole;\r
 import com.trolltech.qt.gui.QPushButton;\r
 import com.trolltech.qt.gui.QPushButton;\r
-import com.trolltech.qt.gui.QTextDocument;\r
-import com.trolltech.qt.gui.QTextEdit;\r
-import com.trolltech.qt.gui.QTextEdit.LineWrapMode;\r
-import com.trolltech.qt.gui.QWidget;\r
 \r
 import cx.fbn.nevernote.Global;\r
 \r
 \r
 import cx.fbn.nevernote.Global;\r
 \r
@@ -112,20 +101,20 @@ public class AccountDialog extends QDialog {
 \r
                grid.addWidget(limitGroup, 1, 1);\r
 \r
 \r
                grid.addWidget(limitGroup, 1, 1);\r
 \r
-               UserAttributes attrib = Global.getUserAttributes();\r
-               QGridLayout attribGrid = new QGridLayout();\r
-               QGroupBox attribGroup = new QGroupBox(tr("User Attributes"));\r
-               attribGrid.addWidget(new QLabel(tr("Incoming Email:")), 1,1);\r
-               String server = Global.getServer();\r
-               if (server.startsWith("www."))\r
-                       server = server.substring(4);\r
+               //UserAttributes attrib = Global.getUserAttributes();\r
+               //QGridLayout attribGrid = new QGridLayout();\r
+               //QGroupBox attribGroup = new QGroupBox(tr("User Attributes"));\r
+               //attribGrid.addWidget(new QLabel(tr("Incoming Email:")), 1,1);\r
+               //String server = Global.getServer();\r
+               //if (server.startsWith("www."))\r
+                       //server = server.substring(4);\r
                \r
                //usually evernote mail is user@m.evernote.com\r
                \r
                //usually evernote mail is user@m.evernote.com\r
-               server = "m."+server;\r
+               //server = "m."+server;\r
                \r
                \r
-               attribGrid.addWidget(createIncomingEmailField(attrib.getIncomingEmailAddress()+"@"+server), 1,2);\r
-               attribGroup.setLayout(attribGrid);\r
-               grid.addWidget(attribGroup, 2,1);\r
+               //attribGrid.addWidget(createIncomingEmailField(attrib.getIncomingEmailAddress()+"@"+server), 1,2);\r
+               //attribGroup.setLayout(attribGrid);\r
+               //grid.addWidget(attribGroup, 2,1);\r
 \r
                \r
                QHBoxLayout buttonLayout = new QHBoxLayout();\r
 \r
                \r
                QHBoxLayout buttonLayout = new QHBoxLayout();\r
@@ -138,6 +127,7 @@ public class AccountDialog extends QDialog {
        }\r
        \r
        // build a field used for the incomming email\r
        }\r
        \r
        // build a field used for the incomming email\r
+       /*\r
        private QWidget createIncomingEmailField(String email){\r
                QTextEdit emailTextEdit = new QTextEdit();\r
                \r
        private QWidget createIncomingEmailField(String email){\r
                QTextEdit emailTextEdit = new QTextEdit();\r
                \r
@@ -172,6 +162,7 @@ public class AccountDialog extends QDialog {
                \r
                return emailTextEdit;\r
        }\r
                \r
                return emailTextEdit;\r
        }\r
+       */\r
        \r
        // OK button pushed, close the window\r
        @SuppressWarnings("unused")\r
        \r
        // OK button pushed, close the window\r
        @SuppressWarnings("unused")\r
index f32cab7..1f24b68 100644 (file)
@@ -160,8 +160,10 @@ public class NoteResourceTable  {
        }\r
        \r
        public void saveNoteResource(Resource r, boolean isDirty) {\r
        }\r
        \r
        public void saveNoteResource(Resource r, boolean isDirty) {\r
-               logger.log(logger.HIGH, "Entering DBRunner.saveNoteResources");\r
+               logger.log(logger.HIGH, "Entering saveNoteResources: isDirty " +isDirty);\r
                boolean check;\r
                boolean check;\r
+               logger.log(logger.HIGH, "Note: " +r.getNoteGuid());\r
+               logger.log(logger.HIGH, "Resource: " +r.getGuid());\r
                NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
                SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
                \r
                NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
                SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
                \r
index 54da38b..f19deee 100644 (file)
@@ -387,6 +387,7 @@ public class NoteTable {
        }\r
        // Update a note's title\r
        public void updateNoteTitle(String guid, String title) {\r
        }\r
        // Update a note's title\r
        public void updateNoteTitle(String guid, String title) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteTitle");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set title=:title, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set title=:title, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -400,9 +401,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note title has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note title has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteTitle");\r
        }\r
        // Update a note's creation date\r
        public void updateNoteCreatedDate(String guid, QDateTime date) {\r
        }\r
        // Update a note's creation date\r
        public void updateNoteCreatedDate(String guid, QDateTime date) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteCreatedDate");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set created=:created, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set created=:created, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -418,9 +421,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note creation date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note creation date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteCreatedDate");\r
        }\r
        // Update a note's creation date\r
        public void updateNoteAlteredDate(String guid, QDateTime date) {\r
        }\r
        // Update a note's creation date\r
        public void updateNoteAlteredDate(String guid, QDateTime date) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteAlteredDate");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set updated=:altered, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set updated=:altered, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -436,9 +441,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note altered date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note altered date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteAlteredDate");\r
        }\r
        // Update a note's creation date\r
        public void updateNoteSubjectDate(String guid, QDateTime date) {\r
        }\r
        // Update a note's creation date\r
        public void updateNoteSubjectDate(String guid, QDateTime date) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteSubjectDate");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeSubjectDate=:altered, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeSubjectDate=:altered, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -454,9 +461,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note subject date date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note subject date date has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteSubjectDate");\r
        }\r
        // Update a note's creation date\r
        public void updateNoteAuthor(String guid, String author) {\r
        }\r
        // Update a note's creation date\r
        public void updateNoteAuthor(String guid, String author) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteSubject");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeAuthor=:author, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeAuthor=:author, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -472,10 +481,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note author has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note author has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
-               \r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteSubject");\r
        }\r
        // Update a note's geo tags\r
        public void updateNoteGeoTags(String guid, Double lon, Double lat, Double alt) {\r
        }\r
        // Update a note's geo tags\r
        public void updateNoteGeoTags(String guid, Double lon, Double lat, Double alt) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteGeoTags");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeLongitude=:longitude, "+\r
                                "attributeLatitude=:latitude, attributeAltitude=:altitude, isDirty=true where guid=:guid");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeLongitude=:longitude, "+\r
                                "attributeLatitude=:latitude, attributeAltitude=:altitude, isDirty=true where guid=:guid");\r
@@ -494,10 +504,12 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note geo tag has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note geo tag has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteGeoTags");\r
                \r
        }\r
        // Update a note's creation date\r
        public void updateNoteSourceUrl(String guid, String url) {\r
                \r
        }\r
        // Update a note's creation date\r
        public void updateNoteSourceUrl(String guid, String url) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteSourceUrl");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeSourceUrl=:url, isDirty=true where guid=:guid");\r
                if (!check) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set attributeSourceUrl=:url, isDirty=true where guid=:guid");\r
                if (!check) {\r
@@ -513,10 +525,11 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note url has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note url has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
-               \r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteSourceUrl");\r
        }\r
        // Update the notebook that a note is assigned to\r
        public void updateNoteNotebook(String guid, String notebookGuid, boolean expungeFromRemote) {\r
        }\r
        // Update the notebook that a note is assigned to\r
        public void updateNoteNotebook(String guid, String notebookGuid, boolean expungeFromRemote) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteNotebook");\r
                String currentNotebookGuid = new String("");\r
                \r
                \r
                String currentNotebookGuid = new String("");\r
                \r
                \r
@@ -545,10 +558,12 @@ public class NoteTable {
                if (!check) {\r
                        logger.log(logger.EXTREME, "Update note notebook has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                if (!check) {\r
                        logger.log(logger.EXTREME, "Update note notebook has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
-               };\r
+               }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteNotebook");\r
        }\r
        // Update a note's title\r
        public void updateNoteContent(String guid, String content) {\r
        }\r
        // Update a note's title\r
        public void updateNoteContent(String guid, String content) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteContent");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set content=:content, updated=CURRENT_TIMESTAMP(), isDirty=true, indexNeeded=true, " +\r
                                " thumbnailneeded=true where guid=:guid");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                boolean check = query.prepare("Update Note set content=:content, updated=CURRENT_TIMESTAMP(), isDirty=true, indexNeeded=true, " +\r
                                " thumbnailneeded=true where guid=:guid");\r
@@ -568,10 +583,12 @@ public class NoteTable {
                        logger.log(logger.EXTREME, "Update note content has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.EXTREME, "Update note content has failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteContent");\r
        }\r
 \r
        // Delete a note\r
        public void deleteNote(String guid) {\r
        }\r
 \r
        // Delete a note\r
        public void deleteNote(String guid) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.deleteNote");\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         query.prepare("Update Note set deleted=CURRENT_TIMESTAMP(), active=false, isDirty=true where guid=:guid");\r
                query.bindValue(":guid", guid);\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         query.prepare("Update Note set deleted=CURRENT_TIMESTAMP(), active=false, isDirty=true where guid=:guid");\r
                query.bindValue(":guid", guid);\r
@@ -579,6 +596,7 @@ public class NoteTable {
                        logger.log(logger.MEDIUM, "Note delete failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
                        logger.log(logger.MEDIUM, "Note delete failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.deleteNote");\r
        }\r
        public void restoreNote(String guid) {\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
        }\r
        public void restoreNote(String guid) {\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
@@ -593,6 +611,7 @@ public class NoteTable {
        }\r
        // Purge a note (actually delete it instead of just marking it deleted)\r
        public void expungeNote(String guid, boolean permanentExpunge, boolean needsSync) {\r
        }\r
        // Purge a note (actually delete it instead of just marking it deleted)\r
        public void expungeNote(String guid, boolean permanentExpunge, boolean needsSync) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.expungeNote");\r
                \r
                if (!permanentExpunge) {\r
                        hideExpungedNote(guid, needsSync);\r
                \r
                if (!permanentExpunge) {\r
                        hideExpungedNote(guid, needsSync);\r
@@ -637,7 +656,7 @@ public class NoteTable {
                        DeletedTable deletedTable = new DeletedTable(logger, db);\r
                        deletedTable.addDeletedItem(guid, "Note");\r
                }\r
                        DeletedTable deletedTable = new DeletedTable(logger, db);\r
                        deletedTable.addDeletedItem(guid, "Note");\r
                }\r
-\r
+               logger.log(logger.HIGH, "Leaving NoteTable.expungeNote");\r
        }\r
        // Purge a bunch of notes based upon the notebook\r
        public void expungeNotesByNotebook(String notebookGuid, boolean permanentExpunge, boolean needsSync) {\r
        }\r
        // Purge a bunch of notes based upon the notebook\r
        public void expungeNotesByNotebook(String notebookGuid, boolean permanentExpunge, boolean needsSync) {\r
@@ -691,6 +710,7 @@ public class NoteTable {
                \r
        // Purge all deleted notes;\r
        public void expungeAllDeletedNotes() {\r
                \r
        // Purge all deleted notes;\r
        public void expungeAllDeletedNotes() {\r
+               logger.log(logger.HIGH, "Entering NoteTable.expungeAllDeletedNotes");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                query.exec("select guid, updateSequenceNumber from note where active = false");\r
                List<String> guids = new ArrayList<String>();\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                query.exec("select guid, updateSequenceNumber from note where active = false");\r
                List<String> guids = new ArrayList<String>();\r
@@ -709,9 +729,11 @@ public class NoteTable {
                        else\r
                                expungeNote(guid, false, true);\r
                }\r
                        else\r
                                expungeNote(guid, false, true);\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.expungeAllDeletedNotes");\r
        }\r
        // Update the note sequence number\r
        public void updateNoteSequence(String guid, int sequence) {\r
        }\r
        // Update the note sequence number\r
        public void updateNoteSequence(String guid, int sequence) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteSequence");\r
                boolean check;\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
                check = query.prepare("Update Note set updateSequenceNumber=:sequence where guid=:guid");\r
                boolean check;\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
                check = query.prepare("Update Note set updateSequenceNumber=:sequence where guid=:guid");\r
@@ -724,9 +746,11 @@ public class NoteTable {
                        logger.log(logger.MEDIUM, "Note sequence update failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                } \r
                        logger.log(logger.MEDIUM, "Note sequence update failed.");\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                } \r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteSequence");\r
        }\r
        // Update the note Guid\r
        public void updateNoteGuid(String oldGuid, String newGuid) {\r
        }\r
        // Update the note Guid\r
        public void updateNoteGuid(String oldGuid, String newGuid) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNoteGuid");\r
                boolean check;\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         NSqlQuery resQuery = new NSqlQuery(db.getResourceConnection());\r
                boolean check;\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         NSqlQuery resQuery = new NSqlQuery(db.getResourceConnection());\r
@@ -768,9 +792,11 @@ public class NoteTable {
                        logger.log(logger.MEDIUM, "Note guid update failed for noteresources.");\r
                        logger.log(logger.MEDIUM, resQuery.lastError());\r
                }\r
                        logger.log(logger.MEDIUM, "Note guid update failed for noteresources.");\r
                        logger.log(logger.MEDIUM, resQuery.lastError());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNoteGuid");\r
        }\r
        // Update a note\r
        public void updateNote(Note n) {\r
        }\r
        // Update a note\r
        public void updateNote(Note n) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.updateNote");\r
                NoteMetadata meta = getNoteMetaInformation(n.getGuid());\r
                String originalGuid = findAlternateGuid(n.getGuid());\r
                expungeNote(n.getGuid(), true, false);\r
                NoteMetadata meta = getNoteMetaInformation(n.getGuid());\r
                String originalGuid = findAlternateGuid(n.getGuid());\r
                expungeNote(n.getGuid(), true, false);\r
@@ -782,6 +808,7 @@ public class NoteTable {
                        updateNoteGuid(n.getGuid(), originalGuid);\r
                        updateNoteGuid(originalGuid, n.getGuid());\r
                }\r
                        updateNoteGuid(n.getGuid(), originalGuid);\r
                        updateNoteGuid(originalGuid, n.getGuid());\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.updateNote");\r
        }\r
        // Does a note exist?\r
        public boolean exists(String guid) {\r
        }\r
        // Does a note exist?\r
        public boolean exists(String guid) {\r
@@ -813,6 +840,7 @@ public class NoteTable {
        }\r
        // This is a convience method to check if a note exists & update/create based upon it\r
        public void syncNote(Note note) {\r
        }\r
        // This is a convience method to check if a note exists & update/create based upon it\r
        public void syncNote(Note note) {\r
+               logger.log(logger.HIGH, "Entering NoteTable.syncNote");\r
                // If we got the note from Evernote we use its \r
                // metadata instead of the local copy.\r
                NoteMetadata meta = null;\r
                // If we got the note from Evernote we use its \r
                // metadata instead of the local copy.\r
                NoteMetadata meta = null;\r
@@ -834,6 +862,7 @@ public class NoteTable {
                        meta.setGuid(note.getGuid());\r
                        updateNoteMetadata(meta);\r
                }\r
                        meta.setGuid(note.getGuid());\r
                        updateNoteMetadata(meta);\r
                }\r
+               logger.log(logger.HIGH, "Leaving NoteTable.syncNote");\r
        }\r
        // Get a list of notes that need to be updated\r
        public List <Note> getDirty() {\r
        }\r
        // Get a list of notes that need to be updated\r
        public List <Note> getDirty() {\r
@@ -861,6 +890,7 @@ public class NoteTable {
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
+               logger.log(logger.LOW, "Dirty local notes: " +new Integer(notes.size()).toString());\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
@@ -889,6 +919,7 @@ public class NoteTable {
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
+               logger.log(logger.LOW, "Dirty linked local notes: " +new Integer(notes.size()).toString());\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
@@ -919,6 +950,7 @@ public class NoteTable {
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
                        tempNote = getNote(index.get(i), true,true,false,true,true);\r
                        notes.add(tempNote);\r
                }\r
+               logger.log(logger.LOW, "Dirty local notes for notebook " +notebookGuid +": " +new Integer(notes.size()).toString());\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
@@ -966,6 +998,7 @@ public class NoteTable {
 \r
        // Reset the dirty bit\r
        public void  resetDirtyFlag(String guid) {\r
 \r
        // Reset the dirty bit\r
        public void  resetDirtyFlag(String guid) {\r
+               logger.log(logger.LOW, "Resetting dirty flag for " +guid);\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                \r
                query.prepare("Update note set isdirty=false where guid=:guid");\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                \r
                query.prepare("Update note set isdirty=false where guid=:guid");\r
@@ -1021,6 +1054,42 @@ public class NoteTable {
                query.exec("select count(guid) from note where isDirty=true and isExpunged = false");\r
                query.next(); \r
                int returnValue = new Integer(query.valueString(0));\r
                query.exec("select count(guid) from note where isDirty=true and isExpunged = false");\r
                query.next(); \r
                int returnValue = new Integer(query.valueString(0));\r
+               logger.log(logger.LOW, "dirty count: " +returnValue);\r
+               //query.exec("select count(guid) from note where isDirty=true and Active = 0 and isExpunged = false");\r
+               //query.next(); \r
+               //logger.log(logger.LOW, "dirty count (active only): " +query.valueString(0));\r
+               //query.exec("Select count(guid) from Note where isDirty = true and isExpunged = false and notebookGuid not in (select guid from notebook where local = true or linked = true)");\r
+               //query.next(); \r
+               //logger.log(logger.LOW, "dirty count (no l&l notebooks): " +query.valueString(0));\r
+               //logger.log(logger.LOW, "Beginning stack trace");\r
+               //logger.log(logger.LOW, Thread.currentThread().getStackTrace());\r
+\r
+               //logger.log(logger.LOW, "*************************");\r
+               //logger.log(logger.LOW, "*** DIRTY RECORD DUMP ***");\r
+               //logger.log(logger.LOW, "*************************");\r
+               //List<Note> recs = getDirty();\r
+               //for (int i=0; i<recs.size(); i++) {\r
+                       //Note n = getNote(recs.get(i).getGuid(), true, true, true, false, true);\r
+                       //logger.log(logger.LOW, "-- Begin Record ---");\r
+                       //logger.log(logger.LOW, "Guid: " +n.getGuid());\r
+                       //logger.log(logger.LOW, "Title: " +n.getTitle());\r
+                       //logger.log(logger.LOW, "Active: " +n.isActive());\r
+                       //logger.log(logger.LOW, "USN: " +n.getUpdateSequenceNum());\r
+                       //logger.log(logger.LOW, "Date Created: " +n.getCreated());\r
+                       //logger.log(logger.LOW, "Date Updated: " +n.getUpdated());\r
+                       //logger.log(logger.LOW, "Date Deleted: " +n.getDeleted());\r
+                       //logger.log(logger.LOW, "Resource Count: " +n.getResourcesSize());\r
+                       //for (int j=0; j<n.getResourcesSize(); j++) {\r
+                               //Resource r = n.getResources().get(j);\r
+                               //logger.log(logger.LOW, "Resource " +j +": " +r.getGuid());\r
+                               //logger.log(logger.LOW, "Active: " +r.isActive());\r
+                               //logger.log(logger.LOW, "USN: " +r.getUpdateSequenceNum());\r
+                       //}\r
+                       //logger.log(logger.LOW, "-- End Record ---");\r
+               //}\r
+               //logger.log(logger.LOW, "*****************************");\r
+               //logger.log(logger.LOW, "*** End DIRTY RECORD DUMP ***");\r
+               //logger.log(logger.LOW, "*****************************");\r
                return returnValue;\r
        }\r
        // Count notes\r
                return returnValue;\r
        }\r
        // Count notes\r
index f421a4e..05d8f4d 100644 (file)
@@ -103,10 +103,20 @@ public class SyncTable {
 \r
        // Set the last sequence date\r
        public void setLastSequenceDate(long date) {\r
 \r
        // Set the last sequence date\r
        public void setLastSequenceDate(long date) {\r
+               logger.log(logger.LOW, "Updating Last Sequence Date: " +date);\r
+               long old = getLastSequenceDate();\r
+               logger.log(logger.LOW, "Old Last Sequence Date: " +old);\r
+               if (date < old) \r
+                       logger.log(logger.LOW, "************* SEQUENCE DATE PROBLEM!!! "+(old-date));\r
                setRecord("LastSequenceDate", new Long(date).toString());\r
        }\r
        // Set the last sequence date\r
        public void setUpdateSequenceNumber(int number) {\r
                setRecord("LastSequenceDate", new Long(date).toString());\r
        }\r
        // Set the last sequence date\r
        public void setUpdateSequenceNumber(int number) {\r
+               logger.log(logger.LOW, "Updating Last Sequence Number: " +number);\r
+               int old = getUpdateSequenceNumber();\r
+               logger.log(logger.LOW, "Old Last Sequence Number: " +old);\r
+               if (number < old) \r
+                       logger.log(logger.LOW, "************* SEQUENCE NUMBER PROBLEM!!! "+(old-number));\r
                setRecord("UpdateSequenceNumber", new Integer(number).toString());\r
        }\r
        // get last sequence date\r
                setRecord("UpdateSequenceNumber", new Integer(number).toString());\r
        }\r
        // get last sequence date\r
index 4709e6d..9933f25 100644 (file)
@@ -198,6 +198,7 @@ public class SyncRunner extends QObject implements Runnable {
                        while(keepRunning) {\r
                                logger.log(logger.EXTREME, "Blocking until work is found");\r
                                String work = workQueue.take();\r
                        while(keepRunning) {\r
                                logger.log(logger.EXTREME, "Blocking until work is found");\r
                                String work = workQueue.take();\r
+                               logger.log(logger.LOW, "Dirty Notes Before Sync: " +new Integer(conn.getNoteTable().getDirtyCount()).toString());\r
                                logger.log(logger.EXTREME, "Work found: " +work);\r
                                if (work.equalsIgnoreCase("stop")) {\r
                                        idle=false;\r
                                logger.log(logger.EXTREME, "Work found: " +work);\r
                                if (work.equalsIgnoreCase("stop")) {\r
                                        idle=false;\r
@@ -225,6 +226,7 @@ public class SyncRunner extends QObject implements Runnable {
                                        syncSignal.errorDisconnect.emit();\r
                                        status.message.emit(tr("Error synchronizing - see log for details."));\r
                                }\r
                                        syncSignal.errorDisconnect.emit();\r
                                        status.message.emit(tr("Error synchronizing - see log for details."));\r
                                }\r
+                               logger.log(logger.LOW, "Dirty Notes After Sync: " +new Integer(conn.getNoteTable().getDirtyCount()).toString());\r
                        }\r
                }       \r
                catch (InterruptedException e1) {\r
                        }\r
                }       \r
                catch (InterruptedException e1) {\r
@@ -586,6 +588,7 @@ public class SyncRunner extends QObject implements Runnable {
        // Sync notes with Evernote\r
        private void syncLocalNotes() {\r
                logger.log(logger.HIGH, "Entering SyncRunner.syncNotes");\r
        // Sync notes with Evernote\r
        private void syncLocalNotes() {\r
                logger.log(logger.HIGH, "Entering SyncRunner.syncNotes");\r
+               logger.log(logger.LOW, "Dirty local notes found: " +new Integer(conn.getNoteTable().getDirtyCount()).toString());\r
                status.message.emit(tr("Sending local notes."));\r
 \r
                List<Note> notes = conn.getNoteTable().getDirty();\r
                status.message.emit(tr("Sending local notes."));\r
 \r
                List<Note> notes = conn.getNoteTable().getDirty();\r
@@ -1215,16 +1218,22 @@ public class SyncRunner extends QObject implements Runnable {
                // 3.) If a copy of the resource is in the local databbase and it is dirty and the hash doesn't match, we ignore it because there\r
                //     is a conflict.  The note conflict should get a copy of the resource at that time.\r
                \r
                // 3.) If a copy of the resource is in the local databbase and it is dirty and the hash doesn't match, we ignore it because there\r
                //     is a conflict.  The note conflict should get a copy of the resource at that time.\r
                \r
+               Note n = conn.getNoteTable().getNote(resource.getNoteGuid(), false, false, false, false, false);\r
+               if (n!=null) {\r
+                       logger.log(logger.HIGH, "Resource for note " +n.getGuid() +" : " +n.getTitle());\r
+               }\r
                boolean saveNeeded = false;\r
                /* #1 */                Resource r = getEvernoteResource(noteStore, resource.getGuid(), true,true,true, authToken);\r
                                                Resource l = conn.getNoteTable().noteResourceTable.getNoteResource(r.getGuid(), false);\r
                                                if (l == null) {\r
                boolean saveNeeded = false;\r
                /* #1 */                Resource r = getEvernoteResource(noteStore, resource.getGuid(), true,true,true, authToken);\r
                                                Resource l = conn.getNoteTable().noteResourceTable.getNoteResource(r.getGuid(), false);\r
                                                if (l == null) {\r
+                                                       logger.log(logger.HIGH, "Local resource not found");\r
                                                        saveNeeded = true;\r
                                                } else {\r
                /* #2 */                        boolean isNoteDirty = conn.getNoteTable().isNoteDirty(r.getNoteGuid());\r
                                                        saveNeeded = true;\r
                                                } else {\r
                /* #2 */                        boolean isNoteDirty = conn.getNoteTable().isNoteDirty(r.getNoteGuid());\r
-                                                       if (!isNoteDirty)\r
+                                                       if (!isNoteDirty) {\r
+                                                               logger.log(logger.HIGH, "Local resource found, but is not dirty");\r
                                                                saveNeeded = true;\r
                                                                saveNeeded = true;\r
-                                                       else {\r
+                                                       else {\r
                /* #3 */                                String remoteHash = "";\r
                                                                if (r != null && r.getData() != null && r.getData().getBodyHash() != null)\r
                                                                        remoteHash = byteArrayToHexString(r.getData().getBodyHash());\r
                /* #3 */                                String remoteHash = "";\r
                                                                if (r != null && r.getData() != null && r.getData().getBodyHash() != null)\r
                                                                        remoteHash = byteArrayToHexString(r.getData().getBodyHash());\r
@@ -1237,10 +1246,12 @@ public class SyncRunner extends QObject implements Runnable {
                                                        }\r
                                                }\r
                                                \r
                                                        }\r
                                                }\r
                                                \r
+                                               logger.log(logger.HIGH, "Resource save needed: " +saveNeeded);\r
                                                if (saveNeeded) \r
                                                        conn.getNoteTable().noteResourceTable.updateNoteResource(r, false);\r
                                                if (r.getMime().equalsIgnoreCase("application/vnd.evernote.ink"))\r
                                                        downloadInkNoteImage(r.getGuid(), authToken);\r
                                                if (saveNeeded) \r
                                                        conn.getNoteTable().noteResourceTable.updateNoteResource(r, false);\r
                                                if (r.getMime().equalsIgnoreCase("application/vnd.evernote.ink"))\r
                                                        downloadInkNoteImage(r.getGuid(), authToken);\r
+               \r
 \r
        }\r
        // Sync remote notes\r
 \r
        }\r
        // Sync remote notes\r
index eacdfcc..d041235 100644 (file)
@@ -65,8 +65,6 @@ public class FileImporter  {
        //********************************************************\r
        public boolean importFile() {\r
                if (fileInfo.isFile()) {\r
        //********************************************************\r
        public boolean importFile() {\r
                if (fileInfo.isFile()) {\r
-                       if (!validAttachment(fileInfo.completeSuffix()))\r
-                               return false;\r
                        if (fileInfo.completeSuffix().equalsIgnoreCase("txt"))\r
                                return importTextFile();\r
                        return importAttachment();\r
                        if (fileInfo.completeSuffix().equalsIgnoreCase("txt"))\r
                                return importTextFile();\r
                        return importAttachment();\r
@@ -177,31 +175,6 @@ public class FileImporter  {
        return true;\r
        }\r
        \r
        return true;\r
        }\r
        \r
-       //********************************************************\r
-       //* Check if we found a valid file type\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
-               if (type.equalsIgnoreCase("TXT"))\r
-                       return true;\r
-               return false;\r
-       }\r
        \r
        //********************************************************\r
        //* Check if we found an image\r
        \r
        //********************************************************\r
        //* Check if we found an image\r
@@ -265,11 +238,7 @@ public class FileImporter  {
        public boolean isValidType() {\r
                if (!checkFileAttachmentSize(fileName))\r
                        return false;\r
        public boolean isValidType() {\r
                if (!checkFileAttachmentSize(fileName))\r
                        return false;\r
-               if (fileInfo.completeSuffix().equalsIgnoreCase("txt"))\r
-                       return true;\r
-               if (validAttachment(fileInfo.completeSuffix()))\r
-                       return true;\r
-               return false;\r
+               return true;\r
        }\r
        //**************************************************************\r
        //* Check the file attachment to be sure it isn't over 25 mb\r
        }\r
        //**************************************************************\r
        //* Check the file attachment to be sure it isn't over 25 mb\r