22 #include "SettingsEngine.h" |
22 #include "SettingsEngine.h" |
23 #include "ShowEngine.h" |
23 #include "ShowEngine.h" |
24 #include "connectionengine.h" |
24 #include "connectionengine.h" |
25 #include "podcastutils.h" |
25 #include "podcastutils.h" |
26 #include "Podcatcher.pan" |
26 #include "Podcatcher.pan" |
27 |
|
28 #include <cmdestination.h> |
|
29 #include <cmmanager.h> |
|
30 #include <bautils.h> |
27 #include <bautils.h> |
31 #include <aknserverapp.h> // MAknServerAppExitObserver |
28 #include <aknserverapp.h> // MAknServerAppExitObserver |
32 #include <DocumentHandler.h> |
29 #include <DocumentHandler.h> |
33 |
30 |
34 |
31 |
81 iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
77 iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
82 |
78 |
83 iImageHandler = CImageHandler::NewL(FsSession(), *this); |
79 iImageHandler = CImageHandler::NewL(FsSession(), *this); |
84 iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
80 iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
85 |
81 |
86 TRAPD(err,iCmManager.OpenL()); |
82 UpdateIAPListL(); |
87 DP1("iCmManager.OpenL(),err=%d;", err); |
|
88 |
|
89 if (err == KErrNone) |
|
90 { |
|
91 UpdateIAPListL(); |
|
92 UpdateSNAPListL(); |
|
93 } |
|
94 |
83 |
95 iSettingsEngine = CSettingsEngine::NewL(*this); |
84 iSettingsEngine = CSettingsEngine::NewL(*this); |
96 iConnectionEngine = CConnectionEngine::NewL(*this); |
85 iConnectionEngine = CConnectionEngine::NewL(*this); |
97 |
86 |
98 TRAP(err, OpenDBL()); |
87 TRAPD(err, OpenDBL()); |
99 |
88 |
100 if (err != KErrNone) |
89 if (err != KErrNone) |
101 { |
90 { |
102 ResetDB(); |
91 ResetDB(); |
103 |
92 |
141 CleanupStack::PopAndDestroy(); // Close table |
130 CleanupStack::PopAndDestroy(); // Close table |
142 } |
131 } |
143 |
132 |
144 EXPORT_C void CPodcastModel::UpdateSNAPListL() |
133 EXPORT_C void CPodcastModel::UpdateSNAPListL() |
145 { |
134 { |
146 DP("CPodcastModel::UpdateSNAPListL BEGIN"); |
135 // DP("CPodcastModel::UpdateSNAPListL BEGIN"); |
147 iSNAPNameArray->Reset(); |
136 // iSNAPNameArray->Reset(); |
148 iSNAPIdArray.Reset(); |
137 // iSNAPIdArray.Reset(); |
149 |
138 // |
150 RCmDestination destination; |
139 // RCmDestination destination; |
151 TPodcastIAPItem IAPItem; |
140 // TPodcastIAPItem IAPItem; |
152 |
141 // |
153 RArray<TUint32> destArray; |
142 // RArray<TUint32> destArray; |
154 CleanupClosePushL(destArray); |
143 // CleanupClosePushL(destArray); |
155 iCmManager.AllDestinationsL(destArray); |
144 // iCmManager.AllDestinationsL(destArray); |
156 |
145 // |
157 TInt cnt = destArray.Count(); |
146 // TInt cnt = destArray.Count(); |
158 DP1("destArray.Count==%d", cnt); |
147 // DP1("destArray.Count==%d", cnt); |
159 for(TInt loop = 0;loop<cnt;loop++) |
148 // for(TInt loop = 0;loop<cnt;loop++) |
160 { |
149 // { |
161 destination = iCmManager.DestinationL (destArray[loop]); |
150 // destination = iCmManager.DestinationL (destArray[loop]); |
162 CleanupClosePushL(destination); |
151 // CleanupClosePushL(destination); |
163 if(!destination.IsHidden()) |
152 // if(!destination.IsHidden()) |
164 { |
153 // { |
165 IAPItem.iIapId = destArray[loop]; |
154 // IAPItem.iIapId = destArray[loop]; |
166 HBufC* name = destination.NameLC(); |
155 // HBufC* name = destination.NameLC(); |
167 DP1(" destination.NameLC==%S", name); |
156 // DP1(" destination.NameLC==%S", name); |
168 iSNAPNameArray->AppendL(*name); |
157 // iSNAPNameArray->AppendL(*name); |
169 CleanupStack::PopAndDestroy(name); |
158 // CleanupStack::PopAndDestroy(name); |
170 iSNAPIdArray.Append(IAPItem); |
159 // iSNAPIdArray.Append(IAPItem); |
171 } |
160 // } |
172 CleanupStack::PopAndDestroy();//close destination |
161 // CleanupStack::PopAndDestroy();//close destination |
173 } |
162 // } |
174 CleanupStack::PopAndDestroy();// close destArray |
163 // CleanupStack::PopAndDestroy();// close destArray |
175 |
164 // |
176 DP("CPodcastModel::UpdateSNAPListL END"); |
165 // DP("CPodcastModel::UpdateSNAPListL END"); |
177 } |
166 } |
178 |
167 |
179 EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames() |
168 EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames() |
180 { |
169 { |
181 return iIapNameArray; |
170 return iIapNameArray; |