main/glxaiwservicehandler.cpp
author hgs
Thu, 14 Oct 2010 17:54:23 +0530
changeset 72 0a8e959402e5
parent 71 27f2d7aec52a
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:   ?Description
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <hbapplication.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <hbview.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <hbmenu.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <hbaction.h>
45
hgs
parents: 44
diff changeset
    22
#include <hbnotificationdialog.h>
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <QtDebug>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <Qt>
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    26
#include <QDir>
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    27
#include <QStringList>
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
54
hgs
parents: 50
diff changeset
    29
#include <xqserviceutil.h>
hgs
parents: 50
diff changeset
    30
#include <xqaiwdeclplat.h>
hgs
parents: 50
diff changeset
    31
#include <xqappmgr.h>
65
hgs
parents: 54
diff changeset
    32
#include <xqaiwdecl.h>
54
hgs
parents: 50
diff changeset
    33
hgs
parents: 50
diff changeset
    34
#include <glxmodelroles.h>
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <glxaiwservicehandler.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <glxstatemanager.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include <glximageviewermanager.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include <glxexternalutility.h>
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include "glxlocalisationstrings.h"
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    40
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    41
#define IMAGE_FETCHER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageFetch")
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    42
#define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image")
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    43
#define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image")
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    44
#define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView")
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    45
#define FILE_BROWSER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageBrowse")
65
hgs
parents: 54
diff changeset
    46
#define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter")
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// GlxAiwServiceHandler()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
GlxAiwServiceHandler::GlxAiwServiceHandler() :
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    53
    HbMainWindow(), 
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    54
    mStateMgr(NULL),
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    55
    mFetcherService(NULL),
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    56
    mNSDIService(NULL),
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    57
    mDSDIService(NULL),
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    58
    mImageViewerService(NULL),
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    59
	mImageBrowserService(NULL)
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
    {
44
hgs
parents: 42
diff changeset
    61
    QString currentInterfaceName = XQServiceUtil::interfaceName();
hgs
parents: 42
diff changeset
    62
    if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageFetch")))
hgs
parents: 42
diff changeset
    63
        {
hgs
parents: 42
diff changeset
    64
        mFetcherService = new GlxGetImageService(this);
hgs
parents: 42
diff changeset
    65
        }
hgs
parents: 42
diff changeset
    66
    else if( 0 == currentInterfaceName.compare(QLatin1String("Image")))
hgs
parents: 42
diff changeset
    67
        {
hgs
parents: 42
diff changeset
    68
        mNSDIService = new GlxGetImageServiceNSDI(this);
hgs
parents: 42
diff changeset
    69
        mDSDIService = new GlxGetImageServiceDSDI(this);
hgs
parents: 42
diff changeset
    70
        }
hgs
parents: 42
diff changeset
    71
    else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IFileView")))
hgs
parents: 42
diff changeset
    72
        {
45
hgs
parents: 44
diff changeset
    73
		viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
hgs
parents: 44
diff changeset
    74
		viewport()->grabGesture(Qt::PinchGesture);
44
hgs
parents: 42
diff changeset
    75
        mImageViewerService = new GlxImageViewerService(this);
hgs
parents: 42
diff changeset
    76
        }
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    77
    else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageBrowse")))
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    78
        {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    79
        mImageBrowserService = new GlxBrowseImageService(this);
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
    80
        }
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
#ifdef _DEBUG
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
	QString t;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
	QStringList args = QApplication::arguments();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
    foreach (QString arg, args)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
        t += "GlxAiwServiceHandler::cmdline arg=" + arg + "\n";
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
	qDebug()<< t;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
#endif
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
// ~GlxAiwServiceHandler()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
GlxAiwServiceHandler::~GlxAiwServiceHandler()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    {
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
    99
    delete mStateMgr;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   100
    delete mFetcherService;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   101
    delete mNSDIService;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   102
    delete mDSDIService;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   103
    delete mImageViewerService;
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   104
	delete mImageBrowserService;
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
void GlxAiwServiceHandler::handleClientDisconnect()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    // Just quit application
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    qApp->quit();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
// itemSelected()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
//
54
hgs
parents: 50
diff changeset
   117
void GlxAiwServiceHandler::itemSelected(const QModelIndex & index,QAbstractItemModel & model)
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    qDebug() << "GlxFetcher::itemSelected";
44
hgs
parents: 42
diff changeset
   120
    if (mFetcherService && mFetcherService->isActive())
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
        {
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   122
        qDebug() << "GlxFetcher::itemSelected mFetcherService->isActive()";
54
hgs
parents: 50
diff changeset
   123
        QVariant variant = model.data(index, GlxUriRole);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
        if (variant.isValid())
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
            {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
            QString itemPath = variant.value<QString> ();
54
hgs
parents: 50
diff changeset
   127
            qDebug() << "GlxFetcher::itemSelected mFetcherService->isActive()::PATH = " << itemPath;
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   128
            QStringList list = (QStringList() << itemPath);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   129
            mFetcherService->complete(list);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   130
            }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   131
        }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   132
    
44
hgs
parents: 42
diff changeset
   133
    else if (mNSDIService && mNSDIService->isActive())
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   134
        {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   135
    qDebug() << "GlxFetcher::itemSelected mNSDIService->isActive()";
54
hgs
parents: 50
diff changeset
   136
        QVariant variant = model.data(index, GlxUriRole);
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   137
        if (variant.isValid())
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   138
            {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   139
            QString itemPath = variant.value<QString> ();
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
            QStringList list = (QStringList() << itemPath);
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   141
            mNSDIService->complete(list);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   142
            }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   143
        }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   144
    
44
hgs
parents: 42
diff changeset
   145
    else if (mDSDIService && mDSDIService->isActive())
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   146
        {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   147
    qDebug() << "GlxFetcher::itemSelected mDSDIService->isActive()";
54
hgs
parents: 50
diff changeset
   148
        QVariant variant = model.data(index, GlxUriRole);
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   149
        if (variant.isValid())
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   150
            {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   151
            QString itemPath = variant.value<QString> ();
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   152
            QStringList list = (QStringList() << itemPath);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   153
            mDSDIService->complete(list);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
            }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    }	
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
65
hgs
parents: 54
diff changeset
   159
void GlxAiwServiceHandler::launchFetcher(QString viewTitle,int fetcherFilterType)
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
    {
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   161
    qDebug() << "GlxAiwServiceHandler::launchFetcher START";
44
hgs
parents: 42
diff changeset
   162
    qApp->setApplicationName(viewTitle);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
54
hgs
parents: 50
diff changeset
   164
    mUtil = GlxExternalUtility::instance();
hgs
parents: 50
diff changeset
   165
    mUtil->setMainWindow(this);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
54
hgs
parents: 50
diff changeset
   167
    mStateMgr = new GlxStateManager();
hgs
parents: 50
diff changeset
   168
	int err = connect(mStateMgr, SIGNAL(gridItemSelected(const QModelIndex &,QAbstractItemModel &)), this,
hgs
parents: 50
diff changeset
   169
            SLOT( itemSelected(const QModelIndex &,QAbstractItemModel &)));
hgs
parents: 50
diff changeset
   170
	qDebug() << "GlxAiwServiceHandler::launchFetcher err = "<< err;
hgs
parents: 50
diff changeset
   171
	
65
hgs
parents: 54
diff changeset
   172
    mStateMgr->launchFetcher(fetcherFilterType);
54
hgs
parents: 50
diff changeset
   173
    return;
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
54
hgs
parents: 50
diff changeset
   176
void GlxAiwServiceHandler::launchImageViewer(QString viewTitle)
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    {
54
hgs
parents: 50
diff changeset
   178
    qApp->setApplicationName(viewTitle);
hgs
parents: 50
diff changeset
   179
    mUtil = GlxExternalUtility::instance();
hgs
parents: 50
diff changeset
   180
    mUtil->setMainWindow(this);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
    mStateMgr = new GlxStateManager();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
    mStateMgr->launchFromExternal();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
    if (mImageViewerService && mImageViewerService->asyncRequest())
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
        connect(mImageViewerService, SIGNAL(returnValueDelivered()), this,
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
                SLOT(handleAnswerDelivered()));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
        mImageViewerService->complete(true);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
    return;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    }
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   192
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   193
void GlxAiwServiceHandler::launchImageBrowser(QString viewTitle)
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   194
    {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   195
    qApp->setApplicationName(viewTitle);
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   196
    mStateMgr = new GlxStateManager();
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   197
	mStateMgr->launchFetcher(0);
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   198
    if (mImageBrowserService && mImageBrowserService->asyncRequest())
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   199
        {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   200
        connect(mImageBrowserService, SIGNAL(returnValueDelivered()), this,
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   201
                SLOT(handleAnswerDelivered()));
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   202
        mImageBrowserService->complete(true);
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   203
        }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   204
    return;
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   205
    }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   206
	
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
// GlxGetImageService()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
GlxGetImageService::GlxGetImageService(GlxAiwServiceHandler* parent) :
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   212
            XQServiceProvider(IMAGE_FETCHER_SERVICE_NAME, parent),
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
            mServiceApp(parent)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
    mImageRequestIndex = -1;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    publishAll();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
    connect(this, SIGNAL(clientDisconnected()), mServiceApp,
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
            SLOT(handleClientDisconnect()));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
// ~GlxGetImageService()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
GlxGetImageService::~GlxGetImageService()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    {
54
hgs
parents: 50
diff changeset
   227
    qDebug() << "GlxGetImageService::~GlxGetImageService()";
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
// fetchFailed()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
void GlxGetImageService::fetchFailed(int errorCode)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
    QStringList filesList;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    filesList.insert(0, QString::number(errorCode));//result
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    doComplete(filesList);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
// complete()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
void GlxGetImageService::complete(QStringList filesList)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
    doComplete(filesList);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
// doComplete()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
void GlxGetImageService::doComplete(QStringList filesList)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    if (isActive())
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
        completeRequest(mImageRequestIndex, filesList);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
        mImageRequestIndex = -1;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
        connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
// isActive()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
//
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
bool GlxGetImageService::isActive()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
    return mImageRequestIndex > -1;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
// fetch()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
// ----------------------------------------------------------------------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
//
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   277
void GlxGetImageService::fetch()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   278
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   279
    mImageRequestIndex = setCurrentRequestAsync();
65
hgs
parents: 54
diff changeset
   280
hgs
parents: 54
diff changeset
   281
    QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
hgs
parents: 54
diff changeset
   282
    if(title.isNull()){
hgs
parents: 54
diff changeset
   283
        title = GLX_TITLE;
hgs
parents: 54
diff changeset
   284
    }
hgs
parents: 54
diff changeset
   285
hgs
parents: 54
diff changeset
   286
	int fetcherFilterType = 0; //no filter
hgs
parents: 54
diff changeset
   287
    if(requestInfo().info(XQINFO_KEY_FILTER_TYPE).canConvert<int>()){
hgs
parents: 54
diff changeset
   288
        fetcherFilterType = (requestInfo().info(XQINFO_KEY_FILTER_TYPE)).toInt();
hgs
parents: 54
diff changeset
   289
        qDebug()<< "GlxGetImageService::fetch() fetcherFilterType = " << fetcherFilterType;
hgs
parents: 54
diff changeset
   290
    }
hgs
parents: 54
diff changeset
   291
    mServiceApp->launchFetcher(title,fetcherFilterType);
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   292
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   293
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   294
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   295
// GlxGetImageService()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   296
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   297
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   298
GlxGetImageServiceNSDI::GlxGetImageServiceNSDI(GlxAiwServiceHandler* parent) :
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   299
            XQServiceProvider(IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME, parent),
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   300
            mServiceApp(parent)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   301
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   302
    mImageRequestIndex = -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   303
    publishAll();
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   304
    connect(this, SIGNAL(clientDisconnected()), mServiceApp,
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   305
            SLOT(handleClientDisconnect()));
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   306
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   307
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   308
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   309
// ~GlxGetImageService()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   310
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   311
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   312
GlxGetImageServiceNSDI::~GlxGetImageServiceNSDI()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   313
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   314
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   315
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   316
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   317
// fetchFailed()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   318
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   319
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   320
void GlxGetImageServiceNSDI::fetchFailed(int errorCode)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   321
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   322
    QStringList filesList;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   323
    filesList.insert(0, QString::number(errorCode));//result
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   324
    doComplete(filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   325
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   326
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   327
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   328
// complete()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   329
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   330
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   331
void GlxGetImageServiceNSDI::complete(QStringList filesList)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   332
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   333
    doComplete(filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   334
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   335
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   336
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   337
// doComplete()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   338
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   339
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   340
void GlxGetImageServiceNSDI::doComplete(QStringList filesList)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   341
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   342
    if (isActive())
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   343
        {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   344
        completeRequest(mImageRequestIndex, filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   345
        mImageRequestIndex = -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   346
        connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   347
        }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   348
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   349
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   350
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   351
// isActive()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   352
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   353
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   354
bool GlxGetImageServiceNSDI::isActive()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   355
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   356
    return mImageRequestIndex > -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   357
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   358
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   359
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   360
// fetch()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   361
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   362
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   363
void GlxGetImageServiceNSDI::fetch(QVariantMap filter, QVariant flag)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   364
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   365
    qDebug() << "GlxGetImageServiceNSDI::fetch WITH PARAMETER START";
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   366
    Q_UNUSED(filter)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   367
    Q_UNUSED(flag)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   368
    fetch();
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   369
    qDebug() << "GlxGetImageServiceNSDI::fetch WITH PARAMETER END";
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   370
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   371
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   372
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   373
// fetch()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   374
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   375
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   376
void GlxGetImageServiceNSDI::fetch()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   377
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   378
    qDebug() << "GlxGetImageServiceNSDI::fetch START";
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   379
    mImageRequestIndex = setCurrentRequestAsync();
65
hgs
parents: 54
diff changeset
   380
hgs
parents: 54
diff changeset
   381
    QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
hgs
parents: 54
diff changeset
   382
    if(title.isNull()){
hgs
parents: 54
diff changeset
   383
        title = GLX_TITLE;
hgs
parents: 54
diff changeset
   384
    }
hgs
parents: 54
diff changeset
   385
44
hgs
parents: 42
diff changeset
   386
    mServiceApp->launchFetcher(title);
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   387
    qDebug() << "GlxGetImageServiceNSDI::fetch END";
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   388
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   389
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   390
//==============================================================================//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   391
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   392
// GlxGetImageService()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   393
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   394
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   395
GlxGetImageServiceDSDI::GlxGetImageServiceDSDI(GlxAiwServiceHandler* parent) :
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   396
            XQServiceProvider(IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME, parent),
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   397
            mServiceApp(parent)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   398
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   399
    mImageRequestIndex = -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   400
    publishAll();
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   401
    connect(this, SIGNAL(clientDisconnected()), mServiceApp,
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   402
            SLOT(handleClientDisconnect()));
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   403
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   404
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   405
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   406
// ~GlxGetImageService()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   407
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   408
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   409
GlxGetImageServiceDSDI::~GlxGetImageServiceDSDI()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   410
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   411
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   412
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   413
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   414
// fetchFailed()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   415
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   416
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   417
void GlxGetImageServiceDSDI::fetchFailed(int errorCode)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   418
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   419
    QStringList filesList;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   420
    filesList.insert(0, QString::number(errorCode));//result
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   421
    doComplete(filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   422
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   423
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   424
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   425
// complete()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   426
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   427
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   428
void GlxGetImageServiceDSDI::complete(QStringList filesList)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   429
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   430
    doComplete(filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   431
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   432
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   433
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   434
// doComplete()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   435
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   436
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   437
void GlxGetImageServiceDSDI::doComplete(QStringList filesList)
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   438
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   439
    if (isActive())
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   440
        {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   441
        completeRequest(mImageRequestIndex, filesList);
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   442
        mImageRequestIndex = -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   443
        connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   444
        }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   445
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   446
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   447
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   448
// isActive()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   449
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   450
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   451
bool GlxGetImageServiceDSDI::isActive()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   452
    {
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   453
    return mImageRequestIndex > -1;
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   454
    }
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   455
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   456
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   457
// fetch()
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   458
// ----------------------------------------------------------------------------
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   459
//
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   460
void GlxGetImageServiceDSDI::fetch(QVariantMap filter, QVariant flag)
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
    Q_UNUSED(filter)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
    Q_UNUSED(flag)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
    mImageRequestIndex = setCurrentRequestAsync();
65
hgs
parents: 54
diff changeset
   465
    QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
hgs
parents: 54
diff changeset
   466
    if(title.isNull()){
hgs
parents: 54
diff changeset
   467
        title = GLX_TITLE;
hgs
parents: 54
diff changeset
   468
    }
hgs
parents: 54
diff changeset
   469
    
44
hgs
parents: 42
diff changeset
   470
    mServiceApp->launchFetcher(title);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
// ----------GlxImageViewerService---------------
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
GlxImageViewerService::GlxImageViewerService(GlxAiwServiceHandler* parent) :
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   476
    XQServiceProvider(FILE_VIEWER_SERVICE_NAME, parent),
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
            mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false),
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
            mImageViewerInstance(NULL)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
    publishAll();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
    connect(this, SIGNAL(clientDisconnected()), mServiceApp,
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
            SLOT(handleClientDisconnect()));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
GlxImageViewerService::~GlxImageViewerService()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
    if (mImageViewerInstance)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
        mImageViewerInstance->Close();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
void GlxImageViewerService::complete(bool ok)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
    {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
    if (mAsyncReqId == -1)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
        return;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
    completeRequest(mAsyncReqId, QVariant(ok));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
bool GlxImageViewerService::view(QString file)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
    {
45
hgs
parents: 44
diff changeset
   503
    XQApplicationManager appmgr;
hgs
parents: 44
diff changeset
   504
    QFile tempfile(file);
hgs
parents: 44
diff changeset
   505
    QVariantList attrValues;
hgs
parents: 44
diff changeset
   506
	QList<int> attrNames;
hgs
parents: 44
diff changeset
   507
	attrNames.append(XQApplicationManager::IsProtected);
hgs
parents: 44
diff changeset
   508
    bool ok = appmgr.getDrmAttributes(tempfile, attrNames, attrValues);
hgs
parents: 44
diff changeset
   509
    if(attrValues.at(0).toBool()){
hgs
parents: 44
diff changeset
   510
		HbNotificationDialog::launchDialog("NOT SUPPORTED");
hgs
parents: 44
diff changeset
   511
        connect(this, SIGNAL(returnValueDelivered()), mServiceApp,
hgs
parents: 44
diff changeset
   512
                SLOT(handleAnswerDelivered()));
hgs
parents: 44
diff changeset
   513
		complete(true);
hgs
parents: 44
diff changeset
   514
		return false;
hgs
parents: 44
diff changeset
   515
    }
hgs
parents: 44
diff changeset
   516
	
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
    XQRequestInfo info = requestInfo();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
    mAsyncRequest = !info.isSynchronous();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
    if (!mImageViewerInstance)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
        mImageViewerInstance = CGlxImageViewerManager::InstanceL();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
        }
42
5e1df1b52eb3 201019_01
hgs
parents: 41
diff changeset
   523
    QString filepath(QDir::toNativeSeparators(file));
41
ae07d189b490 201017_01
hgs
parents: 26
diff changeset
   524
    TPtrC16 str(reinterpret_cast<const TUint16*> (filepath.utf16()));
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
    HBufC* uri = str.Alloc();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
    mImageViewerInstance->SetImageUriL(*uri);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
    if (mAsyncRequest)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
        mAsyncReqId = setCurrentRequestAsync();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
        }
54
hgs
parents: 50
diff changeset
   532
65
hgs
parents: 54
diff changeset
   533
    QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
54
hgs
parents: 50
diff changeset
   534
    if(title.isNull()){
hgs
parents: 50
diff changeset
   535
        title =GLX_IMAGE_VIEWER;
hgs
parents: 50
diff changeset
   536
    }
hgs
parents: 50
diff changeset
   537
    
hgs
parents: 50
diff changeset
   538
    mServiceApp->launchImageViewer(title);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
    return true;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
bool GlxImageViewerService::view(XQSharableFile sf)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
    {
65
hgs
parents: 54
diff changeset
   544
    XQApplicationManager appmgr;
hgs
parents: 54
diff changeset
   545
    QFile tempfile(sf.fileName());
hgs
parents: 54
diff changeset
   546
    QVariantList attrValues;
hgs
parents: 54
diff changeset
   547
    QList<int> attrNames;
hgs
parents: 54
diff changeset
   548
    attrNames.append(XQApplicationManager::IsProtected);
hgs
parents: 54
diff changeset
   549
    bool ok1 = appmgr.getDrmAttributes(tempfile, attrNames, attrValues);
hgs
parents: 54
diff changeset
   550
    if(ok1 && attrValues.at(0).toBool()){
hgs
parents: 54
diff changeset
   551
        HbNotificationDialog::launchDialog("NOT SUPPORTED");
hgs
parents: 54
diff changeset
   552
        connect(this, SIGNAL(returnValueDelivered()), mServiceApp,
hgs
parents: 54
diff changeset
   553
                SLOT(handleAnswerDelivered()));
hgs
parents: 54
diff changeset
   554
        complete(true);
hgs
parents: 54
diff changeset
   555
        return false;
hgs
parents: 54
diff changeset
   556
    }
hgs
parents: 54
diff changeset
   557
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
    if (!mImageViewerInstance)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
        mImageViewerInstance = CGlxImageViewerManager::InstanceL();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
    RFile file;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
    bool ok = sf.getHandle(file);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
    if (ok)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
        mImageViewerInstance->SetImageFileHandleL(file);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
        sf.close();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
        }
54
hgs
parents: 50
diff changeset
   569
65
hgs
parents: 54
diff changeset
   570
    QString title = requestInfo().info(XQINFO_KEY_WINDOW_TITLE).toString();
54
hgs
parents: 50
diff changeset
   571
    if(title.isNull()){
hgs
parents: 50
diff changeset
   572
        title = GLX_IMAGE_VIEWER;
hgs
parents: 50
diff changeset
   573
    }
hgs
parents: 50
diff changeset
   574
    
hgs
parents: 50
diff changeset
   575
    mServiceApp->launchImageViewer(title);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   576
    mAsyncRequest = !XQServiceUtil::isEmbedded();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
    if (mAsyncRequest)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
        {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
        mAsyncReqId = setCurrentRequestAsync();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
        connect(this, SIGNAL(clientDisconnected()), this,
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
                SLOT(handleClientDisconnect()));
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
    return true;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
    }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
71
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   587
// ----------GlxBrowseImageService---------------
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   588
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   589
GlxBrowseImageService::GlxBrowseImageService(GlxAiwServiceHandler* parent) :
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   590
    XQServiceProvider(FILE_BROWSER_SERVICE_NAME, parent),
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   591
            mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false)
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   592
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   593
    {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   594
    publishAll();
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   595
    connect(this, SIGNAL(clientDisconnected()), mServiceApp,
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   596
            SLOT(handleClientDisconnect()));
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   597
    }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   598
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   599
GlxBrowseImageService::~GlxBrowseImageService()
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   600
    {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   601
    }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   602
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   603
void GlxBrowseImageService::complete(bool ok)
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   604
    {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   605
    if (mAsyncReqId == -1)
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   606
        return;
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   607
    completeRequest(mAsyncReqId, QVariant(ok));
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   608
    }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   609
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   610
void GlxBrowseImageService::browse()
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   611
    {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   612
	mServiceApp->launchImageBrowser(GLX_TITLE);
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   613
    XQRequestInfo info = requestInfo();
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   614
    mAsyncRequest = !info.isSynchronous();
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   615
	
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   616
    if (mAsyncRequest)
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   617
        {
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   618
        mAsyncReqId = setCurrentRequestAsync();
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   619
        connect(this, SIGNAL(clientDisconnected()), this,
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   620
                SLOT(handleClientDisconnect()));
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   621
        }
27f2d7aec52a 201039_01
hgs
parents: 65
diff changeset
   622
    }
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624