25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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: Implementation of CWsfWlanSsidSelectionDlg2
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// EXTERNAL INCLUDES
|
|
21 |
#include <avkon.mbg>
|
|
22 |
#include <AknIconUtils.h>
|
|
23 |
#include <wsfwlaninfosorting.rsg>
|
|
24 |
#include <AknIconArray.h> // CAknIcon
|
|
25 |
#include <akntitle.h> // akntitle pane
|
|
26 |
#include <aknlists.h> // CAknSingleGraphicStyleListBox
|
|
27 |
|
|
28 |
// CLASS HEADER
|
|
29 |
#include "wsfwlanssidselectiondlg2.h"
|
|
30 |
|
|
31 |
// INTERNAL INCLUDES
|
|
32 |
#include "wsfwlaninfosorting.hrh"
|
|
33 |
#include "wsflogger.h"
|
|
34 |
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Format string for listbox items
|
|
38 |
*/
|
|
39 |
_LIT( KFormatString, "1\t%S" );
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Number of icons used
|
|
43 |
*/
|
|
44 |
static const TInt KNumIcons = 2;
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
// ----------------------------------------------------------------------------
|
|
49 |
// CWsfWlanSsidSelectionDlg2::NewL
|
|
50 |
// ----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewL(
|
|
53 |
CDesCArrayFlat& aSsidArray,
|
|
54 |
CListBoxView::CSelectionIndexArray& aSelectionIndexArray )
|
|
55 |
{
|
|
56 |
CWsfWlanSsidSelectionDlg2* self = NewLC( aSsidArray,
|
|
57 |
aSelectionIndexArray );
|
|
58 |
CleanupStack::Pop( self );
|
|
59 |
return self;
|
|
60 |
}
|
|
61 |
|
|
62 |
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
// CWsfWlanSsidSelectionDlg2::NewLC
|
|
65 |
// ----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
CWsfWlanSsidSelectionDlg2* CWsfWlanSsidSelectionDlg2::NewLC(
|
|
68 |
CDesCArrayFlat& aSsidArray,
|
|
69 |
CListBoxView::CSelectionIndexArray& aSelectionIndexArray )
|
|
70 |
{
|
|
71 |
CWsfWlanSsidSelectionDlg2* self = new (ELeave) CWsfWlanSsidSelectionDlg2(
|
|
72 |
aSsidArray, aSelectionIndexArray );
|
|
73 |
CleanupStack::PushL( self );
|
|
74 |
self->ConstructL();
|
|
75 |
return self;
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
// ----------------------------------------------------------------------------
|
|
80 |
// CWsfWlanSsidSelectionDlg2::ConstructL
|
|
81 |
// ----------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
void CWsfWlanSsidSelectionDlg2::ConstructL()
|
|
84 |
{
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
// ----------------------------------------------------------------------------
|
|
89 |
// CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2
|
|
90 |
// ----------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
CWsfWlanSsidSelectionDlg2::CWsfWlanSsidSelectionDlg2(
|
|
93 |
CDesCArrayFlat& aSsidArray,
|
|
94 |
CListBoxView::CSelectionIndexArray& aSelectionIndexArray ):
|
|
95 |
CAknListQueryDialog( &aSelectionIndexArray ),
|
|
96 |
iSsidArray( &aSsidArray ),
|
|
97 |
iSelectedItems( &aSelectionIndexArray )
|
|
98 |
{
|
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
// ----------------------------------------------------------------------------
|
|
103 |
// CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2
|
|
104 |
// ----------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
CWsfWlanSsidSelectionDlg2::~CWsfWlanSsidSelectionDlg2()
|
|
107 |
{
|
|
108 |
// restore the title....
|
|
109 |
if ( iTitle && iPane )
|
|
110 |
{
|
|
111 |
iPane->SetText( iTitle );
|
|
112 |
}
|
|
113 |
|
|
114 |
iPane = NULL;
|
|
115 |
iTitle = NULL;
|
|
116 |
iSsidArray = NULL;
|
|
117 |
iSelectedItems = NULL;
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
// ----------------------------------------------------------------------------
|
|
122 |
// CWsfWlanSsidSelectionDlg2::OfferKeyEventL
|
|
123 |
// ----------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
TKeyResponse CWsfWlanSsidSelectionDlg2::OfferKeyEventL(
|
|
126 |
const TKeyEvent& aKeyEvent,
|
|
127 |
TEventCode aType )
|
|
128 |
{
|
|
129 |
if ( aKeyEvent.iCode == EKeyApplicationF )
|
|
130 |
{
|
|
131 |
return EKeyWasConsumed;
|
|
132 |
}
|
|
133 |
else
|
|
134 |
{
|
|
135 |
return CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType );
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
|
|
140 |
// ----------------------------------------------------------------------------
|
|
141 |
// CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL
|
|
142 |
// ----------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
void CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL()
|
|
145 |
{
|
|
146 |
LOG_ENTERFN( "CWsfWlanSsidSelectionDlg2::PreLayoutDynInitL" );
|
|
147 |
|
|
148 |
CAknListQueryDialog::PreLayoutDynInitL();
|
|
149 |
|
|
150 |
CAknListQueryControl *control = static_cast<CAknListQueryControl*>(
|
|
151 |
Control( EListQueryControl ) );
|
|
152 |
CEikListBox* listBox = control->Listbox();
|
|
153 |
|
|
154 |
CDesCArrayFlat *formattedSsids = new (ELeave) CDesCArrayFlat(
|
|
155 |
iSsidArray->Count() );
|
|
156 |
CleanupStack::PushL( formattedSsids );
|
|
157 |
CopyAndFormatArrayContentsL( iSsidArray, formattedSsids );
|
|
158 |
|
|
159 |
SetItemTextArray( formattedSsids );
|
|
160 |
|
|
161 |
CleanupStack::Pop( formattedSsids );
|
|
162 |
|
|
163 |
CAknIconArray* iconArray = CreateQueryIconArrayL();
|
|
164 |
CleanupStack::PushL( iconArray );
|
|
165 |
SetIconArrayL( iconArray );
|
|
166 |
CleanupStack::Pop( iconArray );
|
|
167 |
|
|
168 |
for (TInt i = 0; i < iSelectedItems->Count(); i++)
|
|
169 |
{
|
|
170 |
listBox->View()->SelectItemL( (*iSelectedItems)[i] );
|
|
171 |
}
|
|
172 |
|
|
173 |
CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
|
|
174 |
iPane = (CAknTitlePane*) statusPane->ControlL(
|
|
175 |
TUid::Uid( EEikStatusPaneUidTitle ) );
|
|
176 |
iTitle = iPane->Text()->AllocL();
|
|
177 |
}
|
|
178 |
|
|
179 |
|
|
180 |
// ----------------------------------------------------------------------------
|
|
181 |
// CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL
|
|
182 |
// ----------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CWsfWlanSsidSelectionDlg2::CopyAndFormatArrayContentsL(
|
|
185 |
CDesCArrayFlat* aSource,
|
|
186 |
CDesCArrayFlat* aDest )
|
|
187 |
{
|
|
188 |
TBuf<80> lineBuffer;
|
|
189 |
TInt sourceCount( aSource->Count() );
|
|
190 |
for ( TInt i( 0 ) ; i < sourceCount ; i++ )
|
|
191 |
{
|
|
192 |
const TDesC& item = aSource->MdcaPoint( i );
|
|
193 |
lineBuffer.Format(KFormatString, &item );
|
|
194 |
aDest->AppendL( lineBuffer );
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
// ----------------------------------------------------------------------------
|
|
200 |
// CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL
|
|
201 |
// ----------------------------------------------------------------------------
|
|
202 |
//
|
|
203 |
CAknIconArray* CWsfWlanSsidSelectionDlg2::CreateQueryIconArrayL()
|
|
204 |
{
|
|
205 |
CAknIconArray* iconarray = new( ELeave )CAknIconArray( KNumIcons );
|
|
206 |
CleanupStack::PushL( iconarray );
|
|
207 |
|
|
208 |
const TDesC& iconfilename = AknIconUtils::AvkonIconFileName();
|
|
209 |
|
|
210 |
// empty
|
|
211 |
iconarray->AppendL( CreateIconLC( iconfilename,
|
|
212 |
EMbmAvkonQgn_prop_checkbox_on,
|
|
213 |
EMbmAvkonQgn_prop_checkbox_on_mask,
|
|
214 |
KAknsIIDQgnPropEmpty ));
|
|
215 |
CleanupStack::Pop(); // icon
|
|
216 |
|
|
217 |
// copying
|
|
218 |
iconarray->AppendL(CreateIconLC( iconfilename,
|
|
219 |
EMbmAvkonQgn_prop_checkbox_off,
|
|
220 |
EMbmAvkonQgn_prop_checkbox_off_mask,
|
|
221 |
KAknsIIDNone ));
|
|
222 |
CleanupStack::Pop(); // icon
|
|
223 |
CleanupStack::Pop(); // iconarray
|
|
224 |
|
|
225 |
|
|
226 |
return iconarray;
|
|
227 |
}
|
|
228 |
|
|
229 |
|
|
230 |
// ----------------------------------------------------------------------------
|
|
231 |
// CWsfWlanSsidSelectionDlg2::CreateIconLC
|
|
232 |
// ----------------------------------------------------------------------------
|
|
233 |
//
|
|
234 |
CGulIcon* CWsfWlanSsidSelectionDlg2::CreateIconLC( const TDesC& aFileName,
|
|
235 |
TInt aIcon,
|
|
236 |
TInt aMask,
|
|
237 |
const TAknsItemID& aID )
|
|
238 |
{
|
|
239 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|
240 |
|
|
241 |
CGulIcon* icon = AknsUtils::CreateGulIconL( skinInstance, aID, aFileName,
|
|
242 |
aIcon, aMask );
|
|
243 |
CleanupStack::PushL( icon );
|
|
244 |
|
|
245 |
return icon;
|
|
246 |
}
|
|
247 |
|
|
248 |
|
|
249 |
|