locationpickerservice/src/locationpickerservice.cpp
branchRCL_3
changeset 17 1fc85118c3ae
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: LocationPickerService implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include <hbapplication.h>
       
    19 #include "locationpickerservice.h"
       
    20 #include "locationpickerappwindow.h"
       
    21 
       
    22 // ----------------------------------------------------------------------------
       
    23 // LocationPickerService::LocationPickerService()
       
    24 // ----------------------------------------------------------------------------
       
    25 //
       
    26 LocationPickerService::LocationPickerService(LocationPickerAppWindow* parent)
       
    27 : XQServiceProvider(QLatin1String("com.nokia.symbian.ILocationPick"),parent),mServiceApp(parent)
       
    28 {
       
    29     mAsyncReqId = 0;
       
    30     publishAll();
       
    31 }
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // LocationPickerService::~LocationPickerService()
       
    35 // ----------------------------------------------------------------------------
       
    36 //
       
    37 LocationPickerService::~LocationPickerService()
       
    38 {
       
    39 }
       
    40 
       
    41 
       
    42 // ----------------------------------------------------------------------------
       
    43 // LocationPickerService::complete()
       
    44 // ----------------------------------------------------------------------------
       
    45 void LocationPickerService::complete( QLocationPickerItem aLm )
       
    46 {
       
    47     if ( isActive() )
       
    48     {
       
    49         mReturn=aLm;
       
    50         connect( this, SIGNAL( returnValueDelivered() ), qApp, SLOT( quit() ) );
       
    51         bool ok = completeRequest(mAsyncReqId,mReturn);
       
    52 		mAsyncReqId = 0;
       
    53     }
       
    54 }
       
    55 // ----------------------------------------------------------------------------
       
    56 // isActive()
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 bool LocationPickerService::isActive()
       
    60 {
       
    61     return mAsyncReqId>0;
       
    62 }
       
    63 
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // LocationPickerService::pick()
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 void LocationPickerService::pick()
       
    70 {
       
    71     connect( this, SIGNAL( clientDisconnected() ), qApp, SLOT( quit() ) );
       
    72     mAsyncReqId = setCurrentRequestAsync();
       
    73 }
       
    74 
       
    75 
       
    76