|
1 /* |
|
2 * Copyright (c) 2002 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 * Implementation of CbsUiClenaupHandler |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <gulicon.h> |
|
24 #include <aknnotewrappers.h> |
|
25 #include <aknappui.h> |
|
26 #include <aknnavi.h> |
|
27 #include <CbsCommon.h> |
|
28 #include <cbsuiApp.rsg> |
|
29 #include "CbsUiUtility.h" |
|
30 #include "CbsUiPanic.h" |
|
31 #include "MSaveMessageController.h" |
|
32 #include "CbsUiDebug.h" |
|
33 #include "MCbs.h" |
|
34 |
|
35 |
|
36 |
|
37 // =================== MEMBER FUNCTIONS ==================== |
|
38 |
|
39 |
|
40 // --------------------------------------------------------- |
|
41 // CbsUiUtility::ShowConfirmationNoteL |
|
42 // |
|
43 // |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 void CbsUiUtility::ShowConfirmationNoteL( |
|
47 const TInt aResourceId, TBool aWaitingDialog ) |
|
48 { |
|
49 HBufC* text = CCoeEnv::Static()->AllocReadResourceLC(aResourceId); |
|
50 CAknConfirmationNote* note = |
|
51 new (ELeave) CAknConfirmationNote(aWaitingDialog); |
|
52 note->ExecuteLD(*text); |
|
53 CleanupStack::PopAndDestroy(text); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CbsUiUtility::ShowErrorNoteL |
|
58 // |
|
59 // |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 void CbsUiUtility::ShowErrorNoteL( const TInt aResourceId ) |
|
63 { |
|
64 HBufC* text = CCoeEnv::Static()->AllocReadResourceLC( aResourceId ); |
|
65 CAknErrorNote* note = new (ELeave) CAknErrorNote; |
|
66 note->ExecuteLD( *text ); |
|
67 CleanupStack::PopAndDestroy( text ); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CbsUiUtility::ShowWarningNoteL |
|
72 // |
|
73 // |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 void CbsUiUtility::ShowWarningNoteL( const TInt aResourceId ) |
|
77 { |
|
78 HBufC* text = CCoeEnv::Static()->AllocReadResourceLC( aResourceId ); |
|
79 CAknWarningNote* note = new (ELeave) CAknWarningNote; |
|
80 note->ExecuteLD( *text ); |
|
81 CleanupStack::PopAndDestroy( text ); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------- |
|
85 // CbsUiUtility::CreateEmptyNavigationPaneL |
|
86 // |
|
87 // |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 CAknNavigationDecorator* CbsUiUtility::CreateEmptyNavigationPaneL() |
|
91 { |
|
92 CEikStatusPane* statusPane = |
|
93 STATIC_CAST( CAknAppUi*, |
|
94 CEikonEnv::Static()->EikAppUi() )->StatusPane(); |
|
95 |
|
96 CAknNavigationControlContainer* naviContainer = |
|
97 STATIC_CAST( CAknNavigationControlContainer*, statusPane-> |
|
98 ControlL(TUid::Uid(EEikStatusPaneUidNavi)) ); |
|
99 |
|
100 CAknNavigationDecorator* decorator; |
|
101 decorator = naviContainer->CreateNavigationLabelL(); |
|
102 |
|
103 naviContainer->PushL(*decorator); |
|
104 |
|
105 return decorator; |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // CbsUiUtility::IsSavedL |
|
110 // |
|
111 // |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 TBool CbsUiUtility::IsSavedL( const TCbsMessageHandle aHandle, MCbs& aServer ) |
|
115 { |
|
116 __ASSERT_DEBUG(&aServer, CbsUiPanic(EErrNullPointer) ); |
|
117 __ASSERT_DEBUG(aServer.Connected(), CbsUiPanic(EErrServerDisconnected) ); |
|
118 |
|
119 TCbsMessage message; |
|
120 |
|
121 TInt ret = aServer.FindMessageByHandle(aHandle, message); |
|
122 |
|
123 __CBSUI_ASSERT( ret == KErrNone, CbsUiPanic(EErrMsgHandleNotFound) ); |
|
124 |
|
125 User::LeaveIfError(ret); |
|
126 TBool saved(EFalse); |
|
127 |
|
128 if ( message.iPermanent ) |
|
129 { |
|
130 saved = ETrue; |
|
131 } |
|
132 |
|
133 return saved; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // CbsUiUtility::SaveCurrentMessageL |
|
138 // |
|
139 // |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 TInt CbsUiUtility::SaveCurrentMessageL( |
|
143 const TCbsMessageHandle aHandle, MSaveMessageController& aSaver ) |
|
144 { |
|
145 __ASSERT_DEBUG(&aSaver, CbsUiPanic(EErrNullPointer) ); |
|
146 |
|
147 TInt resultCode( aSaver.SaveMessage(aHandle) ); |
|
148 |
|
149 switch ( resultCode ) |
|
150 { |
|
151 case KErrDiskFull: |
|
152 { |
|
153 User::Leave( KErrDiskFull ); |
|
154 break; |
|
155 } |
|
156 case KErrNone: // Normal case |
|
157 { |
|
158 // do nothing |
|
159 break; |
|
160 } |
|
161 default: |
|
162 { |
|
163 CbsUiUtility::ShowErrorNoteL(R_TEXT_NOTE_MEMORY_FULL_ERROR); |
|
164 break; |
|
165 } |
|
166 } |
|
167 |
|
168 return resultCode; |
|
169 } |
|
170 |
|
171 // End of File |