|
1 /* |
|
2 * Copyright (c) 2000 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: Manual tuning dialog for FMRadio |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknborders.h> |
|
21 #include <eikcapc.h> |
|
22 |
|
23 #include <aknlayoutscalable_avkon.cdl.h> |
|
24 |
|
25 #include "fmradiofrequencyquerydialog.h" |
|
26 #include "fmradiofrequencyquerycontrol.h" |
|
27 #include "fmradio.hrh" |
|
28 #include "debug.h" |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // |
|
35 CFMRadioFrequencyQueryDialog::CFMRadioFrequencyQueryDialog(TUint32& aFreq, const TTone& aTone) : CAknQueryDialog(aTone), iFreq(aFreq) |
|
36 { |
|
37 } |
|
38 |
|
39 // Two-phased constructor. |
|
40 CFMRadioFrequencyQueryDialog* CFMRadioFrequencyQueryDialog::NewL(TUint32& aFreq, const TTone& aTone) |
|
41 { |
|
42 CFMRadioFrequencyQueryDialog* self = new (ELeave) CFMRadioFrequencyQueryDialog(aFreq, aTone); |
|
43 CleanupStack::PushL(self); |
|
44 CEikonEnv::Static()->AddLibraryL(CFMRadioFrequencyQueryControl::StaticCreateCustomControl); |
|
45 CleanupStack::Pop(self); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 // Destructor |
|
51 CFMRadioFrequencyQueryDialog::~CFMRadioFrequencyQueryDialog() |
|
52 { |
|
53 CEikonEnv::Static()->RemoveLibrary(CFMRadioFrequencyQueryControl::StaticCreateCustomControl); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CFMRadioFrequencyQueryDialog::QueryControl |
|
58 // ?implementation_description |
|
59 // (other items were commented in a header). |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CAknQueryControl* CFMRadioFrequencyQueryDialog::QueryControl() const |
|
63 { |
|
64 CEikCaptionedControl* controlPtr = NULL; |
|
65 const TInt KMaxNumPages = GetNumberOfPages(); |
|
66 for (TInt pageCount=0; pageCount<KMaxNumPages; pageCount++) |
|
67 { |
|
68 const TInt KMaxNumLinesOnThisPage= GetNumberOfLinesOnPage(pageCount); |
|
69 for (TInt lineCount=0; lineCount< KMaxNumLinesOnThisPage; lineCount++) |
|
70 { |
|
71 controlPtr = GetLineByLineAndPageIndex(lineCount, pageCount); |
|
72 if (controlPtr && controlPtr->iControlType == EFMRadioCtFrequencyQuery) |
|
73 { |
|
74 return static_cast<CAknQueryControl*>(controlPtr->iControl); |
|
75 } |
|
76 } |
|
77 } |
|
78 return 0; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CFMRadioFrequencyQueryDialog::PreLayoutDynInitL |
|
83 // ?implementation_description |
|
84 // (other items were commented in a header). |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 void CFMRadioFrequencyQueryDialog::PreLayoutDynInitL() |
|
88 { |
|
89 // SetBorder(AknBorderId::EAknBorderNotePopup); |
|
90 SetBorder( TGulBorder::ENone ); |
|
91 SetEditableL(ETrue) ; |
|
92 |
|
93 CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl()); |
|
94 if (control) |
|
95 { |
|
96 control->SetQueryControlObserver(this); |
|
97 control->SetFrequency(iFreq); |
|
98 } |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------- |
|
102 // CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL |
|
103 // ?implementation_description |
|
104 // (other items were commented in a header). |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 TBool CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus) |
|
108 { |
|
109 FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryDialog::HandleQueryEditorStateEventL") ) ); |
|
110 CAknQueryDialog::HandleQueryEditorStateEventL(aQueryControl, aEventType, aStatus); |
|
111 CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(aQueryControl); |
|
112 if ((control) && (aStatus == MAknQueryControlObserver::EEditorValueValid) && (iFreq != control->Frequency())) |
|
113 { |
|
114 iFreq = control->Frequency(); |
|
115 ReportEventL(EEventStateChanged); |
|
116 } |
|
117 return ETrue; |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CFMRadioFrequencyQueryDialog::Frequency |
|
122 // ?implementation_description |
|
123 // (other items were commented in a header). |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 TUint32 CFMRadioFrequencyQueryDialog::Frequency() const |
|
127 { |
|
128 return iFreq; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // CFMRadioFrequencyQueryDialog::UpdateLeftSoftKeyL |
|
133 // ?implementation_description |
|
134 // (other items were commented in a header). |
|
135 // --------------------------------------------------------- |
|
136 // |
|
137 void CFMRadioFrequencyQueryDialog::UpdateLeftSoftKeyL() |
|
138 { |
|
139 CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl()); |
|
140 if ( control ) |
|
141 { |
|
142 TBool showCommand = control->EditorContentIsValidL(); |
|
143 ButtonGroupContainer().MakeCommandVisibleByPosition( CEikButtonGroupContainer::ELeftSoftkeyPosition, showCommand ); |
|
144 ButtonGroupContainer().MakeCommandVisibleByPosition( CEikButtonGroupContainer::EMiddleSoftkeyPosition, showCommand ); |
|
145 ButtonGroupContainer().DrawDeferred(); |
|
146 } |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------- |
|
150 // CFMRadioFrequencyQueryDialog::OkToExitL |
|
151 // --------------------------------------------------------- |
|
152 // |
|
153 TBool CFMRadioFrequencyQueryDialog::OkToExitL(TInt /*aButtonId*/) |
|
154 { |
|
155 CFMRadioFrequencyQueryControl* control = static_cast<CFMRadioFrequencyQueryControl*>(QueryControl()); |
|
156 return control->CanLeaveEditorL(); |
|
157 } |
|
158 |
|
159 // End of File |