|
1 /* |
|
2 * Copyright (c) 2005-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: Displays a dialog on the UI with the help of Symbian OS |
|
15 * notification services. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "ConnMonServ.h" |
|
22 #include "ConnMonIAP.h" |
|
23 #include "CUiDialogAO.h" |
|
24 #include "ConnMonAvailabilityManager.h" |
|
25 #include "log.h" |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CUiDialogAO::CUiDialogAO |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CUiDialogAO::CUiDialogAO( CConnMonServer* aServer ) |
|
34 : |
|
35 CActive( EPriorityStandard ), |
|
36 iServer( aServer ), |
|
37 iDummy( KNullDesC8 ) |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CUiDialogAO::ConstructL |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CUiDialogAO::ConstructL() |
|
46 { |
|
47 CActiveScheduler::Add( this ); |
|
48 |
|
49 // Open RNotifier |
|
50 TInt ret = iNotifier.Connect(); |
|
51 |
|
52 if ( ret != KErrNone ) |
|
53 { |
|
54 LOGIT1("Could not connect to RNotifier, err <%d>", ret ) |
|
55 User::Leave( ret ); |
|
56 } |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CUiDialogAO::NewL |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CUiDialogAO* CUiDialogAO::NewL( CConnMonServer* aServer ) |
|
64 { |
|
65 CUiDialogAO* self = new ( ELeave ) CUiDialogAO( aServer ); |
|
66 |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop( self ); |
|
70 |
|
71 return self; |
|
72 } |
|
73 |
|
74 // Destructor |
|
75 CUiDialogAO::~CUiDialogAO() |
|
76 { |
|
77 Cancel(); |
|
78 |
|
79 iNotifier.Close(); |
|
80 |
|
81 iServer = NULL; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CUiDialogAO::Start |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CUiDialogAO::Start() |
|
89 { |
|
90 if ( !IsActive() ) |
|
91 { |
|
92 iNetIds.FillZ(); |
|
93 iNetIds.Zero(); |
|
94 |
|
95 iNotifier.StartNotifierAndGetResponse( |
|
96 iStatus, |
|
97 KUidSelectNetwork, |
|
98 iDummy, |
|
99 iNetIds ); |
|
100 SetActive(); |
|
101 } |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CUiDialogAO::DoCancel |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CUiDialogAO::DoCancel() |
|
109 { |
|
110 if ( IsActive() ) |
|
111 { |
|
112 iNotifier.CancelNotifier( KUidSelectNetwork ); |
|
113 } |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CUiDialogAO::RunL |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CUiDialogAO::RunL() |
|
121 { |
|
122 if ( iStatus == KErrNone ) |
|
123 { |
|
124 // Set user's LAN network selection |
|
125 iServer->Iap()->SetEndUserLanPreference( iNetIds ); |
|
126 |
|
127 // Write to log |
|
128 |
|
129 if ( iNetIds.Length() > 0 ) |
|
130 { |
|
131 /////////// 3.1U availability staff |
|
132 LOGIT("CUiDialogAO::RunL() triggered HandleAvailabilityChange()") |
|
133 iServer->AvailabilityManager()->HandleAvailabilityChange(); |
|
134 ///////////////////////////////////////////////////////////// |
|
135 } |
|
136 |
|
137 iNotifier.CancelNotifier( KUidSelectNetwork ); |
|
138 } |
|
139 else if ( iStatus == KErrCancel ) |
|
140 { |
|
141 // Reset LAN network selection |
|
142 iServer->Iap()->ResetEndUserLanPreference(); |
|
143 } |
|
144 else |
|
145 { |
|
146 // Write to log |
|
147 } |
|
148 |
|
149 delete this; |
|
150 } |
|
151 |
|
152 // End-of-file |