|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class implements a customized pop-up |
|
15 * which disables LSK if no city/country match is there |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "StartupPopupList.h" |
|
23 #include <aknsfld.h> |
|
24 #include "StartupDefines.h" |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CStartupPopupList::CStartupPopupList() |
|
28 // |
|
29 // --------------------------------------------------------------------------- |
|
30 CStartupPopupList::CStartupPopupList() |
|
31 { |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CStartupPopupList::~CStartupPopupList() |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CStartupPopupList::~CStartupPopupList() |
|
39 { |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CStartupPopupList::NewL() |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CStartupPopupList* CStartupPopupList::NewL( |
|
47 CAknSinglePopupMenuStyleListBox* aListBox, |
|
48 TInt aCbaResource, |
|
49 AknPopupLayouts::TAknPopupLayouts aType) |
|
50 { |
|
51 TRACES("CStartupPopupList::NewL()"); |
|
52 CStartupPopupList* self = new(ELeave)CStartupPopupList(); |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(aListBox, aCbaResource, aType); |
|
55 CleanupStack::Pop(); // self |
|
56 TRACES("CStartupPopupList::NewL(): End"); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CStartupPopupList::ConstructL() |
|
62 // Symbian OS second phase constructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CStartupPopupList::ConstructL(CAknSinglePopupMenuStyleListBox* aListBox, |
|
66 TInt aCbaResource, |
|
67 AknPopupLayouts::TAknPopupLayouts aType) |
|
68 { |
|
69 TRACES("CStartupPopupList::ConstructL()"); |
|
70 CAknPopupList::ConstructL(aListBox, aCbaResource,aType); |
|
71 TRACES("CStartupPopupList::ConstructL(): End"); |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CStartupPopupList::ListBoxItemsChanged() |
|
77 // Handle the ListBox Change Event and Disable "Select" & "MSK" CBA Buttons |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CStartupPopupList::ListBoxItemsChanged(CEikListBox* aListBox) |
|
81 { |
|
82 TRACES("CStartupPopupList::ListBoxItemsChanged()"); |
|
83 // get the CBA button group container |
|
84 CEikButtonGroupContainer* cbaContainer = ButtonGroupContainer(); |
|
85 // check if there's no match of items |
|
86 if( !aListBox->Model()->NumberOfItems() ) |
|
87 { |
|
88 // Disable the 'Select' button |
|
89 cbaContainer->MakeCommandVisible(EAknSoftkeySelect,EFalse); |
|
90 // Disable the 'Middle softkey' button |
|
91 cbaContainer->MakeCommandVisibleByPosition( |
|
92 CEikButtonGroupContainer::EMiddleSoftkeyPosition,EFalse); |
|
93 } |
|
94 // check if 'Select' is disabled |
|
95 else if(!cbaContainer->IsCommandVisible(EAknSoftkeySelect)) |
|
96 { |
|
97 // Enable the 'Select' button if disabled |
|
98 cbaContainer->MakeCommandVisible(EAknSoftkeySelect,ETrue); |
|
99 // Enable the 'Middle softkey' button if disabled |
|
100 cbaContainer->MakeCommandVisibleByPosition( |
|
101 CEikButtonGroupContainer::EMiddleSoftkeyPosition,ETrue); |
|
102 } |
|
103 TRACES("CStartupPopupList::ListBoxItemsChanged(): End"); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CStartupPopupList::ActivateL() |
|
108 // Activate the View and add the ListBox Observer |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void CStartupPopupList::ActivateL() |
|
112 { |
|
113 TRACES("CStartupPopupList::ActivateL()"); |
|
114 // call Base class ActivateL() |
|
115 CAknPopupList::ActivateL(); |
|
116 // add the listbox item change observer |
|
117 ListBox()->AddItemChangeObserverL(this); |
|
118 TRACES("CStartupPopupList::ActivateL(): End"); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CStartupPopupList::HandlePointerEventL() |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 void CStartupPopupList::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
126 { |
|
127 TRACES("CStartupPopupList::HandlePointerEventL()"); |
|
128 TRACES1("CStartupPopupList::HandlePointerEventL: aPointerEvent.iType == %d",aPointerEvent.iType ); |
|
129 |
|
130 /* Handle all taps except when EButton1Down outside of country/city query |
|
131 -> query is not cancelled and scroll bar does not remain pressed down */ |
|
132 if ( Rect().Contains( aPointerEvent.iPosition ) || ( !Rect().Contains( aPointerEvent.iPosition ) && |
|
133 aPointerEvent.iType != TPointerEvent::EButton1Down ) ) |
|
134 { |
|
135 CAknPopupList::HandlePointerEventL( aPointerEvent ); |
|
136 } |
|
137 |
|
138 TRACES("CStartupPopupList::HandlePointerEventL(): End"); |
|
139 } |
|
140 |
|
141 // End of File |