inc/screensavershareddatai.h
changeset 14 8a173132b0aa
parent 2 058b1fc1663a
equal deleted inserted replaced
2:058b1fc1663a 14:8a173132b0aa
     1 /*
       
     2 * Copyright (c) 2005 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:   Defines screensaver shared data connections.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _SCREENSAVERSHAREDDATAI_H__
       
    21 #define _SCREENSAVERSHAREDDATAI_H__
       
    22 
       
    23 #include <msvapi.h>         // for MMsvSessionObserver
       
    24 #include <cenrepnotifyhandler.h>
       
    25 
       
    26 #include "screensaverplugin.h"
       
    27 #include "ScreensaverUtils.h"
       
    28 #include "ScreensaverInternalPSKeys.h"
       
    29 #include "ScreensaverInternalCRKeys.h"
       
    30 #include "screensaverengine.h"
       
    31 
       
    32 // CLASS DECLARATION
       
    33 class CRepository;
       
    34 class CScreensaverRepositoryWatcher;
       
    35 class CSubscriber;
       
    36 class MProfile;
       
    37 class MProfileEngine;
       
    38 
       
    39 class CScreensaverSharedDataI : public CBase, public MMsvEntryObserver,
       
    40     public MMsvSessionObserver
       
    41     {
       
    42 public:
       
    43     /**
       
    44     * Two-phased constructor
       
    45     */
       
    46     static CScreensaverSharedDataI* NewL();
       
    47 
       
    48     /**
       
    49     * Destructor
       
    50     */
       
    51     ~CScreensaverSharedDataI();
       
    52 
       
    53 public:
       
    54     /**
       
    55     * Get the screensaver object type
       
    56     */
       
    57     TDisplayObjectType DisplayObjectType() const;
       
    58 
       
    59     /*
       
    60     * Change the display object type of screensaver
       
    61     */
       
    62     void SetDisplayObjectType( const TDisplayObjectType aType );
       
    63     
       
    64     /**
       
    65     * Gets the display text
       
    66     */
       
    67     void GetDisplayObjectText( TDes& aDes ) const;
       
    68 
       
    69     /*
       
    70     * Get the plug-in name
       
    71     */
       
    72     void GetPluginName( TFileName& aFileName ) const;
       
    73     
       
    74     /*
       
    75     * Get the flag if uses the inversive color 
       
    76     */
       
    77     TBool IsInvertedColors() const;
       
    78     
       
    79     /**
       
    80     * Gets the timeout
       
    81     */
       
    82     TInt ScreensaverTimeout() const;
       
    83     
       
    84     /*
       
    85     * Is the New Contact Note is actived or not
       
    86     */
       
    87     TBool IsNCNActive() const;
       
    88     
       
    89     /*
       
    90     * Get the count of the missed calls 
       
    91     */
       
    92     TInt NewMissedCalls() const;    
       
    93 
       
    94     /**
       
    95     * Request screen lights to be turned on or off
       
    96     *
       
    97     * @param sSecs - lights on for aSecs seconds, 0 = off, max 30.
       
    98     */
       
    99     void SetSSForcedLightsOn( const TInt aSecs );
       
   100 
       
   101     /**
       
   102     * Publish Screensaver on/off status
       
   103     *
       
   104     * @param aOn ETrue - saver on, EFalse - off
       
   105     */
       
   106     void SetScreensaverStatus(const TBool aOn = ETrue);
       
   107 
       
   108     /**
       
   109     * Publish "Screensaver started from Idle" status
       
   110     */
       
   111     void SetSSStartedFromIdleStatus();
       
   112     
       
   113     /*
       
   114     * Get the flag that if the screensaver is allowed or not
       
   115     */
       
   116     TInt IsScreenSaverAllowed() const;
       
   117     
       
   118     /*
       
   119     * Get the Preview mode of screensaver 
       
   120     */
       
   121     TInt ScreensaverPreviewMode() const;
       
   122     
       
   123     /*
       
   124     * Set the preview mode 
       
   125     */
       
   126     void SetScreensaverPreviewMode( const TInt aMode );
       
   127 
       
   128     /**
       
   129     * Get preview state
       
   130     */
       
   131     TScreenSaverPreviewState ScreensaverPreviewState() const;
       
   132     
       
   133     /**
       
   134     * Report preview state
       
   135     */
       
   136     void SetScreensaverPreviewState( const TScreenSaverPreviewState aState );
       
   137     
       
   138     /*
       
   139     * Get keyguard status 
       
   140     *
       
   141     * @return ETrue  key guard is active.
       
   142     *         EFalse key guard is inactive.
       
   143     */
       
   144     TBool IsKeyguardOn() const;
       
   145 
       
   146     /**
       
   147     * Query power save mode usage
       
   148     *
       
   149     * @return ETrue, if power save mode should be used
       
   150     */
       
   151     TBool IsUsePowerSaveMode() const;
       
   152 
       
   153     /**
       
   154     * Query system startup completion status
       
   155     *
       
   156     * @return ETrue, if system startup is complete
       
   157     */
       
   158     TBool IsSystemStartupComplete();
       
   159     
       
   160     /**
       
   161     * Gets the default screensaver type
       
   162     */
       
   163     TDisplayObjectType DefaultScreensaverType() const;
       
   164 
       
   165     /**
       
   166     * Returns number of unread messages in inbox.
       
   167     *
       
   168     * @return  Number of unread messages in inbox.
       
   169     */
       
   170     TInt UnreadMessagesNumber();
       
   171 
       
   172     /**
       
   173     * Return the name of currently selected profile
       
   174     *
       
   175     * @return Profile name descriptor.
       
   176     */
       
   177     const TDesC& ProfileName();
       
   178 
       
   179     /**
       
   180     * Query active profile.
       
   181     *
       
   182     * @return Id of active profile, or system error code.
       
   183     */
       
   184     TInt ActiveProfile();
       
   185 
       
   186     /**
       
   187     * Query new email status
       
   188     *
       
   189     * @return ETrue if there is new email
       
   190     */
       
   191     TBool IsHaveNewEmail() const;
       
   192 
       
   193     /**
       
   194     * Query new voice mail status
       
   195     *
       
   196     * @return ETrue, if there is new voice mail
       
   197     */
       
   198     TBool IsHaveNewVoicemail() const;
       
   199     
       
   200     /**
       
   201     * Query new instant message status
       
   202     *
       
   203     * @return ETrue, if there are instant messages pending
       
   204     */
       
   205     TBool IsHaveNewInstantMessages() const;
       
   206 
       
   207     /**
       
   208     * Query silent mode status
       
   209     *
       
   210     * @return ETrue, if silent mode is on
       
   211     */
       
   212     TBool IsSilentMode();
       
   213 
       
   214     /**
       
   215     * Query vibra mode status
       
   216     *
       
   217     * @return ETrue, if vibra mode is on
       
   218     */
       
   219     TBool IsVibraMode();
       
   220 
       
   221 public:
       
   222     /**
       
   223     * From MMsvSessionObserver. Not used.
       
   224     */
       
   225     void HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/,
       
   226             TAny* /*aArg2*/, TAny* /*aArg3*/);
       
   227 
       
   228     /**
       
   229     * From MMsvEntryObserver. Callback function. Handles global In-box events.
       
   230     * @param aEvent An entry event.
       
   231     */
       
   232     void HandleEntryEventL(TMsvEntryEvent aEvent, TAny* aArg1, TAny* aArg2,
       
   233             TAny* aArg3);
       
   234 
       
   235     /*
       
   236     * Returns the pointer of the screensaver repository 
       
   237     */
       
   238     CRepository* ScreensaverRepository() const;
       
   239 
       
   240 private:
       
   241     
       
   242     /**
       
   243     * C++ default constructor
       
   244     */
       
   245     CScreensaverSharedDataI();
       
   246     
       
   247     /**
       
   248     * Two-phased constructor
       
   249     */
       
   250     void ConstructL();
       
   251     
       
   252     /**
       
   253     * Connect to the screensaver central repository
       
   254     */
       
   255     void ConnectToSSCRL();
       
   256     
       
   257     /**
       
   258     * Connect to the Psln Setting central repository
       
   259     */
       
   260     void ConnectToPslnSettingCRL();
       
   261     void ConnectToCommonTsyCRL();
       
   262     void ConnectToInboxL();
       
   263 
       
   264     /**
       
   265     * Connects to Profile engine. Returns ETrue if successfully connected
       
   266     * iProfileEngine will then point to a valid MProfileEngine
       
   267     */
       
   268     TBool ConnectToProfileEngine();
       
   269 
       
   270     /**
       
   271      * Connects to active profile. Returns ETrue if successfully connected
       
   272      * iActiveProfile will then point to a valid MProfile
       
   273      */
       
   274     TBool ConnectToActiveProfile();
       
   275     
       
   276     /*
       
   277     * Define the screensaver properties 
       
   278     */
       
   279     void DefineScreensaverProperties( TUint32 aKey, const TSecurityPolicy& aWritePolicy );
       
   280 
       
   281 private:
       
   282     // Shared data key state handlers.
       
   283     
       
   284     /**
       
   285     * Callback fuction. Called when the timeout changed
       
   286     */
       
   287     static TInt HandleTimeoutChanged(TAny* aPtr);
       
   288 
       
   289     /**
       
   290     * Resets the inactivity timeout
       
   291     */
       
   292     void ResetInactivityTimeout();
       
   293 
       
   294     /**
       
   295     * Callback fuction. Called when the display object changed
       
   296     */
       
   297     static TInt HandleDisplayObjChanged(TAny* aPtr);
       
   298    
       
   299     /*
       
   300     * Get the default type
       
   301     */
       
   302     void GetDefaultType();
       
   303 
       
   304     /*
       
   305      * Get the default type string from the CR
       
   306      */
       
   307     TInt GetDefaultTypeString( TDes& DefaultScreenSaver );
       
   308     
       
   309     /*
       
   310     * Get the count of the voice mail 
       
   311     */
       
   312     TInt VoiceMailCount( const TUint32 aKey ) const;
       
   313 
       
   314     /**
       
   315     * Invalidate cached active profile
       
   316     */
       
   317     void InvalidateActiveProfile();
       
   318     
       
   319     /**
       
   320     * Returns the AppUi
       
   321     */
       
   322     CScreensaverAppUi *AppUi() const;
       
   323 
       
   324 private:
       
   325     
       
   326     /*
       
   327     * The type of the display object
       
   328     */
       
   329     TDisplayObjectType iDefaultType;
       
   330     /**
       
   331     * not owned!
       
   332     */
       
   333     CScreensaverAppUi* iAppUi;
       
   334 
       
   335     /**
       
   336     * Screensaver specific values.
       
   337     */
       
   338     CRepository* iScreensaverRepository;
       
   339     CScreensaverRepositoryWatcher* iScreensaverRepositoryWatcher;
       
   340 
       
   341     /**
       
   342     * General Settings.
       
   343     */
       
   344     CRepository* iSettingsRepository;
       
   345     CScreensaverRepositoryWatcher* iSettingsRepositoryWatcher;
       
   346 
       
   347     /**
       
   348     * Common tsy repository (voice message waiting)
       
   349     */
       
   350     CRepository* iCTsyRepository;
       
   351 
       
   352 
       
   353     /**
       
   354     * Access to the profile engine
       
   355     */
       
   356     MProfileEngine* iProfileEngine;
       
   357     
       
   358     /**
       
   359     * Need to store also the profile, so that it's name
       
   360     * can be used at any time
       
   361     */
       
   362     MProfile* iActiveProfile;
       
   363 
       
   364     /**
       
   365     * The Msv session pointer.
       
   366     */
       
   367     CMsvSession* iMsvSession;
       
   368     
       
   369     /**
       
   370     *  In-box folder entry. Note that the entry is not owned by this class.
       
   371     */
       
   372     CMsvEntry* iInboxFolder;
       
   373 
       
   374     /**
       
   375     * System startup completion flag
       
   376     */
       
   377     TBool iStartupComplete;
       
   378     };
       
   379 
       
   380 #endif  // C_SCREENSAVERSHAREDDATAI_H
       
   381 // End of file.