phonebookui/pbkcommonui/inc/cntsavemanager.h
changeset 59 a642906a277a
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
       
     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 #ifndef CNTSAVEMANAGER_H
       
    19 #define CNTSAVEMANAGER_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <qtcontacts.h>
       
    23 
       
    24 QTM_BEGIN_NAMESPACE
       
    25 class QContact;
       
    26 class QContactAvatar;
       
    27 QTM_END_NAMESPACE
       
    28 
       
    29 QTM_USE_NAMESPACE
       
    30 
       
    31 /*!
       
    32     Contact saving helper class. Used mainly in edit view for contact saving,
       
    33     but should also be used in other (special) cases a contact needs to be saved.
       
    34     For example "forcing" phonebook to shut down (end key, from task swapper etc..)
       
    35     in detail editors.
       
    36 */
       
    37 class CntSaveManager : public QObject
       
    38 {
       
    39     friend class TestCntSaveManager;
       
    40     Q_OBJECT
       
    41     
       
    42 public:
       
    43     enum CntSaveResult
       
    44     {
       
    45         ESaved = 0,
       
    46         EUpdated,
       
    47         EDeleted,
       
    48         EFailed,
       
    49         ENothingDone
       
    50     };
       
    51     
       
    52     enum CntContactType
       
    53     {
       
    54         EContact = 0,
       
    55         EMyCard,
       
    56         EGroup
       
    57     };
       
    58     
       
    59 public:
       
    60     CntSaveManager(CntContactType type = EContact, QObject* parent = NULL);
       
    61     ~CntSaveManager();
       
    62     
       
    63     CntSaveResult saveContact(QContact* aContact, QContactManager* aManager);
       
    64     
       
    65 private:
       
    66     void setPreferredDetails(QContact* aContact);
       
    67     
       
    68 private:
       
    69     CntContactType   mContactType;
       
    70     
       
    71 };
       
    72 
       
    73 #endif // CNTIMAGEEDITORVIEW_H