summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/cntmodel/inc/cntimagerescaleutility.h
blob: c5d8f001a67079bc5d617f09dfa00c61383fd995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  
*
*/

#ifndef CNTIMAGERESCALEUTILITY_H_
#define CNTIMAGERESCALEUTILITY_H_

#include <f32file.h>

class CContactItem;
/**
 * This is a utility class used with CntImageRescale class. This class holds the information
 * about phonbooks private image folder and is able to update the contact fields.
 * 
 * When user assigns a image to contact, CntImageRescaler copies and rescales the image
 * and asks this class to store it to contact item. 
 */
NONSHARABLE_CLASS(TCntImageRescaleUtility)
{
public:
    /**
     * Returns the private image directory.
     * Creates private image directory if doesn't exist
     * 
     * @return TPath Valid path to image directory
     * @leave If any error occures
     */
    IMPORT_C static TPath ImageDirectoryL();
    /**
     * Create a private image folder if it does not exists already.
     * 
     * @return TPath Full path to created image directory. 
     * @leave If any error occures
     */
    IMPORT_C static TPath CreateImageDirectoryL();
    /**
     * Delete the private image directory if it exists.
     * 
     * @leave If any error occures
     */
    IMPORT_C static void DeleteImageDirectoryL();
    /**
     * Delete the private image from file system, if one exists.
     */
    IMPORT_C static void DeleteImageL( const CContactItem& aItem );
    /**
     * Checks that if the private image filename does not contain an unique
     * identifier (GUID), adds it and renames the image. Updates also the contact
     * item to contain the renamed image path.
     * 
     * @param aItem Contact item which has a private image stored
     * @leave If any error occures 
     */
    IMPORT_C static void UpdateImageNameL( const CContactItem& aItem );
    /**
     * Stores the private image to given contacts field.
     * 
     * @param aItem CContactItem where the private image path should be stored
     * @param aPath New private image path 
     */
    IMPORT_C static void StoreImageFieldL( const CContactItem& aItem, const TPath aPath  );
    
private:
    /**
     * Creates a backup and restore file
     */
    static void CreateBackupAndRestoreFileL( RFs& aFs, const TPath& aDir );
    
    /**
     * Checks whether the drive is ready
     * return KErrNone if drive is ready else it returns KErrBadHandle
     */     
    static TInt IsDriveReady( RFs& aRfs, TInt aDrive );
    
};
#endif /* CNTIMAGERESCALEUTILITY_H_ */