|
1 /* |
|
2 * Copyright (c) 2009 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: Homescreen widget preference service. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HSIWIDGETPREFERENCESERVICE_H |
|
20 #define HSIWIDGETPREFERENCESERVICE_H |
|
21 |
|
22 class QString; |
|
23 class HsWidget; |
|
24 |
|
25 /** |
|
26 * @ingroup group_hswidgetmodel group_widget_api_candidates |
|
27 * @brief Preference store for widget. |
|
28 * |
|
29 * The preference service is a key/value store with both the key and |
|
30 * the value being strings. The widget may store data to be reused |
|
31 * at a later date, such as a username, settings for the widget, persistent data, |
|
32 * and so on. The data is stored on the device, for example on its hard drive, |
|
33 * and can be read back at any time. |
|
34 * |
|
35 * @lib ?library |
|
36 * @since S60 ?S60_version |
|
37 */ |
|
38 class IHsWidgetPreferenceService |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Save a widget preference. |
|
44 * This method will store the given value in the widget |
|
45 * in the widget preference store for the given key. |
|
46 * |
|
47 * The preference store is unique to this widget and any values |
|
48 * stored in it are persisted if the widget is reloaded or closed |
|
49 * and started again. |
|
50 * |
|
51 * If a value for the given key already exists, it is silently |
|
52 * overwritten. Storing an empty string for the given key will |
|
53 * create an entry for the given key with an empty string as its value. |
|
54 * |
|
55 * @param widget HsWidget instance. |
|
56 * @param key The preference to get from the preference store. |
|
57 * @param value The value of the preference. |
|
58 * @return True on success, false otherwise. |
|
59 */ |
|
60 virtual bool setPreferenceForKey(HsWidget *widget, const QString &key, const QString &value)=0; |
|
61 |
|
62 /** |
|
63 * Get a preference from the widget preference store. |
|
64 * Get the value stored for the given key in the widget preference store. |
|
65 * If there is no value for the given key, an empty string is returned. |
|
66 * |
|
67 * @param widget HsWidget instance. |
|
68 * @param key The preference to get from the preference store. |
|
69 * @param value The value of the preference. |
|
70 * @return True on success, false otherwise. |
|
71 */ |
|
72 virtual bool preferenceForKey(HsWidget *widget, const QString &key, QString &value)=0; |
|
73 |
|
74 }; |
|
75 |
|
76 Q_DECLARE_METATYPE(IHsWidgetPreferenceService*) |
|
77 #endif |