|
1 /* |
|
2 * Copyright (c) 2007-2007 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: CSC Applicationīs note utilities |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <csc.rsg> |
|
20 #include <StringLoader.h> |
|
21 #include <aknnotedialog.h> |
|
22 #include <aknnotewrappers.h> |
|
23 |
|
24 #include "csclogger.h" |
|
25 #include "cscnoteutilities.h" |
|
26 |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // Shows a confirmation note without query. |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 void CCSCNoteUtilities::ShowConfirmationNote( |
|
36 TCSCNoteType /*aType*/, const TDesC& /*aText*/ ) |
|
37 { |
|
38 CSCDEBUG( "CCSCNoteUtilites::ShowConfirmationNote - begin" ); |
|
39 |
|
40 // Not used |
|
41 |
|
42 CSCDEBUG( "CCSCNoteUtilites::ShowConfirmationNote - end" ); |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Shows an information note without query. |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 void CCSCNoteUtilities::ShowInformationNoteL( |
|
51 TCSCNoteType aType, const TDesC& aText, const MDesCArray* /*aArray*/ ) |
|
52 { |
|
53 CSCDEBUG( "CCSCNoteUtilites::ShowInformationNoteL" ); |
|
54 |
|
55 // Create note. |
|
56 HBufC* string = NULL; |
|
57 |
|
58 // Select text for note. |
|
59 switch ( aType ) |
|
60 { |
|
61 case ECSCUnableToConfigureNote: |
|
62 string = StringLoader::LoadL( |
|
63 R_QTN_CSC_UNABLE_TO_CONFIGURE_NOTE ); |
|
64 break; |
|
65 case ECSCUnableToDeleteNote: |
|
66 string = StringLoader::LoadL( |
|
67 R_QTN_CSC_UNABLE_TO_DELETE_NOTE, aText ); |
|
68 break; |
|
69 default: |
|
70 break; |
|
71 } |
|
72 |
|
73 if ( string ) |
|
74 { |
|
75 // Set text and show note. |
|
76 CleanupStack::PushL( string ); |
|
77 CAknInformationNote* note = |
|
78 new ( ELeave ) CAknInformationNote( ETrue ); |
|
79 note->ExecuteLD( *string ); |
|
80 CleanupStack::PopAndDestroy( string ); |
|
81 } |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // Shows an error note without query. |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CCSCNoteUtilities::ShowErrorNote( |
|
90 TCSCNoteType /*aType*/, const TDesC& /*aText*/ ) |
|
91 { |
|
92 // Not used |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // Shows a note with query. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 TBool CCSCNoteUtilities::ShowCommonQueryL( |
|
101 TCSCNoteType aType, const TDesC& aText ) |
|
102 { |
|
103 CSCDEBUG( "CCSCNoteUtilites::ShowCommonQueryL - begin" ); |
|
104 |
|
105 TBool ret( EFalse ); |
|
106 TBool showQuery( ETrue ); |
|
107 |
|
108 // Create confirmation query dialog. |
|
109 HBufC* string = NULL; |
|
110 CAknQueryDialog* query = |
|
111 new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
112 |
|
113 CleanupStack::PushL( query ); |
|
114 |
|
115 // Prepare and set text for query. |
|
116 switch ( aType ) |
|
117 { |
|
118 case ECSCConfigureServiceQuery: |
|
119 query->PrepareLC( R_CSC_CONFIGURE_SERVICE_QUERY ); |
|
120 string = StringLoader::LoadLC( |
|
121 R_QTN_CSC_CONFIGURE_SERVICE_QUERY, aText ); |
|
122 query->SetPromptL( *string ); |
|
123 CleanupStack::PopAndDestroy( string ); |
|
124 break; |
|
125 case ECSCDeleteServiceQuery: |
|
126 query->PrepareLC( R_CSC_DELETE_SERVICE_QUERY ); |
|
127 string = StringLoader::LoadLC( |
|
128 R_QTN_CSC_DELETE_SERVICE_QUERY, aText ); |
|
129 query->SetPromptL( *string ); |
|
130 CleanupStack::PopAndDestroy( string ); |
|
131 break; |
|
132 default: |
|
133 // in default case query is not shown |
|
134 showQuery = EFalse; |
|
135 break; |
|
136 } |
|
137 |
|
138 CleanupStack::Pop( query ); |
|
139 |
|
140 // Show query. |
|
141 if ( showQuery ) |
|
142 { |
|
143 if( query->RunLD() ) |
|
144 { |
|
145 ret = ETrue; |
|
146 } |
|
147 } |
|
148 |
|
149 CSCDEBUG( "CCSCNoteUtilites::ShowCommonQueryL - end" ); |
|
150 |
|
151 return ret; |
|
152 } |
|
153 |