|
1 /* |
|
2 * Copyright (c) 2002-2005 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 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "NSmlDSSyncAppUi.h" |
|
22 #include "NSmlDSSyncContainer.h" |
|
23 #include "NSmlDSSyncDocument.h" |
|
24 |
|
25 #include <NSmlDSSync.rsg> |
|
26 #include "NSmlDSSync.hrh" |
|
27 #include "AspDebug.h" |
|
28 |
|
29 #include <eikmenup.h> |
|
30 |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 //#ifdef RD_DSUI_CP_INTEGRATION |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CNSmlDSSyncAppUi::ConstructL |
|
38 // |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void CNSmlDSSyncAppUi::ConstructL() |
|
42 { |
|
43 FLOG( _L("CNSmlDSSyncAppUi::ConstructL START") ); |
|
44 |
|
45 const TInt KBufSize128 = 128; |
|
46 const TInt KModeDialogNoWait = 4; |
|
47 |
|
48 BaseConstructL(EAknEnableSkin | EAknDisableHighlightAnimation | EAknEnableMSK | EAknSingleClickCompatible); |
|
49 |
|
50 TBool flag = CEikonEnv::Static()->StartedAsServerApp() ; |
|
51 if (flag) |
|
52 { |
|
53 TRAP_IGNORE(iIdle = CIdle::NewL( CActive::EPriorityHigh )); |
|
54 |
|
55 if ( !iIdle->IsActive() ) |
|
56 { |
|
57 iIdle->Start( TCallBack( OpenDialog, this ) ); |
|
58 } |
|
59 } |
|
60 else |
|
61 { |
|
62 iAppContainer = new (ELeave) CNSmlDSSyncContainer; |
|
63 iAppContainer->SetMopParent(this); |
|
64 iAppContainer->ConstructL(ClientRect()); |
|
65 AddToStackL(iAppContainer); |
|
66 |
|
67 TBuf<KBufSize128> buf; |
|
68 CNSmlDSSyncDocument* document= STATIC_CAST(CNSmlDSSyncDocument*, Document()); |
|
69 TRAPD(err, document->Model()->ShowSettingsL(0, KModeDialogNoWait, buf)); |
|
70 if(err != KErrNone) |
|
71 { |
|
72 iAvkonAppUi->Exit(); |
|
73 } |
|
74 } |
|
75 |
|
76 FLOG( _L("CNSmlDSSyncAppUi::ConstructL END") ); |
|
77 } |
|
78 |
|
79 // ========================================================================== |
|
80 // METHOD: OpenDialog |
|
81 // |
|
82 // DESIGN: CIdle Callback function |
|
83 // ========================================================================== |
|
84 TInt CNSmlDSSyncAppUi::OpenDialog( TAny* /*aThis*/ ) |
|
85 { |
|
86 const TInt KBufSize128 = 128; |
|
87 |
|
88 // Launch the settings dialog |
|
89 TBuf<KBufSize128> buf; |
|
90 CSyncUtilApi* utilApi = CSyncUtilApi::NewL(); |
|
91 CleanupStack::PushL( utilApi ); |
|
92 |
|
93 TRAP_IGNORE( utilApi->ShowSettingsL( 0, 0, buf ) ); |
|
94 |
|
95 CleanupStack::PopAndDestroy( utilApi ); |
|
96 |
|
97 // We're done; exit |
|
98 iAvkonAppUi->Exit(); |
|
99 |
|
100 return KErrNone; |
|
101 } |
|
102 |
|
103 //#else |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CNSmlDSSyncAppUi::ConstructL |
|
106 // |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 /*void CNSmlDSSyncAppUi::ConstructL() |
|
110 { |
|
111 FLOG( _L("CNSmlDSSyncAppUi::ConstructL START") ); |
|
112 |
|
113 const TInt KBufSize128 = 128; |
|
114 const TInt KModeDialogNoWait = 4; |
|
115 |
|
116 BaseConstructL(EAknEnableSkin | EAknDisableHighlightAnimation | EAknEnableMSK); |
|
117 |
|
118 iAppContainer = new (ELeave) CNSmlDSSyncContainer; |
|
119 iAppContainer->SetMopParent(this); |
|
120 iAppContainer->ConstructL(ClientRect()); |
|
121 AddToStackL(iAppContainer); |
|
122 |
|
123 TBuf<KBufSize128> buf; |
|
124 CNSmlDSSyncDocument* document= STATIC_CAST(CNSmlDSSyncDocument*, Document()); |
|
125 document->Model()->ShowSettingsL(0, KModeDialogNoWait, buf); |
|
126 |
|
127 FLOG( _L("CNSmlDSSyncAppUi::ConstructL END") ); |
|
128 }*/ |
|
129 |
|
130 //#endif |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi |
|
134 // |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi() |
|
138 { |
|
139 FLOG( _L("CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi START") ); |
|
140 //#ifdef RD_DSUI_CP_INTEGRATION |
|
141 if ( iIdle ) |
|
142 { |
|
143 delete iIdle; |
|
144 iIdle = NULL; |
|
145 } |
|
146 //#endif |
|
147 if (iAppContainer) |
|
148 { |
|
149 RemoveFromStack( iAppContainer ); |
|
150 delete iAppContainer; |
|
151 } |
|
152 |
|
153 FLOG( _L("CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi END") ); |
|
154 } |
|
155 |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CNSmlDSSyncAppUi::DynInitMenuPaneL |
|
159 // |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 void CNSmlDSSyncAppUi::DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) |
|
163 { |
|
164 } |
|
165 |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CNSmlDSSyncAppUi::HandleKeyEventL |
|
169 // |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TKeyResponse CNSmlDSSyncAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) |
|
173 { |
|
174 return EKeyWasNotConsumed; |
|
175 } |
|
176 |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CNSmlDSSyncAppUi::HandleCommandL |
|
180 // |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 void CNSmlDSSyncAppUi::HandleCommandL(TInt aCommand) |
|
184 { |
|
185 FLOG( _L("CNSmlDSSyncAppUi::HandleCommandL START") ); |
|
186 |
|
187 switch (aCommand) |
|
188 { |
|
189 case EAknCmdExit: |
|
190 case EEikCmdExit: |
|
191 case EAknSoftkeyBack: |
|
192 { |
|
193 FLOG( _L("before Exit") ); |
|
194 |
|
195 Exit(); |
|
196 |
|
197 FLOG( _L("after Exit") ); |
|
198 break; |
|
199 } |
|
200 |
|
201 default: |
|
202 { |
|
203 break; |
|
204 } |
|
205 } |
|
206 |
|
207 FLOG( _L("CNSmlDSSyncAppUi::HandleCommandL END") ); |
|
208 } |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 // End of File |