|
1 /* |
|
2 * Copyright (c) 2004 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 the License "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: Implementation of class CCodViewDialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "CodViewDialog.h" |
|
22 #include "CodView.h" |
|
23 #include "CodUi.hrh" |
|
24 #include "CodUiPanic.h" |
|
25 #include <AknAppUi.h> |
|
26 #include <CodUi.rsg> |
|
27 |
|
28 // ================= MEMBER FUNCTIONS ======================= |
|
29 |
|
30 // --------------------------------------------------------- |
|
31 // CCodViewDialog::CCodViewDialog |
|
32 // --------------------------------------------------------- |
|
33 // |
|
34 CCodViewDialog::CCodViewDialog( const CCodData& aData, TBool aCod ) |
|
35 : CAknDialog(), iData( aData ), iCod( aCod ) |
|
36 { |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------- |
|
40 // CCodViewDialog::ExecuteLD |
|
41 // --------------------------------------------------------- |
|
42 // |
|
43 TInt CCodViewDialog::ExecuteLD() |
|
44 { |
|
45 return CAknDialog::ExecuteLD( R_COD_UI_COD_VIEW_DIALOG ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------- |
|
49 // CCodViewDialog::CreateCustomControlL |
|
50 // --------------------------------------------------------- |
|
51 // |
|
52 SEikControlInfo CCodViewDialog::CreateCustomControlL( TInt aControlType ) |
|
53 { |
|
54 SEikControlInfo controlInfo; |
|
55 controlInfo.iControl = NULL; |
|
56 controlInfo.iTrailerTextId = 0; |
|
57 controlInfo.iFlags = 0; |
|
58 switch ( aControlType ) |
|
59 { |
|
60 case ECodUiCodView: |
|
61 { |
|
62 controlInfo.iControl = new (ELeave) CCodView(); |
|
63 break; |
|
64 } |
|
65 |
|
66 default: |
|
67 { |
|
68 __ASSERT_DEBUG( EFalse, CodUiPanic( ECodUiBadControl ) ); |
|
69 break; |
|
70 } |
|
71 } |
|
72 return controlInfo; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // CCodViewDialog::ProcessCommandL |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 void CCodViewDialog::ProcessCommandL( TInt aCommandId ) |
|
80 { |
|
81 switch( aCommandId ) |
|
82 { |
|
83 case ECodUiCmdAccept: |
|
84 case ECodUiCmdReject: |
|
85 { |
|
86 TryExitL( aCommandId ); |
|
87 break; |
|
88 } |
|
89 |
|
90 case EAknCmdExit: |
|
91 case EEikCmdExit: |
|
92 { |
|
93 ((CAknAppUi*)iEikonEnv->EikAppUi())->RunAppShutter(); |
|
94 break; |
|
95 } |
|
96 |
|
97 default: |
|
98 { |
|
99 CAknDialog::ProcessCommandL( aCommandId ); |
|
100 } |
|
101 } |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------------- |
|
105 // CCodViewDialog::OfferKeyEventL() |
|
106 // ---------------------------------------------------------- |
|
107 // |
|
108 TKeyResponse CCodViewDialog::OfferKeyEventL |
|
109 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
110 { |
|
111 TKeyResponse result = EKeyWasNotConsumed; |
|
112 if ( |
|
113 ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) && |
|
114 ( !(aKeyEvent.iModifiers & EModifierShift) ) |
|
115 ) |
|
116 { |
|
117 // Selection key press is same as Accept softkey. |
|
118 ProcessCommandL( ECodUiCmdAccept ); |
|
119 result = EKeyWasConsumed; |
|
120 } |
|
121 else if ( aKeyEvent.iCode == EKeyPhoneEnd ) |
|
122 { |
|
123 // Red key press -> Reject. |
|
124 // When incoming voice call ended the screen of download descriptor |
|
125 // information should not be closed. |
|
126 |
|
127 result = EKeyWasConsumed; |
|
128 } |
|
129 else |
|
130 { |
|
131 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
132 } |
|
133 return result; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // CCodViewDialog::PostLayoutDynInitL |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 void CCodViewDialog::PostLayoutDynInitL() |
|
141 { |
|
142 CAknDialog::PostLayoutDynInitL(); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------- |
|
146 // CCodViewDialog::ActivateL |
|
147 // --------------------------------------------------------- |
|
148 // |
|
149 void CCodViewDialog::ActivateL() |
|
150 { |
|
151 CAknDialog::ActivateL(); |
|
152 STATIC_CAST( CCodView*, Control( ECodUiCtlCodViewRtxEd ) )-> |
|
153 SetDataL( iData, iCod ); |
|
154 } |