emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 14:11:15 +0300
branchRCL_3
changeset 80 726fba06891a
parent 73 c8382f7b54ef
permissions -rw-r--r--
Revision: 201039 Kit: 201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description: This file implements class CFSEmailUiSearchListVisualiser.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
// SYSTEM INCLUDES
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include "emailtrace.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <freestyleemailui.mbg>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <AknUtils.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <gulicon.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <StringLoader.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <FreestyleEmailUi.rsg>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include "cfsmailmessage.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include "cfsmailclient.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include "cfsmailfolder.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include "cfsmailbox.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <alf/alfframebrush.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#include <alf/alftextvisual.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include "fstreelist.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include "fstreevisualizerbase.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include "fstreeplaintwolineitemdata.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include "fstreeplaintwolineitemvisualizer.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include "fstreeplainonelinenodedata.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include "fstreeplainonelinenodevisualizer.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#include <AknQueryDialog.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#include "cfsmailcommon.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#include <alf/alfanchorlayout.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <alf/alfdecklayout.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#include <alf/alfcontrolgroup.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <alf/alfevent.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#include <alf/alfbrusharray.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#include <alf/alfenv.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#include <alf/alfcommand.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
#include <aknnotewrappers.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
// <cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <layoutmetadata.cdl.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#include <aknlayoutscalable_apps.cdl.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
#include <featmgr.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#include <aknstyluspopupmenu.h>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
#include "mfsccontactactionmenumodel.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#include "fscontrolbar.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
#include "fscontrolbuttoninterface.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
#include "fscontrolbuttonvisualiser.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
#include <csxhelp/cmail.hlp.hrh>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
// Meeting request headers
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
#include <MeetingRequestUids.hrh>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
#include "cesmricalviewer.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
// INTERNAL INCLUDES
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
#include "FreestyleEmailUiLayoutHandler.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
#include "FreestyleEmailUiMailListModel.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
#include "FreestyleEmailUiMailListVisualiser.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
#include "FreestyleEmailUiSearchListVisualiser.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
#include "FreestyleEmailUiSearchListControl.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
#include "FreestyleEmailUiFileSystemInfo.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
#include "FreestyleEmailUiAppui.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
#include "FreestyleEmailUi.hrh"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
#include "FreestyleEmailUiTextureManager.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
#include "FreestyleEmailUiUtilities.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
#include "FreestyleEmailUiLiterals.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
#include "FreestyleEmailUiShortcutBinding.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
#include "FreestyleEmailUiMsgDetailsVisualiser.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
#include "freestyleemailcenrephandler.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
#include "FreestyleEmailUiHtmlViewerView.h"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
#include "FSEmail.pan"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
// CONST VALUES
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
static const TInt KMaxLengthOfSearchString = 255;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
//<cmail> s60 platform layouts
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
//static const TInt KSearchIconWidth = 30;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
//const TReal KFSHeaderTextBackgroundOpacity = 0.3f;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
static const TInt KItemExpansionDelay = 400;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
static const TInt KListScrollingDelay = 200;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
static const TInt KMaxPreviewPaneLength = 60;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
//<cmail> define search required priorities
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
#define KStandardSearchPriority   CActive::EPriorityStandard  
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
#define KCallingSearchPriority   ( CActive::EPriorityIdle - 1 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
CFSEmailUiSearchListVisualiser* CFSEmailUiSearchListVisualiser::NewL(CAlfEnv& aEnv,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
																 CFreestyleEmailUiAppUi* aAppUi,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
																 CAlfControlGroup& aSearchListControlGroup )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
    CFSEmailUiSearchListVisualiser* self = CFSEmailUiSearchListVisualiser::NewLC(aEnv, aAppUi, aSearchListControlGroup );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
    CleanupStack::Pop(self);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
    return self;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
CFSEmailUiSearchListVisualiser* CFSEmailUiSearchListVisualiser::NewLC(CAlfEnv& aEnv,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
																  CFreestyleEmailUiAppUi* aAppUi,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
																  CAlfControlGroup& aSearchListControlGroup)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
    CFSEmailUiSearchListVisualiser* self = new (ELeave) CFSEmailUiSearchListVisualiser(aAppUi, aEnv, aSearchListControlGroup);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
    CleanupStack::PushL(self);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
    self->ConstructL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    return self;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
void CFSEmailUiSearchListVisualiser::ConstructL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
	BaseConstructL( R_FSEMAILUI_MAIL_SEARCH_VIEW );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
	// Set list as initial focused control
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
	iThisViewActive = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
	iFirstStartCompleted = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
   	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
// CFSEmailUiSearchListVisualiser::DoFirstStartL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
// Purpose of this function is to do first start only when search list is
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
// really needed to be shown. Implemented to make app startuo faster.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
void CFSEmailUiSearchListVisualiser::DoFirstStartL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
    TRect screenRect;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
    // Create control and anchor layout
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
    iSearchListControl = CFreestyleEmailUiSearchListControl::NewL( *iEnv, this );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
    iScreenAnchorLayout = CAlfAnchorLayout::AddNewL( *iSearchListControl );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
    iScreenAnchorLayout->SetFlags(EAlfVisualFlagAutomaticLocaleMirroringEnabled);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
    SetSearchListLayoutAnchors();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
        /*<cmail> paltform layout changes to cmail
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
    TAlfTimedValue barBgTextureOpacity;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    barBgTextureOpacity.SetValueNow( 1 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
    iBarBgVisual->SetOpacity( barBgTextureOpacity );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
    CAlfTexture* barBgTexture = &iAppUi.FsTextureManager()->TextureByIndex( EMailListBarBgIcon );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
    barBgTexture->Size().SetSize( screenRect.Width(), iAppUi.LayoutHandler()->ControlBarHeight() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    iBarBgVisual->SetImage( TAlfImage( *barBgTexture ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
        */ //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
        /*<cmail> magnifier image is not in cmail
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
    // Add bar image component
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
    iBarFindImage = CAlfImageVisual::AddNewL( *iSearchListControl, iScreenAnchorLayout );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
    TAlfTimedValue barFindImageOpacity;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
    barFindImageOpacity.SetValueNow( 1 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
    iBarFindImage->SetOpacity( barFindImageOpacity );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
    CAlfTexture* barFindTexture = &iAppUi.FsTextureManager()->TextureByIndex( ESearchLookingGlassIcon );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
    barFindTexture->Size().SetSize( 15, 15 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
    iBarFindImage->SetImage( TAlfImage( *barFindTexture ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
        */ //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
	// <cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
    // Add bar text component
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
    iBarTextVisual = CAlfTextVisual::AddNewL( *iSearchListControl, iScreenAnchorLayout );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
    iBarTextVisual->EnableShadow(EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
    iBarTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
	// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
	/*<cmail> no initial text or opacity required in cmail
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
    HBufC* initialSearchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
    iBarTextVisual->SetTextL( *initialSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
    CleanupStack::PopAndDestroy( initialSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
    TAlfTimedValue barTextVisualOpacity;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
    barTextVisualOpacity.SetValueNow( 1 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    iBarTextVisual->SetOpacity( barTextVisualOpacity );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmallBold );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
    iBarTextVisual->SetTextStyle ( textStyle->Id() );*/ //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
    if ( !AknLayoutUtils::LayoutMirrored() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
        iBarTextVisual->SetAlign(EAlfAlignHLeft, EAlfAlignVCenter);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
    else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
        iBarTextVisual->SetAlign(EAlfAlignHRight, EAlfAlignVCenter);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
    // Create model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
    iModel = CFSEmailUiMailListModel::NewL( &iAppUi, ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
    // Create list and append to control group and anchor layout
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
    iSearchListLayout = CAlfDeckLayout::AddNewL( *iSearchListControl, iScreenAnchorLayout );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
    iSearchListLayout->SetSize( TSize( screenRect.Width(), screenRect.Height()-
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
            iAppUi.LayoutHandler()->ControlBarHeight() ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
    iSearchTreeListVisualizer = CFsTreeVisualizerBase::NewL(iSearchListControl, *iSearchListLayout);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
    iSearchList = CFsTreeList::NewL(*iSearchTreeListVisualizer, *iEnv );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
    iSearchList->SetScrollbarVisibilityL( EFsScrollbarHideAlways );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
    // Set mark type and icon
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
    iSearchList->SetMarkTypeL( CFsTreeList::EFsTreeListMultiMarkable );
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
   216
    iSearchTreeListVisualizer->SetMarkIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMarkIcon ) );
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
    iSearchTreeListVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
	iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
	iSearchTreeListVisualizer->SetFocusVisibility( iFocusVisible );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
    iSearchList->SetIndentationL(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    //<cmail> events are now offered to controls in different order
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
    ControlGroup().AppendL( iSearchListControl );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    ControlGroup().AppendL( iSearchList->TreeControl() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
    //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    //<cmail> touch
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
    iSearchList->AddObserverL(*this);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
    //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    iSearchOngoing = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
    // Initializing the default stylus long tap popup menu
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    if( !iStylusPopUpMenu )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
        TPoint point( 0, 0 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
        iStylusPopUpMenu = CAknStylusPopUpMenu::NewL( this , point );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
        TResourceReader reader;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
        iCoeEnv->CreateResourceReaderLC( reader,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
                R_STYLUS_POPUP_MENU_SEARCH_LIST_VIEW );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
        iStylusPopUpMenu->ConstructFromResourceL( reader );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
        CleanupStack::PopAndDestroy();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
    // Set mail list background
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
    //<cmail> S60 skin support
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
    //iSearchTreeListVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
    //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    iSearchTreeListVisualizer->SetItemExpansionDelay( KItemExpansionDelay );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
    iSearchList->SetScrollTime( KListScrollingDelay, 0.5 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
    // Set empty text
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
    HBufC* emptyText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_EMPTY_MSG_LIST_TEXT );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    iSearchTreeListVisualizer->SetEmptyListTextL( *emptyText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
    CleanupStack::PopAndDestroy( emptyText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    // Create startup timer
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
    iStartupCallbackTimer = CFSEmailUiGenericTimer::NewL( this );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
    // Set page up and page down keys
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
    iSearchTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
    iSearchTreeListVisualizer->AddCustomPageDownKey( EStdKeyPageDown );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
    CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
    iSearchTreeListVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
    iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iSearchList );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
    iFirstStartCompleted = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
   	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
void CFSEmailUiSearchListVisualiser::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
	LaunchSearchDialogL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
CFSEmailUiSearchListVisualiser::CFSEmailUiSearchListVisualiser( CFreestyleEmailUiAppUi* aAppUi,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
                                                                CAlfEnv& aEnv,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
                                                                CAlfControlGroup& aSearchListControlGroup )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
    :CFsEmailUiViewBase( aSearchListControlGroup, *aAppUi ),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
    iEnv( &aEnv ),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
    iLatestSearchText( 0 ),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
    iListAddedToControlGroup( EFalse ),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
    iPreparedForExit( EFalse ),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
    iConsumeStdKeyYes_KeyUp( EFalse ), // for consuming the call event if call for contact processed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
    iRequiredSearchPriority( KStandardSearchPriority )  // for search email priority decreasing
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
CFSEmailUiSearchListVisualiser::~CFSEmailUiSearchListVisualiser()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
    if ( iStartupCallbackTimer )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
    	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    	iStartupCallbackTimer->Cancel();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
    	delete iStartupCallbackTimer;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
    	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
	iSearchStrings.ResetAndDestroy();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
	iSearchListItemArray.Reset();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
    delete iModel;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
	delete iLatestSearchText;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
	delete iSearchList;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
    delete iStylusPopUpMenu;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
void CFSEmailUiSearchListVisualiser::PrepareForExit()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
    //<cmail> Not needed anymore as controls aren't removed from control group
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
    /*if(!iListAddedToControlGroup)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
        if(iSearchList && iSearchList->TreeControl())
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
            TRAP_IGNORE(ControlGroup().AppendL( iSearchList->TreeControl() ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
        if(iSearchListControl)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
        TRAP_IGNORE(ControlGroup().AppendL( iSearchListControl ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
        iListAddedToControlGroup = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        }*/
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
    //<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
    if ( iSearchOngoing )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
        TRAP_IGNORE( StopSearchL() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
    delete iMailBox;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
    iMailBox = NULL;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
    TRAP_IGNORE( ResetResultListL() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
    iPreparedForExit = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
TInt CFSEmailUiSearchListVisualiser::HighlightedIndex() const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
	TFsTreeItemId focusedId = static_cast<TFsTreeItemId>( iSearchList->FocusedItem() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
	// Map id to the index in model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
	TInt ret( KErrNotFound );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
	for ( TInt i=0; i<iSearchListItemArray.Count();i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
		if ( focusedId == iSearchListItemArray[i].iSearchListItemId)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
			ret = i;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
TUid CFSEmailUiSearchListVisualiser::Id() const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
	return SearchListViewId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
// <cmail> Toolbar
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
/*void CFSEmailUiSearchListVisualiser::DoActivateL(const TVwsViewId& aPrevViewId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
                     TUid aCustomMessageId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
                     const TDesC8& aCustomMessage)*/
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
void CFSEmailUiSearchListVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
                     TUid aCustomMessageId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
                     const TDesC8& aCustomMessage)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
// </cmail> Toolbar
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
	if ( !iFirstStartCompleted )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
	    DoFirstStartL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
	// <cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
    //iSearchList->SetScrollbarVisibilityL( EFsScrollbarHideAlways );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
    if ( aCustomMessageId != KStartListReturnToPreviousFolder )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
    	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
    	iBarTextVisual->SetTextL(KNullDesC);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
    	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
	if ( &aCustomMessage && aCustomMessageId == KStartNewSearch )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
		// If new search, clear old search list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
		iSearchCount=0;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
		iMsgDataCouldBeChanged = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
		// <cmail> fixed CS high cat. finding
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
		ResetResultListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
	// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
	// Store previous view ID
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
	iPreviousViewUid = aPrevViewId.iViewUid;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
	TSearchListActivationData subView;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
	TPckgBuf<TSearchListActivationData> viewData( subView );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
	viewData.Copy( aCustomMessage );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
	subView = viewData();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
	// Update settings and set list mode according to settings
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
	UpdateMailListSettingsL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
	
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
	if ( iMailBox )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
		delete iMailBox;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
		iMailBox = NULL;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
	iMailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( subView.iMailBoxId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
	// If mailbox data is not, try to get default MCE account
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
	if ( !iMailBox )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
		CMsvSession* msvSession = iAppUi.GetMsvSession();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
		CFSMailClient* client = iAppUi.GetMailClient();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
		iMailBox = TFsEmailUiUtility::GetMceDefaultMailboxL( *client, *msvSession );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
	if ( iMailBox )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
		iThisViewActive = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
                //<cmail> visible/unvisible is not controlled by opacity in cmail
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
		//TAlfTimedValue opacity;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
		//opacity.SetValueNow( 1 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
		//iScreenAnchorLayout->SetOpacity( opacity );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
                //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
		iSearchList->ShowListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
		iSearchList->SetFocusedL(ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
		// Set empty text color
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
	   	TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
		iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
		// Launch search dialog automatically when activated
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
		if ( &aCustomMessage && aCustomMessageId == KStartNewSearch )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
			// <cmail> list reseting moved into the begining of the function
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
			// requeset async launching of the search dialog because DoActivateL must
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
			// not be blocked
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
			iStartupCallbackTimer->Cancel(); // just in case
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
			iStartupCallbackTimer->Start( iAppUi.LayoutHandler()->ViewSlideEffectTime() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
		else if ( iModel && iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
			// Need to make sure that return to this view works even if following function leaves.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
			TRAP_IGNORE( CheckAndUpdateFocusedMessageL() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
		
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
	    // Set mailbox name to status pane
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
		iAppUi.SetActiveMailboxNameToStatusPaneL();	
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
    CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
   446
	// Set msk always empty when view is activated.
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
   447
	SetMskL();
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
	// <cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
	ReScaleUiL(); // In case that Landscape/Portrait has changed.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
	// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
	// <cmail> Touch
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
	iSearchList->SetFocusedL(ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
	FocusVisibilityChange( iAppUi.IsFocusShown() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
	// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
 	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
void CFSEmailUiSearchListVisualiser::ChildDoDeactivate()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
    if(iListAddedToControlGroup && (!iPreparedForExit))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
        iListAddedToControlGroup = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
	iThisViewActive = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
    if ( !iAppUi.AppUiExitOngoing() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
        if ( iSearchList->IsFocused() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
            TRAP_IGNORE(iSearchList->SetFocusedL(EFalse));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
        iSearchTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
CFSEmailUiMailListModel* CFSEmailUiSearchListVisualiser::Model()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
	return iModel;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
void CFSEmailUiSearchListVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
	if ( iSearchList->Count() && iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
		if ( aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
		    if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
			   {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
			   // remove help support in pf5250
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
			   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
			   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
		  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
			if ( item && item->ModelItemType() == ETypeMailItem &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
				 item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
				// Highlighted mail is calendar msg
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
				aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
				aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
				// Highlighted mail is mail msg
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
				aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
				aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
			// showing of mail-related options is dependent on focus
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
			// important for touch-only devices
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
			if ( IsFocusShown() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
				aMenuPane->SetItemDimmed(EFsEmailUiCmdOpen, EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
				aMenuPane->SetItemDimmed(EFsEmailUiCmdMore, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
				aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
				aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
				aMenuPane->SetItemDimmed(EFsEmailUiCmdOpen, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
			// remove message reader support because of problems with reading HTML mails
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
			aMenuPane->SetItemDimmed(EFsEmailUiCmdReadEmail, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
	else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
		if ( aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
		    if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
			   {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
			   // remove help support in pf5250
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
			   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
			   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
			aMenuPane->SetItemDimmed(EFsEmailUiCmdMore, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
			aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
			aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
			aMenuPane->SetItemDimmed(EFsEmailUiCmdOpen, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
			aMenuPane->SetItemDimmed(EFsEmailUiCmdReadEmail, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
	if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_ACTIONS ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
	     aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_CALEVENT_ACTIONS)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
		if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
		  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
			if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
				CFSMailMessage* messagePtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
				if ( messagePtr && messagePtr->IsFlagSet( EFSMsgFlag_Read ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
					aMenuPane->SetItemDimmed(EFsEmailUiCmdMarkAsRead, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
				else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
					aMenuPane->SetItemDimmed(EFsEmailUiCmdMarkAsUnread, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
	if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_CALEVENT_ACTIONS)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
		if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
		  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
			if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
				CFSMailMessage* messagePtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
				if ( messagePtr && messagePtr->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
				    TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
				    if ( iAppUi.MrViewerInstanceL() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
				    	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
				    	// Search must be stopped, otherwise resolve will lead to crash
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
		                if ( iSearchOngoing )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
		                     {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
		                     StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
		                     }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
					    mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( item->MessagePtr() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
				   		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
					switch ( mrMethod )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
						{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
						case EESMRMeetingRequestMethodRequest:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
						    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
						    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
							break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
						case EESMRMeetingRequestMethodCancellation:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
						    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
							TBool supportsRemove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaRemoveFromCalendar );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
							if( !supportsRemove )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
                                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
                                aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
                                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
						    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
							break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
						default:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
						case EESMRMeetingRequestMethodUnknown:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
						case EESMRMeetingRequestMethodResponse:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
						    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
							aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
						    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
							break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
						}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
	if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_MORE )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
// <cmail> Prevent Download Manager opening with attachments
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
//		if ( iAppUi.DownloadInfoMediator() && !iAppUi.DownloadInfoMediator()->IsAnyAttachmentDownloads() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
//			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
//			aMenuPane->SetItemDimmed(EFsEmailUiCmdDownloadManager, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
//			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
	if (aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_ACTIONS)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
        CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
        if(item) // Coverity error fix Item could have been NULL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
            CFSMailMessage* messagePtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
            TInt menuIndex( 0 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
    
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
            //Get # of recipients
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
            TInt numRecipients(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
            if ( messagePtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
                numRecipients =TFsEmailUiUtility::CountRecepients( messagePtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
                if ( numRecipients == 1 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
                    //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
                    //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
                    if ( messagePtr->GetToRecipients().Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
                        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
                        if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetToRecipients()[0]->GetEmailAddress()) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
                            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
                            numRecipients++;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
                            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
                        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
                        if ( messagePtr->GetCCRecipients().Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
                            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
                            if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetCCRecipients()[0]->GetEmailAddress()) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
                                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
                                numRecipients++;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
                                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
                            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
                        if ( messagePtr->GetBCCRecipients().Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
                            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
                            if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetBCCRecipients()[0]->GetEmailAddress()) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
                                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
                                numRecipients++;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
                                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
                            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
    
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
            if ( numRecipients > 1 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
                aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
            else if ( aMenuPane->MenuItemExists( EFsEmailUiCmdActionsReplyAll, menuIndex ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
                aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
	if ( !iSearchOngoing && aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
	    if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
		   {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
		   // remove help support in pf5250
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
		   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
		   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
		aMenuPane->SetItemDimmed(EFsEmailUiCmdStopSearch, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
		if ( iSearchCount == 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
			aMenuPane->SetItemDimmed(EFsEmailUiCmdNewSearch, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
		else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
			aMenuPane->SetItemDimmed(EFsEmailUiCmdSearch, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
	if ( iSearchOngoing && aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
	    if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
		   {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
		   // remove help support in pf5250
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
		   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
		   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
		aMenuPane->SetItemDimmed(EFsEmailUiCmdSearch, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
		aMenuPane->SetItemDimmed(EFsEmailUiCmdNewSearch, ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
	iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, CFSEmailUiShortcutBinding::EContextSearchResults );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
void CFSEmailUiSearchListVisualiser::RefreshL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   727
    if ( iFirstStartCompleted ) //Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   728
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
        if ( iModel && iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
             {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
             // Check if zoom level has been switched and refresh items if so
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
             TAknUiZoom prevZoomLevel = iCurrentZoomLevel;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
             CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
             if ( prevZoomLevel != iCurrentZoomLevel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
                 {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
                 for ( TInt i=0; i<iModel->Count(); i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
                     {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
                     // Set font height
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
                     iSearchListItemArray[i].iTreeItemVisualiser->
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
                         SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
                     iSearchTreeListVisualizer->UpdateItemL( iSearchListItemArray[i].iSearchListItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
                     }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
                 }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
             }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
void CFSEmailUiSearchListVisualiser::CreatePlainNodeL( const TDesC& aItemDataBuff,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
                                                     CFsTreePlainOneLineNodeData* &aItemData,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
                                                     CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
    aItemData = CFsTreePlainOneLineNodeData::NewL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
    aItemData->SetDataL( aItemDataBuff );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
	aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex(EListTextureNodeExpanded) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
    aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex(EListTextureNodeCollapsed) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
    aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL( *iSearchList->TreeControl() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
   	TRect screenRect;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
 	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
    TInt nodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
    aNodeVisualizer->SetSize( TSize(screenRect.Width(), nodeHeight) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
    aNodeVisualizer->SetExtendable(EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
  	// Set correct skin text colors for the list items
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   765
   	TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   766
   	TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
    aNodeVisualizer->SetFocusedStateTextColor( focusedColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
    aNodeVisualizer->SetNormalStateTextColor( normalColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
 	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
void CFSEmailUiSearchListVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   773
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   774
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
    CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
    if ( iFirstStartCompleted ) // Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
        if ( aType == EScreenLayoutChanged )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
            SetStatusBarLayout();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
        if ( iSearchTreeListVisualizer )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
            TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
            iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
            ReScaleUiL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
            }       
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
void CFSEmailUiSearchListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
    aLayoutArray.Append( iScreenAnchorLayout );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   797
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   798
// hide or show CAlfVisuals ( used for activation or deactivation )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
void CFSEmailUiSearchListVisualiser::FadeOut(TBool aDirectionOut )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
	FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
	if ( iScreenAnchorLayout != NULL )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
		TAlfTimedValue timedValue( 0, 0 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
		if ( !aDirectionOut )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
		    timedValue.SetTarget( 1, 0 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
		iScreenAnchorLayout->SetOpacity( timedValue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   812
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   813
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
// -----------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
// CFSEmailUiMailListVisualiser::FlipStateChangedL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
// Called when keyboard flip state is changed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
// -----------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   819
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   820
void CFSEmailUiSearchListVisualiser::FlipStateChangedL( TBool aKeyboardFlipOpen )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
    CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
    iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   824
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   825
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
// -----------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
//  CFSEmailUiSearchListVisualiser::FocusVisibilityChange
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
// -----------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
void CFSEmailUiSearchListVisualiser::FocusVisibilityChange(
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
        TBool aVisible )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
    CFsEmailUiViewBase::FocusVisibilityChange( aVisible );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
    if ( iStylusPopUpMenuVisible && !aVisible )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
        // Do not allow to remove the focus from a list element if the pop up
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
        // menu was just launched.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
        return;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
    iSearchTreeListVisualizer->SetFocusVisibility( aVisible );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
// CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
// Sets status bar layout
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
void CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
    TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
    if( Layout_Meta_Data::IsLandscapeOrientation() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
        // landscape must use different layout
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
    if ( StatusPane()->CurrentLayoutResId() !=  res )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   860
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   861
        TRAP_IGNORE(
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
            StatusPane()->SwitchLayoutL( res ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
void CFSEmailUiSearchListVisualiser::HandleCommandL( TInt aCommand )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
    switch ( aCommand )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
       	case EAknSoftkeySelect:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
			TInt modelCount(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
			if ( iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
				modelCount = iModel->Count();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
		 	if ( modelCount ) // Safety check
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
		 		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
			  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
				if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
					CFSMailMessage* messagePtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
					if ( messagePtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
						{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
						OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
						}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
		 		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
 			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
        case EAknSoftkeyBack:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
			if ( !iAppUi.ViewSwitchingOngoing())
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
				if ( iSearchOngoing )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
					StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
                                //<cmail> useless code removed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
				//HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
				//iBarTextVisual->SetTextL( *searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
				//CleanupStack::PopAndDestroy( searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
                                //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
		 		TVwsViewId viewId = TVwsViewId( KFSEmailUiUid, MailListId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
				TMailListActivationData tmp;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
				if ( iMsgDataCouldBeChanged )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
					tmp.iRequestRefresh = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
					iMsgDataCouldBeChanged = EFalse; // List starts a new search
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
				const TPckgBuf<TMailListActivationData> pkgOut( tmp );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
				iAppUi.ReturnToPreviousViewL( pkgOut );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
	       	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
        case EEikCmdExit:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
        case EAknSoftkeyExit:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
        case EFsEmailUiCmdExit:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
            iAppUi.Exit();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
       	case EFsEmailUiCmdCalActionsReplyAsMail:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
		case EFsEmailUiCmdActionsReply:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
				iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
		   	 	ReplyL( NULL ); // Function will check marked/highlighted msg
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   934
		case EFsEmailUiCmdActionsReplyAll:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
				iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
				ReplyAllL( NULL ); // Function will check marked/highlighted msg
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   941
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
       	case EFsEmailUiCmdCalActionsForwardAsMail:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
		case EFsEmailUiCmdActionsForward:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   945
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   946
			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
				iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
				ForwardL( NULL ); // Function will check marked/highlighted msg
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
		case EFsEmailUiCmdGoToTop:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
			if ( iSearchListItemArray.Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
			    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
			    TInt bottomItemId = iSearchListItemArray[0].iSearchListItemId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
    			iSearchTreeListVisualizer->SetFocusedItemL( bottomItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
			    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
		case EFsEmailUiCmdGoToBottom:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
			if ( iSearchListItemArray.Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
			    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
			    TInt bottomItemId = iSearchListItemArray[ iSearchListItemArray.Count()-1 ].iSearchListItemId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
    			iSearchTreeListVisualizer->SetFocusedItemL( bottomItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
			    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
        case EFsEmailUiCmdPageUp:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
            TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 };
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
            iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
        case EFsEmailUiCmdPageDown:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
            TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 };
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
            iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
       	case EFsEmailUiCmdActionsDeleteCalEvent:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
		case EFsEmailUiCmdActionsDelete:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
 			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
				DeleteFocusedMessageL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
        case EAknSoftkeyOpen:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
    		if (!iAppUi.IsFocusShown())
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
    			iAppUi.SetFocusVisibility( ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
    			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
        case EFsEmailUiCmdOpen:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
        	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
 			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
				OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1004
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
       	case EFsEmailUiCmdNewSearch:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
        case EFsEmailUiCmdSearch:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
        	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
			LaunchSearchDialogL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
        	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
        case EFsEmailUiCmdStopSearch:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
        	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
			StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
        	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1017
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
       	case EFsEmailUiCmdMessageDetails:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1019
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1020
 			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
				CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
					static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( HighlightedIndex() ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
                if ( item ) // Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
                    CFSMailMessage& msg = item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1027
                    
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
                    TMsgDetailsActivationData msgDetailsData;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1029
                    msgDetailsData.iMailBoxId = msg.GetMailBoxId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1030
                    msgDetailsData.iFolderId = msg.GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
                    msgDetailsData.iMessageId = msg.GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
                    
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
                    const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
                    iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning,  pkgOut);					
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1035
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1036
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1037
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1038
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1039
       	case EFsEmailUiCmdHelp:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
  			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
			TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1042
  			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1043
  			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
       	case EFsEmailUiCmdActionsCallSender:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1047
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1048
				CallToSenderL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1049
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1050
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1051
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1052
    	case EFsEmailUiCmdActionsAddContact:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1053
    		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1054
			if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
			    CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1057
				if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1058
					{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
					CFSMailAddress* fromAddress = item->MessagePtr().GetSender();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
					TDesC* emailAddress(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
					if ( fromAddress )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
						{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1063
						emailAddress = &fromAddress->GetEmailAddress();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1064
						}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1065
					if ( emailAddress && emailAddress->Length() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1066
						{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1067
						TAddToContactsType aType;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
						//Query to "update existing" or "Create new" --> EFALSE = user choosed "cancel"
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1069
						if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddtoContactsQueryL( aType ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1070
							{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
							CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL(
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
									*emailAddress, EContactUpdateEmail, aType, this );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1073
							}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
						}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1075
					}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1076
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
    		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1079
        case EFsEmailUiCmdMarkAsReadUnreadToggle:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1080
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
            if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
           		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1084
        			static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1085
        		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1086
        			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1087
        			if ( item->MessagePtr().IsFlagSet(EFSMsgFlag_Read) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1088
        				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
        				HandleCommandL( EFsEmailUiCmdMarkAsUnread );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
        				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
        			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
        				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
        				HandleCommandL( EFsEmailUiCmdMarkAsRead );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1094
        				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
        			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1096
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1097
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
        case EFsEmailUiCmdMarkAsUnread:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
            ChangeReadStatusOfHighlightedL( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1103
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1104
        case EFsEmailUiCmdMarkAsRead:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1105
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1106
            ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1107
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
        case EFsEmailUiCmdCalActionsAccept:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1110
        case EFsEmailUiCmdCalActionsTentative:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1111
        case EFsEmailUiCmdCalActionsDecline:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
        case EFsEmailUiCmdCalRemoveFromCalendar:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
		    CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
			if ( item && item->ModelItemType() == ETypeMailItem &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
				 item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
			    ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1119
                iAppUi.MailViewer().HandleMrCommandL( aCommand,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1120
                                                       iAppUi.GetActiveMailbox()->GetId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1121
                                                       item->MessagePtr().GetFolderId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
                                                       item->MessagePtr().GetMessageId() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
// <cmail> Prevent Download Manager opening with attachments
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
//       	case EFsEmailUiCmdDownloadManager:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
//       		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
//			if (iSearchOngoing)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1130
//				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1131
//				StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
//				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
//  			iAppUi.EnterFsEmailViewL( DownloadManagerViewId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1134
//       		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1135
//			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
// </cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1137
       	case EFsEmailUiCmdReadEmail:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1138
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
			iAppUi.StartReadingEmailsL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
        default:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1146
    // Check if the focus needs to be removed after selecting an command from
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1147
    // the stylus popup menu.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1148
    if ( ( iStylusPopUpMenuVisible ) &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
         ( aCommand == KErrCancel ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1150
           aCommand == EFsEmailUiCmdActionsDelete ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
           aCommand == EFsEmailUiCmdMarkAsRead ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1152
           aCommand == EFsEmailUiCmdMarkAsUnread ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
           aCommand == EFsEmailUiCmdActionsMove ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
           aCommand == EFsEmailUiCmdMarkingModeFromPopUp ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1156
        // We end up here if the user selects an option from the pop up menu
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
        // or exits the menu by tapping outside of it's area.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
        // Remove the focus from a list item if an item is focused.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
        iStylusPopUpMenuVisible = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
        iAppUi.SetFocusVisibility( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
TInt CFSEmailUiSearchListVisualiser::LaunchSearchDialogL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1167
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1168
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
	if ( !iLatestSearchText )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
		iLatestSearchText = HBufC::NewL( KMaxLengthOfSearchString );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
	TPtr16 textData = iLatestSearchText->Des();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
	CAknQueryDialog* dlg = CAknQueryDialog::NewL( textData );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
	HBufC* searchPrompt = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_LABEL );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
	dlg->SetPromptL(*searchPrompt);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
	CleanupStack::PopAndDestroy( searchPrompt );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
	TInt ret = dlg->ExecuteLD( R_FSEMAILUI_FIND_MAIL_DIALOG );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
	if ( ret )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
		// Stop any ongoing search before starting a new one
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
		if ( iSearchOngoing )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
		    StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
              //<cmail> make list and header visible by showing control group
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
		else if( !iListAddedToControlGroup )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1188
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
            //ControlGroup().AppendL( iSearchListControl );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
            //ControlGroup().AppendL( iSearchList->TreeControl() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
            iListAddedToControlGroup = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
		iSearchList->SetScrollbarVisibilityL( EFsScrollbarAuto );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
             //</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1195
		// Set searching text
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
		HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCHING );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
		HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + KSpace().Length() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1198
		finalText->Des().Append( *searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1199
		finalText->Des().Append( KSpace );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1200
		finalText->Des().Append( *iLatestSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
		iBarTextVisual->SetTextL( *finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
		CleanupStack::PopAndDestroy( finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
		CleanupStack::PopAndDestroy( searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
		StartSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1206
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1207
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1208
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1209
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1210
void CFSEmailUiSearchListVisualiser::UpdateMailListSettingsL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1211
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1212
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1213
	if ( iAppUi.GetCRHandler() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1214
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1215
		iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1216
		TInt lineValue = iAppUi.GetCRHandler()->MessageListLayout();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1217
		TInt bodyPreviewValue = iAppUi.GetCRHandler()->BodyPreview();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1218
		if ( lineValue == 1 ) // 1-line layouts
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1219
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1220
			if ( bodyPreviewValue == 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1221
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1222
				iListMode = EListControlTypeSingleLinePreviewOff;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1223
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1224
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1225
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1226
				iListMode = EListControlTypeSingleLinePreviewOn;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1227
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1228
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1229
		else //
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1230
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1231
			if ( bodyPreviewValue == 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1232
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1233
				iListMode = EListControlTypeDoubleLinePreviewOff;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1234
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1235
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1236
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1237
				iListMode = EListControlTypeDoubleLinePreviewOn;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1238
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1239
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1240
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1241
	else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1242
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1243
		iNodesInUse = EListControlSeparatorDisabled;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1244
		iListMode = EListControlTypeDoubleLinePreviewOff;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1245
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1246
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1247
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1248
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1249
TBool CFSEmailUiSearchListVisualiser::OfferEventL(const TAlfEvent& aEvent)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1250
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1251
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1252
    TBool result(EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1253
    // On KeyUp of EStdKeyYes usually Call application is called - prevent it if call for contact was previously called
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1254
    if ( iConsumeStdKeyYes_KeyUp && aEvent.IsKeyEvent() && (aEvent.Code() == EEventKeyUp )) 
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1255
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1256
		iConsumeStdKeyYes_KeyUp = EFalse; // in case call button was consumed elsewhere first key up enables calling Call application
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1257
		if ( EStdKeyYes == aEvent.KeyEvent().iScanCode) 
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1258
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1259
			  result = ETrue; // consume not to switch to Call application when call to contact was processed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1260
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1261
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1262
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1263
    if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1264
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1265
        TInt scanCode = aEvent.KeyEvent().iScanCode;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1266
        // Swap right and left controls in mirrored layout
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1267
        if ( AknLayoutUtils::LayoutMirrored() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1268
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1269
            if ( scanCode == EStdKeyRightArrow ) scanCode = EStdKeyLeftArrow;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1270
            else if ( scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1271
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1272
        // Handle possible focus visibility change
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1273
		if ((scanCode == EStdKeyRightArrow)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1274
			|| (scanCode == EStdKeyLeftArrow)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1275
			|| (scanCode == EStdKeyUpArrow)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1276
			|| (scanCode == EStdKeyDownArrow)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1277
			|| (scanCode == EStdKeyEnter)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1278
			|| (scanCode == EStdKeyDeviceA)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1279
			|| (scanCode == EStdKeyDevice3))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1280
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1281
            // If the focus was not active already, ignore the key press
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1282
            if( !iAppUi.SetFocusVisibility( ETrue ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1283
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1284
                return ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1285
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1286
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1287
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1288
        switch ( scanCode )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1289
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1290
            case EStdKeyDevice3: // CENTER CLICK
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1291
            case EStdKeyEnter:  // ENTER EITHER SELECTS ITEM IN TOOLBAR OR OPENS MAIL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1292
            case EStdKeyNkpEnter:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1293
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1294
                if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1295
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1296
                    OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1297
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1298
                result = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1299
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1300
                break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1301
            case EStdKeyYes:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1302
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1303
                if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1304
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1305
                    result = CallToSenderL();	
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1306
                    iConsumeStdKeyYes_KeyUp = result;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1307
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1308
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1309
                break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1310
            default:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1311
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1312
                // check keyboard shortcuts:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1313
                TInt command =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1314
                    iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1315
                        CFSEmailUiShortcutBinding::EContextSearchResults );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1316
                if ( command >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1317
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1318
                    HandleCommandL( command );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1319
                    result = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1320
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1321
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1322
                break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1323
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1324
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1325
    else if ( aEvent.IsPointerEvent() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1326
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1327
        // event should be forwarded to list only if it 
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1328
        // contains at least one item
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1329
        if ( iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1330
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1331
            result = iSearchList->TreeControl()->OfferEventL( aEvent );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1332
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1333
        else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1334
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1335
            // otherwise we consume it so no other ALF controls gets it
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1336
            // e.g. ControlBar
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1337
            result = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1338
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1339
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1340
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1341
    return result;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1342
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1343
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1344
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1345
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1346
void CFSEmailUiSearchListVisualiser::ReScaleUiL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1347
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1348
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1349
    if ( iFirstStartCompleted ) //Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1350
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1351
        SetSearchListLayoutAnchors();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1352
        iScreenAnchorLayout->UpdateChildrenLayout();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1353
        iSearchListLayout->UpdateChildrenLayout();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1354
        // Set bar text color from skin
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1355
        if ( iBarTextVisual )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1356
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1357
			//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1358
			SetHeaderAttributesL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1359
			/*TRgb barTextColor( KRgbBlack );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1360
		    AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1361
		                               barTextColor, KAknsIIDFsTextColors, EAknsCIFsTextColorsCG10 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1362
			iBarTextVisual->SetColor( barTextColor );*/
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1363
			//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1364
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1365
        RefreshL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1366
        //iSearchTreeListVisualizer->HideList();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1367
        iSearchTreeListVisualizer->ShowListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1368
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1369
 	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1370
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1371
void CFSEmailUiSearchListVisualiser::SetSearchListLayoutAnchors()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1372
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1373
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1374
	// Set anchors
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1375
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1376
	// The anchor layout mirrors itself automatically when necessary.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1377
	// There's no need to mirror anything manually here.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1378
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1379
	// TEXT
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1380
    TRect textRect =  iAppUi.LayoutHandler()->GetSearchListHeaderTextLayout().TextRect();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1381
    TPoint tl = textRect.iTl;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1382
    iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 0,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1383
        EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1384
        EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1385
        TAlfTimedPoint( tl.iX, tl.iY ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1386
    TPoint br = textRect.iBr;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1387
    iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1388
        EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1389
        EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1390
        TAlfTimedPoint( br.iX, br.iY ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1391
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1392
    TRect listRect = iAppUi.LayoutHandler()->GetListRect( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1393
    iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1394
        EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1395
        EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1396
        TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1397
    iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1398
        EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1399
        EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1400
        TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1401
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1402
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1403
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1404
TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromIndex( TInt aItemIdx ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1405
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1406
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1407
	TFSMailMsgId msgId; // constructs null ID
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1408
    if ( 0 <= aItemIdx && aItemIdx < iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1409
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1410
        CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1411
    			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(aItemIdx));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1412
    	if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1413
    	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1414
    	    msgId = item->MessagePtr().GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1415
    	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1416
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1417
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1418
    return msgId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1419
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1420
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1421
TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromListId( TFsTreeItemId aListId ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1422
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1423
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1424
	TFSMailMsgId msgId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1425
	for ( TInt i=0; i<iModel->Count();i++)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1426
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1427
		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1428
			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1429
		if ( item && item->ModelItemType() == ETypeMailItem &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1430
		     aListId == item->CorrespondingListId() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1431
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1432
			msgId = item->MessagePtr().GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1433
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1434
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1435
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1436
	return msgId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1437
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1438
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1439
CFSMailMessage& CFSEmailUiSearchListVisualiser::MsgPtrFromListId( TFsTreeItemId aListId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1440
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1441
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1442
	CFSMailMessage* msgPtr(NULL);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1443
	for ( TInt i=0; i<iModel->Count();i++)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1444
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1445
		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1446
			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1447
		if ( item && aListId == item->CorrespondingListId() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1448
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1449
			msgPtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1450
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1451
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1452
	return *msgPtr;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1453
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1454
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1455
	// Item data and visualiser helper functions
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1456
MFsTreeItemData* CFSEmailUiSearchListVisualiser::ItemDataFromItemId( TFsTreeItemId aItemId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1457
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1458
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1459
	TInt i(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1460
	MFsTreeItemData* itemData(NULL);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1461
	for ( ; i<iSearchListItemArray.Count(); i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1462
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1463
		if ( aItemId == iSearchListItemArray[i].iSearchListItemId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1464
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1465
			itemData = iSearchListItemArray[i].iTreeItemData;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1466
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1467
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1468
	return itemData;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1469
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1470
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1471
MFsTreeItemVisualizer* CFSEmailUiSearchListVisualiser::ItemVisualiserFromItemId( TFsTreeItemId aItemId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1472
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1473
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1474
	TInt i(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1475
	MFsTreeItemVisualizer* itemVis(NULL);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1476
	for ( ; i<iSearchListItemArray.Count(); i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1477
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1478
		if ( aItemId == iSearchListItemArray[i].iSearchListItemId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1479
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1480
			itemVis = iSearchListItemArray[i].iTreeItemVisualiser;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1481
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1482
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1483
	return itemVis;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1484
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1485
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1486
// Helpers to get the ordinal of a message in the iModel
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1487
TInt CFSEmailUiSearchListVisualiser::ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1488
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1489
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1490
	TInt idx = KErrNotFound;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1491
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1492
	for ( TInt i=0; i<iModel->Count() ; i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1493
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1494
		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1495
			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1496
		if ( item && item->ModelItemType() == ETypeMailItem &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1497
		     aMessageId == item->MessagePtr().GetMessageId() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1498
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1499
			idx = i;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1500
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1501
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1502
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1503
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1504
	return idx;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1505
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1506
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1507
TInt CFSEmailUiSearchListVisualiser::NextMessageIndex( TInt aCurMsgIdx ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1508
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1509
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1510
	TInt idx = KErrNotFound;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1511
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1512
	for ( TInt i=aCurMsgIdx+1 ; i<iModel->Count() ; i++ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1513
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1514
		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1515
			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1516
		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1517
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1518
			idx = i;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1519
			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1520
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1521
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1522
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1523
	return idx;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1524
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1525
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1526
TInt CFSEmailUiSearchListVisualiser::PreviousMessageIndex( TInt aCurMsgIdx ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1527
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1528
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1529
	TInt idx = KErrNotFound;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1530
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1531
	if ( aCurMsgIdx < iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1532
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1533
    	for ( TInt i=aCurMsgIdx-1 ; i>=0 ; i-- )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1534
    		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1535
    		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1536
    			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1537
    		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1538
    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1539
    			idx = i;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1540
    			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1541
    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1542
    		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1543
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1544
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1545
	return idx;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1546
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1547
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1548
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1549
void CFSEmailUiSearchListVisualiser::OpenHighlightedMailL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1550
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1551
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1552
	if (iSearchOngoing)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1553
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1554
		StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1555
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1556
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1557
	CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1558
		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1559
	if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1560
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1561
		// First make sure that the highlighted message really exists in the store
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1562
		// Get confirmed msg ptr
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1563
		CFSMailMessage* confirmedMsgPtr(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1564
		TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1565
							item->MessagePtr().GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1566
		if ( confirmedMsgPtr && err == KErrNone )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1567
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1568
		 	CFSMailFolder* highlightedMsgFolder =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1569
		 		iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), confirmedMsgPtr->GetFolderId() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1570
			CleanupStack::PushL( highlightedMsgFolder );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1571
			TInt msgFolderType = highlightedMsgFolder->GetFolderType();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1572
			TFSMailMsgId highlightedMsgFolderId = highlightedMsgFolder->GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1573
			CleanupStack::PopAndDestroy( highlightedMsgFolder );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1574
			// Pointer confirmed, store Id and delete not needed anymore
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1575
			TFSMailMsgId confirmedId = confirmedMsgPtr->GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1576
			delete confirmedMsgPtr;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1577
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1578
			// Open to editor from drafts
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1579
			if ( msgFolderType == EFSDraftsFolder )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1580
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1581
				TEditorLaunchParams params;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1582
				params.iMailboxId = iAppUi.GetActiveMailboxId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1583
				params.iActivatedExternally = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1584
				params.iMsgId = confirmedId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1585
				params.iFolderId = highlightedMsgFolderId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1586
			    iAppUi.LaunchEditorL( KEditorCmdOpen, params );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1587
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1588
			else if ( msgFolderType == EFSOutbox )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1589
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1590
				TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_OPEN_FROM_OUTBOX_NOTE, ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1591
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1592
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1593
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1594
				THtmlViewerActivationData tmp;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1595
				tmp.iMailBoxId = iAppUi.GetActiveMailbox()->GetId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1596
				tmp.iMessageId = confirmedId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1597
				tmp.iFolderId = highlightedMsgFolderId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1598
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1599
				const TPckgBuf<THtmlViewerActivationData> pkgOut( tmp );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1600
				ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1601
				iAppUi.EnterFsEmailViewL( HtmlViewerId, KStartViewerWithMsgId, pkgOut );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1602
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1603
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1604
		else if ( err == KErrNotFound )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1605
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1606
			TRAP_IGNORE( CheckAndUpdateFocusedMessageL() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1607
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1608
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1609
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1610
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1611
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1612
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1613
void CFSEmailUiSearchListVisualiser::ReplyL( CFSMailMessage* aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1614
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1615
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1616
	DoReplyForwardL( KEditorCmdReply, aMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1617
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1618
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1619
void CFSEmailUiSearchListVisualiser::ReplyAllL(  CFSMailMessage* aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1620
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1621
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1622
	DoReplyForwardL( KEditorCmdReplyAll, aMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1623
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1624
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1625
void CFSEmailUiSearchListVisualiser::ForwardL( CFSMailMessage* aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1626
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1627
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1628
	DoReplyForwardL( KEditorCmdForward, aMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1629
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1630
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1631
void CFSEmailUiSearchListVisualiser::DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1632
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1633
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1634
    // Stop search when reply/forward has been selected
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1635
	if ( iSearchOngoing )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1636
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1637
		StopSearchL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1638
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1639
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1640
    if ( iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1641
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1642
       	CFSMailMessage* messagePointer = aMsgPtr;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1643
    	if ( !messagePointer  )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1644
    		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1645
            RFsTreeItemIdList markedEntries;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1646
    		iSearchList->GetMarkedItemsL( markedEntries );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1647
    		TInt markedCount = markedEntries.Count();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1648
    		if ( markedCount == 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1649
    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1650
       		    CFSEmailUiMailListModelItem* item = NULL;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1651
       		    item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1652
       		    if (item)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1653
       		        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1654
       		        messagePointer = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1655
       		        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1656
    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1657
    		else if ( markedCount == 1)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1658
    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1659
    			messagePointer = &MsgPtrFromListId( markedEntries[0] );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1660
    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1661
    		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1662
    	if ( messagePointer )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1663
    		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1664
    		// No reply/Forward for calendar messages, at least not in 1.0
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1665
	   		if ( !messagePointer->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1666
    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1667
	    		TEditorLaunchParams params;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1668
	    		params.iMailboxId = iAppUi.GetActiveMailboxId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1669
	    		params.iActivatedExternally = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1670
	    		params.iMsgId = messagePointer->GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1671
	    		iAppUi.LaunchEditorL( aMode, params );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1672
    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1673
    		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1674
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1675
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1676
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1677
void CFSEmailUiSearchListVisualiser::StartSearchL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1678
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1679
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1680
	iSearchCount++;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1681
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1682
    // Reset previous results before starting new search
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1683
	// <cmail> fixed CS high cat. finding
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1684
	ResetResultListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1685
    TLex lex( *iLatestSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1686
    while ( !lex.Eos() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1687
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1688
        HBufC* token = lex.NextToken().AllocLC();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1689
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1690
        iSearchStrings.AppendL( token );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1691
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1692
        CleanupStack::Pop( token );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1693
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1694
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1695
	TFSMailSortCriteria sortCriteria;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1696
    sortCriteria.iField = EFSMailSortByDate;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1697
    sortCriteria.iOrder = EFSMailDescending;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1698
   	iSearchOngoing = ETrue;
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  1699
	// Model and list is set to be empty, set also MSK to empty
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  1700
	SetMskL();
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1701
	// Initialisr TextSearcher
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1702
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1703
	// Start search.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1704
	iMailBox->SearchL( iSearchStrings, sortCriteria, *this );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1705
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1706
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1707
void CFSEmailUiSearchListVisualiser::StopSearchL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1708
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1709
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1710
	iSearchOngoing = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1711
	if ( iMailBox )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1712
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1713
		iMailBox->CancelSearch();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1714
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1715
	HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH_RESULTS );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1716
	HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + 4 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1717
	finalText->Des().Append( *searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1718
	finalText->Des().Append( KSpace );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1719
	finalText->Des().Append( *iLatestSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1720
	iBarTextVisual->SetTextL( *finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1721
	CleanupStack::PopAndDestroy( finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1722
	CleanupStack::PopAndDestroy( searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1723
	iRequiredSearchPriority = KStandardSearchPriority; // <cmail> return back
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1724
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1725
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1726
void CFSEmailUiSearchListVisualiser::ResetResultListL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1727
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1728
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1729
    if( iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1730
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1731
        iModel->Reset();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1732
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1733
    if( iSearchList )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1734
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1735
        iSearchList->RemoveAllL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1736
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1737
    iSearchListItemArray.Reset();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1738
    iSearchStrings.ResetAndDestroy();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1739
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1740
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1741
void CFSEmailUiSearchListVisualiser::MatchFoundL( CFSMailMessage* aMatchMessage )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1742
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1743
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1744
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1745
	if ( !iSearchList->IsFocused() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1746
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1747
		iSearchList->SetFocusedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1748
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1749
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1750
	// Delete receved owned object and add confirmed msg pointer to model insteaed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1751
	// This is done because it seems that matched message objects seems to be different
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1752
	// in some protocols than original messages
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1753
	CleanupStack::PushL( aMatchMessage );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1754
	CFSMailMessage* confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1755
						aMatchMessage->GetFolderId(), aMatchMessage->GetMessageId(), EFSMsgDataEnvelope );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1756
	CleanupStack::PopAndDestroy( aMatchMessage );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1757
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1758
	if ( confirmedMsgPtr ) // Append item into model and list if msg pointer was confirmed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1759
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1760
		// Append to model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1761
		CFSEmailUiMailListModelItem* newItem = CFSEmailUiMailListModelItem::NewL( confirmedMsgPtr, ETypeMailItem);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1762
		iModel->AppendL(newItem);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1763
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1764
		// Append to list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1765
	   	TRect screenRect;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1766
	 	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1767
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1768
		CFSMailAddress* fromAddress = confirmedMsgPtr->GetSender();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1769
		TDesC* diplayName = NULL;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1770
		if ( fromAddress )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1771
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1772
			diplayName = &fromAddress->GetDisplayName();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1773
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1774
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1775
		// Set first line of data
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1776
		HBufC* dispName = NULL;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1777
		if ( fromAddress && diplayName && diplayName->Length() != 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1778
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1779
			dispName = HBufC::NewLC( diplayName->Length() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1780
			dispName->Des().Append( *diplayName );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1781
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1782
		else if ( fromAddress && fromAddress->GetEmailAddress().Length() != 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1783
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1784
			dispName = HBufC::NewLC( fromAddress->GetEmailAddress().Length() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1785
			dispName->Des().Append( fromAddress->GetEmailAddress() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1786
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1787
		else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1788
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1789
			dispName = HBufC::NewLC( 0 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1790
			dispName->Des().Append( KNullDesC );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1791
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1792
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1793
		// Drop out unwanted characters from display name such as <> and ""
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1794
		// And set display name data
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1795
		if ( dispName )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1796
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1797
			TFsEmailUiUtility::StripDisplayName( *dispName );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1798
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1799
		// Create item data and
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1800
		CFsTreePlainTwoLineItemData* itemData = CFsTreePlainTwoLineItemData::NewL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1801
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1802
		itemData->SetDataL( *dispName );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1803
		CleanupStack::PopAndDestroy( dispName );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1804
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1805
		// Set time text data
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1806
		HBufC* timeText = TFsEmailUiUtility::ListMsgTimeTextFromMsgLC( confirmedMsgPtr, EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1807
		itemData->SetDateTimeDataL ( *timeText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1808
		CleanupStack::PopAndDestroy();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1809
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1810
		// Set second line of data
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1811
		HBufC* subjectText = TFsEmailUiUtility::CreateSubjectTextLC( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1812
		itemData->SetSecondaryDataL( *subjectText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1813
		CleanupStack::PopAndDestroy( subjectText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1814
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1815
		// Set message icon
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1816
		CAlfTexture* itemTexture = &TFsEmailUiUtility::GetMsgIcon( confirmedMsgPtr, *iAppUi.FsTextureManager() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1817
		itemData->SetIcon ( *itemTexture );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1818
	    CFsTreePlainTwoLineItemVisualizer* itemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL(*iSearchList->TreeControl());
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1819
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1820
		itemVisualizer->SetExtendable( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1821
		TInt itemHeight = iAppUi.LayoutHandler()->OneLineListItemHeight();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1822
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1823
		itemVisualizer->SetSize( TSize( screenRect.Width(), itemHeight ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1824
	 	itemVisualizer->SetExtendedSize( TSize( screenRect.Width(), 2*itemHeight ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1825
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1826
		// Set font height
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1827
		itemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1828
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1829
		// Set font bolding
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1830
		if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1831
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1832
			itemVisualizer->SetTextBold( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1833
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1834
		else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1835
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1836
			itemVisualizer->SetTextBold( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1837
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1838
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1839
	  	// Set correct skin text colors for the list items
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1840
	   	TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1841
	   	TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1842
	    itemVisualizer->SetFocusedStateTextColor( focusedColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1843
	    itemVisualizer->SetNormalStateTextColor( normalColor );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1844
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1845
		switch ( iListMode )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1846
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1847
		    case EListControlTypeDoubleLinePreviewOn:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1848
		    case EListControlTypeSingleLinePreviewOn:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1849
				itemVisualizer->SetPreviewPaneOn( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1850
				itemVisualizer->SetPreviewPaneEnabledSize( TSize(screenRect.Width(), 3*itemHeight) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1851
		        // fall through
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1852
		    case EListControlTypeDoubleLinePreviewOff:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1853
		    case EListControlTypeSingleLinePreviewOff:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1854
	   	 		itemVisualizer->SetExtendable(ETrue);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1855
	 			itemVisualizer->SetExtendedSize(TSize(screenRect.Width(), 2*itemHeight));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1856
	 			break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1857
		    default:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1858
		        break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1859
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1860
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1861
		// Update initial preview pane text for items if needed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1862
	  	if ( iListMode == EListControlTypeSingleLinePreviewOn ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1863
			 iListMode == EListControlTypeDoubleLinePreviewOn )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1864
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1865
			UpdatePreviewPaneTextForItemL( itemData, confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1866
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1867
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1868
		// Set follow up flag icon
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1869
		if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1870
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1871
			if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_FollowUp ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1872
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1873
			 	itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagList ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1874
				itemVisualizer->SetFlagIconVisible( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1875
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1876
			else if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_FollowUpComplete ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1877
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1878
			 	itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagCompleteList ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1879
				itemVisualizer->SetFlagIconVisible( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1880
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1881
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1882
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1883
		 	    itemVisualizer->SetFlagIconVisible( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1884
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1885
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1886
	 	else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1887
	 	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1888
	 	    itemVisualizer->SetFlagIconVisible( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1889
	 	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1890
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1891
		TFsTreeItemId itemId = iSearchList->InsertItemL( *itemData, *itemVisualizer, KFsTreeRootID );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1892
		if (iSearchList->FocusedItem() == KFsTreeNoneID)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1893
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1894
		    iSearchList->SetFocusedItemL(itemId);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1895
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1896
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1897
		SSearchListItem searchListItem;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1898
		searchListItem.iSearchListItemId = itemId;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1899
		searchListItem.iTreeItemData = itemData;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1900
		searchListItem.iTreeItemVisualiser = itemVisualizer;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1901
	    iSearchListItemArray.AppendL( searchListItem );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1902
	    newItem->AddCorrespondingListId( itemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1903
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1904
		if ( iSearchList->Count() == 1 ) // Call only once, temp fix because of error in generic
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1905
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1906
			if ( iListMode == EListControlTypeDoubleLinePreviewOn ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1907
				 iListMode == EListControlTypeDoubleLinePreviewOff )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1908
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1909
		        iSearchTreeListVisualizer->SetItemsAlwaysExtendedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1910
		 		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1911
			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1912
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1913
				// Set the extendedability and extended size
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1914
		   		iSearchTreeListVisualizer->SetItemsAlwaysExtendedL( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1915
				}
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  1916
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  1917
			// Set msk to "Open when first is found".
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  1918
			SetMskL();
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1919
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1920
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1921
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1922
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1923
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1924
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1925
// HandleMailBoxEventL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1926
// Function removes objects from the list that are deleted.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1927
// Also updates icon and read status if synced so from the server
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1928
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1929
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1930
void CFSEmailUiSearchListVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1931
    TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1932
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1933
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1934
    if ( iFirstStartCompleted ) // Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1935
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1936
        CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1937
        if ( activeMailbox && aMailbox.Id() == activeMailbox->GetId().Id() ) // Safety, in list events that only concern active mailbox are handled
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1938
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1939
            if ( iModel && iModel->Count() && (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1940
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1941
                RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>(aParam1);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1942
                if ( removedEntries && removedEntries->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1943
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1944
                    RemoveMsgItemsFromListIfFoundL( *removedEntries );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1945
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1946
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1947
            else if ( iModel && iModel->Count() && aEvent == TFSEventMailChanged )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1948
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1949
                // Get array of changed entries
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1950
                RArray<TFSMailMsgId>* entries = static_cast<RArray<TFSMailMsgId>*>(aParam1);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1951
                // Get ID of the folder that this cahnge concerns.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1952
                TFSMailMsgId* parentFolderId = static_cast<TFSMailMsgId*>( aParam2 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1953
                for ( TInt i=0 ; i < entries->Count() ; i++)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1954
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1955
                    TFSMailMsgId entryId = (*entries)[i];
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1956
                    CFSMailMessage* confirmedMsgPtr(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1957
                    TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1958
                                            *parentFolderId, entryId, EFSMsgDataEnvelope ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1959
                    if ( confirmedMsgPtr && err == KErrNone )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1960
                        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1961
                        CleanupStack::PushL( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1962
                        UpdateMsgIconAndBoldingL( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1963
                        CleanupStack::PopAndDestroy( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1964
                        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1965
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1966
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1967
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1968
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1969
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1970
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1971
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1972
// RemoveMsgItemsFromListIfFoundL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1973
// Message removing from list if found. Does not panic or return found status.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1974
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1975
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1976
void CFSEmailUiSearchListVisualiser::RemoveMsgItemsFromListIfFoundL( const RArray<TFSMailMsgId>& aEntryIds )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1977
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1978
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1979
	if ( iModel && iModel->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1980
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1981
		for ( TInt i=0 ; i<aEntryIds.Count() ; ++i )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1982
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1983
		    const TFSMailMsgId& entryId = aEntryIds[i];
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1984
	    	if ( !entryId.IsNullId() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1985
	    		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1986
	        	TInt idx = ItemIndexFromMessageId( entryId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1987
	        	if ( idx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1988
	        	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1989
	    			iSearchList->RemoveL( iSearchListItemArray[idx].iSearchListItemId ); // remove from list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1990
	    			iSearchListItemArray.Remove( idx ); // remove from internal array.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1991
	    	 		iModel->RemoveAndDestroy( idx ); // Remove from model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1992
	        	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1993
	    		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1994
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1995
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1996
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1997
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1998
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1999
// UpdatePreviewPaneTextForItemL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2000
// Updates preview pane text for item
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2001
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2002
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2003
void CFSEmailUiSearchListVisualiser::UpdatePreviewPaneTextForItemL(CFsTreePlainTwoLineItemData* aItemData, CFSMailMessage* aMsgPtr  )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2004
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2005
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2006
	// Preview pane data update
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2007
	if ( aMsgPtr && ( iListMode == EListControlTypeSingleLinePreviewOn ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2008
		 iListMode == EListControlTypeDoubleLinePreviewOn ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2009
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2010
		CFSMailMessagePart* textPart = aMsgPtr->PlainTextBodyPartL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2011
		CleanupStack::PushL( textPart );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2012
		if ( textPart && ( textPart->FetchLoadState() == EFSPartial ||
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2013
			 textPart->FetchLoadState() == EFSFull ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2014
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2015
            TInt previewSize = Min( KMaxPreviewPaneLength, textPart->FetchedContentSize() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2016
            HBufC* plainTextData16 = HBufC::NewLC( previewSize );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2017
            TPtr textPtr = plainTextData16->Des();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2018
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2019
            textPart->GetContentToBufferL( textPtr, 0 ); // Zero is start offset
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2020
            // Crop out line feed, paragraph break, and tabulator
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2021
            TFsEmailUiUtility::FilterListItemTextL( textPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2022
            aItemData->SetPreviewPaneDataL( *plainTextData16 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2023
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2024
            CleanupStack::PopAndDestroy( plainTextData16 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2025
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2026
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2027
		// Else display message size in preview pane
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2028
		else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2029
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2030
			TUint contentSize = aMsgPtr->ContentSize();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2031
			HBufC* sizeDesc = TFsEmailUiUtility::CreateSizeDescLC( contentSize );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2032
			HBufC* msgSizeText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_PREV_PANE_MSG_SIZE, *sizeDesc );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2033
			aItemData->SetPreviewPaneDataL( *msgSizeText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2034
			CleanupStack::PopAndDestroy( msgSizeText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2035
			CleanupStack::PopAndDestroy( sizeDesc );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2036
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2037
		CleanupStack::PopAndDestroy( textPart );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2038
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2039
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2040
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2041
void CFSEmailUiSearchListVisualiser::SearchCompletedL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2042
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2043
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2044
	iSearchOngoing = EFalse;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2045
	HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH_RESULTS );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2046
	HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + 4 );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2047
	finalText->Des().Append( *searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2048
	finalText->Des().Append( KSpace );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2049
	finalText->Des().Append( *iLatestSearchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2050
	iBarTextVisual->SetTextL( *finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2051
	CleanupStack::PopAndDestroy( finalText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2052
	CleanupStack::PopAndDestroy( searchText );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2053
	iRequiredSearchPriority = KStandardSearchPriority; //<cmail> return back
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2054
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2055
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2056
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2057
void CFSEmailUiSearchListVisualiser::ChangeReadStatusOfHighlightedL( TInt aRead )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2058
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2059
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2060
	if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2061
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2062
		CFSEmailUiMailListModelItem* selectedItem =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2063
	 		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2064
        if ( selectedItem ) // Safety
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2065
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2066
            TBool wasRead = selectedItem->MessagePtr().IsFlagSet( EFSMsgFlag_Read );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2067
            if ( (wasRead && !aRead) || (!wasRead && aRead) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2068
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2069
                // Read status is changed
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2070
                iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2071
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2072
                if ( aRead )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2073
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2074
                    // Send flags, local and server
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2075
                    selectedItem->MessagePtr().SetFlag( EFSMsgFlag_Read );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2076
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2077
                else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2078
                    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2079
                    // Send flags, local and server
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2080
                    selectedItem->MessagePtr().ResetFlag( EFSMsgFlag_Read );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2081
                    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2082
                selectedItem->MessagePtr().SaveMessageL();	// Save flag
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2083
                // Switch icon to correct one
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2084
                UpdateMsgIconAndBoldingL( HighlightedIndex() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2085
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2086
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2087
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2088
	} 
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2089
	
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2090
void CFSEmailUiSearchListVisualiser::CheckAndUpdateFocusedMessageL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2091
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2092
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2093
	if ( iModel && iModel->Count() ) // Needed safety check
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2094
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2095
		TInt highlightedIndex = HighlightedIndex();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2096
		CFSEmailUiMailListModelItem* selectedItem =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2097
	 		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( highlightedIndex ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2098
		if ( selectedItem && selectedItem->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2099
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2100
			CFSMailMessage* msgPtr = &selectedItem->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2101
			if ( msgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2102
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2103
				CFSMailFolder* folderPtr =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2104
				    iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), msgPtr->GetFolderId() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2105
				CleanupStack::PushL( folderPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2106
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2107
	    		if ( !folderPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2108
	    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2109
	    			// Pointer is not valid anymore, msg has been delete,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2110
	    			// so it must be removed from the search list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2111
	    			RemoveFocusedFromListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2112
	    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2113
	    		else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2114
	    			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2115
	    			CFSMailMessage* confirmedMsgPtr(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2116
	    			TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2117
	    										folderPtr->GetFolderId(), msgPtr->GetMessageId(), EFSMsgDataEnvelope ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2118
	    			if ( confirmedMsgPtr && err == KErrNone)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2119
	    				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2120
	    				CleanupStack::PushL( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2121
	    				UpdateMsgIconAndBoldingL( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2122
	    				CleanupStack::PopAndDestroy( confirmedMsgPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2123
	    				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2124
	    			else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2125
	    				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2126
	    				RemoveFocusedFromListL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2127
	    				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2128
	    			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2129
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2130
	    		CleanupStack::PopAndDestroy( folderPtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2131
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2132
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2133
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2134
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2135
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2136
void CFSEmailUiSearchListVisualiser::RemoveFocusedFromListL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2137
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2138
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2139
	iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2140
	SSearchListItem item;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2141
	item.iSearchListItemId = iSearchList->FocusedItem();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2142
	TInt IndexToBeDestroyed = iSearchListItemArray.Find( item );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2143
	iSearchListItemArray.Remove( IndexToBeDestroyed ); // remove from internal array.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2144
	iModel->RemoveAndDestroy( IndexToBeDestroyed ); // Remove from model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2145
	iSearchList->RemoveL( iSearchList->FocusedItem() );		// remove from list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2146
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2147
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2148
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2149
// Updates our own message object with the data from a given message object.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2150
// The messages are matched with the message ID.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2151
void CFSEmailUiSearchListVisualiser::UpdateMsgIconAndBoldingL( CFSMailMessage* aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2152
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2153
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2154
	if ( aMsgPtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2155
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2156
		for ( TInt i=0 ; i < iModel->Count() ; i++)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2157
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2158
			CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2159
				static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2160
			if ( item && item->ModelItemType()==ETypeMailItem &&
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2161
				 item->MessagePtr().GetMessageId() == aMsgPtr->GetMessageId() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2162
				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2163
				// Update all flags
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2164
				TUint32 prevFlags = item->MessagePtr().GetFlags();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2165
				TUint32 newFlags = aMsgPtr->GetFlags();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2166
				if ( prevFlags != newFlags )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2167
				    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2168
    				item->MessagePtr().ResetFlag( prevFlags );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2169
    				item->MessagePtr().SetFlag( newFlags );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2170
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2171
    				// Save changed flags in internal model array
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2172
    				item->MessagePtr().SaveMessageL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2173
    				iMsgDataCouldBeChanged = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2174
				    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2175
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2176
				// Update the list item graphics
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2177
				UpdateMsgIconAndBoldingL( i );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2178
				break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2179
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2180
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2181
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2182
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2183
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2184
// Updates list item at given index to match the state of the message object
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2185
void CFSEmailUiSearchListVisualiser::UpdateMsgIconAndBoldingL( TInt aListIndex )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2186
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2187
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2188
    if (aListIndex < iSearchListItemArray.Count())
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2189
    	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2190
	    CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2191
		    static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(aListIndex) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2192
	    if ( item && item->ModelItemType()==ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2193
		    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2194
		    CFSMailMessage* msgPtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2195
		    CAlfTexture* itemTexture = &TFsEmailUiUtility::GetMsgIcon( msgPtr, *iAppUi.FsTextureManager() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2196
		    CFsTreePlainTwoLineItemData* itemData =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2197
                static_cast<CFsTreePlainTwoLineItemData*>( iSearchListItemArray[aListIndex].iTreeItemData );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2198
		    CFsTreePlainTwoLineItemVisualizer* itemVis =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2199
                static_cast<CFsTreePlainTwoLineItemVisualizer*>( iSearchListItemArray[aListIndex].iTreeItemVisualiser );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2200
		    itemData->SetIcon( *itemTexture );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2201
		    if ( msgPtr->IsFlagSet( EFSMsgFlag_Read ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2202
			    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2203
			    itemVis->SetTextBold( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2204
			    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2205
		    else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2206
			   {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2207
			   itemVis->SetTextBold( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2208
			   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2209
		    // Set follow up flag icon correctly
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2210
		    if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2211
			    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2212
			    if ( msgPtr->IsFlagSet( EFSMsgFlag_FollowUp ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2213
				    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2214
			 	    itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagList ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2215
				    itemVis->SetFlagIconVisible( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2216
				    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2217
			    else if ( msgPtr->IsFlagSet( EFSMsgFlag_FollowUpComplete ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2218
				    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2219
			 	    itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagCompleteList ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2220
				    itemVis->SetFlagIconVisible( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2221
				    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2222
			    else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2223
				    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2224
		 	        itemVis->SetFlagIconVisible( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2225
				    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2226
			    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2227
		    else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2228
		        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2229
		        itemVis->SetFlagIconVisible( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2230
		        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2231
		    iSearchTreeListVisualizer->UpdateItemL( iSearchListItemArray[aListIndex].iSearchListItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2232
		    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2233
    	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2234
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2235
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2236
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2237
// Delete messages
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2238
void CFSEmailUiSearchListVisualiser::DeleteFocusedMessageL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2239
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2240
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2241
	if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2242
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2243
		TInt currentItemIndex = HighlightedIndex();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2244
		CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2245
			static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(currentItemIndex));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2246
		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2247
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2248
			CFSMailMessage& messagePtr = item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2249
			TInt queryTextId(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2250
            if ( messagePtr.IsFlagSet( EFSMsgFlag_CalendarMsg ))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2251
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2252
                queryTextId = R_FREESTYLE_EMAIL_DELETE_CALEVENT_NOTE;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2253
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2254
            else
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2255
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2256
                queryTextId = R_FREESTYLE_EMAIL_DELETE_MAIL_NOTE;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2257
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2258
            HBufC* msgSubject = TFsEmailUiUtility::CreateSubjectTextLC( &messagePtr );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2259
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2260
            TInt okToDelete( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2261
            if ( iAppUi.GetCRHandler()->WarnBeforeDelete() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2262
               {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2263
               okToDelete = TFsEmailUiUtility::ShowConfirmationQueryL( queryTextId, *msgSubject );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2264
               }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2265
            CleanupStack::PopAndDestroy( msgSubject );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2266
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2267
			if ( okToDelete )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2268
 				{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2269
 				iMsgDataCouldBeChanged = ETrue; // Refresh
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2270
 				// Delete message from framework, and perform internal housekeeping
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2271
 				TFSMailMsgId msgId = messagePtr.GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2272
 				RArray<TFSMailMsgId> msgIds;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2273
 				msgIds.Append( msgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2274
				TFSMailMsgId folderId = messagePtr.GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2275
				TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2276
				iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2277
	 			msgIds.Reset();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2278
				SSearchListItem item;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2279
				item.iSearchListItemId = iSearchList->FocusedItem();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2280
				TInt IndexToBeDestroyed = iSearchListItemArray.Find( item );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2281
				iSearchListItemArray.Remove( IndexToBeDestroyed ); // remove from internal array.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2282
		 		iModel->RemoveAndDestroy( IndexToBeDestroyed ); // Remove from model
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2283
				iSearchList->RemoveL( iSearchList->FocusedItem() );		// remove from list
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2284
				}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2285
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2286
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2287
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2288
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2289
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2290
// Navigation functions, used mainly from viewer
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2291
TBool CFSEmailUiSearchListVisualiser::IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2292
														  TFSMailMsgId& aFoundNextMsgId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2293
														  TFSMailMsgId& aFoundNextMsgFolderId ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2294
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2295
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2296
	TBool ret(EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2297
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2298
	TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2299
	if ( curIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2300
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2301
	    TInt nextIdx = NextMessageIndex(curIdx);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2302
	    if ( nextIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2303
	        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2304
	        ret = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2305
	        aFoundNextMsgId = MsgIdFromIndex(nextIdx);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2306
	        CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2307
    			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item( nextIdx ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2308
    		if ( item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2309
    	  	  {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2310
    	 	   aFoundNextMsgFolderId = item->MessagePtr().GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2311
    	 	   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2312
	        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2313
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2314
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2315
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2316
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2317
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2318
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2319
TBool CFSEmailUiSearchListVisualiser::IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2320
														  	  TFSMailMsgId& aFoundPreviousMsgId,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2321
														  	  TFSMailMsgId& aFoundPrevMsgFolderId ) const
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2322
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2323
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2324
	TBool ret(EFalse);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2325
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2326
	TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2327
	if ( curIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2328
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2329
	    TInt prevIdx = PreviousMessageIndex(curIdx);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2330
	    if ( prevIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2331
	        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2332
	        ret = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2333
	        aFoundPreviousMsgId = MsgIdFromIndex(prevIdx);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2334
	     	CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2335
    			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item( prevIdx ));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2336
    		if ( item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2337
    	  	  {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2338
    	 	   aFoundPrevMsgFolderId = item->MessagePtr().GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2339
    	 	   }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2340
	        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2341
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2342
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2343
    return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2344
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2345
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2346
TInt CFSEmailUiSearchListVisualiser::MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2347
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2348
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2349
	TInt ret(KErrNotFound);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2350
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2351
	TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2352
	TInt nextIdx = NextMessageIndex( curIdx );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2353
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2354
	if ( curIdx >= 0 && nextIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2355
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2356
	    // Focus the new message
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2357
	    iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[nextIdx].iSearchListItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2358
	    ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2359
        aFoundNextMsgId = MsgIdFromIndex( nextIdx );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2360
	    ret = KErrNone;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2361
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2362
	if ( ret == KErrNone )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2363
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2364
		OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2365
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2366
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2367
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2368
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2369
TInt CFSEmailUiSearchListVisualiser::MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2370
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2371
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2372
	TInt ret(KErrNotFound);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2373
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2374
	TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2375
	TInt prevIdx = PreviousMessageIndex( curIdx );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2376
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2377
	if ( curIdx >= 0 && prevIdx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2378
	    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2379
	    // Focus the new message
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2380
	    iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[prevIdx].iSearchListItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2381
	    ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2382
        aFoundPreviousMsgId = MsgIdFromIndex( prevIdx );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2383
	    ret = KErrNone;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2384
	    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2385
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2386
	if ( ret == KErrNone )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2387
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2388
		OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2389
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2390
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2391
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2392
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2393
TInt CFSEmailUiSearchListVisualiser::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2394
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2395
	FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2396
	TInt ret(KErrNotFound);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2397
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2398
	TInt idx = ItemIndexFromMessageId( aFoundPreviousMsgId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2399
	if ( idx >= 0 )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2400
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2401
		// Focus the previous message
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2402
		iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[idx].iSearchListItemId );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2403
		ChangeReadStatusOfHighlightedL( ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2404
		ret = KErrNone;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2405
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2406
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2407
	if ( ret == KErrNone )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2408
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2409
		OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2410
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2411
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2412
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2413
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2414
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2415
	// Helper functions to get highlighted message id and folder id
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2416
TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageFolderId()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2417
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2418
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2419
	TFSMailMsgId ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2420
 	if ( iSearchList->Count() && iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2421
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2422
	  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2423
		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2424
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2425
			ret = item->MessagePtr().GetFolderId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2426
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2427
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2428
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2429
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2430
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2431
TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageId()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2432
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2433
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2434
	TFSMailMsgId ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2435
	if ( iSearchList->Count() && iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2436
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2437
	  	CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2438
		if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2439
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2440
			ret = item->MessagePtr().GetMessageId();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2441
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2442
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2443
	return ret;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2444
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2445
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2446
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2447
//<cmail> Touch
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2448
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2449
// CFSEmailUiSearchListVisualiser::TreeListEventL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2450
// From MFsTreeListObserver
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2451
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2452
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2453
void CFSEmailUiSearchListVisualiser::TreeListEventL( const TFsTreeListEvent aEvent,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2454
                                                     const TFsTreeItemId /*aId*/,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2455
                                                     const TPoint& aPoint )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2456
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2457
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2458
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2459
    switch(aEvent)
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2460
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2461
        case MFsTreeListObserver::EFsTreeListItemTouchAction:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2462
            DoHandleActionL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2463
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2464
        case MFsTreeListObserver::EFsTreeListItemTouchLongTap:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2465
            if ( iSearchList->Count() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2466
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2467
                LaunchStylusPopupMenuL( aPoint );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2468
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2469
            break;
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2470
        case MFsTreeListObserver::EFsTreeListItemWillGetFocused:
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2471
            {
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2472
            SetMskL();
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2473
            break;
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2474
            }
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2475
        case MFsTreeListObserver::EFsFocusVisibilityChange:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2476
        	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2477
        	iAppUi.SetFocusVisibility( EFalse );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2478
        	break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2479
        	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2480
        case MFsTreeListObserver::EFsTreeListItemTouchFocused:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2481
        default:
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2482
            //Just ignore rest of events
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2483
            break;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2484
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2485
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2486
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2487
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2488
// CFSEmailUiSearchListVisualiser::DoHandleActionL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2489
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2490
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2491
void CFSEmailUiSearchListVisualiser::DoHandleActionL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2492
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2493
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2494
    TInt modelCount = 0;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2495
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2496
    if ( iModel )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2497
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2498
        modelCount = iModel->Count();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2499
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2500
    if ( modelCount ) // Safety check
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2501
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2502
        CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2503
        if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2504
            {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2505
            CFSMailMessage* messagePtr = &item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2506
            if ( messagePtr )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2507
                {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2508
                OpenHighlightedMailL();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2509
                }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2510
            }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2511
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2512
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2513
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2514
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2515
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2516
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2517
// From MFSEmailUiContactHandlerObserver
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2518
// The ownership of the CLS items in the contacts array is transferred to the
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2519
// observer, and they must be deleted by the observer.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2520
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2521
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2522
void CFSEmailUiSearchListVisualiser::OperationCompleteL(
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2523
    TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2524
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2525
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2526
    iRequiredSearchPriority = KStandardSearchPriority; //<cmail> return back
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2527
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2528
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2529
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2530
// From MFSEmailUiContactHandlerObserver
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2531
// Handles error in contact handler operation.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2532
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2533
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2534
void CFSEmailUiSearchListVisualiser::OperationErrorL(
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2535
    TContactHandlerCmd /*aCmd*/, TInt /*aError*/ )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2536
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2537
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2538
    iRequiredSearchPriority = KStandardSearchPriority; //<cmail> return back
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2539
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2540
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2541
TBool CFSEmailUiSearchListVisualiser::CallToSenderL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2542
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2543
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2544
	CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2545
		dynamic_cast<CFSEmailUiMailListModelItem*>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2546
			( iModel->Item( HighlightedIndex() ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2547
	if ( item && item->ModelItemType() == ETypeMailItem )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2548
		{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2549
		CFSMailAddress* fromAddress = item->MessagePtr().GetSender();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2550
		TDesC* emailAddress(0);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2551
		if ( fromAddress )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2552
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2553
			emailAddress = &fromAddress->GetEmailAddress();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2554
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2555
		if ( emailAddress && emailAddress->Length() )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2556
			{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2557
			CFsDelayedLoader::InstanceL()->GetContactHandlerL()->
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2558
				FindAndCallToContactByEmailL( *emailAddress,
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2559
					iAppUi.GetActiveMailbox(), this, ETrue );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2560
                   iRequiredSearchPriority = KCallingSearchPriority; //decrease priority to enable search for contact
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2561
                   return ETrue; // searching started - consume keyup event
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2562
			}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2563
		}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2564
  return EFalse; //no calling key up will execute Call app
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2565
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2566
80
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2567
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2568
// ---------------------------------------------------------------------------
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2569
// Logic for changing msk
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2570
// ---------------------------------------------------------------------------
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2571
//
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2572
void CFSEmailUiSearchListVisualiser::SetMskL()
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2573
	{
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2574
    FUNC_LOG;
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2575
	if ( iFirstStartCompleted )
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2576
	    {
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2577
	    if ( iSearchList && iSearchList->Count() )
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2578
	        {
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2579
	        ChangeMskCommandL( R_FSE_QTN_MSK_OPEN );
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2580
	        }
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2581
	    else
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2582
	        {
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2583
	        ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2584
	        }
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2585
	    }
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2586
	}
726fba06891a Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 73
diff changeset
  2587
64
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2588
//<cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2589
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2590
// CFSEmailUiSearchListVisualiser::SetHeaderTextAttributesL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2591
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2592
// Apply header text/background attributes
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2593
// This creates i.e "Search result: %S " title caption and background graphics
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2594
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2595
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2596
void CFSEmailUiSearchListVisualiser::SetHeaderAttributesL()
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2597
	{
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2598
	// Set bar text color/style from skin
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2599
	iBarTextVisual->SetTextStyle( iAppUi.LayoutHandler()->
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2600
	        FSTextStyleFromLayoutL( AknLayoutScalable_Apps::main_sp_fs_ctrlbar_pane_t1( 0 ) ).Id() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2601
	iBarTextVisual->SetColor( iAppUi.LayoutHandler()->
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2602
							ListNormalStateTextSkinColor() );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2603
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2604
	}
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2605
//</cmail>
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2606
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2607
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2608
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2609
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2610
// LaunchStylusPopupMenuL
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2611
// Function launches avkon stylus popup menu based for the tapped item
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2612
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2613
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2614
void CFSEmailUiSearchListVisualiser::LaunchStylusPopupMenuL( const TPoint& aPoint )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2615
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2616
    // Verify that the item's type is correct
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2617
    CFSEmailUiMailListModelItem* item =
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2618
        static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2619
    if ( item && ( item->ModelItemType() == ETypeMailItem ) )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2620
        {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2621
        // Add mark as read / unread options
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2622
        const CFSMailMessage& message = item->MessagePtr();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2623
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2624
        TBool messageRead( message.IsFlagSet( EFSMsgFlag_Read ) );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2625
        iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !messageRead );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2626
        iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsRead, messageRead );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2627
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2628
        // Set the position for the popup
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2629
	    TPoint point(aPoint.iX, aPoint.iY + 45);
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2630
	    iStylusPopUpMenu->SetPosition( point, CAknStylusPopUpMenu::EPositionTypeRightBottom );
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2631
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2632
        // Display the popup and set the flag to indicate that the menu was
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2633
        // launched so that list focus stays visible.
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2634
        iStylusPopUpMenu->ShowMenu();
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2635
        iStylusPopUpMenuVisible = ETrue;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2636
        }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2637
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2638
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2639
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2640
// ClientRequiredSearchPriority
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2641
// the email searching priority may be decreased to enable searching for contacts
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2642
// ---------------------------------------------------------------------------
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2643
//
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2644
void CFSEmailUiSearchListVisualiser::ClientRequiredSearchPriority( TInt *apRequiredSearchPriority )
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2645
    {
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2646
    FUNC_LOG;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2647
    if (iRequiredSearchPriority != (*apRequiredSearchPriority))
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2648
    *apRequiredSearchPriority = iRequiredSearchPriority; 
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2649
    return;
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2650
    }
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2651
3533d4323edc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2652
// End of file