Commit 59f0bdb6 authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

Add database cleanup calls to have a clean shutdown of SQLite data at application termination

parent b9f8dbfe
......@@ -62,6 +62,7 @@
#include "databaseparameters.h"
#include "digikamapp.h"
#include "scancontroller.h"
#include "thumbnaildatabaseaccess.h"
#include "version.h"
using namespace Digikam;
......@@ -235,6 +236,8 @@ int main(int argc, char* argv[])
int ret = app.exec();
DatabaseAccess::cleanUpDatabase();
ThumbnailDatabaseAccess::cleanUpDatabase();
KExiv2Iface::KExiv2::cleanupExiv2();
return ret;
......
......@@ -30,6 +30,7 @@
#include <QSqlDatabase>
#include <QDBusConnection>
#include <QString>
#include <QTimer>
// KDE includes
......@@ -47,6 +48,7 @@
#include "databaseparameters.h"
#include "scancontroller.h"
#include "setup.h"
#include "thumbnaildatabaseaccess.h"
#include "version.h"
namespace Digikam
......@@ -76,16 +78,28 @@ int main(int argc, char** argv)
KCmdLineArgs::init(argc, argv, &aboutData);
KApplication app;
DatabaseParameters params = DatabaseParameters::parametersFromConfig(KGlobal::config());
DatabaseParameters params;
params.databaseType = DatabaseParameters::SQLiteDatabaseType();
params.setDatabasePath(QDir::currentPath() + "/digikam-test.db");
params.setThumbsDatabasePath(QDir::currentPath() + "/digikam-thumbs-test.db");
params.legacyAndDefaultChecks();
QDBusConnection::sessionBus().registerService("org.kde.digikam.startup-" +
QString::number(QCoreApplication::instance()->applicationPid()));
// initialize database
bool b = AlbumManager::instance()->setDatabase(params, false);
bool b = AlbumManager::instance()->setDatabase(params, false, "/media/fotos/Digikam Sample/");
kDebug() << "Database initialization done: " << b;
QTimer::singleShot(500, &app, SLOT(quit()));
app.exec();
ScanController::instance()->shutDown();
DatabaseAccess::cleanUpDatabase();
ThumbnailDatabaseAccess::cleanUpDatabase();
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment