|
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: CNewContactLauncherAppUi implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <avkon.hrh> |
|
20 #include <aknmessagequerydialog.h> |
|
21 #include <aknnotewrappers.h> |
|
22 #include <StringLoader.h> |
|
23 #include <f32file.h> |
|
24 #include <s32file.h> |
|
25 #include <hlplch.h> |
|
26 |
|
27 #include "NewContactLauncher.hrh" |
|
28 #include "NewContactLauncher.pan" |
|
29 #include "NewContactLauncherApplication.h" |
|
30 #include "NewContactLauncherAppUi.h" |
|
31 #include "NewContactLauncherAppView.h" |
|
32 #include <e32std.h> |
|
33 #include <apgtask.h> |
|
34 #include <apgcli.h> |
|
35 #include <bautils.h> |
|
36 #include <AiwCommon.h> |
|
37 #include <AiwContactSelectionDataTypes.h> |
|
38 #include <AiwContactAssignDataTypes.h> |
|
39 #include <AiwVariant.h> |
|
40 #include <NewContactLauncher.rsg> |
|
41 #include <coemain.h> |
|
42 #include <coeutils.h> |
|
43 #include <sysutil.h> |
|
44 |
|
45 |
|
46 _LIT( KNewContactLauncherResourceFileName, "\\resource\\apps\\newcontactlauncher.rsc"); |
|
47 |
|
48 |
|
49 // ============================ MEMBER FUNCTIONS =============================== |
|
50 |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CNewContactLauncherAppUi::ConstructL() |
|
54 // Symbian 2nd phase constructor can leave. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CNewContactLauncherAppUi::ConstructL() |
|
58 { |
|
59 // Initialise app UI with standard value. |
|
60 BaseConstructL(CAknAppUi::EAknEnableSkin); |
|
61 |
|
62 // Create view object |
|
63 iAppView = CNewContactLauncherAppView::NewL(ClientRect()); |
|
64 |
|
65 TFileName resfileName; |
|
66 resfileName.Append (KNewContactLauncherResourceFileName); |
|
67 |
|
68 BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resfileName ); |
|
69 |
|
70 if ( !ConeUtils::FileExists ( resfileName) ) |
|
71 { |
|
72 User::Leave( KErrGeneral ); |
|
73 } |
|
74 |
|
75 iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resfileName ); |
|
76 |
|
77 iServiceHandler = CAiwServiceHandler::NewL(); |
|
78 |
|
79 iServiceHandler->AttachL( R_AIWASSIGNMENT_INTEREST ); |
|
80 |
|
81 TUint assignFlags = 0; |
|
82 assignFlags |= AiwContactAssign::ECreateNewContact; |
|
83 |
|
84 iAiwParamList = CAiwGenericParamList::NewL(); |
|
85 |
|
86 iAiwParamList->AppendL( |
|
87 TAiwGenericParam( |
|
88 EGenericParamContactAssignData, |
|
89 TAiwVariant(AiwContactAssign::TAiwSingleContactAssignDataV1Pckg( |
|
90 AiwContactAssign::TAiwSingleContactAssignDataV1().SetFlags( assignFlags ))))); |
|
91 iServiceHandler->ExecuteServiceCmdL( |
|
92 KAiwCmdAssign, |
|
93 *iAiwParamList, |
|
94 iServiceHandler->OutParamListL(), |
|
95 0, |
|
96 this); |
|
97 |
|
98 } |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CNewContactLauncherAppUi::CNewContactLauncherAppUi() |
|
101 // C++ default constructor can NOT contain any code, that might leave. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CNewContactLauncherAppUi::CNewContactLauncherAppUi() |
|
105 { |
|
106 // No implementation required |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CNewContactLauncherAppUi::~CNewContactLauncherAppUi() |
|
111 // Destructor. |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 CNewContactLauncherAppUi::~CNewContactLauncherAppUi() |
|
115 { |
|
116 delete iAppView; |
|
117 |
|
118 if (iServiceHandler) |
|
119 { |
|
120 iServiceHandler->Reset(); |
|
121 } |
|
122 delete iServiceHandler; |
|
123 |
|
124 CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); |
|
125 |
|
126 delete iAiwParamList; |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // Called by the framework when the application status pane |
|
131 // size is changed. Passes the new client rectangle to the |
|
132 // AppView |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void CNewContactLauncherAppUi::HandleStatusPaneSizeChange() |
|
136 { |
|
137 iAppView->SetRect(ClientRect()); |
|
138 } |
|
139 |
|
140 TInt CNewContactLauncherAppUi::HandleNotifyL( TInt /*aCmdId*/, TInt /*aEventId*/, |
|
141 CAiwGenericParamList& aEventParamList, |
|
142 const CAiwGenericParamList& /*aInParamList*/ ) |
|
143 { |
|
144 if ( aEventParamList.Count() > 0 ) |
|
145 { |
|
146 const TAiwGenericParam& aiwGenericParam = aEventParamList[0]; |
|
147 TInt err = aiwGenericParam.Value().AsTInt32(); |
|
148 if ( err == KErrDiskFull ) |
|
149 { |
|
150 // Show not enough memory note |
|
151 CCoeEnv::Static()->HandleError( err ); |
|
152 } |
|
153 } |
|
154 Exit(); |
|
155 return KErrNone; |
|
156 } |
|
157 |
|
158 void CNewContactLauncherAppUi::ProcessMessageL( TUid /*aUid*/, const TDesC8& /*aParamData*/) |
|
159 { |
|
160 // no implementation needed now |
|
161 } |
|
162 |
|
163 |
|
164 |
|
165 // End of File |