Added parsing of CSV-formatted Symbian event logs
[qwerkisync] / SyncerThread.cpp
index 55fce3c..da36473 100644 (file)
@@ -28,7 +28,6 @@
 #include "EventTypes/EventFromFileList.h"
 #include "EventTypes/iEvent.h"
 #include "EventLogBackupManager.h"
-#include "EventLogReindexer.h"
 #include "EventParsers/Factory.h"
 #include "EventParsers/iEventParser.h"
 
@@ -37,6 +36,7 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QProcess>
+#include <QSharedPointer>
 
 #include <stdexcept>
 
@@ -196,8 +196,6 @@ void SyncerThread::run()
                                        foreach(iHashable::Hash newHash, newHashesByPath.value(filename))
                                                recordsToReturn.append(pathsByHashes.value(newHash).second);
 
-                                       ++idx;
-
                                        // Repeating an action that caused an exception last time
                                        // shouldn't happen again, but just in case...
                                        try
@@ -213,6 +211,8 @@ void SyncerThread::run()
                                                        {
                                                                qDebug() << "Unable to insert event: " << exception.what();
                                                        }
+
+                                                       emit EventProcessed(++idx, newHashes.count());
                                                }
                                        }
                                        catch(const std::runtime_error &exception)
@@ -220,14 +220,14 @@ void SyncerThread::run()
                                                qDebug() << exception.what() << endl;
                                        }
 
+                                       // Just to make sure the listeners are synced even if the
+                                       // earlier call is skipped due to errors...
                                        emit EventProcessed(idx, newHashes.count());
                                }
                        }
 
-                       // Reorder the DB IDs as Nokia are guilty of both premature
-                       // optimisation as well as closed source UIs...
-                       EventLogReindexer reindexer;
-                       reindexer.Reindex();
+                       // Perform any post-insert cleanup (i.e. reindexing)
+                       allBackends.PostInsert();
 
                        // Need to find a better way of refreshing the conversations view...
                        QProcess::execute("pkill rtcom");