1 /* |
|
2 * Copyright (c) 2005-2006 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: Shortcut definition parser |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "aiscutrepositorywatcher.h" |
|
20 #include <centralrepository.h> // For CRepository |
|
21 |
|
22 |
|
23 |
|
24 CAiScutRepositoryWatcher* CAiScutRepositoryWatcher::NewL( |
|
25 const TUid aUid, |
|
26 const TUint32 aKey, |
|
27 CCenRepNotifyHandler::TCenRepKeyType aKeyType, |
|
28 TCallBack aCallBack, |
|
29 CRepository* aRepository) |
|
30 { |
|
31 CAiScutRepositoryWatcher* self = |
|
32 new (ELeave) CAiScutRepositoryWatcher(aUid, aKey, aCallBack, aRepository); |
|
33 |
|
34 CleanupStack::PushL(self); |
|
35 self->ConstructL(aKeyType); |
|
36 CleanupStack::Pop(self); |
|
37 |
|
38 return self; |
|
39 } |
|
40 |
|
41 CAiScutRepositoryWatcher* CAiScutRepositoryWatcher::NewL( |
|
42 const TUid aUid, |
|
43 TCallBack aCallBack, |
|
44 CRepository* aRepository) |
|
45 { |
|
46 CAiScutRepositoryWatcher* self = |
|
47 new (ELeave) CAiScutRepositoryWatcher( |
|
48 aUid, |
|
49 NCentralRepositoryConstants::KInvalidNotificationId, |
|
50 aCallBack, |
|
51 aRepository); |
|
52 |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(); |
|
55 CleanupStack::Pop(self); |
|
56 |
|
57 return self; |
|
58 } |
|
59 |
|
60 CAiScutRepositoryWatcher::~CAiScutRepositoryWatcher() |
|
61 { |
|
62 if (iNotifyHandler) |
|
63 { |
|
64 iNotifyHandler->StopListening(); |
|
65 delete iNotifyHandler; |
|
66 } |
|
67 } |
|
68 |
|
69 CAiScutRepositoryWatcher::CAiScutRepositoryWatcher( |
|
70 const TUid aUid, |
|
71 const TUint32 aKey, |
|
72 TCallBack aCallBack, |
|
73 CRepository* aRepository) |
|
74 : |
|
75 iUid(aUid), iKey(aKey), iCallBack(aCallBack), iRepository(aRepository) |
|
76 { |
|
77 } |
|
78 |
|
79 void CAiScutRepositoryWatcher::ConstructL( |
|
80 CCenRepNotifyHandler::TCenRepKeyType aKeyType) |
|
81 { |
|
82 iNotifyHandler = CCenRepNotifyHandler::NewL( |
|
83 *this, *iRepository, aKeyType, iKey); |
|
84 } |
|
85 |
|
86 void CAiScutRepositoryWatcher::ConstructL() |
|
87 { |
|
88 iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iRepository); |
|
89 } |
|
90 |
|
91 void CAiScutRepositoryWatcher::StartListeningL() |
|
92 { |
|
93 if (iNotifyHandler) |
|
94 { |
|
95 iNotifyHandler->StartListeningL(); |
|
96 } |
|
97 } |
|
98 |
|
99 void CAiScutRepositoryWatcher::StopListening() |
|
100 { |
|
101 if (iNotifyHandler) |
|
102 { |
|
103 iNotifyHandler->StopListening(); |
|
104 } |
|
105 } |
|
106 |
|
107 TUint32 CAiScutRepositoryWatcher::ChangedKey() |
|
108 { |
|
109 return iChangedKey; |
|
110 } |
|
111 |
|
112 void CAiScutRepositoryWatcher::HandleNotifyInt(TUint32 aKey, TInt /*aNewValue*/) |
|
113 { |
|
114 iChangedKey = aKey; |
|
115 iCallBack.CallBack(); |
|
116 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
117 } |
|
118 |
|
119 void CAiScutRepositoryWatcher::HandleNotifyString( |
|
120 TUint32 aKey, const TDesC16& /*aNewValue*/) |
|
121 { |
|
122 iChangedKey = aKey; |
|
123 iCallBack.CallBack(); |
|
124 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
125 } |
|
126 |
|
127 void CAiScutRepositoryWatcher::HandleNotifyGeneric(TUint32 aKey) |
|
128 { |
|
129 iChangedKey = aKey; |
|
130 iCallBack.CallBack(); |
|
131 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
132 } |
|
133 |
|
134 void CAiScutRepositoryWatcher::HandleNotifyError( |
|
135 TUint32 /*aKey*/, TInt /*aError*/, CCenRepNotifyHandler* /*aHandler*/) |
|
136 { |
|
137 } |
|
138 |
|
139 // End of File |
|