|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "DialogProcessor.h" |
|
17 #include "DbAccess.h" |
|
18 //#include <comms-infras/dbaccess.h> |
|
19 |
|
20 CDialogProcessor* CDialogProcessor::NewL(TInt) |
|
21 { |
|
22 CDialogProcessor* self = new(ELeave)CDialogProcessor(); |
|
23 CleanupStack::PushL(self); |
|
24 self->ConstructL(); |
|
25 CleanupStack::Pop(); // self |
|
26 return self; |
|
27 } |
|
28 |
|
29 CDialogProcessor::CDialogProcessor() |
|
30 { |
|
31 } |
|
32 |
|
33 void CDialogProcessor::ConstructL() |
|
34 { |
|
35 CCommsDbAccess *aDatabase = CCommsDbAccess::NewL(); |
|
36 CleanupStack::PushL( aDatabase ); |
|
37 aDatabase->GetCurrentSettingsL(iSettings, ECommDbConnectionDirectionOutgoing, 1); |
|
38 CleanupStack::PopAndDestroy( aDatabase ); |
|
39 |
|
40 TCallBack callback(DialogCb, this); |
|
41 iDialogCb = new(ELeave) CAsyncCallBack(callback, CActive::EPriorityStandard); |
|
42 } |
|
43 |
|
44 CDialogProcessor::~CDialogProcessor() |
|
45 { |
|
46 |
|
47 delete iDialogCb; |
|
48 } |
|
49 |
|
50 TInt CDialogProcessor::DialogCb(TAny* aThisPtr) |
|
51 { |
|
52 CDialogProcessor* self = static_cast<CDialogProcessor*>(aThisPtr); |
|
53 self->DialogComplete(); |
|
54 return KErrNone; |
|
55 } |
|
56 |
|
57 void CDialogProcessor::DialogComplete() |
|
58 { |
|
59 |
|
60 switch(iAction) |
|
61 { |
|
62 case ESelectConnection: |
|
63 iObserver->MDPOSelectComplete(KErrNone, iSettings); |
|
64 break; |
|
65 case ESelectModemAndLocation: |
|
66 iObserver->MDPOSelectModemAndLocationComplete(KErrNone, iSettings); |
|
67 break; |
|
68 case EReconnect: |
|
69 iObserver->MDPOReconnectComplete(KErrNone); |
|
70 break; |
|
71 case EWarnNewConnection: |
|
72 iObserver->MDPOWarnComplete(KErrNone, ETrue); |
|
73 break; |
|
74 default: |
|
75 User::Invariant(); |
|
76 } |
|
77 } |
|
78 |
|
79 void CDialogProcessor::SelectConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs&) |
|
80 { |
|
81 |
|
82 iAction = ESelectConnection; |
|
83 iObserver = &aObserver; |
|
84 iDialogCb->CallBack(); |
|
85 } |
|
86 |
|
87 void CDialogProcessor::SelectConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs&, TInt) |
|
88 { |
|
89 |
|
90 iAction = ESelectConnection; |
|
91 iObserver = &aObserver; |
|
92 iDialogCb->CallBack(); |
|
93 } |
|
94 |
|
95 void CDialogProcessor::SelectModemAndLocation(MDialogProcessorObserver& aObserver) |
|
96 { |
|
97 |
|
98 iAction = ESelectModemAndLocation; |
|
99 iObserver = &aObserver; |
|
100 iDialogCb->CallBack(); |
|
101 } |
|
102 |
|
103 void CDialogProcessor::Reconnect(MDialogProcessorObserver& aObserver) |
|
104 { |
|
105 |
|
106 iAction = EReconnect; |
|
107 iObserver = &aObserver; |
|
108 iDialogCb->CallBack(); |
|
109 } |
|
110 |
|
111 void CDialogProcessor::WarnNewConnection(MDialogProcessorObserver& aObserver, const TConnectionPrefs&, const TDesC*, const TIspConnectionNames*, TInt) |
|
112 { |
|
113 |
|
114 iAction = EWarnNewConnection; |
|
115 iObserver = &aObserver; |
|
116 iDialogCb->CallBack(); |
|
117 } |
|
118 |
|
119 |
|
120 // |
|
121 // Default implementation of MDialogProcessorObserver |
|
122 // |
|
123 |
|
124 void MDialogProcessorObserver::MDPOSelectComplete(TInt, const TConnectionSettings&) |
|
125 { |
|
126 User::Invariant(); |
|
127 } |
|
128 |
|
129 void MDialogProcessorObserver::MDPOSelectModemAndLocationComplete(TInt, const TConnectionSettings&) |
|
130 { |
|
131 User::Invariant(); |
|
132 } |
|
133 |
|
134 void MDialogProcessorObserver::MDPOWarnComplete(TInt, TBool) |
|
135 { |
|
136 User::Invariant(); |
|
137 } |
|
138 |
|
139 void MDialogProcessorObserver::MDPOLoginComplete(TInt) |
|
140 { |
|
141 User::Invariant(); |
|
142 } |
|
143 |
|
144 void MDialogProcessorObserver::MDPOAuthenticateComplete(TInt) |
|
145 { |
|
146 User::Invariant(); |
|
147 } |
|
148 |
|
149 void MDialogProcessorObserver::MDPOReconnectComplete(TInt) |
|
150 { |
|
151 User::Invariant(); |
|
152 } |
|
153 |
|
154 void MDialogProcessorObserver::MDPOReadPctComplete(TInt) |
|
155 { |
|
156 User::Invariant(); |
|
157 } |
|
158 |
|
159 void MDialogProcessorObserver::MDPODestroyPctComplete(TInt) |
|
160 { |
|
161 User::Invariant(); |
|
162 } |
|
163 |
|
164 void MDialogProcessorObserver::MDPOQoSWarningComplete(TInt, TBool) |
|
165 { |
|
166 User::Invariant(); |
|
167 } |
|
168 |