src/hbcore/utils/hbdeviceprofile.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 28 b7da29130b0e
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    27 #include "hbdeviceprofiledatabase_p.h"
    27 #include "hbdeviceprofiledatabase_p.h"
    28 #include "hbinstance_p.h"
    28 #include "hbinstance_p.h"
    29 #include "hbmemorymanager_p.h"
    29 #include "hbmemorymanager_p.h"
    30 #include "hbtheme_p.h"
    30 #include "hbtheme_p.h"
    31 #include "hbthemeclient_p.h"
    31 #include "hbthemeclient_p.h"
    32 #include <hbmainwindow.h>
    32 #include "hbmainwindow.h"
    33 #include "hbmainwindow_p.h"
    33 #include "hbmainwindow_p.h"
    34 
    34 
    35 #include <QDebug>
    35 #ifdef Q_OS_SYMBIAN
       
    36 #include "hbthemecommon_symbian_p.h"
       
    37 #endif
    36 
    38 
    37 // To store the pointer to the deviceProfiles at the client side.
    39 // To store the pointer to the deviceProfiles at the client side.
    38 static HbDeviceProfileList *deviceProfilesList = 0;
    40 static HbDeviceProfileList *deviceProfilesList = 0;
    39 
    41 
    40 #define MM_PER_INCH 25.4
    42 #define MM_PER_INCH 25.4
   297 {
   299 {
   298 }
   300 }
   299 
   301 
   300 HbDeviceProfileList *HbDeviceProfilePrivate::deviceProfiles()
   302 HbDeviceProfileList *HbDeviceProfilePrivate::deviceProfiles()
   301 {
   303 {
   302     if (!deviceProfilesList) {
   304     // HbOrientationStatus may call this from the Theme Server process
       
   305     // too and this needs special support.
       
   306     bool isThemeServer = false;
       
   307 #ifdef Q_OS_SYMBIAN
       
   308     RProcess process;
       
   309     isThemeServer = process.SecureId().iId == KServerUid3.iUid;
       
   310     process.Close();
       
   311 #endif
       
   312     if (!deviceProfilesList && !isThemeServer) {
   303         // Will result in IPC call. gets the shared memory offset from themeserver.
   313         // Will result in IPC call. gets the shared memory offset from themeserver.
   304         deviceProfilesList = HbThemeClient::global()->deviceProfiles();
   314         deviceProfilesList = HbThemeClient::global()->deviceProfiles();
   305     }
   315     }
   306 
   316 
   307     if (!deviceProfilesList) {
   317     if (!deviceProfilesList) {
       
   318         HbMemoryManager::MemoryType memType = isThemeServer
       
   319             ? HbMemoryManager::SharedMemory : HbMemoryManager::HeapMemory;
   308         // This is fall back.Create/Get the HbDeviceProfileDatabase Instance at
   320         // This is fall back.Create/Get the HbDeviceProfileDatabase Instance at
   309         // the client side and read the deviceProfilesList.
   321         // the client side and read the deviceProfilesList.
   310         HbDeviceProfileDatabase *deviceProfileDataBase =
   322         HbDeviceProfileDatabase *deviceProfileDataBase =
   311             HbDeviceProfileDatabase::instance(HbMemoryManager::HeapMemory);
   323             HbDeviceProfileDatabase::instance(memType);
   312         deviceProfilesList = HbMemoryUtils::getAddress<HbDeviceProfileList>(HbMemoryManager::HeapMemory,
   324         deviceProfilesList = HbMemoryUtils::getAddress<HbDeviceProfileList>(memType,
   313                              deviceProfileDataBase->deviceProfilesOffset());
   325                              deviceProfileDataBase->deviceProfilesOffset());
   314     }
   326     }
   315     return deviceProfilesList;
   327     return deviceProfilesList;
   316 }
   328 }
   317 // end of file