#include "EventTypes/EventFromFileList.h"
#include "EventTypes/iEvent.h"
#include "EventLogBackupManager.h"
-#include "EventLogReindexer.h"
#include "EventParsers/Factory.h"
#include "EventParsers/iEventParser.h"
#include <QFile>
#include <QFileInfo>
#include <QProcess>
+#include <QSharedPointer>
#include <stdexcept>
foreach(iHashable::Hash hash, newHashes)
qDebug() << hash << endl;
- // Now an optimisation: group the new hases by the files they come
+ // Now an optimisation: group the new hashes by the files they come
// from. This enables each file to only be parsed once and return
// all the required events from it.
QHash<QString, QList<iHashable::Hash> > newHashesByPath;
qDebug() << "Importing new events";
- // Re-parse the new events
+ // Re-parse the new events and insert them
+ allBackends.PreInsert();
{
int idx = 0;
foreach(QString filename, newHashesByPath.keys())
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
{
qDebug() << "Unable to insert event: " << exception.what();
}
+
+ emit EventProcessed(++idx, newHashes.count());
}
}
catch(const std::runtime_error &exception)
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();
+ allBackends.PostInsert(); // Perform any post-insert cleanup (i.e. reindexing)
// Need to find a better way of refreshing the conversations view...
QProcess::execute("pkill rtcom");