[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/extragear/graphics/digikam/1.0-databaseext
From:       Holger Foerster <hamsi2k () freenet ! de>
Date:       2010-01-19 21:12:18
Message-ID: 1263935538.618149.13913.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1077269 by foerster:

Improved database switch support.
Disconnect all database error handlers first before new database settings are \
activated.

 M  +4 -12     digikam/albummanager.cpp  
 M  +4 -0      libs/database/databaseaccess.cpp  
 M  +4 -1      libs/database/databasecorebackend.cpp  
 M  +4 -0      libs/database/thumbnaildatabaseaccess.cpp  


--- branches/extragear/graphics/digikam/1.0-databaseext/digikam/albummanager.cpp \
#1077268:1077269 @@ -442,11 +442,6 @@
     // if there is no file at the new place, copy old one
     DatabaseParameters params = DatabaseAccess::parameters();
 
-    kDebug(50003) << "Comparing old database name ["<< params.databaseName <<"] with \
type ["<< params.databaseType <<"] with new database name ["<< dbName <<"] with type \
["<< dbType <<"] and setting internal server ["<< d->dbInternalServer <<"] with new \
                ["<< internalServer <<"].";
-
-    if (d->dbName == dbName && params.databaseType == dbType && \
                d->dbInternalServer==internalServer)
-        return;
-
     // New database type SQLITE
     if (dbType == "SQLITE"){
         QDir newDir(dbName);
@@ -582,11 +577,9 @@
         DigikamApp::instance()->stopInternalDatabase();
     }
 
-    if (dbName.isEmpty())
-        return false;
-
     // This is to ensure that the setup does not overrule the command line.
     // Replace with a better solution?
+    /*
     if (priority)
     {
         d->hasPriorizedDbPath = true;
@@ -597,10 +590,8 @@
         // true means, don't exit()
         return true;
     }
+    */
 
-    if (d->dbName == dbName && d->dbInternalServer == internalServer)
-        return true;
-
     // shutdown possibly running collection scans. Must call resumeCollectionScan \
further down.  ScanController::instance()->cancelAllAndSuspendCollectionScan();
     QApplication::setOverrideCursor(Qt::WaitCursor);
@@ -979,7 +970,8 @@
             dbConnectOptions,
             new DatabaseThumbnailInfoProvider());
 
-    ThumbnailDatabaseAccess::initDatabaseErrorHandler(handler);
+    DatabaseGUIErrorHandler *thumbnailsDBHandler = new \
DatabaseGUIErrorHandler(ThumbnailDatabaseAccess::parameters()); +    \
ThumbnailDatabaseAccess::initDatabaseErrorHandler(thumbnailsDBHandler);  
     QApplication::restoreOverrideCursor();
 #endif
--- branches/extragear/graphics/digikam/1.0-databaseext/libs/database/databaseaccess.cpp \
#1077268:1077269 @@ -186,6 +186,10 @@
     if (d->backend && d->backend->isOpen())
         d->backend->close();
 
+    // Kill the old database error handler
+    if (d->backend)
+        d->backend->setDatabaseErrorHandler(0);
+
     d->parameters = parameters;
 
     if (!d->databaseWatch)
--- branches/extragear/graphics/digikam/1.0-databaseext/libs/database/databasecorebackend.cpp \
#1077268:1077269 @@ -490,11 +490,14 @@
 void DatabaseCoreBackend::setDatabaseErrorHandler(DatabaseErrorHandler *handler)
 {
     Q_D(DatabaseCoreBackend);
-    if (handler->thread() != QCoreApplication::instance()->thread())
+    if (handler!=0 && handler->thread() != QCoreApplication::instance()->thread())
     {
         kError(50003) << "DatabaseErrorHandler must live in the main thread";
         Q_ASSERT(false);
     }
+    if (d->errorHandler!=0){
+        d->errorHandler->~QObject();
+    }
     d->errorHandler = handler;
 }
 
--- branches/extragear/graphics/digikam/1.0-databaseext/libs/database/thumbnaildatabaseaccess.cpp \
#1077268:1077269 @@ -153,6 +153,10 @@
     if (d->backend && d->backend->isOpen())
         d->backend->close();
 
+    // Kill the old database error handler
+    if (d->backend)
+        d->backend->setDatabaseErrorHandler(0);
+
     d->parameters = parameters;
 
     if (!d->backend || !d->backend->isCompatible(parameters))


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic