mmsengine/mmsserver/src/mmsschedulesend.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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 *     Scheduled sending of MMS messages
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include    <msvstd.h>
       
    23 #include    <msventry.h>
       
    24 #include    <msvschedulesend.h>
       
    25 #include    <msvschedulesettings.h>
       
    26 
       
    27 #include    "mmsschedulesend.h"
       
    28 #include    "mmsscheduledentry.h"
       
    29 #include    "mmsaccount.h"
       
    30 #include    "mmscmds.h"
       
    31 
       
    32 // EXTERNAL DATA STRUCTURES
       
    33 
       
    34 // EXTERNAL FUNCTION PROTOTYPES  
       
    35 
       
    36 // CONSTANTS
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 
       
    42 // MODULE DATA STRUCTURES
       
    43 
       
    44 // LOCAL FUNCTION PROTOTYPES
       
    45 
       
    46 // ==================== LOCAL FUNCTIONS ====================
       
    47 
       
    48 // ================= MEMBER FUNCTIONS =======================
       
    49 
       
    50 // C++ default constructor can NOT contain any code, that
       
    51 // might leave.
       
    52 //
       
    53 CMmsScheduleSend::CMmsScheduleSend( CMsvServerEntry& aServerEntry )
       
    54     : CMsvScheduleSend( aServerEntry )
       
    55     {
       
    56     }
       
    57 
       
    58 // Two-phased constructor.
       
    59 CMmsScheduleSend* CMmsScheduleSend::NewL( CMsvServerEntry& aServerEntry )
       
    60     {
       
    61     CMmsScheduleSend* self = new (ELeave) CMmsScheduleSend( aServerEntry );
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67     
       
    68 // Destructor
       
    69 CMmsScheduleSend::~CMmsScheduleSend()
       
    70     {
       
    71     
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------
       
    75 // CMmsScheduleSend::GetMessageL
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 CMsvScheduledEntry* CMmsScheduleSend::GetMessageL(
       
    79     const TMsvId aId ) const
       
    80     {
       
    81     //  Returns a pointer to a newly created CMmsScheduledEntry,
       
    82     //  which encapsulates the scheduling and recipient information relating
       
    83     //  to the message identified by aId.
       
    84 
       
    85     //Set the iServerEntry to the message identified by aId
       
    86     User::LeaveIfError(iServerEntry.SetEntry(aId));
       
    87 
       
    88     //Create a new CFaxScheduledEntry
       
    89     CMmsScheduledEntry* entry = CMmsScheduledEntry::NewL(iServerEntry.Entry());
       
    90     CleanupStack::PushL(entry);
       
    91 
       
    92     CMsvStore* store = iServerEntry.ReadStoreL();
       
    93     CleanupStack::PushL(store);
       
    94 
       
    95     //Restore the entry from the message's store.
       
    96     entry->RestoreL(*store);
       
    97 
       
    98     CleanupStack::PopAndDestroy( store );
       
    99     CleanupStack::Pop( entry );
       
   100 
       
   101     return entry;
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CMmsScheduleSend::LoadSettings
       
   106 // ---------------------------------------------------------
       
   107 //
       
   108 void CMmsScheduleSend::LoadSettingsL( TInt aCommand )
       
   109     {
       
   110     CMmsAccount* account = CMmsAccount::NewL();
       
   111     CleanupStack::PushL( account ); // ***
       
   112     
       
   113     switch( aCommand )
       
   114         {
       
   115         case EMmsReceive:
       
   116         case EMmsScheduledReceive:
       
   117         case EMmsReceiveForced:
       
   118         case EMmsScheduledReceiveForced:
       
   119             account->LoadScheduleReceiveSettingsL(
       
   120                 ScheduleSettings(), 
       
   121                 OffPeakTimes(),
       
   122                 SendErrorActions(), 
       
   123                 AgentActions() );        
       
   124         break;
       
   125         default: // loading send settings as default
       
   126             account->LoadScheduleSendSettingsL(
       
   127                 ScheduleSettings(), 
       
   128                 OffPeakTimes(), 
       
   129                 SendErrorActions(), 
       
   130                 AgentActions() );        
       
   131         }
       
   132     
       
   133     CleanupStack::PopAndDestroy( account );
       
   134     }
       
   135     
       
   136 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   137 
       
   138 //  End of File  
       
   139