|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 contact ringing tone assigner. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTRINGINGTONEASSIGNER_H |
|
20 #define CPBK2CONTACTRINGINGTONEASSIGNER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MPbk2ContactAssigner.h" |
|
25 #include <Pbk2ServerAppIPC.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MPbk2ContactAssignerObserver; |
|
29 class CPbk2DrmManager; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Phonebook 2 contact ringing tone assigner. |
|
35 */ |
|
36 class CPbk2ContactRingingToneAssigner : public CActive, |
|
37 public MPbk2ContactAssigner |
|
38 { |
|
39 public: // Construction and destruction |
|
40 |
|
41 /** |
|
42 * Creates a new instance of this class. |
|
43 * |
|
44 * @param aObserver Observer. |
|
45 * @return A new instance of this class. |
|
46 */ |
|
47 static CPbk2ContactRingingToneAssigner* NewL( |
|
48 MPbk2ContactAssignerObserver& aObserver ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CPbk2ContactRingingToneAssigner(); |
|
54 |
|
55 public: // From MPbk2ContactAssigner |
|
56 void AssignDataL( |
|
57 MVPbkStoreContact& aStoreContact, |
|
58 MVPbkStoreContactField* aContactField, |
|
59 const MVPbkFieldType* aFieldType, |
|
60 const HBufC* aDataBuffer ); |
|
61 void AssignAttributeL( |
|
62 MVPbkStoreContact& aStoreContact, |
|
63 MVPbkStoreContactField* aContactField, |
|
64 TPbk2AttributeAssignData aAttributeAssignData ); |
|
65 |
|
66 private: // From CActive |
|
67 void RunL(); |
|
68 void DoCancel(); |
|
69 TInt RunError( |
|
70 TInt aError ); |
|
71 |
|
72 private: // Implementation |
|
73 CPbk2ContactRingingToneAssigner( |
|
74 MPbk2ContactAssignerObserver& aObserver ); |
|
75 void ConstructL(); |
|
76 void InsertDataL( |
|
77 MVPbkStoreContactField& aField, |
|
78 const HBufC& aDataBuffer ); |
|
79 void IssueRequest(); |
|
80 TInt PassesDrmCheckL( |
|
81 const HBufC* aDataBuffer, |
|
82 TBool& aIsProtected ); |
|
83 TBool PassesSizeCheckL( |
|
84 const HBufC* aDataBuffer ); |
|
85 void MaxToneFileSizeL( |
|
86 TInt& aMaxSizeKB ) const; |
|
87 TInt CheckFileSizeLimit( |
|
88 const TDesC& aFileName, |
|
89 TInt aSizeLimit ); |
|
90 TInt CheckToneFileSize( |
|
91 const TDesC& aFile, |
|
92 TInt aSizeLimitKB ); |
|
93 void ShowSizeErrorNoteL( |
|
94 TInt aSizeLimitKB ) const; |
|
95 |
|
96 /** |
|
97 * Process states. |
|
98 */ |
|
99 enum TProcessState |
|
100 { |
|
101 EStopping, |
|
102 EDrmProtected |
|
103 }; |
|
104 |
|
105 private: // Data |
|
106 /// Ref: Observer |
|
107 MPbk2ContactAssignerObserver& iObserver; |
|
108 /// Own: Index of the added field |
|
109 TInt iIndex; |
|
110 /// Own: Error code |
|
111 TInt iError; |
|
112 /// Own: DRM manager |
|
113 CPbk2DrmManager* iDrmManager; |
|
114 /// Own: Current state of process |
|
115 TProcessState iState; |
|
116 }; |
|
117 |
|
118 #endif // CPBK2CONTACTRINGINGTONEASSIGNER_H |
|
119 |
|
120 // End of File |