9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: ESMR title pane handler implementation |
14 * Description: MR title pane handler implementation |
15 |
15 * |
16 * |
|
17 */ |
16 */ |
18 |
17 |
19 |
|
20 #include "emailtrace.h" |
|
21 #include "cesmrtitlepanehandler.h" |
18 #include "cesmrtitlepanehandler.h" |
22 |
19 |
|
20 #include <akntitle.h> |
|
21 #include <eikspane.h> |
|
22 #include <avkon.hrh> // EEikStatusPaneUidTitle |
|
23 |
|
24 // DEBUG |
|
25 #include "emailtrace.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // CESMRTitlePaneHandler::CESMRTitlePaneHandler |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CESMRTitlePaneHandler::CESMRTitlePaneHandler( CEikonEnv& aEnv ) |
|
34 : iEikEnv( aEnv ) |
|
35 { |
|
36 FUNC_LOG; |
|
37 // Do nothing |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CESMRTitlePaneHandler::ConstructL |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 void CESMRTitlePaneHandler::ConstructL() |
|
45 { |
|
46 FUNC_LOG; |
|
47 // Do nothing |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CESMRTitlePaneHandler::NewL |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CESMRTitlePaneHandler* CESMRTitlePaneHandler::NewL( CEikonEnv& aEnv ) |
|
55 { |
|
56 FUNC_LOG; |
|
57 CESMRTitlePaneHandler* self = new (ELeave) CESMRTitlePaneHandler( aEnv ); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CESMRTitlePaneHandler::~CESMRTitlePaneHandler |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CESMRTitlePaneHandler::~CESMRTitlePaneHandler() |
|
69 { |
|
70 FUNC_LOG; |
|
71 delete iSaveTitlePaneText; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CESMRTitlePaneHandler::SetNewTitle |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CESMRTitlePaneHandler::SetNewTitle( const TDesC* aNewTitle ) |
|
79 { |
|
80 FUNC_LOG; |
|
81 TRAPD( error, SetTitlePaneTextL( aNewTitle ) ); |
|
82 |
|
83 if ( error != KErrNone ) |
|
84 { |
|
85 iEikEnv.HandleError( error ); |
|
86 } |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CESMRTitlePaneHandler::Rollback |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CESMRTitlePaneHandler::Rollback() |
|
94 { |
|
95 FUNC_LOG; |
|
96 if ( iTitlePane && iSaveTitlePaneText ) |
|
97 { |
|
98 // iTitlePane takes ownership of iSaveTitlePaneText |
|
99 iTitlePane->SetText( iSaveTitlePaneText ); |
|
100 iSaveTitlePaneText = NULL; |
|
101 } |
|
102 } |
23 |
103 |
24 |
104 |
25 #include <akntitle.h> |
105 // --------------------------------------------------------------------------- |
26 |
106 // CESMRTitlePaneHandler::SetTitlePaneTextL |
27 #include <eikspane.h> |
107 // --------------------------------------------------------------------------- |
28 |
108 // |
29 #include <avkon.hrh> // EEikStatusPaneUidTitle |
109 void CESMRTitlePaneHandler::SetTitlePaneTextL( const TDesC* aNewTitle ) |
30 |
110 { |
31 |
|
32 |
|
33 CESMRTitlePaneHandler::CESMRTitlePaneHandler( CEikonEnv& aEnv ) |
|
34 |
|
35 : iEikEnv( aEnv ) |
|
36 |
|
37 { |
|
38 FUNC_LOG; |
111 FUNC_LOG; |
39 // Do nothing |
112 // Reset saved state |
40 |
|
41 } |
|
42 |
|
43 |
|
44 |
|
45 void CESMRTitlePaneHandler::ConstructL() |
|
46 |
|
47 { |
|
48 FUNC_LOG; |
|
49 // Do nothing |
|
50 |
|
51 } |
|
52 |
|
53 |
|
54 |
|
55 CESMRTitlePaneHandler* CESMRTitlePaneHandler::NewL( CEikonEnv& aEnv ) |
|
56 |
|
57 { |
|
58 FUNC_LOG; |
|
59 CESMRTitlePaneHandler* self = new (ELeave) CESMRTitlePaneHandler( aEnv ); |
|
60 |
|
61 CleanupStack::PushL( self ); |
|
62 |
|
63 self->ConstructL(); |
|
64 |
|
65 CleanupStack::Pop( self ); |
|
66 |
|
67 return self; |
|
68 |
|
69 } |
|
70 |
|
71 |
|
72 |
|
73 CESMRTitlePaneHandler::~CESMRTitlePaneHandler() |
|
74 |
|
75 { |
|
76 FUNC_LOG; |
|
77 delete iSaveTitlePaneText; |
|
78 |
|
79 } |
|
80 |
|
81 |
|
82 |
|
83 void CESMRTitlePaneHandler::SetNewTitle( const TDesC* aNewTitle ) |
|
84 |
|
85 { |
|
86 FUNC_LOG; |
|
87 TRAPD( error, SetTitlePaneTextL( aNewTitle ) ); |
|
88 |
|
89 if ( error != KErrNone ) |
|
90 |
|
91 { |
|
92 |
|
93 iEikEnv.HandleError( error ); |
|
94 |
|
95 } |
|
96 |
|
97 } |
|
98 |
|
99 |
|
100 |
|
101 void CESMRTitlePaneHandler::Rollback() |
|
102 |
|
103 { |
|
104 FUNC_LOG; |
|
105 if ( iTitlePane && iSaveTitlePaneText ) |
|
106 |
|
107 { |
|
108 |
|
109 // iTitlePane takes ownership of iSaveTitlePaneText |
|
110 |
|
111 iTitlePane->SetText( iSaveTitlePaneText ); |
|
112 |
|
113 iSaveTitlePaneText = NULL; |
|
114 |
|
115 } |
|
116 |
|
117 } |
|
118 |
|
119 |
|
120 |
|
121 void CESMRTitlePaneHandler::SetTitlePaneTextL( const TDesC* aNewTitle ) |
|
122 |
|
123 { |
|
124 FUNC_LOG; |
|
125 // Reset saved state |
|
126 |
|
127 delete iSaveTitlePaneText; |
113 delete iSaveTitlePaneText; |
128 |
|
129 iSaveTitlePaneText = NULL; |
114 iSaveTitlePaneText = NULL; |
130 |
|
131 |
|
132 |
115 |
133 CEikStatusPane* statusPane = iEikEnv.AppUiFactory()->StatusPane(); |
116 CEikStatusPane* statusPane = iEikEnv.AppUiFactory()->StatusPane(); |
134 |
117 |
135 if (statusPane) |
118 if ( statusPane ) |
|
119 { |
|
120 if ( statusPane->PaneCapabilities( |
|
121 TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() ) |
|
122 { |
|
123 iTitlePane = static_cast<CAknTitlePane*>( |
|
124 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
136 |
125 |
137 { |
126 if ( iTitlePane->Text() ) |
138 |
|
139 if (statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)) |
|
140 |
|
141 .IsPresent()) |
|
142 |
|
143 { |
|
144 |
|
145 iTitlePane = static_cast<CAknTitlePane*> |
|
146 |
|
147 (statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle))); |
|
148 |
|
149 if (iTitlePane->Text()) |
|
150 |
|
151 { |
127 { |
152 |
|
153 iSaveTitlePaneText = iTitlePane->Text()->AllocL(); |
128 iSaveTitlePaneText = iTitlePane->Text()->AllocL(); |
154 |
|
155 } |
129 } |
156 |
130 |
157 if (aNewTitle) |
131 if ( aNewTitle ) |
158 |
|
159 { |
132 { |
160 |
133 iTitlePane->SetTextL( *aNewTitle ); |
161 iTitlePane->SetTextL(*aNewTitle); |
|
162 |
|
163 } |
134 } |
164 |
|
165 else |
135 else |
166 |
|
167 { |
136 { |
168 |
|
169 iTitlePane->SetTextToDefaultL(); |
137 iTitlePane->SetTextToDefaultL(); |
170 |
|
171 } |
138 } |
172 |
|
173 } |
139 } |
174 |
|
175 } |
140 } |
176 |
141 } |
177 } |
|
178 |
|
179 |
|
180 |
142 |
181 // End of file |
143 // End of file |
182 |
144 |