email_pub/email_widget_api/tsrc/3rdpartyapitestplugin2/src/mailboxdataimpl.cpp
branchRCL_3
changeset 8 e1b6206813b4
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
       
     1 /*
       
     2 * Copyright (c) 2009 - 2010 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:  3rd party api testplugin mailbox data
       
    15 *
       
    16 */
       
    17 
       
    18 #include <memaildata.h>
       
    19 #include <memailmailboxdata.h>
       
    20 #include <memailmessagedata.h>
       
    21 
       
    22 #include "emailtrace.h"
       
    23 #include "mailboxdataimpl.h"
       
    24 #include "messagedataimpl.h"
       
    25 #include "t_testpluginconst.hrh"
       
    26 #include "applaunchdataimpl.h"
       
    27 
       
    28 // Hardcoded default values
       
    29 
       
    30 // Path to graphics file with icon/mask numbers (client must provide separate file with brand graphics)
       
    31 _LIT( KDefaultBrandingIcon, "mif(Z:\\resource\\apps\\google_brand_graphics.mif 16384 16385)" );
       
    32 _LIT( KDefaultName, "HARDCODED" );           // default mailbox name
       
    33 const TInt KDefaultMailboxId = 12345;
       
    34 const TUid KDefaultAppUid  = { 0x200009EE }; // App to be launched from widget
       
    35 const TUid KDefaultViewUid = { 0x00000001 }; // View to be activated from widget
       
    36 const TBool KDefaultIsOutboxEmpty( ETrue );
       
    37 const TBool KDefaultUnseen( EFalse );
       
    38 
       
    39 // ---------------------------------------------------------
       
    40 // ---------------------------------------------------------
       
    41 CMailboxDataImpl* CMailboxDataImpl::NewL()
       
    42     {
       
    43     FUNC_LOG;
       
    44     CMailboxDataImpl* self = new(ELeave) CMailboxDataImpl();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop( self );
       
    48     return self;
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------
       
    52 // ---------------------------------------------------------
       
    53 CMailboxDataImpl::~CMailboxDataImpl()
       
    54     {
       
    55     delete iName;
       
    56 
       
    57     for ( TInt i = 0; i < iMessages.Count(); i++ )
       
    58         {
       
    59         delete static_cast<CMessageDataImpl*>(iMessages[i]);
       
    60         iMessages.Remove(i);
       
    61         }
       
    62     iMessages.ResetAndDestroy();
       
    63     delete iAppLaunchParams;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // ---------------------------------------------------------
       
    68 CMailboxDataImpl::CMailboxDataImpl() :
       
    69     iName( NULL ),
       
    70     iBrandingIcon( NULL),
       
    71     iIsOutboxEmpty( KDefaultIsOutboxEmpty ),
       
    72     iUnseen( KDefaultUnseen ),
       
    73     iAppLaunchParams( NULL )
       
    74     {
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // ---------------------------------------------------------
       
    79 void CMailboxDataImpl::ConstructL()
       
    80     {
       
    81     iAppLaunchParams = CAppLaunchDataImpl::NewL( KDefaultAppUid, KDefaultViewUid );
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // ---------------------------------------------------------
       
    86 TUint CMailboxDataImpl::MailboxId() const
       
    87     {
       
    88     FUNC_LOG;
       
    89     return KDefaultMailboxId;
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // ---------------------------------------------------------
       
    94 const TDesC& CMailboxDataImpl::Name() const
       
    95     {
       
    96     FUNC_LOG;
       
    97     return KDefaultName;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // ---------------------------------------------------------
       
   102 const TDesC& CMailboxDataImpl::BrandingIcon() const
       
   103     {
       
   104     FUNC_LOG;
       
   105     return KDefaultBrandingIcon;
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // ---------------------------------------------------------
       
   110 TBool CMailboxDataImpl::IsOutboxEmpty() const
       
   111     {
       
   112     FUNC_LOG;
       
   113     return iIsOutboxEmpty;
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // ---------------------------------------------------------
       
   118 const RPointerArray<EmailInterface::MMessageData>& CMailboxDataImpl::LatestMessagesL() const
       
   119     {
       
   120     FUNC_LOG;
       
   121     return iMessages;
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------
       
   125 // ---------------------------------------------------------
       
   126 TInt CMailboxDataImpl::MessageCount() const
       
   127     {
       
   128     return iMessages.Count();
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------
       
   132 // ---------------------------------------------------------
       
   133 TBool CMailboxDataImpl::Unseen() const
       
   134     {
       
   135     FUNC_LOG;
       
   136     return iUnseen;
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------
       
   140 // ---------------------------------------------------------
       
   141 EmailInterface::MEmailLaunchParameters& CMailboxDataImpl::LaunchParameters() const
       
   142     {
       
   143     FUNC_LOG;
       
   144     return *( static_cast<EmailInterface::MEmailLaunchParameters*>( iAppLaunchParams ) );
       
   145     }