messagingappbase/mce/src/MceConnectMailboxTimer.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:  
       
    15 *     Active object for timing "Connect" query for Remote mailbox.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <msvids.h> // KMsvNullIndexEntryId
       
    23 #include "MceConnectMailboxTimer.h"
       
    24 #include "mceui.h"
       
    25 
       
    26 // LOCAL CONSTANTS AND MACROS
       
    27 const TInt KMceRemoteMailboxConnectionTimeout = 3000000; // 3 seconds
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 // C++ constructor can NOT contain any code that
       
    32 // might leave.
       
    33 //
       
    34 CMceConnectMailboxTimer::CMceConnectMailboxTimer( CMceUi& aMceUi ) :
       
    35     CActive( EPriorityStandard ),
       
    36     iMceUi( aMceUi ),
       
    37     iAccountId( KMsvNullIndexEntryId )
       
    38     {
       
    39     }
       
    40 
       
    41 
       
    42 // Symbian OS default constructor can leave.
       
    43 void CMceConnectMailboxTimer::ConstructL()
       
    44     {
       
    45     User::LeaveIfError( iTimer.CreateLocal() );
       
    46     CActiveScheduler::Add( this );
       
    47     }
       
    48 
       
    49 // Two-phased constructor.
       
    50 CMceConnectMailboxTimer* CMceConnectMailboxTimer::NewL(
       
    51             CMceUi& aMceUi )
       
    52     {
       
    53     CMceConnectMailboxTimer* self =
       
    54         new (ELeave) CMceConnectMailboxTimer(
       
    55         aMceUi );
       
    56 
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop( self );
       
    60 
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // Destructor
       
    66 CMceConnectMailboxTimer::~CMceConnectMailboxTimer()
       
    67     {
       
    68     Cancel();
       
    69     iTimer.Close();
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------
       
    73 // CMceConnectMailboxTimer::SetTimer
       
    74 // ----------------------------------------------------
       
    75 void CMceConnectMailboxTimer::SetTimer( TMsvId aAccountId )
       
    76     {
       
    77     const TTimeIntervalMicroSeconds32 timeInterval = KMceRemoteMailboxConnectionTimeout;
       
    78     iAccountId = aAccountId;
       
    79     Cancel();
       
    80     iTimer.After( iStatus, timeInterval );
       
    81     SetActive();
       
    82     }
       
    83 
       
    84 // ----------------------------------------------------
       
    85 // CMceConnectMailboxTimer::RunL
       
    86 // ----------------------------------------------------
       
    87 void CMceConnectMailboxTimer::RunL()
       
    88     {
       
    89     iMceUi.GoOnlineWithQueryL( iAccountId );
       
    90     }
       
    91 
       
    92 // ----------------------------------------------------
       
    93 // CMceConnectMailboxTimer::DoCancel
       
    94 // ----------------------------------------------------
       
    95 void CMceConnectMailboxTimer::DoCancel()
       
    96     {
       
    97     iTimer.Cancel();
       
    98     }
       
    99 
       
   100 
       
   101 //  End of File