79 initDbPath(); |
79 initDbPath(); |
80 iDatabaseManagerSignalHandler = new DatabaseManagerSignalHandler(*this); |
80 iDatabaseManagerSignalHandler = new DatabaseManagerSignalHandler(*this); |
81 } |
81 } |
82 |
82 |
83 CDatabaseManagerServerSession::CDatabaseManagerServerSession(CDatabaseManagerServer& aServer) |
83 CDatabaseManagerServerSession::CDatabaseManagerServerSession(CDatabaseManagerServer& aServer) |
84 : iDatabaseManagerSignalHandler(NULL), |
84 : iServer(aServer), |
|
85 iDatabaseManagerSignalHandler(NULL), |
85 iDb(NULL), |
86 iDb(NULL), |
86 m_watcher(NULL), |
87 m_watcher(NULL) |
87 iServer(aServer) |
|
88 { |
88 { |
89 iServer.IncreaseSessions(); |
89 iServer.IncreaseSessions(); |
90 } |
90 } |
91 |
91 |
92 CDatabaseManagerServerSession::~CDatabaseManagerServerSession() |
92 CDatabaseManagerServerSession::~CDatabaseManagerServerSession() |
553 } |
553 } |
554 } |
554 } |
555 |
555 |
556 void CDatabaseManagerServerSession::initDbPath() |
556 void CDatabaseManagerServerSession::initDbPath() |
557 { |
557 { |
558 QSettings::Scope settingsScope = QSettings::SystemScope;; |
|
559 QString dbIdentifier = "_system"; |
558 QString dbIdentifier = "_system"; |
560 ServiceDatabase *db = iDb; |
559 ServiceDatabase *db = iDb; |
561 QSettings settings(QSettings::IniFormat, settingsScope, |
|
562 QLatin1String("Nokia"), QLatin1String("QtServiceFramework")); |
|
563 QFileInfo fi(settings.fileName()); |
|
564 #ifdef __WINS__ |
560 #ifdef __WINS__ |
565 // In emulator use commmon place for service database |
561 // In emulator use commmon place for service database |
566 // instead of server's private directory (server is in thread, so each |
562 // instead of server's private directory (on emulator server is in thread so it |
567 // application gets its own private directory) |
563 // doesn't get its own private directory). |
568 QDir dir; |
564 QDir dir(QDir::toNativeSeparators("C:\\Data\\temp\\QtServiceFW")); |
569 QString serviceDbPath = QDir::toNativeSeparators("C:/Data/temp/QtServiceFW"); |
|
570 dir.mkpath(serviceDbPath); |
|
571 if (!dir.cd(serviceDbPath)) { |
|
572 qWarning() << "Fatal error: could not create needed path for serviceDatabase: " << serviceDbPath; |
|
573 User::Panic(_L("PLAT (emulator)"), 0); |
|
574 } |
|
575 #else |
565 #else |
576 QDir dir = fi.dir(); |
566 // On hardware, use this DB server's private directory (C:/Private/<UID3>) |
|
567 QDir dir(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\Nokia")); |
577 #endif |
568 #endif |
578 QString qtVersion(qVersion()); |
569 QString qtVersion(qVersion()); |
579 qtVersion = qtVersion.left(qtVersion.size() -2); //strip off patch version |
570 qtVersion = qtVersion.left(qtVersion.size() -2); //strip off patch version |
580 QString dbName = QString("QtServiceFramework_") + qtVersion + dbIdentifier + QLatin1String(".db"); |
571 QString dbName = QString("QtServiceFramework_") + qtVersion + dbIdentifier + QLatin1String(".db"); |
581 db->setDatabasePath(dir.path() + QDir::separator() + dbName); |
572 db->setDatabasePath(dir.path() + QDir::separator() + dbName); |