messagingappbase/mce/src/MceEmailNotifHandler.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:   Active object for marking the e-mails as read and resetting
       
    15 *				 the count of the unread e-mails.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "MceEmailNotifHandler.h"
       
    24 #include <e32std.h>
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMceEmailNotifHandler::CMceAttachmentAddition
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CMceEmailNotifHandler::CMceEmailNotifHandler() : CActive(EPriorityStandard)
       
    36     {
       
    37     CActiveScheduler::Add(this);
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMceEmailNotifHandler::NewLC
       
    42 // Two phase constructor
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CMceEmailNotifHandler* CMceEmailNotifHandler::NewLC()
       
    46 	{
       
    47     CMceEmailNotifHandler* self = new(ELeave) CMceEmailNotifHandler();
       
    48     CleanupStack::PushL(self);
       
    49     self->ConstructL();
       
    50     return self;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CMceEmailNotifHandler::NewLC
       
    55 // Two phase constructor
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMceEmailNotifHandler* CMceEmailNotifHandler::NewL()
       
    59 	{
       
    60 	CMceEmailNotifHandler* self = NewLC();
       
    61     CleanupStack::Pop(); // self
       
    62     return self;
       
    63 	}
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMceEmailNotifHandler::NewLC
       
    67 // Two phase constructor
       
    68 // -----------------------------------------------------------------------------
       
    69 //	
       
    70 void CMceEmailNotifHandler::ConstructL()
       
    71 	{
       
    72 	iNcnNotification = MNcnInternalNotification::CreateMNcnInternalNotificationL();
       
    73 	}
       
    74 	
       
    75 // -----------------------------------------------------------------------------
       
    76 // CMceEmailNotifHandler::~CMceAttachmentAddition
       
    77 // Destructor
       
    78 // -----------------------------------------------------------------------------
       
    79 CMceEmailNotifHandler::~CMceEmailNotifHandler()
       
    80     {
       
    81     Cancel();
       
    82     delete iNcnNotification;
       
    83     iNcnNotification = NULL;
       
    84     }	
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMceEmailNotifHandler::AttachFileL
       
    88 // Assign the asyncronous request for adding the attachment into the entry.
       
    89 // (other items were commented in a header).
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CMceEmailNotifHandler::HandleNotif()
       
    93 	{
       
    94 	if( IsActive() )
       
    95         {
       
    96         // Operation is allready running
       
    97         return;	    
       
    98         }
       
    99 	
       
   100 	iNcnNotification->MarkUnread( EIndexMailBox, iStatus );
       
   101 	SetActive();
       
   102 	}
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CMceEmailNotifHandler::HandleNotif
       
   106 // (other items were commented in a header).
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void CMceEmailNotifHandler::HandleNotif(const TMsvId& aMailbox)
       
   110     {
       
   111     if( IsActive() )
       
   112         {
       
   113         // Operation is allready running
       
   114         return;     
       
   115         }
       
   116     
       
   117     iNcnNotification->MarkUnread( EIndexMailBox, aMailbox,iStatus );
       
   118     SetActive();
       
   119     }
       
   120 // -----------------------------------------------------------------------------
       
   121 // CMceEmailNotifHandler::RunL
       
   122 // Completes the asyncronous service request
       
   123 // (other items were commented in a header).
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CMceEmailNotifHandler::RunL()
       
   127     {
       
   128     ;// nothing
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CMceEmailNotifHandler::DoCancel
       
   133 // Cancels the asyncronous request, adding the attachment
       
   134 // (other items were commented in a header).
       
   135 // -----------------------------------------------------------------------------
       
   136 //	
       
   137 void CMceEmailNotifHandler::DoCancel()
       
   138     {
       
   139     // Cancel operation of the async request not called!
       
   140     iNcnNotification->CancelMarkUnread();
       
   141     }
       
   142   
       
   143  // -----------------------------------------------------------------------------
       
   144 // CMceEmailNotifHandler::RunError
       
   145 // Called by the framework if RunL leaves
       
   146 // (other items were commented in a header).
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 TInt CMceEmailNotifHandler::RunError( TInt )
       
   150  	{
       
   151  	return KErrNone;
       
   152  	}
       
   153 
       
   154 //  End of File