homescreensrv_plat/hswidgetmodel_api/hsipreferencestore.h
author hgs
Fri, 09 Jul 2010 14:19:08 +0300
changeset 102 8b8b34fa9751
parent 98 d2f833ab7940
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
* All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
*
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
* Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
* Description:  Preference store interface.
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#ifndef HSIPREFERENCESTORE_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define HSIPREFERENCESTORE_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
class QString;
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
98
hgs
parents: 85
diff changeset
    23
hgs
parents: 85
diff changeset
    24
/*DEPRECATED
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
    \class IHsPreferenceStore
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
    \brief Interface class for preference store.
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
    The preference store is a key/value store with both the key and
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    the value being strings. The widget may store data to be reused
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
    at a later date, such as a username, settings for the widget, persistent data,
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
    and so on. The data is stored on the device, for example on its hard drive,
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
    and can be read back at any time.
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
class IHsPreferenceStore
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
    Virtual destructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    virtual ~IHsPreferenceStore() {};
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
    Save a widget preference.
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
    This method will store the given value in the widget
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
    in the widget preference store for the given key.
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    The preference store is unique to this widget and any values
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
    stored in it are persisted if the widget is reloaded or closed
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
    and started again.
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
    If a value for the given key already exists, it is silently
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    overwritten. Storing an empty string for the given key will
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    create an entry for the given key with an empty string as its value.
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
    \a id HsWidget's unique identifier
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
    \a key The string to save the preference under.
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
    \a value The value of the preference.     
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    virtual bool setPreferenceForKey(int id, const QString &key, const QString &value) = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
    Get a preference from the widget preference store.
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
    Get the value stored for the given key in the widget preference store.
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
    If there is no value for the given key, an empty string is returned.
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
    \a id HsWidget's unique identifier
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    \a key The preference to get from the preference store.    
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
    \a value The value of the preference is written to this object.
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
    virtual bool preferenceForKey(int id, const QString &key, QString &value) = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
#endif