|
1 // Copyright (c) 1997-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 "rasdef.h" |
|
17 |
|
18 CConnectBox::CConnectBox(CNtRas* aNtRas) |
|
19 : CActive(KKeyReaderPriority), iNtRas(aNtRas) |
|
20 { |
|
21 __DECLARE_NAME(_S("CConnectBox")); |
|
22 CActiveScheduler::Add(this); |
|
23 _LIT(KYes, "yes"); |
|
24 iYes=KYes; |
|
25 _LIT(KNo, "no"); |
|
26 iNo=KNo; |
|
27 _LIT(KNTRas, "NT Ras"); |
|
28 iLine1=KNTRas; |
|
29 } |
|
30 |
|
31 CConnectBox::~CConnectBox() |
|
32 { |
|
33 Cancel(); |
|
34 iNotifier.Close(); |
|
35 } |
|
36 |
|
37 CConnectBox* CConnectBox::NewL(CNtRas* aNtRas, TBool aReconnect) |
|
38 { |
|
39 |
|
40 CConnectBox* p = new (ELeave) CConnectBox(aNtRas); |
|
41 CleanupStack::PushL(p); |
|
42 p->ConstructL(aReconnect); |
|
43 CleanupStack::Pop(); |
|
44 return p; |
|
45 } |
|
46 |
|
47 void CConnectBox::ConstructL(TBool aReconnect) |
|
48 { |
|
49 |
|
50 TUint32 servermode, yestoconnect; |
|
51 |
|
52 iNtRas->ReadInt(NIF_IFSERVERMODE, servermode); |
|
53 if(aReconnect) |
|
54 iNtRas->ReadInt(RAS_YESTORECONNECT, yestoconnect); |
|
55 else |
|
56 iNtRas->ReadInt(RAS_YESTOCONNECT, yestoconnect); |
|
57 |
|
58 if(servermode||yestoconnect) |
|
59 { |
|
60 iButtonVal=1; |
|
61 TRequestStatus* p = &iStatus; |
|
62 User::RequestComplete(p, KErrNone); |
|
63 SetActive(); |
|
64 return; |
|
65 } |
|
66 User::LeaveIfError(iNotifier.Connect()); |
|
67 if (aReconnect) |
|
68 { |
|
69 _LIT(KReconnect, "Reconnect ?"); |
|
70 iLine2=KReconnect; |
|
71 } |
|
72 else |
|
73 { |
|
74 _LIT(KConnect, "Connect ?"); |
|
75 iLine2=KConnect; |
|
76 } |
|
77 iNotifier.Notify(iLine1, iLine2, iNo, iYes, iButtonVal, iStatus); |
|
78 SetActive(); |
|
79 } |
|
80 |
|
81 void CConnectBox::RunL() |
|
82 { |
|
83 if (iStatus!=KErrNone) |
|
84 { |
|
85 iNtRas->ConnectDialogComplete(iStatus.Int()); |
|
86 return; |
|
87 } |
|
88 |
|
89 switch (iButtonVal) |
|
90 { |
|
91 case 1: |
|
92 iNtRas->ConnectDialogComplete(KErrNone); |
|
93 break; |
|
94 |
|
95 default: |
|
96 iNtRas->ConnectDialogComplete(KErrCancel); |
|
97 break; |
|
98 } |
|
99 } |
|
100 |
|
101 void CConnectBox::DoCancel() |
|
102 { |
|
103 |
|
104 } |