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