|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef CENTRALREPOSITORYHANDLER_H |
|
23 #define CENTRALREPOSITORYHANDLER_H |
|
24 |
|
25 #include <exception> |
|
26 #include <e32base.h> |
|
27 #include <centralrepository.h> |
|
28 |
|
29 #include "settingshandlerbase.h" |
|
30 #include "cenrepmonitor.h" |
|
31 |
|
32 class XQSettingsKey; |
|
33 class CRepository; |
|
34 |
|
35 class CCentralRepositoryHandler : public CBase, public SettingsHandlerBase |
|
36 { |
|
37 public: |
|
38 static CCentralRepositoryHandler* NewL(TUid aUid); |
|
39 ~CCentralRepositoryHandler(); |
|
40 |
|
41 TInt createKey(unsigned long key, const TInt& value); |
|
42 TInt createKey(unsigned long key, const TReal& value); |
|
43 TInt createKey(unsigned long key, const TDesC8& value); |
|
44 TInt createKey(unsigned long key, const TDesC16& value); |
|
45 |
|
46 TInt deleteKey(unsigned long key); |
|
47 |
|
48 TInt resetKey(unsigned long key); |
|
49 TInt resetRepository(); |
|
50 |
|
51 TInt findKeyL(unsigned long partialKey, TUint32 mask, RArray<TUint32>& aFoundKeys); |
|
52 TInt findKeyL(unsigned long partialKey, TUint32 mask, const TInt& value, bool negative, RArray<TUint32>& aFoundKeys); |
|
53 TInt findKeyL(unsigned long partialKey, TUint32 mask, const TReal& value, bool negative, RArray<TUint32>& aFoundKeys); |
|
54 TInt findKeyL(unsigned long partialKey, TUint32 mask, const TDesC8& value, bool negative, RArray<TUint32>& aFoundKeys); |
|
55 TInt findKeyL(unsigned long partialKey, TUint32 mask, const TDesC16& value, bool negative, RArray<TUint32>& aFoundKeys); |
|
56 |
|
57 TInt startTransaction(CRepository::TTransactionMode transactionMode); |
|
58 TInt commitTransaction(); |
|
59 void cancelTransaction(); |
|
60 void failTransaction(); |
|
61 TInt transactionState() const; |
|
62 |
|
63 private: |
|
64 CCentralRepositoryHandler(TUid aUid); |
|
65 void ConstructL(); |
|
66 |
|
67 protected: //From SettingsHandlerBase |
|
68 void setObserver(MSettingsHandlerObserver* observer); |
|
69 bool handleStartMonitoring(const XQSettingsKey& key, XQSettingsManager::Type type, MSettingsHandlerObserver& observer, TInt& error); |
|
70 bool handleStopMonitoring(const XQSettingsKey& key, TInt& error); |
|
71 |
|
72 TInt getValue(unsigned long key, TInt& value); |
|
73 TInt getValue(unsigned long key, TReal& value); |
|
74 void getValueL(unsigned long key, RBuf8& value); |
|
75 void getValueL(unsigned long key, RBuf16& value); |
|
76 |
|
77 TInt setValue(unsigned long key, const TInt& value); |
|
78 TInt setValue(unsigned long key, const TReal& value); |
|
79 TInt setValue(unsigned long key, const TDesC8& value); |
|
80 TInt setValue(unsigned long key, const TDesC16& value); |
|
81 |
|
82 private: |
|
83 TUid m_uid; |
|
84 CRepository* iRepository; |
|
85 MSettingsHandlerObserver* m_observer; |
|
86 QHash<unsigned long int, CCenRepMonitor*> m_monitors; |
|
87 }; |
|
88 |
|
89 #endif //CENTRALREPOSITORYHANDLER_H |