20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include <e32base.h> |
21 #include <e32base.h> |
22 #include <msvapi.h> |
22 #include <msvapi.h> |
23 #include <mmsclient.h> |
23 #include <mmsclient.h> |
24 #include <mtclreg.h> |
24 #include <mtclreg.h> |
25 #include <ApDataHandler.h> |
25 #include <cmmanagerext.h> |
26 #include <ApAccessPointItem.h> |
26 #include <cmconnectionmethodext.h> |
|
27 #include <cmpluginpacketdatadef.h> |
27 #include <CWPCharacteristic.h> |
28 #include <CWPCharacteristic.h> |
28 #include <CWPParameter.h> |
29 #include <CWPParameter.h> |
29 #include <CWPAdapter.h> |
30 #include <CWPAdapter.h> |
30 #include <favouritesdb.h> |
31 #include <favouritesdb.h> |
31 #include "CWPWAPMMSItem.h" |
32 #include "CWPWAPMMSItem.h" |
47 // |
48 // |
48 CWPWAPMMSItem::CWPWAPMMSItem( const TDesC& aTitle, |
49 CWPWAPMMSItem::CWPWAPMMSItem( const TDesC& aTitle, |
49 const TDesC& aDefaultName, |
50 const TDesC& aDefaultName, |
50 CWPCharacteristic& aCharacteristic, |
51 CWPCharacteristic& aCharacteristic, |
51 CCommsDatabase*& aDb, |
52 CCommsDatabase*& aDb, |
52 CApDataHandler*& aAPHandler ) |
53 RCmManagerExt*& aCmManager ) |
53 : CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aAPHandler ) |
54 : CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aCmManager ) |
54 { |
55 { |
55 } |
56 } |
56 |
57 |
57 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
58 // CWPWAPMMSItem::ConstructL |
59 // CWPWAPMMSItem::ConstructL |
71 // |
72 // |
72 CWPWAPMMSItem* CWPWAPMMSItem::NewL( const TDesC& aTitle, |
73 CWPWAPMMSItem* CWPWAPMMSItem::NewL( const TDesC& aTitle, |
73 const TDesC& aDefaultName, |
74 const TDesC& aDefaultName, |
74 CWPCharacteristic& aCharacteristic, |
75 CWPCharacteristic& aCharacteristic, |
75 CCommsDatabase*& aDb, |
76 CCommsDatabase*& aDb, |
76 CApDataHandler*& aAPHandler ) |
77 RCmManagerExt*& aCmManager ) |
77 { |
78 { |
78 CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, |
79 CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, |
79 aCharacteristic, aDb, aAPHandler ); |
80 aCharacteristic, aDb, aCmManager ); |
80 CleanupStack::PushL(self); |
81 CleanupStack::PushL(self); |
81 self->ConstructL(); |
82 self->ConstructL(); |
82 CleanupStack::Pop(self); |
83 CleanupStack::Pop(self); |
83 return self; |
84 return self; |
84 } |
85 } |
94 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
95 // |
96 // |
96 void CWPWAPMMSItem::SaveL() |
97 void CWPWAPMMSItem::SaveL() |
97 { |
98 { |
98 CreateDbL(); |
99 CreateDbL(); |
99 |
100 TBool check = EFalse; |
100 // Find a proper GPRS access point |
101 RCmConnectionMethodExt cm; |
101 CApAccessPointItem* item = FindGPRSLC(); |
102 TUint32 bearer = 0; |
102 WriteHomePageL( *item ); |
103 for( TInt i( 0 ); i < iLinks.Count() && check == EFalse ; i++ ) |
103 CleanupStack::PopAndDestroy(); // item |
104 { |
|
105 CWPCharacteristic* curr = iLinks[i]; |
|
106 TPckgBuf<TUint32> uidPckg; |
|
107 const TInt pkgLength( uidPckg.MaxLength() ); |
|
108 for( TInt dataNum( 0 ); check == EFalse && curr->Data( dataNum ).Length() == pkgLength;dataNum++ ) |
|
109 { |
|
110 uidPckg.Copy( curr->Data( dataNum ) ); |
|
111 // Read the access point pointed to by TO-NAPID or TO-PROXY |
|
112 cm = iCmManager->ConnectionMethodL( uidPckg() ); |
|
113 CleanupClosePushL( cm ); |
|
114 bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); |
|
115 if( bearer == KUidPacketDataBearerType ) |
|
116 { |
|
117 // Item left on cleanup stack |
|
118 check = ETrue; |
|
119 } |
|
120 else |
|
121 { |
|
122 CleanupStack::PopAndDestroy(); // cm |
|
123 } |
|
124 } |
|
125 } |
|
126 |
|
127 WriteHomePageL( cm ); |
|
128 CleanupStack::PopAndDestroy(); // cm |
104 } |
129 } |
105 |
130 |
106 // ----------------------------------------------------------------------------- |
131 // ----------------------------------------------------------------------------- |
107 // CWPWAPMMSItem::CanSetAsDefault |
132 // CWPWAPMMSItem::CanSetAsDefault |
108 // ----------------------------------------------------------------------------- |
133 // ----------------------------------------------------------------------------- |
221 void CWPWAPMMSItem::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, |
246 void CWPWAPMMSItem::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, |
222 TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) |
247 TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) |
223 { |
248 { |
224 } |
249 } |
225 |
250 |
226 // ----------------------------------------------------------------------------- |
251 |
227 // CWPWAPMMSItem::FindGPRSL |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 CApAccessPointItem* CWPWAPMMSItem::FindGPRSLC() const |
|
231 { |
|
232 CApAccessPointItem* result = NULL; |
|
233 for( TInt i( 0 ); i < iLinks.Count() && result == NULL; i++ ) |
|
234 { |
|
235 CWPCharacteristic* curr = iLinks[i]; |
|
236 |
|
237 TPckgBuf<TUint32> uidPckg; |
|
238 const TInt pkgLength( uidPckg.MaxLength() ); |
|
239 for( TInt dataNum( 0 ); |
|
240 result == NULL && curr->Data( dataNum ).Length() == pkgLength; |
|
241 dataNum++ ) |
|
242 { |
|
243 uidPckg.Copy( curr->Data( dataNum ) ); |
|
244 |
|
245 // Read the access point pointed to by TO-NAPID or TO-PROXY |
|
246 CApAccessPointItem* item = CApAccessPointItem::NewLC(); |
|
247 iAPHandler->AccessPointDataL( uidPckg(), *item ); |
|
248 |
|
249 if( item->BearerTypeL() == EApBearerTypeGPRS ) |
|
250 { |
|
251 // Item left on cleanup stack |
|
252 result = item; |
|
253 } |
|
254 else |
|
255 { |
|
256 CleanupStack::PopAndDestroy(); // item |
|
257 } |
|
258 } |
|
259 } |
|
260 |
|
261 if( !result ) |
|
262 { |
|
263 // Nothing left on cleanup stack. That doesn't matter as we leave. |
|
264 User::Leave( KErrNotFound ); |
|
265 } |
|
266 |
|
267 return result; |
|
268 } |
|
269 |
252 |
270 // End of File |
253 // End of File |