phonebookui/phonebookservices/src/cntservicesubeditview.cpp
branchRCL_3
changeset 62 5b6f26637ad3
equal deleted inserted replaced
58:d4f567ce2e7c 62:5b6f26637ad3
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cntservicesubeditview.h"
       
    19 #include <cntservicescontact.h>
       
    20 #include <QCoreApplication>
       
    21 #include "cntdebug.h"
       
    22 
       
    23 CntServiceSubEditView::CntServiceSubEditView( CntAbstractServiceProvider& aServiceProvider )
       
    24 : CntEditView(),
       
    25 mProvider( aServiceProvider )
       
    26 {   
       
    27     connect( this, SIGNAL(contactUpdated(int)), this, SLOT(doContactUpdated(int)) );
       
    28     connect( this, SIGNAL(contactRemoved(bool)), this, SLOT(doContactRemoved(bool)) );
       
    29 }
       
    30 
       
    31 CntServiceSubEditView::~CntServiceSubEditView()
       
    32 {
       
    33 }
       
    34 
       
    35 void CntServiceSubEditView::doContactUpdated(int aSuccess)
       
    36 {
       
    37     CNT_ENTRY_ARGS(aSuccess)
       
    38     
       
    39     if ( mProvider.allowSubViewsExit() )
       
    40     {
       
    41         int retValue = aSuccess ? KCntServicesReturnValueContactSaved : KCntServicesReturnValueContactNotModified;
       
    42         QVariant variant;
       
    43         variant.setValue(retValue);
       
    44         mProvider.overrideReturnValue(variant);
       
    45     }
       
    46     
       
    47     CNT_EXIT
       
    48 }
       
    49 
       
    50 void CntServiceSubEditView::doContactRemoved(bool aSuccess)
       
    51 {
       
    52     CNT_ENTRY_ARGS(aSuccess)
       
    53 
       
    54     if ( mProvider.allowSubViewsExit() )
       
    55     {
       
    56         int retValue = aSuccess ? KCntServicesReturnValueContactDeleted : KCntServicesReturnValueContactNotModified;
       
    57         QVariant variant;
       
    58         variant.setValue(retValue);
       
    59         mProvider.CompleteServiceAndCloseApp(variant);
       
    60     }
       
    61 
       
    62     CNT_EXIT
       
    63 }
       
    64 
       
    65 // EOF