80
|
1 |
// Copyright (c) 2004-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 |
// CMMSACCOUNT.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
|
|
19 |
#include <centralrepository.h>
|
|
20 |
#include <cmmsaccounts.h>
|
|
21 |
#include <cmmssettings.h>
|
|
22 |
#include <mmmssettingsobserver.h>
|
|
23 |
|
|
24 |
|
|
25 |
const TUint32 KNullId = 0x00000000;
|
|
26 |
const TUid KMMSRepositoryUid = {0x10202D4C};
|
|
27 |
const TInt KMaxSettingLength = 256;
|
|
28 |
const TInt KMmsSettingsVersion = 1;
|
|
29 |
const TUint32 KIncrementAccount = 0x00100000;
|
|
30 |
const TInt KShiftAccountId = 20;
|
|
31 |
const TUint32 KInitialiseSettings = 0x00000000; // Initial settings are in account 0
|
|
32 |
|
|
33 |
const TUint32 KAccountMask = 0x800FFFFF;
|
|
34 |
const TUint32 KMaximumAccounts = 0x80000000;
|
|
35 |
const TUint32 KDefaultAccountId = 0x80000003;
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
/**
|
|
40 |
Allocates and constructs an MMS account object.
|
|
41 |
|
|
42 |
Initialises all member data to their default values.
|
|
43 |
|
|
44 |
@return
|
|
45 |
The newly constructed MMS account object.
|
|
46 |
*/
|
|
47 |
EXPORT_C CMmsAccounts* CMmsAccounts::NewL()
|
|
48 |
{
|
|
49 |
CMmsAccounts* self = CMmsAccounts::NewLC();
|
|
50 |
CleanupStack::Pop(self);
|
|
51 |
return self;
|
|
52 |
}
|
|
53 |
|
|
54 |
/**
|
|
55 |
Allocates and constructs an MMS account object.
|
|
56 |
|
|
57 |
Initialises all member data to their default values.
|
|
58 |
|
|
59 |
@return
|
|
60 |
The newly constructed MMS account object.
|
|
61 |
*/
|
|
62 |
EXPORT_C CMmsAccounts* CMmsAccounts::NewLC()
|
|
63 |
{
|
|
64 |
CMmsAccounts* self = new (ELeave) CMmsAccounts();
|
|
65 |
CleanupStack::PushL(self);
|
|
66 |
self->ConstructL();
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
/**
|
|
71 |
Second phase construction.
|
|
72 |
*/
|
|
73 |
void CMmsAccounts::ConstructL()
|
|
74 |
{
|
|
75 |
iRepository = CRepository::NewL(KMMSRepositoryUid);
|
|
76 |
}
|
|
77 |
|
|
78 |
/**
|
|
79 |
Constructor.
|
|
80 |
*/
|
|
81 |
CMmsAccounts::CMmsAccounts()
|
|
82 |
: CActive(CActive::EPriorityStandard)
|
|
83 |
{
|
|
84 |
CActiveScheduler::Add(this);
|
|
85 |
}
|
|
86 |
|
|
87 |
/**
|
|
88 |
Destructor.
|
|
89 |
*/
|
|
90 |
EXPORT_C CMmsAccounts::~CMmsAccounts()
|
|
91 |
{
|
|
92 |
Cancel();
|
|
93 |
iObservers.Close();
|
|
94 |
delete iRepository;
|
|
95 |
}
|
|
96 |
|
|
97 |
void CMmsAccounts::DoCancel()
|
|
98 |
{
|
|
99 |
// cancel request to the repository
|
|
100 |
iRepository->NotifyCancel(KNullId, KNullId);
|
|
101 |
}
|
|
102 |
|
|
103 |
void CMmsAccounts::RunL()
|
|
104 |
{
|
|
105 |
// Notify all observers
|
|
106 |
for(TInt i=iObservers.Count()-1; i>=0; --i)
|
|
107 |
{
|
|
108 |
iObservers[i]->HandleNotify(MMmsSettingsObserver::ESettingsUpdated);
|
|
109 |
}
|
|
110 |
|
|
111 |
// Re-issue notification request
|
|
112 |
User::LeaveIfError(iRepository->NotifyRequest(KNullId, KNullId, iStatus));
|
|
113 |
SetActive();
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
Registers a new MMS Settings observer.
|
|
118 |
|
|
119 |
@param aObserver
|
|
120 |
A reference to an observer to be registered for events
|
|
121 |
*/
|
|
122 |
EXPORT_C void CMmsAccounts::AddObserverL(MMmsSettingsObserver& aObserver)
|
|
123 |
{
|
|
124 |
iObservers.AppendL(&aObserver);
|
|
125 |
|
|
126 |
if (IsActive() == EFalse)
|
|
127 |
{
|
|
128 |
// Issue notification request
|
|
129 |
User::LeaveIfError(iRepository->NotifyRequest(KNullId, KNullId, iStatus));
|
|
130 |
SetActive();
|
|
131 |
}
|
|
132 |
}
|
|
133 |
|
|
134 |
/**
|
|
135 |
Deregisters a previously registered observer.
|
|
136 |
|
|
137 |
@param aObserver
|
|
138 |
A reference to an observer to be unregistered for events
|
|
139 |
*/
|
|
140 |
EXPORT_C void CMmsAccounts::RemoveObserver(MMmsSettingsObserver& aObserver)
|
|
141 |
{
|
|
142 |
TInt i = iObservers.Find(&aObserver);
|
|
143 |
__ASSERT_ALWAYS(i>=0, User::Invariant());
|
|
144 |
iObservers.Remove(i);
|
|
145 |
|
|
146 |
if (iObservers.Count() <= 0)
|
|
147 |
{
|
|
148 |
Cancel();
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
/**
|
|
153 |
Creates a MMS Account.
|
|
154 |
|
|
155 |
@param aAccountName
|
|
156 |
MMS account Name
|
|
157 |
|
|
158 |
@param aSettings
|
|
159 |
MMS Settings
|
|
160 |
|
|
161 |
@return
|
|
162 |
MMS Account Id
|
|
163 |
*/
|
|
164 |
EXPORT_C TMmsAccountId CMmsAccounts::CreateMMSAccountL(const TDesC& aAccountName, const CMmsSettings& aSettings)
|
|
165 |
{
|
|
166 |
// Get the number of accounts exist in CenRep
|
|
167 |
RArray<TUint32> accountIds;
|
|
168 |
CleanupClosePushL(accountIds);
|
|
169 |
TInt error = iRepository->FindL(KNullId, static_cast<TUint32>(KAccountMask), accountIds);
|
|
170 |
if (error != KErrNotFound)
|
|
171 |
{
|
|
172 |
User::LeaveIfError(error);
|
|
173 |
}
|
|
174 |
TInt accountsCount = accountIds.Count() - 1; // ignoring the default account
|
|
175 |
CleanupStack::PopAndDestroy(&accountIds);
|
|
176 |
|
|
177 |
if (accountsCount >= MaxMMSAccounts())
|
|
178 |
{
|
|
179 |
// Can't create any more accounts
|
|
180 |
User::Leave(KErrOverflow);
|
|
181 |
}
|
|
182 |
|
|
183 |
TUint32 accountId = 0;
|
|
184 |
accountId = GetNextEmptyAccountSlotL();
|
|
185 |
DoSaveSettingsL(accountId, aSettings, aAccountName);
|
|
186 |
|
|
187 |
TMmsAccountId account;
|
|
188 |
account.iMmsAccountId = accountId >> KShiftAccountId;
|
|
189 |
account.iMmsAccountName = aAccountName;
|
|
190 |
return account;
|
|
191 |
}
|
|
192 |
|
|
193 |
TUint CMmsAccounts::GetNextEmptyAccountSlotL()
|
|
194 |
{
|
|
195 |
TUint32 accountId = KNullId;
|
|
196 |
TBuf<KMmsAccountNameSize> accountName;
|
|
197 |
TInt error = 0;
|
|
198 |
TBool found = EFalse;
|
|
199 |
TInt maximumAccount = MaxMMSAccounts();
|
|
200 |
|
|
201 |
for (TInt count = 0; count < maximumAccount; ++count)
|
|
202 |
{
|
|
203 |
accountId = accountId + KIncrementAccount;
|
|
204 |
error = iRepository->Get(accountId + EMmsAccountName, accountName);
|
|
205 |
if (error == KErrNotFound)
|
|
206 |
{
|
|
207 |
found = ETrue;
|
|
208 |
break;
|
|
209 |
}
|
|
210 |
else
|
|
211 |
{
|
|
212 |
User::LeaveIfError(error);
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
if (found == EFalse)
|
|
217 |
{
|
|
218 |
// No empty slot available
|
|
219 |
User::Leave(KErrNotFound);
|
|
220 |
}
|
|
221 |
|
|
222 |
return accountId;
|
|
223 |
}
|
|
224 |
|
|
225 |
/**
|
|
226 |
Maximum number of accounts that can be stored in the Central Repository
|
|
227 |
|
|
228 |
@return
|
|
229 |
The maximum number of accounts
|
|
230 |
*/
|
|
231 |
EXPORT_C TInt CMmsAccounts::MaxMMSAccounts()
|
|
232 |
{
|
|
233 |
TInt maxAccounts = 0;
|
|
234 |
TInt error = iRepository->Get(KMaximumAccounts, maxAccounts);
|
|
235 |
if(error != KErrNone)
|
|
236 |
{
|
|
237 |
return error;
|
|
238 |
}
|
|
239 |
return maxAccounts;
|
|
240 |
}
|
|
241 |
|
|
242 |
/**
|
|
243 |
Gets a list of MMS account IDs stored in the Central Repository.
|
|
244 |
|
|
245 |
Any existing entries in the array will be deleted.
|
|
246 |
|
|
247 |
@param aAccountIds
|
|
248 |
A list if MMS account Ids
|
|
249 |
*/
|
|
250 |
EXPORT_C void CMmsAccounts::GetMMSAccountsL(RArray<TMmsAccountId>& aAccountIds) const
|
|
251 |
{
|
|
252 |
CleanupClosePushL( aAccountIds );
|
|
253 |
aAccountIds.Reset();
|
|
254 |
RArray<TUint32> accountIds;
|
|
255 |
CleanupClosePushL(accountIds);
|
|
256 |
TInt error = iRepository->FindL(KNullId, static_cast<TUint32>(KAccountMask), accountIds);
|
|
257 |
if (error != KErrNotFound)
|
|
258 |
{
|
|
259 |
User::LeaveIfError(error);
|
|
260 |
}
|
|
261 |
|
|
262 |
TMmsAccountId accountId;
|
|
263 |
TInt count = accountIds.Count();
|
|
264 |
for(TInt i = 1; i < count; ++i)
|
|
265 |
{
|
|
266 |
TUint32 settingId = accountIds[i];
|
|
267 |
User::LeaveIfError(iRepository->Get(settingId + EMmsAccountName, accountId.iMmsAccountName));
|
|
268 |
accountId.iMmsAccountId = accountIds[i] >> KShiftAccountId;
|
|
269 |
aAccountIds.AppendL(accountId);
|
|
270 |
}
|
|
271 |
|
|
272 |
CleanupStack::PopAndDestroy(&accountIds);
|
|
273 |
CleanupStack::Pop(&aAccountIds); // aAccountIds
|
|
274 |
}
|
|
275 |
|
|
276 |
/**
|
|
277 |
Deletes the specified MMS account.
|
|
278 |
|
|
279 |
@param aAccountId
|
|
280 |
MMS account Id
|
|
281 |
*/
|
|
282 |
EXPORT_C void CMmsAccounts::DeleteMMSAccountL(const TMmsAccountId& aAccountId)
|
|
283 |
{
|
|
284 |
TUint32 accountId = aAccountId.iMmsAccountId << KShiftAccountId;
|
|
285 |
|
|
286 |
// Read in proxy and napId counts
|
|
287 |
TInt proxyCount = 0;
|
|
288 |
User::LeaveIfError(iRepository->Get(accountId + EMmsProxyCount, proxyCount));
|
|
289 |
|
|
290 |
TInt napIdCount = 0;
|
|
291 |
User::LeaveIfError(iRepository->Get(accountId + EMmsNapIdCount, napIdCount));
|
|
292 |
|
|
293 |
// Delete account
|
|
294 |
User::LeaveIfError(iRepository->StartTransaction(CRepository::EReadWriteTransaction));
|
|
295 |
iRepository->CleanupRollbackTransactionPushL();
|
|
296 |
|
|
297 |
iRepository->Delete(accountId + EMmsAccountName);
|
|
298 |
iRepository->Delete(accountId + EMmsSettingsVersion);
|
|
299 |
iRepository->Delete(accountId + EMmsApplicationID);
|
|
300 |
iRepository->Delete(accountId + EMmsAddress);
|
|
301 |
iRepository->Delete(accountId + EMmsCreationMode);
|
|
302 |
iRepository->Delete(accountId + EMmsSettingsFlags);
|
|
303 |
iRepository->Delete(accountId + EMmsProxyCount);
|
|
304 |
|
|
305 |
TUint32 proxyId = accountId + EMmsProxyList;
|
|
306 |
for(TInt loop=0; loop < proxyCount; ++loop)
|
|
307 |
{
|
|
308 |
iRepository->Delete(proxyId);
|
|
309 |
++proxyId;
|
|
310 |
}
|
|
311 |
|
|
312 |
iRepository->Delete(accountId + EMmsNapIdCount);
|
|
313 |
|
|
314 |
TUint32 napId = accountId + EMmsNapIdList;
|
|
315 |
for(TInt loop=0; loop < proxyCount; ++loop)
|
|
316 |
{
|
|
317 |
iRepository->Delete(napId);
|
|
318 |
++napId;
|
|
319 |
}
|
|
320 |
|
|
321 |
iRepository->Delete(accountId + EMmsAutomaticDownload);
|
|
322 |
iRepository->Delete(accountId + EMmsValidityPeriod);
|
|
323 |
iRepository->Delete(accountId + EMmsMaxDownloadSize);
|
|
324 |
iRepository->Delete(accountId + EMmsMaxDownloadRetries);
|
|
325 |
iRepository->Delete(accountId + EMmsDownloadRetryInterval);
|
|
326 |
iRepository->Delete(accountId + EMmsMaxSendMsgSize);
|
|
327 |
iRepository->Delete(accountId + EMmsDeviceContentClass);
|
|
328 |
iRepository->Delete(accountId + EMmsMaxImageHeight);
|
|
329 |
iRepository->Delete(accountId + EMmsMaxImageWidth);
|
|
330 |
|
|
331 |
CleanupStack::Pop();
|
|
332 |
TUint32 errorId = 0;
|
|
333 |
User::LeaveIfError(iRepository->CommitTransaction(errorId));
|
|
334 |
}
|
|
335 |
|
|
336 |
/**
|
|
337 |
Loads MMS settings from the Central Repository for the specified account Id.
|
|
338 |
|
|
339 |
@param aAccountId
|
|
340 |
MMS account Id
|
|
341 |
|
|
342 |
@param aSettings
|
|
343 |
MMS settings
|
|
344 |
*/
|
|
345 |
EXPORT_C void CMmsAccounts::LoadSettingsL(const TMmsAccountId& aAccountId, CMmsSettings& aSettings)
|
|
346 |
{
|
|
347 |
TUint32 accountId = aAccountId.iMmsAccountId << KShiftAccountId;
|
|
348 |
DoLoadSettingsL(accountId, aSettings);
|
|
349 |
}
|
|
350 |
|
|
351 |
void CMmsAccounts::DoLoadSettingsL(TUint32 aAccountId, CMmsSettings& aSettings)
|
|
352 |
{
|
|
353 |
TInt temp = 0;
|
|
354 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsApplicationID, temp));
|
|
355 |
aSettings.SetApplicationID(temp);
|
|
356 |
|
|
357 |
TBuf<KMaxSettingLength> tempBuff;
|
|
358 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsAddress, tempBuff));
|
|
359 |
aSettings.SetAddressL(tempBuff);
|
|
360 |
|
|
361 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsCreationMode, temp));
|
|
362 |
aSettings.SetCreationModeL(static_cast<TCreationMode>(temp));
|
|
363 |
|
|
364 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsSettingsFlags, temp));
|
|
365 |
aSettings.SetMmsSettingsFlags(static_cast<TUint32>(temp));
|
|
366 |
|
|
367 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsProxyCount, temp));
|
|
368 |
TInt count = temp;
|
|
369 |
|
|
370 |
aSettings.RemoveAllProxies();
|
|
371 |
TUint32 proxyId = aAccountId + EMmsProxyList;
|
|
372 |
for(TInt loop=0; loop < count; ++loop)
|
|
373 |
{
|
|
374 |
User::LeaveIfError(iRepository->Get(proxyId, temp));
|
|
375 |
aSettings.AddProxyL(TUid::Uid(temp));
|
|
376 |
++proxyId;
|
|
377 |
}
|
|
378 |
|
|
379 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsNapIdCount, count));
|
|
380 |
|
|
381 |
aSettings.RemoveAllNapIds();
|
|
382 |
TUint32 napId = aAccountId + EMmsNapIdList;
|
|
383 |
for(TInt loop=0; loop < count; ++loop)
|
|
384 |
{
|
|
385 |
User::LeaveIfError(iRepository->Get(napId, temp));
|
|
386 |
aSettings.AddNapIdL(TUid::Uid(temp));
|
|
387 |
++napId;
|
|
388 |
}
|
|
389 |
|
|
390 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsAutomaticDownload, temp));
|
|
391 |
aSettings.SetAutomaticDownload(static_cast<TAutomaticDownloadOptions>(temp));
|
|
392 |
|
|
393 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsValidityPeriod, temp));
|
|
394 |
aSettings.SetValidityPeriod(temp);
|
|
395 |
|
|
396 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsMaxDownloadSize, temp));
|
|
397 |
aSettings.SetMaxDownloadSize(temp);
|
|
398 |
|
|
399 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsMaxDownloadRetries, temp));
|
|
400 |
aSettings.SetMaxDownloadRetries(temp);
|
|
401 |
|
|
402 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsDownloadRetryInterval, temp));
|
|
403 |
aSettings.SetDownloadRetryInterval(temp);
|
|
404 |
|
|
405 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsMaxSendMsgSize, temp));
|
|
406 |
aSettings.SetMaxSendMsgSize(temp);
|
|
407 |
|
|
408 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsDeviceContentClass, temp));
|
|
409 |
aSettings.SetDeviceContentClass(temp);
|
|
410 |
|
|
411 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsMaxImageHeight, temp));
|
|
412 |
aSettings.SetMaxImageHeight(temp);
|
|
413 |
|
|
414 |
User::LeaveIfError(iRepository->Get(aAccountId + EMmsMaxImageWidth, temp));
|
|
415 |
aSettings.SetMaxImageWidth(temp);
|
|
416 |
}
|
|
417 |
|
|
418 |
/**
|
|
419 |
Populates the supplied setting object with default values.
|
|
420 |
|
|
421 |
@param aSettings
|
|
422 |
MMS Setting
|
|
423 |
*/
|
|
424 |
EXPORT_C void CMmsAccounts::PopulateDefaultSettingsL(CMmsSettings& aSettings)
|
|
425 |
{
|
|
426 |
DoLoadSettingsL(KInitialiseSettings, aSettings);
|
|
427 |
}
|
|
428 |
|
|
429 |
/**
|
|
430 |
Saves MMS settings to the Central Repository for the specified account Id.
|
|
431 |
|
|
432 |
@param aAccountId
|
|
433 |
MMS account Id
|
|
434 |
|
|
435 |
@param aSettings
|
|
436 |
MMS settings
|
|
437 |
*/
|
|
438 |
EXPORT_C void CMmsAccounts::SaveSettingsL(const TMmsAccountId& aAccountId, const CMmsSettings& aSettings) const
|
|
439 |
{
|
|
440 |
TUint32 accountId = aAccountId.iMmsAccountId << KShiftAccountId;
|
|
441 |
DoSaveSettingsL(accountId, aSettings, aAccountId.iMmsAccountName);
|
|
442 |
}
|
|
443 |
|
|
444 |
void CMmsAccounts::DoSaveSettingsL(TUint32 aAccountId, const CMmsSettings& aSettings, const TDesC& aAccountName) const
|
|
445 |
{
|
|
446 |
User::LeaveIfError(iRepository->StartTransaction(CRepository::EReadWriteTransaction));
|
|
447 |
iRepository->CleanupRollbackTransactionPushL();
|
|
448 |
// Update account name
|
|
449 |
iRepository->Set(aAccountId + EMmsAccountName, aAccountName);
|
|
450 |
iRepository->Set(aAccountId + EMmsSettingsVersion, KMmsSettingsVersion);
|
|
451 |
iRepository->Set(aAccountId + EMmsApplicationID, aSettings.ApplicationID());
|
|
452 |
iRepository->Set(aAccountId + EMmsAddress, aSettings.Address());
|
|
453 |
iRepository->Set(aAccountId + EMmsCreationMode, static_cast<TInt>(aSettings.CreationMode()));
|
|
454 |
iRepository->Set(aAccountId + EMmsSettingsFlags, static_cast<TInt>(aSettings.MmsSettingsFlags()));
|
|
455 |
iRepository->Set(aAccountId + EMmsProxyCount, aSettings.ProxyCount());
|
|
456 |
|
|
457 |
TUint32 proxyId = aAccountId + EMmsProxyList;
|
|
458 |
for(TInt loop=0; loop < aSettings.ProxyCount(); ++loop)
|
|
459 |
{
|
|
460 |
iRepository->Set(proxyId, static_cast<TInt>(aSettings.GetProxy(loop).iUid));
|
|
461 |
++proxyId;
|
|
462 |
}
|
|
463 |
|
|
464 |
iRepository->Set(aAccountId + EMmsNapIdCount, aSettings.NapIdCount());
|
|
465 |
|
|
466 |
TUint32 napId = aAccountId + EMmsNapIdList;
|
|
467 |
for(TInt loop=0; loop < aSettings.NapIdCount(); ++loop)
|
|
468 |
{
|
|
469 |
iRepository->Set(napId, static_cast<TInt>(aSettings.GetNapId(loop).iUid));
|
|
470 |
++napId;
|
|
471 |
}
|
|
472 |
|
|
473 |
iRepository->Set(aAccountId + EMmsAutomaticDownload, static_cast<TInt>(aSettings.AutomaticDownload()));
|
|
474 |
iRepository->Set(aAccountId + EMmsValidityPeriod, aSettings.ValidityPeriod());
|
|
475 |
iRepository->Set(aAccountId + EMmsMaxDownloadSize, aSettings.MaxDownloadSize());
|
|
476 |
iRepository->Set(aAccountId + EMmsMaxDownloadRetries, aSettings.MaxDownloadRetries());
|
|
477 |
iRepository->Set(aAccountId + EMmsDownloadRetryInterval, aSettings.DownloadRetryInterval());
|
|
478 |
iRepository->Set(aAccountId + EMmsMaxSendMsgSize, aSettings.MaxSendMsgSize());
|
|
479 |
iRepository->Set(aAccountId + EMmsDeviceContentClass, aSettings.DeviceContentClass());
|
|
480 |
iRepository->Set(aAccountId + EMmsMaxImageHeight, aSettings.MaxImageHeight());
|
|
481 |
iRepository->Set(aAccountId + EMmsMaxImageWidth, aSettings.MaxImageWidth());
|
|
482 |
|
|
483 |
CleanupStack::Pop();
|
|
484 |
TUint32 errorId = 0;
|
|
485 |
User::LeaveIfError(iRepository->CommitTransaction(errorId));
|
|
486 |
}
|
|
487 |
|
|
488 |
/**
|
|
489 |
Gets the default MMS account.
|
|
490 |
|
|
491 |
@return
|
|
492 |
The default account
|
|
493 |
|
|
494 |
@leave
|
|
495 |
KErrNotFound If the default account not been set previously or if MMSSettings for
|
|
496 |
the default account does not exist in the Central Repository.
|
|
497 |
*/
|
|
498 |
EXPORT_C TMmsAccountId CMmsAccounts::DefaultMMSAccountL( ) const
|
|
499 |
{
|
|
500 |
TMmsAccountId account;
|
|
501 |
User::LeaveIfError(iRepository->Get(KDefaultAccountId, account.iMmsAccountId));
|
|
502 |
|
|
503 |
TUint32 accountId = account.iMmsAccountId << KShiftAccountId;
|
|
504 |
User::LeaveIfError(iRepository->Get(accountId + EMmsAccountName, account.iMmsAccountName));
|
|
505 |
|
|
506 |
return account;
|
|
507 |
}
|
|
508 |
|
|
509 |
/**
|
|
510 |
Sets the default MMS account.
|
|
511 |
|
|
512 |
@param aDefaultAccount
|
|
513 |
Account to be set as default
|
|
514 |
*/
|
|
515 |
EXPORT_C void CMmsAccounts::SetDefaultMMSAccountL(const TMmsAccountId& aDefaultAccount)
|
|
516 |
{
|
|
517 |
iRepository->Set(KDefaultAccountId, aDefaultAccount.iMmsAccountId);
|
|
518 |
}
|
|
519 |
|
|
520 |
|
|
521 |
|