Move RtcomEventLogger DB path out into settings. Ideally, it'd be nice to have the...
[qwerkisync] / DBBackends / RtcomEventLogger.cpp
index aac4790..264b65a 100644 (file)
@@ -54,7 +54,7 @@ QDebug operator<<(QDebug, GList &);
 QDebug operator<<(QDebug, QList<RTComElAttachment*> &);
 
 RtcomEventLogger::RtcomEventLogger(const Settings &settings) :
-       m_Settings(settings), mk_DBPath("/.rtcom-eventlogger/el-v1.db")
+       m_Settings(settings)
 {
        RTComEl *el(rtcom_el_new());
        if(NULL != el)
@@ -77,7 +77,7 @@ RtcomEventLogger::RtcomEventLogger(const Settings &settings) :
 }
 
 RtcomEventLogger::RtcomEventLogger(const Settings &settings, const EventTypes::RtcomEvent &event) :
-       m_Settings(settings), mk_DBPath("/.rtcom-eventlogger/el-v1.db")
+       m_Settings(settings)
 {
 }
 
@@ -340,10 +340,10 @@ void RtcomEventLogger::ClearInsertedIDs()
 void RtcomEventLogger::Reindex()
 {
        // Set up the database connection...
-       QSqlDatabase db(QSqlDatabase::addDatabase( "QSQLITE" ));
+       QSqlDatabase db(QSqlDatabase::addDatabase("QSQLITE"));
 
-       db.setDatabaseName( QDir::homePath() + mk_DBPath );
-       if ( ! db.open() )
+       db.setDatabaseName(CurrentSettings().DBPath());
+       if(!db.open())
        {
                throw std::runtime_error("Cannot open database: Unable to establish database connection");
        }