|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Implement of pen input plugin utils:resource,repository,LafEnv |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #include <CentralRepository.h> |
|
26 |
|
27 #include "chinesefindutils.h" |
|
28 |
|
29 // ======== MEMBER FUNCTIONS ======== |
|
30 |
|
31 CFindRepositoryWatcher* CFindRepositoryWatcher::NewL( |
|
32 const TUid aUid, |
|
33 const TUint32 aKey, |
|
34 CCenRepNotifyHandler::TCenRepKeyType aKeyType, |
|
35 TCallBack aCallBack, |
|
36 CRepository* aRepository) |
|
37 { |
|
38 CFindRepositoryWatcher* self = new(ELeave) CFindRepositoryWatcher(aUid, aKey, aCallBack, aRepository); |
|
39 |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(aKeyType); |
|
42 CleanupStack::Pop(self); |
|
43 |
|
44 return self; |
|
45 } |
|
46 |
|
47 CFindRepositoryWatcher* CFindRepositoryWatcher::NewL( |
|
48 const TUid aUid, |
|
49 TCallBack aCallBack, |
|
50 CRepository* aRepository) |
|
51 { |
|
52 CFindRepositoryWatcher* self = new(ELeave) CFindRepositoryWatcher(aUid, NCentralRepositoryConstants::KInvalidNotificationId, aCallBack, aRepository); |
|
53 |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop(self); |
|
57 |
|
58 return self; |
|
59 } |
|
60 |
|
61 CFindRepositoryWatcher::~CFindRepositoryWatcher() |
|
62 { |
|
63 if (iNotifyHandler) |
|
64 { |
|
65 iNotifyHandler->StopListening(); |
|
66 delete iNotifyHandler; |
|
67 } |
|
68 } |
|
69 |
|
70 CFindRepositoryWatcher::CFindRepositoryWatcher( |
|
71 const TUid aUid, |
|
72 const TUint32 aKey, |
|
73 TCallBack aCallBack, |
|
74 CRepository* aRepository) |
|
75 : |
|
76 iUid(aUid), iKey(aKey), iCallBack(aCallBack), iRepository(aRepository) |
|
77 { |
|
78 } |
|
79 |
|
80 void CFindRepositoryWatcher::ConstructL(CCenRepNotifyHandler::TCenRepKeyType aKeyType) |
|
81 { |
|
82 iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iRepository, aKeyType, iKey); |
|
83 iNotifyHandler->StartListeningL(); |
|
84 } |
|
85 |
|
86 void CFindRepositoryWatcher::ConstructL() |
|
87 { |
|
88 iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iRepository); |
|
89 iNotifyHandler->StartListeningL(); |
|
90 } |
|
91 |
|
92 TUint32 CFindRepositoryWatcher::ChangedKey() |
|
93 { |
|
94 return iChangedKey; |
|
95 } |
|
96 |
|
97 void CFindRepositoryWatcher::HandleNotifyInt(TUint32 aKey, TInt /*aNewValue*/) |
|
98 { |
|
99 iChangedKey = aKey; |
|
100 iCallBack.CallBack(); |
|
101 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
102 } |
|
103 |
|
104 void CFindRepositoryWatcher::HandleNotifyError(TUint32 /*aKey*/, TInt /*aError*/, CCenRepNotifyHandler* /*aHandler*/) |
|
105 { |
|
106 } |
|
107 |
|
108 void CFindRepositoryWatcher::HandleNotifyGeneric(TUint32 aId) |
|
109 { |
|
110 iChangedKey = aId; |
|
111 iCallBack.CallBack(); |
|
112 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
113 } |
|
114 |
|
115 // End Of File |