src/screensavershareddatamonitor.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:30:40 +0100
branchRCL_3
changeset 26 e8d784ac1a4b
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:   Implementation for screensaver shared data monitoring.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include <coemain.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <ScreensaverInternalCRKeys.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <UsbWatcherInternalPSKeys.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <avkondomainpskeys.h>               // kaknkeyguardstatus
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <ctsydomainpskeys.h>                // kpsuidctsycallinformation
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <startupdomainpskeys.h>             // kpsglobalsystemstate
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <ScreensaverInternalPSKeys.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <UikonInternalPSKeys.h>             // kuikmmcinserted
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <hwrmpowerstatesdkpskeys.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <ctsydomaincrkeys.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <centralrepository.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <akntransitionutils.h>
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#endif
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include "screensavershareddatamonitor.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include "screensavershareddatai.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include "screensaverrepositorywatcher.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include "screensaverview.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include "screensaverengine.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#include "screensaverappui.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
#include "screensaversubscriber.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#include "screensaverutility.h"
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
//System shuttingdown value
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
const TInt KSystemShuttingdown = 1;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
// CScreensaverSharedDataMonitor::~CScreensaverSharedDataMonitor
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
CScreensaverSharedDataMonitor::~CScreensaverSharedDataMonitor()
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
    DeleteSubscriber( iPreviewModeSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
    iPreviewModeProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
    DeleteSubscriber( iMMCWatchSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
    iMMCWatchProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
    DeleteSubscriber( iUSBWatchSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
    iUSBWatchProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
    DeleteSubscriber( iKeyguardStateSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
    iKeyguardStateProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
    DeleteSubscriber( iCallStateSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
    iCallStateProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
    DeleteSubscriber( iShuttingDownSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
    iShuttingDownProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
    DeleteSubscriber( iActivateSSSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
    iActivateSSProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
    DeleteSubscriber( iChargerStateSubscriber );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
    iChargerStateProperty.Close();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
    delete iMessageWaitingWatcher;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
    delete iMessageWaitingRepository;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
// CScreensaverSharedDataMonitor::NewL
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
CScreensaverSharedDataMonitor* CScreensaverSharedDataMonitor::NewL( CScreensaverSharedDataI* aData )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
    CScreensaverSharedDataMonitor* self = new( ELeave )CScreensaverSharedDataMonitor( aData );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
    CleanupStack::PushL( self );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    self->ConstructL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
    CleanupStack::Pop(); // self;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    return self;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
// CScreensaverSharedDataMonitor::CScreensaverSharedDataMonitor
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
CScreensaverSharedDataMonitor::CScreensaverSharedDataMonitor(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    CScreensaverSharedDataI* aData )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    :iData( aData )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
    // No implementation required
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
// CScreensaverSharedDataMonitor::ConstructL
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
// 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
void CScreensaverSharedDataMonitor::ConstructL()
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
    User::LeaveIfError(iPreviewModeProperty.Attach(KPSUidScreenSaver, KScreenSaverPreviewMode));
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    iPreviewModeSubscriber = new (ELeave) CSubscriber(TCallBack(HandlePreviewModeChanged, this), iPreviewModeProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
    iPreviewModeSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
    // MMC watcher
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
    User::LeaveIfError(iMMCWatchProperty.Attach(KPSUidUikon, KUikMMCInserted));
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
    iMMCWatchSubscriber = new (ELeave) CSubscriber(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
        TCallBack(HandleMMCStateChanged, this), iMMCWatchProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
    iMMCWatchSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    // USB watcher (MMC dismount)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    User::LeaveIfError(iUSBWatchProperty.Attach(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
           KPSUidUsbWatcher, KUsbWatcherSelectedPersonality));
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
    iUSBWatchSubscriber = new (ELeave) CSubscriber(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
        TCallBack(HandleUSBStateChanged, this), iUSBWatchProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    iUSBWatchSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
    // Keyguard state watcher
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
    User::LeaveIfError(iKeyguardStateProperty.Attach(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
        KPSUidAvkonDomain, KAknKeyguardStatus));
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
    iKeyguardStateSubscriber = new (ELeave) CSubscriber(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
        TCallBack(HandleKeyguardStateChanged, this), iKeyguardStateProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
    iKeyguardStateSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
    // Call state watcher
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
    User::LeaveIfError(iCallStateProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
    iCallStateSubscriber = new (ELeave) CSubscriber(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
        TCallBack(HandleCallStateChanged, this), iCallStateProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    iCallStateSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
    // Shutting down state watcher
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
    User::LeaveIfError( iShuttingDownProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
    iShuttingDownSubscriber = new (ELeave) CSubscriber(
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
        TCallBack(HandleShuttingDownStateChanged, this), iShuttingDownProperty);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
    iShuttingDownSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
    User::LeaveIfError( iActivateSSProperty.Attach( KPSUidScreenSaver, KScreenSaverActivate ) );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
    iActivateSSSubscriber = new( ELeave ) CSubscriber( 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
        TCallBack( HandleActivateSSChanged, this ), iActivateSSProperty );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
    iActivateSSSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
    User::LeaveIfError( iChargerStateProperty.Attach( KPSUidHWRMPowerState, KHWRMChargingStatus ) );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
    iChargerStateSubscriber = new (ELeave) CSubscriber( 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
        TCallBack( HandleChargerStateChanged, this ), iChargerStateProperty );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    iChargerStateSubscriber->SubscribeL();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    iMessageWaitingRepository = CRepository::NewL( KCRUidCtsyMessageWaitingIndicator );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
    iMessageWaitingWatcher = CScreensaverRepositoryWatcher::NewL( KCRUidCtsyMessageWaitingIndicator,
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
                                                                  TCallBack( HandleMessageWaitingStateChanged, this ),
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
                                                                  iMessageWaitingRepository );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
// CScreensaverSharedDataMonitor::View
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
// 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
CScreensaverView* CScreensaverSharedDataMonitor::View()
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
    return STATIC_CAST( CScreensaverAppUi*, CCoeEnv::Static()->AppUi() )->ScreensaverView();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
// CScreensaverSharedDataMonitor::Model
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
CScreensaverEngine& CScreensaverSharedDataMonitor::Model()
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
    return STATIC_CAST( CScreensaverAppUi*, CCoeEnv::Static()->AppUi() )->Model();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
// CScreensaverSharedDataMonitor::DeteleSubscriber
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
void CScreensaverSharedDataMonitor::DeleteSubscriber( CSubscriber*& aSubscriber )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
    if ( aSubscriber )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
        aSubscriber->StopSubscribe();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
    delete aSubscriber;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
// CScreensaverSharedDataMonitor::HandlePreviewModeChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
// Handles preview mode property key change. If key is changed to 1,
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
// preview mode is started
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
TInt CScreensaverSharedDataMonitor::HandlePreviewModeChanged(TAny *aPtr)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
    CScreensaverSharedDataMonitor *data = STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
    if ( data->iData->ScreensaverPreviewMode() == 1)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
        TRAP_IGNORE( data->Model().StartPreviewModeL() );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
// CScreensaverSharedDataMonitor::HandleMMCStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
// Handles MMC state change callback. If current plugin is loaded from
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
// MMC, screensaver defaults to date & time when MMC removed
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
TInt CScreensaverSharedDataMonitor::HandleMMCStateChanged(TAny* aPtr)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
    User::ResetInactivityTime();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
// CScreensaverSharedDataMonitor::HandleUSBStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
// Handles USB state change callback. If current plugin is loaded from
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
// MMC, screensaver defaults to date & time when USB attached
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
TInt CScreensaverSharedDataMonitor::HandleUSBStateChanged(TAny* aPtr)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
    // Same handler as in MMC removal, parameter tells it's because of USB
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
    User::ResetInactivityTime();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
// CScreensaverSharedDataMonitor::HandleKeyguardStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
// Handles keyguards status change callback.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
// When keys become locked, screensaver timeout is shortened.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
TInt CScreensaverSharedDataMonitor::HandleKeyguardStateChanged(TAny* aPtr)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
    // If keyguard just became unlocked, inform model so that
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
    // short timeout use is reset. Otherwise there might be a situation
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    // where short timeout was in use, user opened keys, did something
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
    // without letting the device idle for short timeout period and
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    // locked keys again. Then short timeout would remain in use without this
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    // notification.
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    // Also inform of keys locked, in case Screensaver is running this
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    // happened because of automatic keyguard fired, and screensaver
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
    // should update the display to show the keyguard indicator
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
    CScreensaverSharedDataMonitor* _this =
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
        STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
    _this->Model().HandleKeyguardStateChanged( _this->iData->IsKeyguardOn() );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
// CScreensaverSharedDataMonitor::HandleCallStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
// Handles call state change callback. If call state changes,
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
// screensaver is stopped
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
TInt CScreensaverSharedDataMonitor::HandleCallStateChanged(TAny* aPtr)
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
#ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
    // Prevent fullscreen transition from screensaver on incoming call
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
    CAknTransitionUtils::SetData( KScreensaverCallStateChange, (TAny*)1 );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
#endif
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
    User::ResetInactivityTime();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
    STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
// CScreensaverSharedDataMonitor::HandleShuttingDownStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
// -----------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
TInt CScreensaverSharedDataMonitor::HandleShuttingDownStateChanged( TAny* /*aPtr*/ )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
    TInt startupState = -1;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
    RProperty::Get( KPSUidStartup, KPSGlobalSystemState, startupState );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
    if( startupState == ESwStateShuttingDown )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
        RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, KSystemShuttingdown);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
// CScreensaverSharedDataMonitor::HandleActivateSSChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
TInt CScreensaverSharedDataMonitor::HandleActivateSSChanged( TAny* aPtr )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    TInt activateState = -1;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
    RProperty::Get( KPSUidScreenSaver, KScreenSaverActivate, activateState );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
    if( activateState && -1 != activateState )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
        // Enable SS
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
        SCRLOGGER_WRITE("SharedDataMonitor: Activate SS");
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
        STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StartScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
    else if ( !activateState )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        // Disable SS
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
        SCRLOGGER_WRITE("SharedDataMonitor: Stop SS");
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
        STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
    else
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
        // Unknown state
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
// CScreensaverSharedDataMonitor::HandleChargerStateChanged
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
TInt CScreensaverSharedDataMonitor::HandleChargerStateChanged( TAny* aPtr )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
    TInt state = -1;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
    RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus, state );
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
    
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
    switch ( state )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
        case EChargingStatusError: // Some error has occurred when charger is connected or charging. 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
        case EChargingStatusNotConnected: // Charger not connected/uninitialized
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
        case EChargingStatusCharging: // Device is charging
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
            {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
            User::ResetInactivityTime();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
            STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
            }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
            break;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
        case EChargingStatusChargingComplete: // Charging completed
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
        case EChargingStatusNotCharging: // Charger is connected, device not charging
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
        case EChargingStatusAlmostComplete: // Charging almost completed
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
        case EChargingStatusChargingContinued: // Charging continued after brief interruption
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
        default:
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
            break;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
// 
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
// ---------------------------------------------------------------------------
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
//
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
TInt CScreensaverSharedDataMonitor::HandleMessageWaitingStateChanged( TAny* aPtr )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
    {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
    CScreensaverSharedDataMonitor* self = STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr);
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
    if ( self->iMessageWaitingWatcher->ChangedKey() == KCtsyMessageWaitingDisplayStatus )
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
        {
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
        self->View()->UpdateAndRefresh();
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
        }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
    return KErrNone;
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
    }
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
e8d784ac1a4b Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
// End of file