equal
deleted
inserted
replaced
40 |
40 |
41 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch") |
41 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch") |
42 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image") |
42 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image") |
43 #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") |
44 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView") |
44 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView") |
|
45 #define FILE_BROWSER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageBrowse") |
45 #define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter") |
46 #define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter") |
46 |
47 |
47 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
48 // GlxAiwServiceHandler() |
49 // GlxAiwServiceHandler() |
49 // ---------------------------------------------------------------------------- |
50 // ---------------------------------------------------------------------------- |
52 HbMainWindow(), |
53 HbMainWindow(), |
53 mStateMgr(NULL), |
54 mStateMgr(NULL), |
54 mFetcherService(NULL), |
55 mFetcherService(NULL), |
55 mNSDIService(NULL), |
56 mNSDIService(NULL), |
56 mDSDIService(NULL), |
57 mDSDIService(NULL), |
57 mImageViewerService(NULL) |
58 mImageViewerService(NULL), |
|
59 mImageBrowserService(NULL) |
58 { |
60 { |
59 QString currentInterfaceName = XQServiceUtil::interfaceName(); |
61 QString currentInterfaceName = XQServiceUtil::interfaceName(); |
60 if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageFetch"))) |
62 if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageFetch"))) |
61 { |
63 { |
62 mFetcherService = new GlxGetImageService(this); |
64 mFetcherService = new GlxGetImageService(this); |
69 else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IFileView"))) |
71 else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IFileView"))) |
70 { |
72 { |
71 viewport()->setAttribute(Qt::WA_AcceptTouchEvents); |
73 viewport()->setAttribute(Qt::WA_AcceptTouchEvents); |
72 viewport()->grabGesture(Qt::PinchGesture); |
74 viewport()->grabGesture(Qt::PinchGesture); |
73 mImageViewerService = new GlxImageViewerService(this); |
75 mImageViewerService = new GlxImageViewerService(this); |
|
76 } |
|
77 else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageBrowse"))) |
|
78 { |
|
79 mImageBrowserService = new GlxBrowseImageService(this); |
74 } |
80 } |
75 |
81 |
76 #ifdef _DEBUG |
82 #ifdef _DEBUG |
77 QString t; |
83 QString t; |
78 QStringList args = QApplication::arguments(); |
84 QStringList args = QApplication::arguments(); |
93 delete mStateMgr; |
99 delete mStateMgr; |
94 delete mFetcherService; |
100 delete mFetcherService; |
95 delete mNSDIService; |
101 delete mNSDIService; |
96 delete mDSDIService; |
102 delete mDSDIService; |
97 delete mImageViewerService; |
103 delete mImageViewerService; |
|
104 delete mImageBrowserService; |
98 } |
105 } |
99 |
106 |
100 void GlxAiwServiceHandler::handleClientDisconnect() |
107 void GlxAiwServiceHandler::handleClientDisconnect() |
101 { |
108 { |
102 // Just quit application |
109 // Just quit application |
180 SLOT(handleAnswerDelivered())); |
187 SLOT(handleAnswerDelivered())); |
181 mImageViewerService->complete(true); |
188 mImageViewerService->complete(true); |
182 } |
189 } |
183 return; |
190 return; |
184 } |
191 } |
|
192 |
|
193 void GlxAiwServiceHandler::launchImageBrowser(QString viewTitle) |
|
194 { |
|
195 qApp->setApplicationName(viewTitle); |
|
196 mStateMgr = new GlxStateManager(); |
|
197 mStateMgr->launchFetcher(0); |
|
198 if (mImageBrowserService && mImageBrowserService->asyncRequest()) |
|
199 { |
|
200 connect(mImageBrowserService, SIGNAL(returnValueDelivered()), this, |
|
201 SLOT(handleAnswerDelivered())); |
|
202 mImageBrowserService->complete(true); |
|
203 } |
|
204 return; |
|
205 } |
|
206 |
185 // ---------------------------------------------------------------------------- |
207 // ---------------------------------------------------------------------------- |
186 // GlxGetImageService() |
208 // GlxGetImageService() |
187 // ---------------------------------------------------------------------------- |
209 // ---------------------------------------------------------------------------- |
188 // |
210 // |
189 GlxGetImageService::GlxGetImageService(GlxAiwServiceHandler* parent) : |
211 GlxGetImageService::GlxGetImageService(GlxAiwServiceHandler* parent) : |
560 SLOT(handleClientDisconnect())); |
582 SLOT(handleClientDisconnect())); |
561 } |
583 } |
562 return true; |
584 return true; |
563 } |
585 } |
564 |
586 |
565 |
587 // ----------GlxBrowseImageService--------------- |
|
588 |
|
589 GlxBrowseImageService::GlxBrowseImageService(GlxAiwServiceHandler* parent) : |
|
590 XQServiceProvider(FILE_BROWSER_SERVICE_NAME, parent), |
|
591 mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false) |
|
592 |
|
593 { |
|
594 publishAll(); |
|
595 connect(this, SIGNAL(clientDisconnected()), mServiceApp, |
|
596 SLOT(handleClientDisconnect())); |
|
597 } |
|
598 |
|
599 GlxBrowseImageService::~GlxBrowseImageService() |
|
600 { |
|
601 } |
|
602 |
|
603 void GlxBrowseImageService::complete(bool ok) |
|
604 { |
|
605 if (mAsyncReqId == -1) |
|
606 return; |
|
607 completeRequest(mAsyncReqId, QVariant(ok)); |
|
608 } |
|
609 |
|
610 void GlxBrowseImageService::browse() |
|
611 { |
|
612 mServiceApp->launchImageBrowser(GLX_TITLE); |
|
613 XQRequestInfo info = requestInfo(); |
|
614 mAsyncRequest = !info.isSynchronous(); |
566 |
615 |
|
616 if (mAsyncRequest) |
|
617 { |
|
618 mAsyncReqId = setCurrentRequestAsync(); |
|
619 connect(this, SIGNAL(clientDisconnected()), this, |
|
620 SLOT(handleClientDisconnect())); |
|
621 } |
|
622 } |
|
623 |
|
624 |