39 #include <xqserviceutil.h> |
39 #include <xqserviceutil.h> |
40 #include <glxstatemanager.h> |
40 #include <glxstatemanager.h> |
41 #include <glximageviewermanager.h> |
41 #include <glximageviewermanager.h> |
42 #include <glxexternalutility.h> |
42 #include <glxexternalutility.h> |
43 #include "glxlocalisationstrings.h" |
43 #include "glxlocalisationstrings.h" |
|
44 #include <xqaiwdeclplat.h> |
|
45 |
|
46 #define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch") |
|
47 #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image") |
|
48 #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image") |
|
49 #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView") |
|
50 |
44 |
51 |
45 // ---------------------------------------------------------------------------- |
52 // ---------------------------------------------------------------------------- |
46 // GlxAiwServiceHandler() |
53 // GlxAiwServiceHandler() |
47 // ---------------------------------------------------------------------------- |
54 // ---------------------------------------------------------------------------- |
48 // |
55 // |
49 GlxAiwServiceHandler::GlxAiwServiceHandler() : |
56 GlxAiwServiceHandler::GlxAiwServiceHandler() : |
50 HbMainWindow(), mModel(NULL), mView(NULL), mService(NULL), |
57 HbMainWindow(), |
51 mStateMgr(NULL),mFSView(NULL),mFetcherContextMenu(NULL) |
58 mModel(NULL), |
52 { |
59 mView(NULL), |
53 mService = new GlxGetImageService(this); |
60 mStateMgr(NULL), |
|
61 mFSView(NULL), |
|
62 mFetcherContextMenu(NULL), |
|
63 mFetcherService(NULL), |
|
64 mNSDIService(NULL), |
|
65 mDSDIService(NULL), |
|
66 mImageViewerService(NULL) |
|
67 { |
|
68 mFetcherService = new GlxGetImageService(this); |
|
69 mNSDIService = new GlxGetImageServiceNSDI(this); |
|
70 mDSDIService = new GlxGetImageServiceDSDI(this); |
|
71 |
54 mImageViewerService = new GlxImageViewerService(this); |
72 mImageViewerService = new GlxImageViewerService(this); |
55 |
73 |
56 #ifdef _DEBUG |
74 #ifdef _DEBUG |
57 QString t; |
75 QString t; |
58 QStringList args = QApplication::arguments(); |
76 QStringList args = QApplication::arguments(); |
92 // ---------------------------------------------------------------------------- |
114 // ---------------------------------------------------------------------------- |
93 // |
115 // |
94 void GlxAiwServiceHandler::itemSelected(const QModelIndex & index) |
116 void GlxAiwServiceHandler::itemSelected(const QModelIndex & index) |
95 { |
117 { |
96 qDebug() << "GlxFetcher::itemSelected"; |
118 qDebug() << "GlxFetcher::itemSelected"; |
97 if (mService->isActive()) |
119 |
98 { |
120 if (mFetcherService->isActive()) |
99 qDebug() << "GlxFetcher::itemSelected :: SERVICE ACTIVE"; |
121 { |
|
122 qDebug() << "GlxFetcher::itemSelected mFetcherService->isActive()"; |
100 QVariant variant = mModel->data(index, GlxUriRole); |
123 QVariant variant = mModel->data(index, GlxUriRole); |
101 if (variant.isValid()) |
124 if (variant.isValid()) |
102 { |
125 { |
103 QString itemPath = variant.value<QString> (); |
126 QString itemPath = variant.value<QString> (); |
104 qDebug() << "GlxFetcher::itemSelected :: VALID URI -->" << itemPath; |
|
105 QStringList list = (QStringList() << itemPath); |
127 QStringList list = (QStringList() << itemPath); |
106 mService->complete(list); |
128 mFetcherService->complete(list); |
107 } |
129 } |
108 } |
130 } |
|
131 |
|
132 if (mNSDIService->isActive()) |
|
133 { |
|
134 qDebug() << "GlxFetcher::itemSelected mNSDIService->isActive()"; |
|
135 QVariant variant = mModel->data(index, GlxUriRole); |
|
136 if (variant.isValid()) |
|
137 { |
|
138 QString itemPath = variant.value<QString> (); |
|
139 QStringList list = (QStringList() << itemPath); |
|
140 mNSDIService->complete(list); |
|
141 } |
|
142 } |
|
143 |
|
144 if (mDSDIService->isActive()) |
|
145 { |
|
146 qDebug() << "GlxFetcher::itemSelected mDSDIService->isActive()"; |
|
147 QVariant variant = mModel->data(index, GlxUriRole); |
|
148 if (variant.isValid()) |
|
149 { |
|
150 QString itemPath = variant.value<QString> (); |
|
151 QStringList list = (QStringList() << itemPath); |
|
152 mDSDIService->complete(list); |
|
153 } |
|
154 } |
109 } |
155 } |
110 |
156 |
111 |
157 |
112 |
158 |
113 void GlxAiwServiceHandler::launchFetcher() |
159 void GlxAiwServiceHandler::launchFetcher() |
114 { |
160 { |
|
161 qDebug() << "GlxAiwServiceHandler::launchFetcher START"; |
115 HbStyleLoader::registerFilePath(":/data/photos.css"); |
162 HbStyleLoader::registerFilePath(":/data/photos.css"); |
116 GlxModelParm modelParm(KGlxCollectionPluginAllImplementationUid, 0); |
163 GlxModelParm modelParm(KGlxCollectionPluginAllImplementationUid, 0); |
117 mModel = new GlxMediaModel(modelParm); |
164 mModel = new GlxMediaModel(modelParm); |
118 |
165 |
119 if ( this->orientation() == Qt::Horizontal ) { |
166 if ( this->orientation() == Qt::Horizontal ) { |
265 |
312 |
266 // ---------------------------------------------------------------------------- |
313 // ---------------------------------------------------------------------------- |
267 // fetch() |
314 // fetch() |
268 // ---------------------------------------------------------------------------- |
315 // ---------------------------------------------------------------------------- |
269 // |
316 // |
270 void GlxGetImageService::fetch(QVariantMap filter, QVariant flag) |
317 void GlxGetImageService::fetch() |
|
318 { |
|
319 mImageRequestIndex = setCurrentRequestAsync(); |
|
320 mServiceApp->launchFetcher(); |
|
321 } |
|
322 |
|
323 // ---------------------------------------------------------------------------- |
|
324 // GlxGetImageService() |
|
325 // ---------------------------------------------------------------------------- |
|
326 // |
|
327 GlxGetImageServiceNSDI::GlxGetImageServiceNSDI(GlxAiwServiceHandler* parent) : |
|
328 XQServiceProvider(IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME, parent), |
|
329 mServiceApp(parent) |
|
330 { |
|
331 mImageRequestIndex = -1; |
|
332 publishAll(); |
|
333 connect(this, SIGNAL(clientDisconnected()), mServiceApp, |
|
334 SLOT(handleClientDisconnect())); |
|
335 } |
|
336 |
|
337 // ---------------------------------------------------------------------------- |
|
338 // ~GlxGetImageService() |
|
339 // ---------------------------------------------------------------------------- |
|
340 // |
|
341 GlxGetImageServiceNSDI::~GlxGetImageServiceNSDI() |
|
342 { |
|
343 } |
|
344 |
|
345 // ---------------------------------------------------------------------------- |
|
346 // fetchFailed() |
|
347 // ---------------------------------------------------------------------------- |
|
348 // |
|
349 void GlxGetImageServiceNSDI::fetchFailed(int errorCode) |
|
350 { |
|
351 QStringList filesList; |
|
352 filesList.insert(0, QString::number(errorCode));//result |
|
353 doComplete(filesList); |
|
354 } |
|
355 |
|
356 // ---------------------------------------------------------------------------- |
|
357 // complete() |
|
358 // ---------------------------------------------------------------------------- |
|
359 // |
|
360 void GlxGetImageServiceNSDI::complete(QStringList filesList) |
|
361 { |
|
362 doComplete(filesList); |
|
363 } |
|
364 |
|
365 // ---------------------------------------------------------------------------- |
|
366 // doComplete() |
|
367 // ---------------------------------------------------------------------------- |
|
368 // |
|
369 void GlxGetImageServiceNSDI::doComplete(QStringList filesList) |
|
370 { |
|
371 if (isActive()) |
|
372 { |
|
373 completeRequest(mImageRequestIndex, filesList); |
|
374 mImageRequestIndex = -1; |
|
375 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
376 } |
|
377 } |
|
378 |
|
379 // ---------------------------------------------------------------------------- |
|
380 // isActive() |
|
381 // ---------------------------------------------------------------------------- |
|
382 // |
|
383 bool GlxGetImageServiceNSDI::isActive() |
|
384 { |
|
385 return mImageRequestIndex > -1; |
|
386 } |
|
387 |
|
388 // ---------------------------------------------------------------------------- |
|
389 // fetch() |
|
390 // ---------------------------------------------------------------------------- |
|
391 // |
|
392 void GlxGetImageServiceNSDI::fetch(QVariantMap filter, QVariant flag) |
|
393 { |
|
394 qDebug() << "GlxGetImageServiceNSDI::fetch WITH PARAMETER START"; |
|
395 Q_UNUSED(filter) |
|
396 Q_UNUSED(flag) |
|
397 fetch(); |
|
398 qDebug() << "GlxGetImageServiceNSDI::fetch WITH PARAMETER END"; |
|
399 } |
|
400 |
|
401 // ---------------------------------------------------------------------------- |
|
402 // fetch() |
|
403 // ---------------------------------------------------------------------------- |
|
404 // |
|
405 void GlxGetImageServiceNSDI::fetch() |
|
406 { |
|
407 qDebug() << "GlxGetImageServiceNSDI::fetch START"; |
|
408 mImageRequestIndex = setCurrentRequestAsync(); |
|
409 mServiceApp->launchFetcher(); |
|
410 qDebug() << "GlxGetImageServiceNSDI::fetch END"; |
|
411 } |
|
412 |
|
413 //==============================================================================// |
|
414 // ---------------------------------------------------------------------------- |
|
415 // GlxGetImageService() |
|
416 // ---------------------------------------------------------------------------- |
|
417 // |
|
418 GlxGetImageServiceDSDI::GlxGetImageServiceDSDI(GlxAiwServiceHandler* parent) : |
|
419 XQServiceProvider(IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME, parent), |
|
420 mServiceApp(parent) |
|
421 { |
|
422 mImageRequestIndex = -1; |
|
423 publishAll(); |
|
424 connect(this, SIGNAL(clientDisconnected()), mServiceApp, |
|
425 SLOT(handleClientDisconnect())); |
|
426 } |
|
427 |
|
428 // ---------------------------------------------------------------------------- |
|
429 // ~GlxGetImageService() |
|
430 // ---------------------------------------------------------------------------- |
|
431 // |
|
432 GlxGetImageServiceDSDI::~GlxGetImageServiceDSDI() |
|
433 { |
|
434 } |
|
435 |
|
436 // ---------------------------------------------------------------------------- |
|
437 // fetchFailed() |
|
438 // ---------------------------------------------------------------------------- |
|
439 // |
|
440 void GlxGetImageServiceDSDI::fetchFailed(int errorCode) |
|
441 { |
|
442 QStringList filesList; |
|
443 filesList.insert(0, QString::number(errorCode));//result |
|
444 doComplete(filesList); |
|
445 } |
|
446 |
|
447 // ---------------------------------------------------------------------------- |
|
448 // complete() |
|
449 // ---------------------------------------------------------------------------- |
|
450 // |
|
451 void GlxGetImageServiceDSDI::complete(QStringList filesList) |
|
452 { |
|
453 doComplete(filesList); |
|
454 } |
|
455 |
|
456 // ---------------------------------------------------------------------------- |
|
457 // doComplete() |
|
458 // ---------------------------------------------------------------------------- |
|
459 // |
|
460 void GlxGetImageServiceDSDI::doComplete(QStringList filesList) |
|
461 { |
|
462 if (isActive()) |
|
463 { |
|
464 completeRequest(mImageRequestIndex, filesList); |
|
465 mImageRequestIndex = -1; |
|
466 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
|
467 } |
|
468 } |
|
469 |
|
470 // ---------------------------------------------------------------------------- |
|
471 // isActive() |
|
472 // ---------------------------------------------------------------------------- |
|
473 // |
|
474 bool GlxGetImageServiceDSDI::isActive() |
|
475 { |
|
476 return mImageRequestIndex > -1; |
|
477 } |
|
478 |
|
479 // ---------------------------------------------------------------------------- |
|
480 // fetch() |
|
481 // ---------------------------------------------------------------------------- |
|
482 // |
|
483 void GlxGetImageServiceDSDI::fetch(QVariantMap filter, QVariant flag) |
271 { |
484 { |
272 Q_UNUSED(filter) |
485 Q_UNUSED(filter) |
273 Q_UNUSED(flag) |
486 Q_UNUSED(flag) |
274 mImageRequestIndex = setCurrentRequestAsync(); |
487 mImageRequestIndex = setCurrentRequestAsync(); |
275 mServiceApp->launchFetcher(); |
488 mServiceApp->launchFetcher(); |
276 } |
489 } |
277 |
490 |
278 // ----------GlxImageViewerService--------------- |
491 // ----------GlxImageViewerService--------------- |
279 |
492 |
280 GlxImageViewerService::GlxImageViewerService(GlxAiwServiceHandler* parent) : |
493 GlxImageViewerService::GlxImageViewerService(GlxAiwServiceHandler* parent) : |
281 XQServiceProvider(QLatin1String( |
494 XQServiceProvider(FILE_VIEWER_SERVICE_NAME, parent), |
282 "com.nokia.services.media.com.nokia.symbian.IFileView"), parent), |
|
283 mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false), |
495 mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false), |
284 mImageViewerInstance(NULL) |
496 mImageViewerInstance(NULL) |
285 |
497 |
286 { |
498 { |
287 publishAll(); |
499 publishAll(); |