63
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Definition of the class CPbkxRclBaseDlg.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include <AknsListBoxBackgroundControlContext.h>
|
|
21 |
#include <AknsConstants.h>
|
|
22 |
#include <AknsUtils.h>
|
|
23 |
#include <eikfrlb.h>
|
|
24 |
#include <eikfrlbd.h>
|
|
25 |
#include <eikclb.h>
|
|
26 |
#include <eikclbd.h>
|
|
27 |
|
|
28 |
#include "cpbkxrclbasedlg.h"
|
|
29 |
#include "cpbkxrclsearchresultlistbox.h"
|
|
30 |
#include "cpbkxrclresultinfolistbox.h"
|
|
31 |
#include "cpbkxrclsearchresultlistbox.h"
|
|
32 |
#include "cpbkxrclresultinfolistbox.h"
|
|
33 |
#include "engine.hrh"
|
|
34 |
|
|
35 |
// ======== MEMBER FUNCTIONS ========
|
|
36 |
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
// CPbkxRclBaseDlg::CPbkxRclBaseDlg
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
CPbkxRclBaseDlg::CPbkxRclBaseDlg(
|
|
42 |
TInt& aIndex,
|
|
43 |
CDesCArray* aArray,
|
|
44 |
MEikCommandObserver* aCommand,
|
|
45 |
TBool aColumnListBox ) :
|
|
46 |
CAknSelectionListDialog( aIndex, aArray, aCommand ),
|
|
47 |
iListItemId( KAknsIIDQgnFsGrafContactsContent ),
|
|
48 |
iListBottomId( KAknsIIDQsnBgColumnA ),
|
|
49 |
iHighlightId( KAknsIIDQgnFsList ),
|
|
50 |
iHighlightCenterId( KAknsIIDQgnFsListCenter ),
|
|
51 |
iHighlightTextColorId( KAknsIIDFsHighlightColors ),
|
|
52 |
iTextColorId( KAknsIIDFsTextColors ),
|
|
53 |
iColumnListBox( aColumnListBox )
|
|
54 |
{
|
|
55 |
FUNC_LOG;
|
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
// CPbkxRclBaseDlg::ConstructL
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
void CPbkxRclBaseDlg::ConstructL( TInt aResourceId )
|
|
63 |
{
|
|
64 |
FUNC_LOG;
|
|
65 |
CAknSelectionListDialog::ConstructL( aResourceId );
|
|
66 |
}
|
|
67 |
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
// CPbkxRclBaseDlg::~CPbkxRclBaseDlg
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
CPbkxRclBaseDlg::~CPbkxRclBaseDlg()
|
|
73 |
{
|
|
74 |
FUNC_LOG;
|
|
75 |
}
|
|
76 |
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// CPbkxRclBaseDlg::HandleResourceChange
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
void CPbkxRclBaseDlg::HandleResourceChange( TInt aType )
|
|
82 |
{
|
|
83 |
FUNC_LOG;
|
|
84 |
CEikDialog::HandleResourceChange( aType );
|
|
85 |
if ( aType == KAknsMessageSkinChange )
|
|
86 |
{
|
|
87 |
UpdateGraphics();
|
|
88 |
}
|
|
89 |
else if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
90 |
{
|
|
91 |
|
|
92 |
// for some reason formatted cell listbox loses settings
|
|
93 |
// when layout is switched
|
|
94 |
if ( !iColumnListBox )
|
|
95 |
{
|
|
96 |
UpdateGraphics();
|
|
97 |
}
|
|
98 |
}
|
|
99 |
}
|
|
100 |
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
// CPbkxRclBaseDlg::IsAcceptableListBoxType
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
TBool CPbkxRclBaseDlg::IsAcceptableListBoxType(
|
|
106 |
TInt aControlType,
|
|
107 |
TBool& aIsFormattedCellList ) const
|
|
108 |
{
|
|
109 |
FUNC_LOG;
|
|
110 |
if ( aControlType == ERclSearchResultListBox )
|
|
111 |
{
|
|
112 |
aIsFormattedCellList = EFalse;
|
|
113 |
return ETrue;
|
|
114 |
}
|
|
115 |
else if ( aControlType == ERclResultInfoListBox )
|
|
116 |
{
|
|
117 |
aIsFormattedCellList = ETrue;
|
|
118 |
return ETrue;
|
|
119 |
}
|
|
120 |
else
|
|
121 |
{
|
|
122 |
return CAknSelectionListDialog::IsAcceptableListBoxType(
|
|
123 |
aControlType,
|
|
124 |
aIsFormattedCellList );
|
|
125 |
}
|
|
126 |
}
|
|
127 |
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// CPbkxRclBaseDlg::CreateCustomControlL
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
SEikControlInfo CPbkxRclBaseDlg::CreateCustomControlL( TInt aControlType )
|
|
133 |
{
|
|
134 |
FUNC_LOG;
|
|
135 |
if ( aControlType == ERclSearchResultListBox )
|
|
136 |
{
|
|
137 |
CCoeControl* control = new ( ELeave ) CPbkxRclSearchResultListBox();
|
|
138 |
SEikControlInfo info = { control, 0, 0 };
|
|
139 |
return info;
|
|
140 |
}
|
|
141 |
else if ( aControlType == ERclResultInfoListBox )
|
|
142 |
{
|
|
143 |
CCoeControl* control = new ( ELeave ) CPbkxRclResultInfoListBox();
|
|
144 |
SEikControlInfo info = { control, 0, 0 };
|
|
145 |
return info;
|
|
146 |
}
|
|
147 |
else
|
|
148 |
{
|
|
149 |
return CAknSelectionListDialog::CreateCustomControlL( aControlType );
|
|
150 |
}
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// CPbkxRclBaseDlg::UpdateGraphics
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CPbkxRclBaseDlg::UpdateGraphics()
|
|
158 |
{
|
|
159 |
FUNC_LOG;
|
|
160 |
|
|
161 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
162 |
|
|
163 |
CAknsListBoxBackgroundControlContext* bgContext = NULL;
|
|
164 |
CFormattedCellListBoxItemDrawer* fItemDrawer = NULL;
|
|
165 |
CColumnListBoxItemDrawer* cItemDrawer = NULL;
|
|
166 |
|
|
167 |
// set first to this value, then change if those are not found
|
|
168 |
iHighlightId = KAknsIIDQgnFsList;
|
|
169 |
iHighlightCenterId = KAknsIIDQgnFsListCenter;
|
|
170 |
|
|
171 |
if ( iColumnListBox )
|
|
172 |
{
|
|
173 |
CEikColumnListBox* listBox =
|
|
174 |
static_cast<CEikColumnListBox*>( ListBox() );
|
|
175 |
cItemDrawer = listBox->ItemDrawer();
|
|
176 |
bgContext =
|
|
177 |
static_cast<CAknsListBoxBackgroundControlContext*>(
|
|
178 |
cItemDrawer->ColumnData()->SkinBackgroundContext() );
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
CEikFormattedCellListBox* listBox =
|
|
183 |
static_cast<CEikFormattedCellListBox*>( ListBox() );
|
|
184 |
fItemDrawer = listBox->ItemDrawer();
|
|
185 |
bgContext =
|
|
186 |
static_cast<CAknsListBoxBackgroundControlContext*>(
|
|
187 |
fItemDrawer->FormattedCellData()->SkinBackgroundContext() );
|
|
188 |
}
|
|
189 |
|
|
190 |
if ( skin->GetCachedItemData( iListItemId ) )
|
|
191 |
{
|
|
192 |
bgContext->SetBitmap( iListItemId );
|
|
193 |
bgContext->SetTiledBitmap( iListItemId );
|
|
194 |
}
|
|
195 |
|
|
196 |
if ( skin->GetCachedItemData( iListBottomId ) )
|
|
197 |
{
|
|
198 |
bgContext->SetBottomBitmap( iListBottomId );
|
|
199 |
}
|
|
200 |
|
|
201 |
if ( skin->GetCachedItemData( iHighlightId ) &&
|
|
202 |
skin->GetCachedItemData( iHighlightCenterId ) )
|
|
203 |
{
|
|
204 |
if ( iColumnListBox )
|
|
205 |
{
|
|
206 |
cItemDrawer->ColumnData()->SetSkinHighlightFrame(
|
|
207 |
&iHighlightId,
|
|
208 |
&iHighlightCenterId );
|
|
209 |
}
|
|
210 |
else
|
|
211 |
{
|
|
212 |
fItemDrawer->FormattedCellData()->SetSkinHighlightFrame(
|
|
213 |
&iHighlightId,
|
|
214 |
&iHighlightCenterId );
|
|
215 |
}
|
|
216 |
}
|
|
217 |
else
|
|
218 |
{
|
|
219 |
// put defaults if fs specific items are not found
|
|
220 |
iHighlightId = KAknsIIDQsnFrList;
|
|
221 |
iHighlightCenterId = KAknsIIDQsnFrListCenter;
|
|
222 |
if ( iColumnListBox )
|
|
223 |
{
|
|
224 |
cItemDrawer->ColumnData()->SetSkinHighlightFrame(
|
|
225 |
&iHighlightId,
|
|
226 |
&iHighlightCenterId );
|
|
227 |
}
|
|
228 |
else
|
|
229 |
{
|
|
230 |
fItemDrawer->FormattedCellData()->SetSkinHighlightFrame(
|
|
231 |
&iHighlightId,
|
|
232 |
&iHighlightCenterId );
|
|
233 |
}
|
|
234 |
}
|
|
235 |
|
|
236 |
}
|
|
237 |
|