Upload notes that belong to me
| 770 | |
| 771 | // Upload notes that belong to me |
| 772 | qint32 SyncRunner::uploadLinkedNotes(qint32 notebookLid) { |
| 773 | QLOG_TRACE_IN(); |
| 774 | qint32 usn; |
| 775 | qint32 maxUsn = 0; |
| 776 | NoteTable noteTable(db); |
| 777 | QList<qint32> lids, validLids, deletedLids; |
| 778 | noteTable.getAllDirty(lids, notebookLid); |
| 779 | |
| 780 | // Split the list into deleted and updated notes |
| 781 | for (int i=0; i<lids.size(); i++) { |
| 782 | if (noteTable.isDeleted(lids[i])) |
| 783 | deletedLids.append(lids[i]); |
| 784 | else |
| 785 | validLids.append(lids[i]); |
| 786 | } |
| 787 | |
| 788 | // Start deleting notes |
| 789 | for (int i=0; i<deletedLids.size(); i++) { |
| 790 | QString guid = noteTable.getGuid(deletedLids[i]); |
| 791 | noteTable.setDirty(lids[i], false); |
| 792 | usn = comm->deleteLinkedNote(guid); |
| 793 | if (usn > maxUsn) { |
| 794 | maxUsn = usn; |
| 795 | noteTable.setUpdateSequenceNumber(deletedLids[i], usn); |
| 796 | noteTable.setDirty(deletedLids[i], false); |
| 797 | if (!finalSync) |
| 798 | emit(noteSynchronized(deletedLids[i], false)); |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | |
| 803 | // Start deleting notes that were in the trash, but the trash was |
| 804 | // emptied. |
| 805 | NotebookTable bookTable(db); |
| 806 | QString notebookGuid = ""; |
| 807 | bookTable.getGuid(notebookGuid, notebookLid); |
| 808 | |
| 809 | // Get all of the notes |
| 810 | QStringList deleteQueueGuids; |
| 811 | noteTable.getAllDeleteQueue(deleteQueueGuids, notebookGuid); |
| 812 | |
| 813 | |
| 814 | // Do the actual deletes |
| 815 | for (int i=0; i<deleteQueueGuids.size(); i++) { |
| 816 | QString guid = deleteQueueGuids[i]; |
| 817 | usn = comm->deleteLinkedNote(guid); |
| 818 | if (usn > maxUsn) { |
| 819 | maxUsn = usn; |
| 820 | } |
| 821 | noteTable.expungeFromDeleteQueue(guid); |
| 822 | } |
| 823 | |
| 824 | |
| 825 | // Start uploading notes |
| 826 | for (int i=0; i<validLids.size(); i++) { |
| 827 | Note note; |
| 828 | noteTable.get(note, validLids[i],true, true); |
| 829 | qint32 oldUsn = note.updateSequenceNum; |
nothing calls this directly
no test coverage detected