|
|
|
@ -55,21 +55,50 @@ void Context::loadPlugins()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString dbPath = m_settings->value("db/path", "").toString();
|
|
|
|
|
if (!dbPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
openDb(dbPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Context::openDb(const QString &path)
|
|
|
|
|
{
|
|
|
|
|
if (m_db != NULL) {
|
|
|
|
|
delete m_db;
|
|
|
|
|
m_dbOpened = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkDb(path);
|
|
|
|
|
m_db = new odb::sqlite::database(path.toStdString());
|
|
|
|
|
m_settings->setValue("db/path", path);
|
|
|
|
|
m_dbOpened = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Context::destroy()
|
|
|
|
|
{
|
|
|
|
|
if (m_db != NULL)
|
|
|
|
|
{
|
|
|
|
|
delete m_db;
|
|
|
|
|
m_db = NULL;
|
|
|
|
|
m_dbOpened = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete m_settings;
|
|
|
|
|
|
|
|
|
|
foreach (IPlugin *plugin, m_plugins)
|
|
|
|
|
{
|
|
|
|
|
delete plugin;
|
|
|
|
|
}
|
|
|
|
|
m_plugins.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Context::Context()
|
|
|
|
|
{
|
|
|
|
|
m_db = NULL;
|
|
|
|
|
m_settings = new QSettings("itsolved.cz", "prodejna");
|
|
|
|
|
m_dbOpened = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Context::checkDb(const QString &path)
|
|
|
|
|