|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CTcSIPContext.h" |
|
19 #include "SIPConstants.h" |
|
20 #include "TCmdDestroyAllProfiles.h" |
|
21 #include "CTcSIPProfileContainer.h" |
|
22 |
|
23 #include <sipmanagedprofile.h> |
|
24 #include <sipmanagedprofileregistry.h> |
|
25 #include <sipprofile.h> |
|
26 #include <sipprofiletypeinfo.h> |
|
27 |
|
28 /** |
|
29 * INPUT: |
|
30 * Headers: - |
|
31 * Parameters: - |
|
32 * IDs: RegistryId |
|
33 * |
|
34 * OUTPUT: |
|
35 * Parameters: - |
|
36 * IDs: - |
|
37 */ |
|
38 void TCmdDestroyAllProfiles::ExecuteL() |
|
39 { |
|
40 // -- Setup --------------------------------------------------------------- |
|
41 |
|
42 // Get selected registry |
|
43 CTcSIPProfileContainer& container = SelectProfileL(); |
|
44 |
|
45 // -- Execution ----------------------------------------------------------- |
|
46 |
|
47 // Get default profile from the profile registry |
|
48 CSIPManagedProfile* profile; |
|
49 |
|
50 do { |
|
51 profile = static_cast< CSIPManagedProfile* > |
|
52 ( container.ManagedProfileRegistry().DefaultProfileL() ); |
|
53 |
|
54 // See if profile was found |
|
55 if( profile ) |
|
56 { |
|
57 // Deleting profile from the persistent storage |
|
58 container.ManagedProfileRegistry().DestroyL( *profile ); |
|
59 iContext.Registry().DestroyObject( profile ); |
|
60 } |
|
61 } while( profile ); |
|
62 |
|
63 |
|
64 // -- Response creation --------------------------------------------------- |
|
65 } |
|
66 |
|
67 TBool TCmdDestroyAllProfiles::Match( const TTcIdentifier& aId ) |
|
68 { |
|
69 return TTcSIPCommandBase::Match( aId, _L8("DestroyAllProfiles") ); |
|
70 } |
|
71 |
|
72 TTcCommandBase* TCmdDestroyAllProfiles::CreateL( MTcTestContext& aContext ) |
|
73 { |
|
74 return new( ELeave ) TCmdDestroyAllProfiles( aContext ); |
|
75 } |
|
76 |
|
77 |