1 /* |
|
2 * Copyright (c) 2007-2008 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 of CWsfWlanInfoSortingDbChangeNotifier |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // CLASS HEADER |
|
21 #include "wsfwlaninfosortingdbchangenotifier.h" |
|
22 |
|
23 // INTERNAL INCLUDES |
|
24 #include "wsfwlaninfosortingfiltervisitor.h" |
|
25 |
|
26 |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CWsfWlanInfoSortingDbChangeNotifier::NewLC |
|
30 // ---------------------------------------------------------------------------- |
|
31 // |
|
32 CWsfWlanInfoSortingDbChangeNotifier* |
|
33 CWsfWlanInfoSortingDbChangeNotifier::NewLC( RDbDatabase& aDatabase ) |
|
34 { |
|
35 CWsfWlanInfoSortingDbChangeNotifier* thisPtr = |
|
36 new (ELeave) CWsfWlanInfoSortingDbChangeNotifier( aDatabase ); |
|
37 CleanupStack::PushL( thisPtr ); |
|
38 thisPtr->ConstructL(); |
|
39 return thisPtr; |
|
40 } |
|
41 |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CWsfWlanInfoSortingDbChangeNotifier::NewL |
|
45 // ---------------------------------------------------------------------------- |
|
46 // |
|
47 CWsfWlanInfoSortingDbChangeNotifier* CWsfWlanInfoSortingDbChangeNotifier::NewL( |
|
48 RDbDatabase& aDatabase ) |
|
49 { |
|
50 CWsfWlanInfoSortingDbChangeNotifier* thisPtr = NewLC( aDatabase ); |
|
51 CleanupStack::Pop( thisPtr ); |
|
52 return thisPtr; |
|
53 } |
|
54 |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // CWsfWlanInfoSortingDbChangeNotifier::~CWsfWlanInfoSortingDbChangeNotifier |
|
58 // ---------------------------------------------------------------------------- |
|
59 // |
|
60 CWsfWlanInfoSortingDbChangeNotifier::~CWsfWlanInfoSortingDbChangeNotifier() |
|
61 { |
|
62 Cancel(); |
|
63 iDbAwareFilters.Reset(); |
|
64 iNotifier.Close(); |
|
65 } |
|
66 |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CWsfWlanInfoSortingDbChangeNotifier::CWsfWlanInfoSortingDbChangeNotifier |
|
70 // ---------------------------------------------------------------------------- |
|
71 // |
|
72 CWsfWlanInfoSortingDbChangeNotifier::CWsfWlanInfoSortingDbChangeNotifier( |
|
73 RDbDatabase& aDatabase ): |
|
74 CActive( CActive::EPriorityLow ), |
|
75 iDatabase( &aDatabase ) |
|
76 { |
|
77 } |
|
78 |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CWsfWlanInfoSortingDbChangeNotifier::ConstructL |
|
82 // ---------------------------------------------------------------------------- |
|
83 // |
|
84 void CWsfWlanInfoSortingDbChangeNotifier::ConstructL() |
|
85 { |
|
86 User::LeaveIfError( iNotifier.Open( *iDatabase ) ); |
|
87 CActiveScheduler::Add( this ); |
|
88 |
|
89 } |
|
90 |
|
91 |
|
92 // ---------------------------------------------------------------------------- |
|
93 // CWsfWlanInfoSortingDbChangeNotifier::StartDbObservation |
|
94 // ---------------------------------------------------------------------------- |
|
95 // |
|
96 void CWsfWlanInfoSortingDbChangeNotifier::StartDbObservation() |
|
97 { |
|
98 iNotifier.NotifyChange( iStatus ); |
|
99 SetActive(); |
|
100 } |
|
101 |
|
102 |
|
103 // ---------------------------------------------------------------------------- |
|
104 // CWsfWlanInfoSortingDbChangeNotifier::DoCancel |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 void CWsfWlanInfoSortingDbChangeNotifier::DoCancel() |
|
108 { |
|
109 iNotifier.Cancel(); |
|
110 } |
|
111 |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CWsfWlanInfoSortingDbChangeNotifier::RunL |
|
115 // ---------------------------------------------------------------------------- |
|
116 // |
|
117 void CWsfWlanInfoSortingDbChangeNotifier::RunL() |
|
118 { |
|
119 if ( iStatus.Int() >= RDbNotifier::ECommit ) |
|
120 { |
|
121 TInt dbAwareFiltersCount( iDbAwareFilters.Count() ); |
|
122 if ( dbAwareFiltersCount ) |
|
123 { |
|
124 TInt i( 0 ); |
|
125 for ( ; i < dbAwareFiltersCount ; i++ ) |
|
126 { |
|
127 (iDbAwareFilters)[i]->ReadFilterDefsL(); |
|
128 } |
|
129 } |
|
130 } |
|
131 StartDbObservation(); |
|
132 } |
|
133 |
|
134 |
|
135 // ---------------------------------------------------------------------------- |
|
136 // CWsfWlanInfoSortingDbChangeNotifier::AppendDbRelatedFilterL |
|
137 // ---------------------------------------------------------------------------- |
|
138 // |
|
139 void CWsfWlanInfoSortingDbChangeNotifier::AppendDbRelatedFilterL( |
|
140 MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ) |
|
141 { |
|
142 iDbAwareFilters.AppendL( aRelatedFilter ); |
|
143 } |
|
144 |
|
145 |
|
146 // ---------------------------------------------------------------------------- |
|
147 // CWsfWlanInfoSortingDbChangeNotifier::RemoveDbRelatedFilter |
|
148 // ---------------------------------------------------------------------------- |
|
149 // |
|
150 void CWsfWlanInfoSortingDbChangeNotifier::RemoveDbRelatedFilter( |
|
151 MWsfWlanInfoSortingFilterVisitor* aRelatedFilter ) |
|
152 { |
|
153 TInt index = iDbAwareFilters.Find( aRelatedFilter ); |
|
154 if ( index != KErrNotFound ) |
|
155 { |
|
156 iDbAwareFilters.Remove( index ); |
|
157 } |
|
158 } |
|
159 |
|
160 |
|