phonebookui/phonebookservices/src/cntserviceeditview.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 "cntserviceeditview.h"
       
    19 #include <cntservicescontact.h>
       
    20 #include <QCoreApplication>
       
    21 #include "cntdebug.h"
       
    22 
       
    23 CntServiceEditView::CntServiceEditView( 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     connect( this, SIGNAL(changesDiscarded()), this, SLOT(doChangesDiscarded()) );
       
    30 }
       
    31 
       
    32 CntServiceEditView::~CntServiceEditView()
       
    33 {
       
    34 }
       
    35 
       
    36 void CntServiceEditView::doContactUpdated(int aSuccess)
       
    37 {
       
    38     CNT_ENTRY_ARGS(aSuccess)
       
    39     
       
    40     int retValue = aSuccess ? KCntServicesReturnValueContactSaved : KCntServicesReturnValueContactNotModified;
       
    41     QVariant variant;
       
    42     variant.setValue(retValue);
       
    43     mProvider.CompleteServiceAndCloseApp(variant);
       
    44     
       
    45     CNT_EXIT
       
    46 }
       
    47 
       
    48 void CntServiceEditView::doContactRemoved(bool aSuccess)
       
    49 {
       
    50     CNT_ENTRY_ARGS(aSuccess)
       
    51             
       
    52     int retValue = aSuccess ? KCntServicesReturnValueContactDeleted : KCntServicesReturnValueContactNotModified;
       
    53     QVariant variant;
       
    54     variant.setValue(retValue);
       
    55     mProvider.CompleteServiceAndCloseApp(variant);
       
    56     
       
    57     CNT_EXIT
       
    58 }
       
    59 
       
    60 void CntServiceEditView::doChangesDiscarded()
       
    61 {
       
    62     CNT_ENTRY
       
    63     
       
    64     QVariant variant;
       
    65     variant.setValue(KCntServicesReturnValueContactNotModified);
       
    66     mProvider.CompleteServiceAndCloseApp(variant);
       
    67     
       
    68     CNT_EXIT
       
    69 }
       
    70 
       
    71 // EOF