Bug 118543

Summary: enable-nfs-hack no longer works
Product: [Applications] digikam Reporter: hads <hads>
Component: Portability-CmakeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:

Description hads 2005-12-17 22:48:59 UTC
Version:           0.8 (using KDE KDE 3.5.0)
Installed from:    Unlisted Binary Package
Compiler:          GCC4 
OS:                Linux

digikam compiled with the --enable-nfs-hack no longer works. It throws the error "Failed to open new Album Database" on startup.
Comment 1 Tom Albers 2005-12-26 21:18:35 UTC
SVN commit 491610 by toma:

Fix the unsupported feature --enable-nfs-hack again. Adjusted the upgradedb class to convert to and from a digikam compiled with that parameter. Also fixed the kioslave, which did not included the config.h, thus NFS_HACK contained the wrong value, so the hack did not work at all in 0.8.0.

Please test if you are using this unsupported feature.
CCMAIL: digikam-users@kde.org
BUG: 118543



 M  +20 -4     digikam/upgradedb_sqlite2tosqlite3.cpp  
 M  +2 -0      kioslave/sqlitedb.cpp  


--- trunk/extragear/graphics/digikam/digikam/upgradedb_sqlite2tosqlite3.cpp #491609:491610
@@ -25,6 +25,8 @@
 #include <qfileinfo.h>
 
 #include <kdebug.h>
+#include <kstandarddirs.h>
+#include <kio/global.h>
 #include <iostream>
 
 #include "albumdb.h"
@@ -85,9 +87,15 @@
 {
     QString libraryPath = QDir::cleanDirPath(_libraryPath);
 
+    QString newDB= libraryPath + "/digikam3.db";
+
+#ifdef NFS_HACK
+    newDB = locateLocal("appdata", KIO::encodeFileName(QDir::cleanDirPath(newDB)));
+    kdDebug() << "NFS: " << newDB << endl;
+#endif
+    
     AlbumDB db3;
-    db3.setDBPath(libraryPath + "/digikam3.db");
-    
+    db3.setDBPath(newDB);
     if (!db3.isValid())
     {
 	kdWarning() << "Failed to open new Album Database" << endl;
@@ -97,7 +105,15 @@
     if (db3.getSetting("UpgradedFromSqlite2") == "yes")
 	return true;
 
-    QFileInfo fi(libraryPath + "/digikam.db");
+    QString dbPath = libraryPath + "/digikam.db";
+
+#ifdef NFS_HACK
+    dbPath = locateLocal("appdata", KIO::encodeFileName(QDir::cleanDirPath(dbPath)));
+    kdDebug() << "From NFS: " << dbPath << endl;
+#endif
+        
+    QFileInfo fi(dbPath);
+
     if (!fi.exists())
     {
 	kdDebug() << "No old database present. Not upgrading" << endl;
@@ -106,7 +122,7 @@
     }
 
     AlbumDB_Sqlite2 db2;
-    db2.setDBPath(libraryPath + "/digikam.db");
+    db2.setDBPath( dbPath );
     if (!db2.isValid())
     {
 	kdDebug() << "Failed to initialize Old Album Database" << endl;
--- trunk/extragear/graphics/digikam/kioslave/sqlitedb.cpp #491609:491610
@@ -28,6 +28,8 @@
 
 #include "sqlitedb.h"
 
+#include "config.h" // Needed for NFS_HACK
+
 SqliteDB::SqliteDB()
 {
     m_db = 0;