Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-545

QServicemanager on E72

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 1.1.0
    • 1.0.2
    • Service Framework
    • None
    • Nokia Qt Sdk 1.0.1
    • 158bf0bc7aec33e9addaa0895fec7a45b9cf8ab0

    Description

      hi,

      i am having a trying to load a service on E72 using the QServiceManager.
      Here is the piece of the code

      Code:

      QServiceManager* serviceManager = new QServiceManager();

      QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());

      // Adds the service to QServiceManager, needs to be done only once.

      bool added = serviceManager->addService(SERVICE_XML);
      if (!added) {
      }

      QServiceManager::Error error = serviceManager->error();
      if (error != QServiceManager::NoError &&
      error != QServiceManager::ServiceAlreadyExists)

      { return false; }

      QList<QtMobility::QServiceInterfaceDescriptor> descriptors = serviceManager->findInterfaces("Interface");
      QObject* serviceObject = 0;

      if ( descriptors.count() > 0 ){ // Loads One interface object serviceObject = serviceManager->loadInterface( descriptors.at(0) ); }

      error = serviceManager->error();
      if (error != QServiceManager::NoError &&
      error != QServiceManager::ServiceAlreadyExists) { return false; }

      I am getting error 1: which is ->
      QServiceManager::StorageAccessError 1 The service data storage is not accessible. This could be because the caller does not have the required permissions.

      The same application works fine on N97. Please advise do I have to do anything special for 3.2.x series,.
      I have used Nokia Qt SDK 1.0 for compiling this application.

      I have done some debugging on the service fw manager sources taken from here qt-mobility-opensource-src-1.0.2.zip and found the following
      in the ServiceDatabase:pen()

      Code:

      if(m_databasePath.isEmpty ())
      m_databasePath = databasePath();
      LOGTXT("m_databasePath:" + databasePath());

      path = m_databasePath;
      QFileInfo dbFileInfo(path);
      LOGTXT("dbFileInfo: " + dbFileInfo.absolutePath());

      LOGTXT("app dir path:" + QCoreApplication::applicationDirPath());
      if (!dbFileInfo.dir().exists()) {
      if(!QDir::root().mkpath(dbFileInfo.path()))

      { // Problem QString errorText("Could not create database directory: %1"); m_lastError.setError(DBError::CannotCreateDbDir, errorText.arg(dbFileInfo.path())); #ifdef QT_SFW_SERVICEDATABASE_DEBUG qWarning() << "ServiceDatabase::open():-" << "Problem:" << qPrintable(m_lastError.text()); #endif LOGTXT("Problem:" + m_lastError.text()); close(); return false; }

      }

      QDir::root().mkpath(dbFileInfo.path()) is failing when i checked the pro there is missing AllFiles capability.
      But the QFile should be able to create the file by default in to the private directory. But creating the path is explicitly using the QDir::root().mkpath is not allowed i presume.
      I wonder how it is working in N97??

      More finding with out changing the pro file if the following changes are made to the code

      Code:

      //old
      if (!dbFileInfo.dir().exists()) {
      if(!QDir::root().mkpath(dbFileInfo.path()))

      { QString errorText("Could not create database directory: %1"); m_lastError.setError(DBError::CannotCreateDbDir, errorText.arg(dbFileInfo.path())); #ifdef QT_SFW_SERVICEDATABASE_DEBUG qWarning() << "ServiceDatabase::open():-" << "Problem:" << qPrintable(m_lastError.text()); #endif LOGTXT("Problem:" + m_lastError.text()); close(); return false; }

      Code:

      // new

      if (!dbFileInfo.dir().exists()) {
      QFile file(path);
      if(file.open(QIODevice::ReadWrite))
      {
      LOGTXT("database created:");
      if (!dbFileInfo.dir().exists())

      { LOGTXT("database path exists:"); }

      else

      { LOGTXT("database path does not exists:"); }

      }
      else

      { LOGTXT("naaah database not created:"); }

      //if(!QDir::root().mkpath(dbFileInfo.path()))
      if(!file.exists())

      { QString errorText("Could not create database directory: %1"); m_lastError.setError(DBError::CannotCreateDbDir, errorText.arg(dbFileInfo.path())); #ifdef QT_SFW_SERVICEDATABASE_DEBUG qWarning() << "ServiceDatabase::open():-" << "Problem:" << qPrintable(m_lastError.text()); #endif LOGTXT("Problem 1:" + m_lastError.text()); close(); return false; }

      }

      The code works like a charm. As said, QDir::root().mkpath is not working if the private directories has to be created, sounds logical. And QFile file("filename"); is creating the file in the private directory of the executable again sounds logical. So the above fix is working nice. But still wondering how it is working on 5800 and N97. What is different there, The capabilities should have chipped in there too??

      Attachments

        Activity

          People

            stanleyj Andrew Stanley-Jones (closed Nokia identity) (Inactive)
            sriky27 srikanth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: