emailuis/widget/emailwidgetsettings/src/emailwidgetsettingslistview.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2009 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:  CEmailWidgetSettingsListView implementation
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <eikclbd.h>
       
    20 #include <eikmop.h>
       
    21 #include <bacline.h>
       
    22 
       
    23 #include "emailtrace.h"
       
    24 #include "emailwidgetsettingslistview.h"
       
    25 #include "cmailwidgetcenrepkeys.h"
       
    26 
       
    27 const TUid KEmailWidgetSettingsListViewId = {1};
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CEmailWidgetSettingsListView::ConstructL
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 void CEmailWidgetSettingsListView::ConstructL()
       
    36     {
       
    37     BaseConstructL();
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CEmailWidgetSettingsListView::~CEmailWidgetSettingsListView
       
    42 // ---------------------------------------------------------------------------
       
    43 //	
       
    44 CEmailWidgetSettingsListView::~CEmailWidgetSettingsListView()
       
    45     {
       
    46     delete iCid;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CEmailWidgetSettingsListView::DoActivateL
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CEmailWidgetSettingsListView::DoActivateL(const TVwsViewId& aPrevViewId,TUid /*aCustomMessageId*/,const TDesC8& /*aCustomMessage*/)
       
    54     {
       
    55     iPrevViewId = aPrevViewId;
       
    56     iView = new(ELeave) CEmailWidgetSettingsListViewContainer;
       
    57     iView->SetMopParent(this);
       
    58     iView->ConstructL(this,AppUi()->ClientRect());
       
    59     AppUi()->AddToViewStackL(*this, iView);
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CEmailWidgetSettingsListView::DoDeactivate
       
    64 // ---------------------------------------------------------------------------
       
    65 //	
       
    66 void CEmailWidgetSettingsListView::DoDeactivate()
       
    67     {
       
    68     if (iView)
       
    69         {
       
    70         AppUi()->RemoveFromViewStack(*this, iView);
       
    71         }
       
    72     delete iView;
       
    73     iView = NULL;
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CEmailWidgetSettingsListView::Id
       
    78 // ---------------------------------------------------------------------------
       
    79 //	
       
    80 TUid CEmailWidgetSettingsListView::Id() const
       
    81     {
       
    82     return KEmailWidgetSettingsListViewId;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CEmailWidgetSettingsListView::HandleListBoxEventL
       
    87 // ---------------------------------------------------------------------------
       
    88 //	
       
    89 void CEmailWidgetSettingsListView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
       
    90     {
       
    91     if (aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked)
       
    92         {    
       
    93         iView->SaveSelectedL();
       
    94         AppUi()->HandleCommandL(EAknSoftkeyCancel); // Exit app
       
    95 		}
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CEmailWidgetSettingsListView::HandleCommandL
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CEmailWidgetSettingsListView::HandleCommandL(TInt aCommandId)
       
   103     {
       
   104     switch (aCommandId)
       
   105         {
       
   106         case EAknSoftkeyCancel:
       
   107             AppUi()->HandleCommandL(aCommandId);
       
   108             break;
       
   109         case EAknSoftkeySelect:            
       
   110             iView->SaveSelectedL();
       
   111             AppUi()->HandleCommandL(EAknSoftkeyCancel); // Exit app
       
   112             break;            
       
   113         default:
       
   114             //Handled by App UI
       
   115             break;
       
   116         }
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CEmailWidgetSettingsListView::HandleForegroundEventL
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CEmailWidgetSettingsListView::HandleForegroundEventL(TBool aForeground)
       
   124     {
       
   125     if (!aForeground)
       
   126         {
       
   127         AppUi()->HandleCommandL(EAknSoftkeyCancel); //Exit app
       
   128         }
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CEmailWidgetSettingsListView::HandleStatusPaneSizeChange
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CEmailWidgetSettingsListView::HandleStatusPaneSizeChange()
       
   136     {
       
   137     if (iView && iView->iListBox)
       
   138         {
       
   139         iView->SetRect(ClientRect());
       
   140         }
       
   141     }
       
   142 
       
   143 // End of File