calendarui/settings/settingsui/inc/calensetting.h
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     1 /*
       
     2 * Copyright (c) 2002 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:   CCalenSetting has calendar setting data.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CALENSETTING_H
       
    20 #define CALENSETTING_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <calenconstants.h>         // TCalenWeekTitle
       
    25 #include <ecom/implementationinformation.h>
       
    26 
       
    27 #include "calencustomisationmanager.h"
       
    28 #include "CalendarVariant.hrh"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class RWriteStream;
       
    32 class RReadStream;
       
    33 class CRepository;
       
    34 
       
    35 //  CLASS DEFINITIONS
       
    36 
       
    37 /**
       
    38  *  Have calendar setting data
       
    39  */
       
    40 NONSHARABLE_CLASS( CCalenSetting ) : public CBase
       
    41     {
       
    42 public:  // Construction
       
    43     /**
       
    44      * Returns an instance of the singleton.
       
    45      */
       
    46     IMPORT_C static CCalenSetting* InstanceL();
       
    47 
       
    48     /**
       
    49      * Releases an instance of the singleton.
       
    50      */
       
    51     IMPORT_C void Release();
       
    52 
       
    53 public:  // New functions
       
    54     /**
       
    55      * Returns an array of UIDs of plugins known to be disabled or enabled.
       
    56      */
       
    57     IMPORT_C CCalenCustomisationManager::CCalenPluginStatusArray&
       
    58                                                     PluginAvailability();
       
    59 
       
    60     /**
       
    61      * Return default view
       
    62      * @return Default view - could be a native or a custom view uid.
       
    63      */
       
    64     IMPORT_C TUid DefaultView() const;
       
    65 
       
    66     /**
       
    67      * Return setting type of week format
       
    68      * @return startday of week - TDay
       
    69      */
       
    70     IMPORT_C TDay WeekFormat() const;
       
    71 
       
    72     /**
       
    73      * Return setting type of week title
       
    74      * @return Week title - EWeekTitleNumber | EWeekTitleDuration
       
    75      */
       
    76     IMPORT_C TCalenWeekTitle WeekTitle() const;
       
    77  	
       
    78 	/**
       
    79      * Return week number   
       
    80 	 * @return TCalenWeekNumber 
       
    81      */
       
    82     IMPORT_C TCalenWeekNumber WeekNumberEnable() const;
       
    83     /**
       
    84      * Return setting for calendar alarm snooze time.
       
    85      * @return Minutes to snooze.
       
    86      */
       
    87     IMPORT_C TInt SnoozeTime() const;
       
    88 
       
    89 #ifdef RD_CALEN_EXTERNAL_CAL
       
    90     /**
       
    91      * Return setting for the external calendar availability
       
    92      * @return 1 if there is ext calendar.
       
    93      */
       
    94     IMPORT_C TInt ExtCalendar() const;
       
    95 
       
    96     /**
       
    97      * Writes External calendar enabled flag to central repository
       
    98      *
       
    99      */
       
   100     IMPORT_C void SetExtCalendar(TInt aEnabled);
       
   101 #endif //RD_CALEN_EXTERNAL_CAL
       
   102 
       
   103 
       
   104     /**
       
   105      * Return setting for toolbar.
       
   106      * @return on/off.
       
   107      */
       
   108     IMPORT_C TInt Toolbar();
       
   109 
       
   110 
       
   111     /**
       
   112      * Gets the list of all plugins available and enables/disables them
       
   113      * in the customisation manager, based on their enabled setting.
       
   114      */
       
   115     IMPORT_C void UpdatePluginListL( CCalenCustomisationManager& aCustomisationManager );
       
   116 
       
   117     /**
       
   118      * Sets a plugin on or off.
       
   119      */
       
   120     IMPORT_C void SetPluginStatusL( TUid aPluginUid, TBool aEnabled );
       
   121 
       
   122     /**
       
   123      * Set default view
       
   124      * @param aDefView CCalenView::EDayView | CCalenView::EWeekView |
       
   125      *                 CCalenView::EMonthView
       
   126      */
       
   127     IMPORT_C void SetDefaultView( TUid aDefView );
       
   128 
       
   129     /**
       
   130      * Set startday of week
       
   131      * @param aFormat TDay
       
   132      */
       
   133     IMPORT_C void SetWeekFormat( TDay aDay );
       
   134 
       
   135     /**
       
   136      * Set week title
       
   137      * @param aTitle EWeekTitleNumber | EWeekTitleDuration
       
   138      */
       
   139     IMPORT_C void SetWeekTitle( TCalenWeekTitle aTitle );
       
   140 	
       
   141  	/**
       
   142      * Set week number
       
   143      * @param TCalenWeekNumber
       
   144      */
       
   145    IMPORT_C void SetWeekNumber( TCalenWeekNumber aNumber );
       
   146     /**
       
   147      * Set snooze time.
       
   148      * @param aSnoozeTime Snooze time in minutes.
       
   149      */
       
   150     IMPORT_C void SetSnoozeTime( TInt aSnoozeTime );
       
   151 
       
   152 
       
   153     /**
       
   154      * Set toolbar.
       
   155      * @param aShown 1 on, 0 off.
       
   156      */
       
   157     IMPORT_C void SetToolbar(TInt aShown);
       
   158 
       
   159 
       
   160     /**
       
   161      * Load setting data from shared data or central repository
       
   162      */
       
   163     IMPORT_C void LoadL();
       
   164 
       
   165     /**
       
   166      * Save setting data to shared data or central repository
       
   167      */
       
   168     IMPORT_C void SaveL() const;
       
   169 
       
   170 private:  // Typedefs
       
   171     typedef TPckg<CCalenCustomisationManager::CCalenPluginStatusArray> TPluginStatusPckg;
       
   172     typedef TPckgBuf<CCalenCustomisationManager::CCalenPluginStatusArray> TPluginStatusPckgBuf;
       
   173 
       
   174 private:
       
   175     /**
       
   176      * C++ default constructor.
       
   177      */
       
   178     CCalenSetting();
       
   179 
       
   180     /**
       
   181      * Destructor
       
   182      */
       
   183     ~CCalenSetting();
       
   184 
       
   185     // Prevent assignment and copy constructor
       
   186     //lint -e{1526}
       
   187     CCalenSetting& operator=(const CCalenSetting&);
       
   188     //lint -e{1526}
       
   189     CCalenSetting(const CCalenSetting&);
       
   190 
       
   191 private:  // New functions
       
   192     /**
       
   193      * Checks the list of enabled/disabled plugins (iPluginAvailability), and if
       
   194      * any are no longer installed, remove them from the list.
       
   195      * Returns ETrue if action taken, EFalse otherwise.
       
   196      */
       
   197     TBool RemovePluginsNoLongerInstalled( const RImplInfoPtrArray& aAvailablePlugins );
       
   198 
       
   199     /**
       
   200      * Checks the list of enabled/disabled plugins (iPluginAvailability) against
       
   201      * the given array of available plugins, and if any plugins are not in the
       
   202      * availability list, add them.
       
   203      * Returns ETrue if action taken, EFalse otherwise.
       
   204      */
       
   205     TBool AddPluginsNewlyInstalledL( const RImplInfoPtrArray& aAvailablePlugins ,
       
   206                                             CCalenCustomisationManager& aCustomisationManager );
       
   207 
       
   208     /**
       
   209      * Saves the list of enabled/disabled plugins to repository.
       
   210      */
       
   211     void SavePluginListL( CRepository& aRepository ) const;
       
   212 
       
   213     /**
       
   214      * Converts the string to the plugin status array.
       
   215      */
       
   216     void PopulatePluginAvailabilityFromBufferL( const TDesC& aBuf );
       
   217 
       
   218     /**
       
   219      * Converts the plugins status array to a buffer.
       
   220      */
       
   221     void PopulateBufferFromPluginAvailabilityL( RBuf& aBuf ) const;
       
   222 
       
   223 private:    // Data
       
   224     TInt                      iRefCount;
       
   225     TUid                      iDefaultView;
       
   226     TDay                      iWeekFormat;
       
   227     TCalenWeekTitle           iWeekTitle;
       
   228     TCalenWeekNumber          iWeekNumber;
       
   229     TInt                      iSnoozeTime;
       
   230     CCalenCustomisationManager::CCalenPluginStatusArray  iPluginAvailability;
       
   231 #ifdef RD_CALEN_EXTERNAL_CAL
       
   232     TInt                      iExtCalendar;
       
   233 #endif //RD_CALEN_EXTERNAL_CAL
       
   234 
       
   235 
       
   236     TInt                      iToolbar;
       
   237 
       
   238     };
       
   239 
       
   240 #endif // CALENSETTING_H
       
   241 
       
   242 
       
   243 // End of File