|
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 * Defines common methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32def.h> |
|
23 #include <e32std.h> |
|
24 #include <eikenv.h> |
|
25 #include <ApSettingsHandlerCommons.h> |
|
26 #include "ApSettingsHandlerUI.hrh" |
|
27 #include <ApSetUI.rsg> |
|
28 #include <AknQueryDialog.h> |
|
29 #include <aknnotedialog.h> |
|
30 #include <StringLoader.h> |
|
31 |
|
32 #include <AknProgressDialog.h> |
|
33 #include <AknWaitDialog.h> |
|
34 |
|
35 #include "ApSettingsHandlerLogger.h" |
|
36 |
|
37 void Panic( TApSettingsHandlerUiPanicCodes aPanic ) |
|
38 { |
|
39 APSETUILOGGER_ENTERFN( EOther,"Commons::Panic") |
|
40 |
|
41 _LIT( kApSet, "APSettingsHandlerUi" ) ; |
|
42 User::Panic( kApSet, aPanic ) ; |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // AskQueryL |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 TInt AskQueryL( TInt aResId, TDesC* aVar ) |
|
51 { |
|
52 APSETUILOGGER_ENTERFN( EOther,"Commons::AskQueryL") |
|
53 |
|
54 HBufC* temp; |
|
55 if ( aVar ) |
|
56 { |
|
57 temp = StringLoader::LoadL( aResId, *aVar ); |
|
58 CleanupStack::PushL( temp ); |
|
59 } |
|
60 else |
|
61 { |
|
62 temp = CEikonEnv::Static()->AllocReadResourceLC( aResId ); |
|
63 } |
|
64 CAknQueryDialog* qd = |
|
65 CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); |
|
66 TInt retval = qd->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); |
|
67 CleanupStack::PopAndDestroy(); // temp |
|
68 |
|
69 APSETUILOGGER_LEAVEFN( EOther,"Commons::AskQueryL") |
|
70 return retval; |
|
71 } |
|
72 |
|
73 |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // ShowNoteL |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 TInt ShowNoteL( TInt aResId, TDesC* aVar ) |
|
80 { |
|
81 APSETUILOGGER_ENTERFN( EOther,"Commons::ShowNoteL") |
|
82 |
|
83 HBufC* temp; |
|
84 if ( aVar ) |
|
85 { |
|
86 temp = StringLoader::LoadL( aResId, *aVar ); |
|
87 CleanupStack::PushL( temp ); |
|
88 } |
|
89 else |
|
90 { |
|
91 temp = CEikonEnv::Static()->AllocReadResourceLC( aResId ); |
|
92 } |
|
93 CAknNoteDialog* dlg = |
|
94 new ( ELeave ) CAknNoteDialog |
|
95 ( |
|
96 REINTERPRET_CAST( CEikDialog**, &dlg ), |
|
97 CAknNoteDialog::ENoTone, |
|
98 CAknNoteDialog::EShortTimeout |
|
99 ); |
|
100 dlg->PrepareLC( R_GENERAL_NOTE ); |
|
101 dlg->SetTextL( *temp ); |
|
102 TInt retval = dlg->RunLD(); |
|
103 CleanupStack::PopAndDestroy(); // temp |
|
104 |
|
105 APSETUILOGGER_LEAVEFN( EOther,"Commons::ShowNoteL") |
|
106 return retval; |
|
107 } |
|
108 |
|
109 |
|
110 #ifdef __TEST_OOMDEBUG |
|
111 TInt GetTestStateL() |
|
112 { |
|
113 APSETUILOGGER_ENTERFN( EOther,"Commons::GetTestStateL") |
|
114 |
|
115 TInt retval( 0 ); |
|
116 RFs fs; |
|
117 User::LeaveIfError( fs.Connect() ); |
|
118 CleanupClosePushL<RFs>( fs ); |
|
119 TUint att; |
|
120 if ( fs.Att( KTestFileName, att ) == KErrNone ) |
|
121 { |
|
122 RFile file; |
|
123 TInt err = file.Open( fs, KTestFileName, |
|
124 EFileShareAny | EFileStreamText | |
|
125 EFileRead |
|
126 ); |
|
127 if ( err == KErrNone ) |
|
128 { |
|
129 TBuf8<256> buf; |
|
130 err = file.Read( buf ); |
|
131 if ( err == KErrNone ) |
|
132 { |
|
133 TInt val; |
|
134 TLex8 lex( buf ); |
|
135 err = lex.Val( val ); |
|
136 if ( err == KErrNone ) |
|
137 { |
|
138 retval = val; |
|
139 } |
|
140 } |
|
141 } |
|
142 file.Close(); |
|
143 } |
|
144 CleanupStack::PopAndDestroy(); // fs, will also close it |
|
145 |
|
146 APSETUILOGGER_LEAVEFN( EOther,"Commons::GetTestStateL") |
|
147 return retval; |
|
148 } |
|
149 #endif // __TEST_OOMDEBUG |
|
150 |
|
151 // End of File |