main/glxaiwservicehandler.cpp
changeset 70 a91aa46552be
parent 55 fb37077c270f
equal deleted inserted replaced
67:199e6e1e0b54 70:a91aa46552be
    27 #include <QStringList>
    27 #include <QStringList>
    28 
    28 
    29 #include <xqserviceutil.h>
    29 #include <xqserviceutil.h>
    30 #include <xqaiwdeclplat.h>
    30 #include <xqaiwdeclplat.h>
    31 #include <xqappmgr.h>
    31 #include <xqappmgr.h>
       
    32 #include <xqaiwdecl.h>
    32 
    33 
    33 #include <glxmodelroles.h>
    34 #include <glxmodelroles.h>
    34 #include <glxaiwservicehandler.h>
    35 #include <glxaiwservicehandler.h>
    35 #include <glxstatemanager.h>
    36 #include <glxstatemanager.h>
    36 #include <glximageviewermanager.h>
    37 #include <glximageviewermanager.h>
    39 
    40 
    40 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch")
    41 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch")
    41 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image")
    42 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image")
    42 #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image")
    43 #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image")
    43 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView")
    44 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView")
    44 
    45 #define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter")
    45 
    46 
    46 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    47 // GlxAiwServiceHandler()
    48 // GlxAiwServiceHandler()
    48 // ----------------------------------------------------------------------------
    49 // ----------------------------------------------------------------------------
    49 //
    50 //
   146             }
   147             }
   147         }
   148         }
   148     }	
   149     }	
   149 
   150 
   150 
   151 
   151 void GlxAiwServiceHandler::launchFetcher(QString viewTitle)
   152 void GlxAiwServiceHandler::launchFetcher(QString viewTitle,int fetcherFilterType)
   152     {
   153     {
   153     qDebug() << "GlxAiwServiceHandler::launchFetcher START";
   154     qDebug() << "GlxAiwServiceHandler::launchFetcher START";
   154     qApp->setApplicationName(viewTitle);
   155     qApp->setApplicationName(viewTitle);
   155 
   156 
   156     mUtil = GlxExternalUtility::instance();
   157     mUtil = GlxExternalUtility::instance();
   159     mStateMgr = new GlxStateManager();
   160     mStateMgr = new GlxStateManager();
   160 	int err = connect(mStateMgr, SIGNAL(gridItemSelected(const QModelIndex &,QAbstractItemModel &)), this,
   161 	int err = connect(mStateMgr, SIGNAL(gridItemSelected(const QModelIndex &,QAbstractItemModel &)), this,
   161             SLOT( itemSelected(const QModelIndex &,QAbstractItemModel &)));
   162             SLOT( itemSelected(const QModelIndex &,QAbstractItemModel &)));
   162 	qDebug() << "GlxAiwServiceHandler::launchFetcher err = "<< err;
   163 	qDebug() << "GlxAiwServiceHandler::launchFetcher err = "<< err;
   163 	
   164 	
   164     mStateMgr->launchFetcher();
   165     mStateMgr->launchFetcher(fetcherFilterType);
   165     return;
   166     return;
   166     }
   167     }
   167 
   168 
   168 void GlxAiwServiceHandler::launchImageViewer(QString viewTitle)
   169 void GlxAiwServiceHandler::launchImageViewer(QString viewTitle)
   169     {
   170     {
   252 // ----------------------------------------------------------------------------
   253 // ----------------------------------------------------------------------------
   253 //
   254 //
   254 void GlxGetImageService::fetch()
   255 void GlxGetImageService::fetch()
   255     {
   256     {
   256     mImageRequestIndex = setCurrentRequestAsync();
   257     mImageRequestIndex = setCurrentRequestAsync();
   257     QString title =  GLX_TITLE;
   258 
   258     mServiceApp->launchFetcher(title);
   259     QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
       
   260     if(title.isNull()){
       
   261         title = GLX_TITLE;
       
   262     }
       
   263 
       
   264 	int fetcherFilterType = 0; //no filter
       
   265     if(requestInfo().info(XQINFO_KEY_FILTER_TYPE).canConvert<int>()){
       
   266         fetcherFilterType = (requestInfo().info(XQINFO_KEY_FILTER_TYPE)).toInt();
       
   267         qDebug()<< "GlxGetImageService::fetch() fetcherFilterType = " << fetcherFilterType;
       
   268     }
       
   269     mServiceApp->launchFetcher(title,fetcherFilterType);
   259     }
   270     }
   260 
   271 
   261 // ----------------------------------------------------------------------------
   272 // ----------------------------------------------------------------------------
   262 // GlxGetImageService()
   273 // GlxGetImageService()
   263 // ----------------------------------------------------------------------------
   274 // ----------------------------------------------------------------------------
   342 //
   353 //
   343 void GlxGetImageServiceNSDI::fetch()
   354 void GlxGetImageServiceNSDI::fetch()
   344     {
   355     {
   345     qDebug() << "GlxGetImageServiceNSDI::fetch START";
   356     qDebug() << "GlxGetImageServiceNSDI::fetch START";
   346     mImageRequestIndex = setCurrentRequestAsync();
   357     mImageRequestIndex = setCurrentRequestAsync();
   347     QString title = GLX_TITLE;
   358 
       
   359     QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
       
   360     if(title.isNull()){
       
   361         title = GLX_TITLE;
       
   362     }
       
   363 
   348     mServiceApp->launchFetcher(title);
   364     mServiceApp->launchFetcher(title);
   349     qDebug() << "GlxGetImageServiceNSDI::fetch END";
   365     qDebug() << "GlxGetImageServiceNSDI::fetch END";
   350     }
   366     }
   351 
   367 
   352 //==============================================================================//
   368 //==============================================================================//
   422 void GlxGetImageServiceDSDI::fetch(QVariantMap filter, QVariant flag)
   438 void GlxGetImageServiceDSDI::fetch(QVariantMap filter, QVariant flag)
   423     {
   439     {
   424     Q_UNUSED(filter)
   440     Q_UNUSED(filter)
   425     Q_UNUSED(flag)
   441     Q_UNUSED(flag)
   426     mImageRequestIndex = setCurrentRequestAsync();
   442     mImageRequestIndex = setCurrentRequestAsync();
   427     QString title  = GLX_TITLE;    
   443     QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
       
   444     if(title.isNull()){
       
   445         title = GLX_TITLE;
       
   446     }
       
   447     
   428     mServiceApp->launchFetcher(title);
   448     mServiceApp->launchFetcher(title);
   429     }
   449     }
   430 
   450 
   431 // ----------GlxImageViewerService---------------
   451 // ----------GlxImageViewerService---------------
   432 
   452 
   486     if (mAsyncRequest)
   506     if (mAsyncRequest)
   487         {
   507         {
   488         mAsyncReqId = setCurrentRequestAsync();
   508         mAsyncReqId = setCurrentRequestAsync();
   489         }
   509         }
   490 
   510 
   491     QString title = requestInfo().info("WindowTitle").toString();
   511     QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
   492     if(title.isNull()){
   512     if(title.isNull()){
   493         title =GLX_IMAGE_VIEWER;
   513         title =GLX_IMAGE_VIEWER;
   494     }
   514     }
   495     
   515     
   496     mServiceApp->launchImageViewer(title);
   516     mServiceApp->launchImageViewer(title);
   497     return true;
   517     return true;
   498     }
   518     }
   499 
   519 
   500 bool GlxImageViewerService::view(XQSharableFile sf)
   520 bool GlxImageViewerService::view(XQSharableFile sf)
   501     {
   521     {
       
   522     XQApplicationManager appmgr;
       
   523     QFile tempfile(sf.fileName());
       
   524     QVariantList attrValues;
       
   525     QList<int> attrNames;
       
   526     attrNames.append(XQApplicationManager::IsProtected);
       
   527     bool ok1 = appmgr.getDrmAttributes(tempfile, attrNames, attrValues);
       
   528     if(ok1 && attrValues.at(0).toBool()){
       
   529         HbNotificationDialog::launchDialog("NOT SUPPORTED");
       
   530         connect(this, SIGNAL(returnValueDelivered()), mServiceApp,
       
   531                 SLOT(handleAnswerDelivered()));
       
   532         complete(true);
       
   533         return false;
       
   534     }
       
   535 
   502     if (!mImageViewerInstance)
   536     if (!mImageViewerInstance)
   503         {
   537         {
   504         mImageViewerInstance = CGlxImageViewerManager::InstanceL();
   538         mImageViewerInstance = CGlxImageViewerManager::InstanceL();
   505         }
   539         }
   506     RFile file;
   540     RFile file;
   509         {
   543         {
   510         mImageViewerInstance->SetImageFileHandleL(file);
   544         mImageViewerInstance->SetImageFileHandleL(file);
   511         sf.close();
   545         sf.close();
   512         }
   546         }
   513 
   547 
   514     QString title = requestInfo().info("WindowTitle").toString();
   548     QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
   515     if(title.isNull()){
   549     if(title.isNull()){
   516         title = GLX_IMAGE_VIEWER;
   550         title = GLX_IMAGE_VIEWER;
   517     }
   551     }
   518     
   552     
   519     mServiceApp->launchImageViewer(title);
   553     mServiceApp->launchImageViewer(title);