phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/inc/infowidgetpreferences.h
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 40 bab96b7ed1a4
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
     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:  
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef INFOWIDGETPREFERENCES_H
       
    19 #define INFOWIDGETPREFERENCES_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QStringList>
       
    23 #include <QFlags>
       
    24 
       
    25 // Preference string values
       
    26 const char DISPLAY_SETTING_ON[]    = "On";
       
    27 const char DISPLAY_SETTING_OFF[]     = "Off";
       
    28 
       
    29 class InfoWidgetPreferences : public QObject
       
    30 {
       
    31     Q_OBJECT
       
    32 
       
    33 public: 
       
    34     enum DisplaySetting {
       
    35         DisplayOff = 0, 
       
    36         DisplayOn    
       
    37     }; 
       
    38     
       
    39     enum Option {
       
    40         DisplayHomeZone = 0x1,
       
    41         DisplayMcn = 0x2,
       
    42         DisplayActiveLine = 0x4, 
       
    43         DisplaySatText = 0x8,
       
    44         DisplaySpn = 0x10
       
    45     };
       
    46     Q_DECLARE_FLAGS(Options, Option)
       
    47 
       
    48 public:
       
    49     InfoWidgetPreferences(QObject *parent = NULL);
       
    50     ~InfoWidgetPreferences();
       
    51 
       
    52     bool storePreferences();
       
    53     void restorePreferences();
       
    54     QStringList preferenceNames();
       
    55             
       
    56     bool isPreferenceSet(Option preferenceId) const;
       
    57     QString preference(Option preferenceId) const;
       
    58     InfoWidgetPreferences::Options preferences() const;
       
    59     void setPreference(Option preferenceId, const QString &preferenceString);
       
    60      
       
    61     bool validate(); 
       
    62     int visibleItemCount();
       
    63 
       
    64 signals:
       
    65     void prefChanged(int option,int displaySetting);
       
    66 		
       
    67 private:
       
    68     Q_DISABLE_COPY(InfoWidgetPreferences)
       
    69 
       
    70     InfoWidgetPreferences::Options m_options; 
       
    71     InfoWidgetPreferences::Options m_validatedOptions;
       
    72 };
       
    73 
       
    74 Q_DECLARE_OPERATORS_FOR_FLAGS(InfoWidgetPreferences::Options)
       
    75 
       
    76 #endif // INFOWIDGETPREFERENCES_H
       
    77