main/glxaiwservicehandler.cpp
changeset 49 f291796e213d
parent 48 d0b4e67b3a60
child 50 a0f57508af73
child 55 fb37077c270f
equal deleted inserted replaced
48:d0b4e67b3a60 49:f291796e213d
    19 #include <hbview.h>
    19 #include <hbview.h>
    20 #include <hbmenu.h>
    20 #include <hbmenu.h>
    21 #include <hbaction.h>
    21 #include <hbaction.h>
    22 #include <hbtoolbar.h>
    22 #include <hbtoolbar.h>
    23 #include <hbstyleloader.h>
    23 #include <hbstyleloader.h>
       
    24 #include <hbnotificationdialog.h>
    24 
    25 
    25 #include <QtDebug>
    26 #include <QtDebug>
    26 #include <Qt>
    27 #include <Qt>
    27 #include <QDir>
    28 #include <QDir>
    28 #include <QStringList>
    29 #include <QStringList>
    40 #include <glxstatemanager.h>
    41 #include <glxstatemanager.h>
    41 #include <glximageviewermanager.h>
    42 #include <glximageviewermanager.h>
    42 #include <glxexternalutility.h>
    43 #include <glxexternalutility.h>
    43 #include "glxlocalisationstrings.h"
    44 #include "glxlocalisationstrings.h"
    44 #include <xqaiwdeclplat.h>
    45 #include <xqaiwdeclplat.h>
       
    46 #include <xqappmgr.h>
    45 
    47 
    46 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch")
    48 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch")
    47 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image")
    49 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image")
    48 #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image")
    50 #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image")
    49 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView")
    51 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView")
    75         mNSDIService = new GlxGetImageServiceNSDI(this);
    77         mNSDIService = new GlxGetImageServiceNSDI(this);
    76         mDSDIService = new GlxGetImageServiceDSDI(this);
    78         mDSDIService = new GlxGetImageServiceDSDI(this);
    77         }
    79         }
    78     else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IFileView")))
    80     else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IFileView")))
    79         {
    81         {
       
    82 		viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
       
    83 		viewport()->grabGesture(Qt::PinchGesture);
    80         mImageViewerService = new GlxImageViewerService(this);
    84         mImageViewerService = new GlxImageViewerService(this);
    81         }
    85         }
    82 
    86 
    83 #ifdef _DEBUG
    87 #ifdef _DEBUG
    84 	QString t;
    88 	QString t;
   192 			Qt::QueuedConnection );
   196 			Qt::QueuedConnection );
   193 	qDebug() << "GlxAiwServiceHandler::launchFetcher END";
   197 	qDebug() << "GlxAiwServiceHandler::launchFetcher END";
   194     }
   198     }
   195 
   199 
   196 void GlxAiwServiceHandler::itemSpecificMenuTriggered(qint32 viewId,QPointF pos)
   200 void GlxAiwServiceHandler::itemSpecificMenuTriggered(qint32 viewId,QPointF pos)
   197 	{
   201 {
   198     mFetcherContextMenu = new HbMenu();
   202     mFetcherContextMenu = new HbMenu();
   199 	HbAction *action = mFetcherContextMenu->addAction(GLX_MENU_OPEN);
   203 	HbAction *action = mFetcherContextMenu->addAction(GLX_MENU_OPEN);
       
   204 	action->setObjectName( "Menu Open" );
   200 	connect(action, SIGNAL(triggered()), this, SLOT(openFSView()));
   205 	connect(action, SIGNAL(triggered()), this, SLOT(openFSView()));
   201 	connect(this, SIGNAL(aboutToChangeOrientation ()), mFetcherContextMenu, SLOT(close()));
   206 	connect(this, SIGNAL(aboutToChangeOrientation ()), mFetcherContextMenu, SLOT(close()));
   202 	connect( mFetcherContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) );
   207 	connect( mFetcherContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) );
   203 	mFetcherContextMenu->setPreferredPos( pos );
   208 	mFetcherContextMenu->setPreferredPos( pos );
   204 	mFetcherContextMenu->show();
   209 	mFetcherContextMenu->show();
   205  	}
   210 }
   206 
   211 
   207 void GlxAiwServiceHandler::closeContextMenu()
   212 void GlxAiwServiceHandler::closeContextMenu()
   208     {
   213     {
   209     disconnect( this, SIGNAL( aboutToChangeOrientation () ), mFetcherContextMenu, SLOT( close() ) );
   214     disconnect( this, SIGNAL( aboutToChangeOrientation () ), mFetcherContextMenu, SLOT( close() ) );
   210     disconnect( mFetcherContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) ); 
   215     disconnect( mFetcherContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) ); 
   219     }
   224     }
   220     else {
   225     else {
   221         mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole );
   226         mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole );
   222     }    
   227     }    
   223     HbAction* selectAction = new HbAction(GLX_BUTTON_SELECT);
   228     HbAction* selectAction = new HbAction(GLX_BUTTON_SELECT);
       
   229     selectAction->setObjectName( "FS Select" );
       
   230     
   224 	connect(selectAction, SIGNAL(triggered()), this, SLOT(handleFSSelect()));
   231 	connect(selectAction, SIGNAL(triggered()), this, SLOT(handleFSSelect()));
   225     HbToolBar* toolBar = new HbToolBar();
   232     HbToolBar* toolBar = new HbToolBar();
   226     toolBar->setOrientation( Qt::Horizontal );
   233     toolBar->setOrientation( Qt::Horizontal );
   227     toolBar->setVisible(true);
   234     toolBar->setVisible(true);
   228 	toolBar->addAction(selectAction);
   235 	toolBar->addAction(selectAction);
   544     completeRequest(mAsyncReqId, QVariant(ok));
   551     completeRequest(mAsyncReqId, QVariant(ok));
   545     }
   552     }
   546 
   553 
   547 bool GlxImageViewerService::view(QString file)
   554 bool GlxImageViewerService::view(QString file)
   548     {
   555     {
       
   556     XQApplicationManager appmgr;
       
   557     QFile tempfile(file);
       
   558     QVariantList attrValues;
       
   559 	QList<int> attrNames;
       
   560 	attrNames.append(XQApplicationManager::IsProtected);
       
   561     bool ok = appmgr.getDrmAttributes(tempfile, attrNames, attrValues);
       
   562     if(attrValues.at(0).toBool()){
       
   563 		HbNotificationDialog::launchDialog("NOT SUPPORTED");
       
   564         connect(this, SIGNAL(returnValueDelivered()), mServiceApp,
       
   565                 SLOT(handleAnswerDelivered()));
       
   566 		complete(true);
       
   567 		return false;
       
   568     }
       
   569 	
   549     XQRequestInfo info = requestInfo();
   570     XQRequestInfo info = requestInfo();
   550     mAsyncRequest = !info.isSynchronous();
   571     mAsyncRequest = !info.isSynchronous();
   551     if (!mImageViewerInstance)
   572     if (!mImageViewerInstance)
   552         {
   573         {
   553         mImageViewerInstance = CGlxImageViewerManager::InstanceL();
   574         mImageViewerInstance = CGlxImageViewerManager::InstanceL();