44 #include <finditemmenu.h> |
44 #include <finditemmenu.h> |
45 #include <finditem.hrh> |
45 #include <finditem.hrh> |
46 #include <centralrepository.h> |
46 #include <centralrepository.h> |
47 #include <cenrepnotifyhandler.h> |
47 #include <cenrepnotifyhandler.h> |
48 #include <CommonUiInternalCRKeys.h> |
48 #include <CommonUiInternalCRKeys.h> |
49 #include <AknUtils.h> |
49 #include <AknUtils.h> |
50 #include <avkon.hrh> // EAknCmdHelp |
50 #include <avkon.hrh> // EAknCmdHelp |
51 #include <avkon.mbg> |
51 #include <avkon.mbg> |
52 #include <avkon.rsg> |
52 #include <avkon.rsg> |
53 #include <aknlayoutscalable_apps.cdl.h> |
53 #include <aknlayoutscalable_apps.cdl.h> |
54 #include <csxhelp/cale.hlp.hrh> |
54 #include <csxhelp/cale.hlp.hrh> |
97 // ---------------------------------------------------------------------------- |
97 // ---------------------------------------------------------------------------- |
98 // |
98 // |
99 CCalenMissedEventContainer::CCalenMissedEventContainer(CCalenNativeView* aView, |
99 CCalenMissedEventContainer::CCalenMissedEventContainer(CCalenNativeView* aView, |
100 MCalenServices& aServices ) |
100 MCalenServices& aServices ) |
101 : CCalenContainer( aView, aServices ), |
101 : CCalenContainer( aView, aServices ), |
102 iEntry(NULL), |
102 iEntry(NULL) |
103 iAutomaticHlValue(ETrue), |
103 |
104 iAutomaticHlInitialized(EFalse) |
|
105 { |
104 { |
106 TRACE_ENTRY_POINT; |
105 TRACE_ENTRY_POINT; |
107 TRACE_EXIT_POINT; |
106 TRACE_EXIT_POINT; |
108 } |
107 } |
109 |
108 |
160 |
159 |
161 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
160 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
162 Rect(), |
161 Rect(), |
163 ETrue ); |
162 ETrue ); |
164 |
163 |
165 iAutoFinder = CItemFinder::NewL(); |
164 |
166 iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
165 iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
167 iFindMenu->AttachItemFinderMenuL(0); |
166 iFindMenu->AttachItemFinderMenuL(0); |
168 |
167 |
169 iParaFormat = CParaFormat::NewL(); |
168 iParaFormat = CParaFormat::NewL(); |
170 |
169 |
171 |
170 |
172 iTextEditor = new (ELeave) CEikRichTextEditor; |
171 iTextEditor = new (ELeave) CEikRichTextEditor; |
173 iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | |
172 iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | |
174 CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor); |
173 CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor); |
175 iTextEditor->SetMopParent(this); |
174 iTextEditor->SetMopParent(this); |
176 iTextEditor->SetRect( Rect() ); |
175 iTextEditor->SetRect( Rect() ); |
177 |
176 |
178 |
177 |
179 ReadAutoHlCenRepValueAndSetNotifyL(); |
178 iTextEditor->EnableKineticScrollingL(ETrue); |
180 SetAutomaticHighlightL(iAutomaticHlValue); |
179 TRACE_EXIT_POINT; |
181 TRACE_EXIT_POINT; |
|
182 } |
180 } |
183 |
181 |
184 // ---------------------------------------------------------------------------- |
182 // ---------------------------------------------------------------------------- |
185 // CCalenMissedEventContainer::UpdateSize |
183 // CCalenMissedEventContainer::UpdateSize |
186 // Do layout changes after calendar settings are |
184 // Do layout changes after calendar settings are |
214 // ---------------------------------------------------------------------------- |
212 // ---------------------------------------------------------------------------- |
215 // |
213 // |
216 void CCalenMissedEventContainer::CompletePopulationL() |
214 void CCalenMissedEventContainer::CompletePopulationL() |
217 { |
215 { |
218 TRACE_ENTRY_POINT; |
216 TRACE_ENTRY_POINT; |
219 |
|
220 if(iTextEditor && iTextEditor->Text()->DocumentLength() > 0 && iAutoFinder) |
|
221 { |
|
222 iAutoFinder->SetEditor((CEikRichTextEditor**)&iTextEditor); |
|
223 } |
|
224 |
217 |
225 iTextEditor->SetFocus(ETrue); |
218 iTextEditor->SetFocus(ETrue); |
226 ActivateL(); |
219 ActivateL(); |
227 AddToStackAndMakeVisibleL(); |
220 AddToStackAndMakeVisibleL(); |
228 DrawDeferred(); |
221 DrawDeferred(); |
343 { |
336 { |
344 switch (aKeyEvent.iCode) |
337 switch (aKeyEvent.iCode) |
345 { |
338 { |
346 case EKeyUpArrow: |
339 case EKeyUpArrow: |
347 { |
340 { |
348 iAutoFinder->NextItemOrScrollL( CItemFinder::ENextUp ); |
341 |
349 // Scroll the text view up by one line |
342 // Scroll the text view up by one line |
350 iTextEditor->MakeVisible(EFalse); |
343 iTextEditor->MakeVisible(EFalse); |
351 TInt scrollLines = KScrollViewerUp; |
344 TInt scrollLines = KScrollViewerUp; |
352 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
345 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
353 iTextEditor->UpdateScrollBarsL(); |
346 iTextEditor->UpdateScrollBarsL(); |
354 iTextEditor->MakeVisible(ETrue); |
347 iTextEditor->MakeVisible(ETrue); |
355 //Set focus immediately for highlight of auto find text |
348 //Set focus immediately for highlight of auto find text |
356 iTextEditor->SetFocus(ETrue); |
349 iTextEditor->SetFocus(ETrue); |
357 keyResponse = EKeyWasConsumed; |
350 keyResponse = EKeyWasConsumed; |
358 } |
351 } |
359 break; |
352 break; |
360 |
353 |
361 case EKeyDownArrow: |
354 case EKeyDownArrow: |
362 { |
355 { |
363 iAutoFinder->NextItemOrScrollL( CItemFinder::ENextDown ); |
356 |
364 // Scroll the text view down by one line |
357 // Scroll the text view down by one line |
365 iTextEditor->MakeVisible(EFalse); |
358 iTextEditor->MakeVisible(EFalse); |
366 TInt scrollLines = KScrollViewerDown; |
359 TInt scrollLines = KScrollViewerDown; |
367 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
360 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
368 iTextEditor->UpdateScrollBarsL(); |
361 iTextEditor->UpdateScrollBarsL(); |
427 return keyResponse; |
419 return keyResponse; |
428 |
420 |
429 |
421 |
430 } |
422 } |
431 |
423 |
432 // ---------------------------------------------------------------------------- |
|
433 // CCalenMissedEventContainer::HandleNumberCallL |
|
434 // ---------------------------------------------------------------------------- |
|
435 // |
|
436 void CCalenMissedEventContainer::HandleNumberCallL() |
|
437 { |
|
438 TRACE_ENTRY_POINT; |
|
439 |
|
440 const CItemFinder::CFindItemExt& findItem = iAutoFinder->CurrentItemExt(); |
|
441 |
|
442 if(findItem.iItemType != CItemFinder::EPhoneNumber) |
|
443 { |
|
444 return; |
|
445 } |
|
446 |
|
447 iFindMenu->HandleCallL( findItem.iItemDescriptor->Des() ); |
|
448 |
|
449 TRACE_EXIT_POINT; |
|
450 } |
|
451 |
424 |
452 // ---------------------------------------------------------------------------- |
425 // ---------------------------------------------------------------------------- |
453 // CCalenMissedEventContainer::HandlePointerEventL |
426 // CCalenMissedEventContainer::HandlePointerEventL |
454 // Process pointer event. |
427 // Process pointer event. |
455 // (other items were commented in a header). |
428 // (other items were commented in a header). |
481 case TPointerEvent::EButton1Up: |
454 case TPointerEvent::EButton1Up: |
482 { |
455 { |
483 iTextEditor->SetFocus(ETrue); |
456 iTextEditor->SetFocus(ETrue); |
484 TInt curPos = iTextEditor->CursorPos(); |
457 TInt curPos = iTextEditor->CursorPos(); |
485 TRect rect = iTextEditor->Rect(); |
458 TRect rect = iTextEditor->Rect(); |
486 if ( !iAutoFinder->ItemWasTappedL( aPointerEvent.iPosition - rect.iTl ) ) |
|
487 { |
|
488 // return; |
|
489 } |
|
490 break; |
459 break; |
491 } |
460 } |
492 default: |
461 default: |
493 { |
462 { |
494 break; |
463 break; |
495 } |
464 } |
496 } |
465 } |
497 iTextEditor->HandlePointerEventL(aPointerEvent); |
|
498 } |
466 } |
499 |
467 |
500 TRACE_EXIT_POINT; |
468 TRACE_EXIT_POINT; |
501 } |
469 } |
502 |
470 |
2102 TRACE_ENTRY_POINT; |
2070 TRACE_ENTRY_POINT; |
2103 TRACE_EXIT_POINT; |
2071 TRACE_EXIT_POINT; |
2104 return iEventViewData; |
2072 return iEventViewData; |
2105 } |
2073 } |
2106 |
2074 |
2107 // ----------------------------------------------------------------------------- |
2075 |
2108 // CCalenMissedEventContainer::ReadAutoHlCenRepValueAndSetNotifyL |
2076 // ----------------------------------------------------------------------------- |
2109 // |
2077 // CCalenMissedEventContainer::HandleNotifyError |
2110 // ----------------------------------------------------------------------------- |
2078 // From MCenRepNotifyHandlerCallback |
2111 // |
2079 // ----------------------------------------------------------------------------- |
2112 void CCalenMissedEventContainer::ReadAutoHlCenRepValueAndSetNotifyL() |
2080 // |
2113 { |
|
2114 TRACE_ENTRY_POINT; |
|
2115 |
|
2116 if ( iAutomaticHlInitialized ) |
|
2117 return; |
|
2118 |
|
2119 // Create the session |
|
2120 iCenRepSession = CRepository::NewL( KCRUidCommonUi ); |
|
2121 |
|
2122 if( iCenRepSession ) |
|
2123 { |
|
2124 // Get the value of AutomaticHighlight key |
|
2125 iCenRepSession->Get( KCuiAutomaticHighlight, iAutomaticHlValue ); |
|
2126 // Create the notifer |
|
2127 iNotifier = |
|
2128 CCenRepNotifyHandler::NewL( |
|
2129 *this, *iCenRepSession, CCenRepNotifyHandler::EIntKey, |
|
2130 KCuiAutomaticHighlight ); |
|
2131 // Start listening |
|
2132 iNotifier->StartListeningL(); |
|
2133 } |
|
2134 |
|
2135 iAutomaticHlInitialized = ETrue; // Done once per viewer |
|
2136 |
|
2137 TRACE_EXIT_POINT; |
|
2138 } |
|
2139 |
|
2140 // ----------------------------------------------------------------------------- |
|
2141 // CCalenMissedEventContainer::HandleNotifyInt |
|
2142 // Handles the incoming notifications of key changes |
|
2143 // ----------------------------------------------------------------------------- |
|
2144 // |
|
2145 void CCalenMissedEventContainer::HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue ) |
|
2146 { |
|
2147 TRACE_ENTRY_POINT; |
|
2148 |
|
2149 // Notifies changes on KCuiAutomaticHighlight |
|
2150 TRAPD(error,SetAutomaticHighlightL( aNewValue )); |
|
2151 if ( error != KErrNone ) |
|
2152 { |
|
2153 User::Panic(_L("CCalenMissedEventContainer"),error); |
|
2154 } |
|
2155 TRACE_EXIT_POINT; |
|
2156 } |
|
2157 |
|
2158 |
|
2159 void CCalenMissedEventContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/, |
2081 void CCalenMissedEventContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/, |
2160 CCenRepNotifyHandler* /*aHandler*/ ) |
2082 CCenRepNotifyHandler* /*aHandler*/ ) |
2161 { |
2083 { |
2162 TRACE_ENTRY_POINT; |
2084 TRACE_ENTRY_POINT; |
2163 |
2085 |
2172 iCenRepSession = NULL; |
2094 iCenRepSession = NULL; |
2173 |
2095 |
2174 TRACE_EXIT_POINT; |
2096 TRACE_EXIT_POINT; |
2175 } |
2097 } |
2176 |
2098 |
2177 // ----------------------------------------------------------------------------- |
2099 |
2178 // CCalenMissedEventContainer::SetAutomaticHighlightL |
|
2179 // ----------------------------------------------------------------------------- |
|
2180 // |
|
2181 void CCalenMissedEventContainer::SetAutomaticHighlightL( const TBool aSwitchON ) |
|
2182 { |
|
2183 TRACE_ENTRY_POINT; |
|
2184 |
|
2185 if ( iAutoFinder ) |
|
2186 { |
|
2187 // content highlight |
|
2188 if ( aSwitchON ) |
|
2189 { // switch ON |
|
2190 iAutoFinder->SetFindModeL( |
|
2191 CItemFinder::EPhoneNumber | |
|
2192 CItemFinder::EUrlAddress | |
|
2193 CItemFinder::EEmailAddress ); |
|
2194 |
|
2195 } |
|
2196 else |
|
2197 { // switch OFF |
|
2198 iAutoFinder->SetFindModeL( |
|
2199 CItemFinder::ENoneSelected ); |
|
2200 |
|
2201 } |
|
2202 } |
|
2203 |
|
2204 TRACE_EXIT_POINT; |
|
2205 } |
|
2206 |
|
2207 // ----------------------------------------------------------------------------- |
|
2208 // CCalenMissedEventContainer::GetItemFinder |
|
2209 // ----------------------------------------------------------------------------- |
|
2210 // |
|
2211 CItemFinder* CCalenMissedEventContainer::GetItemFinder() |
|
2212 { |
|
2213 TRACE_ENTRY_POINT; |
|
2214 TRACE_EXIT_POINT; |
|
2215 |
|
2216 return iAutoFinder; |
|
2217 } |
|
2218 // ----------------------------------------------------------------------------- |
2100 // ----------------------------------------------------------------------------- |
2219 // CCalenMissedEventContainer::GetFindItemMenu |
2101 // CCalenMissedEventContainer::GetFindItemMenu |
2220 // ----------------------------------------------------------------------------- |
2102 // ----------------------------------------------------------------------------- |
2221 // |
2103 // |
2222 CFindItemMenu* CCalenMissedEventContainer::GetFindItemMenu() |
2104 CFindItemMenu* CCalenMissedEventContainer::GetFindItemMenu() |
2275 else |
2157 else |
2276 { |
2158 { |
2277 return EFalse; |
2159 return EFalse; |
2278 } |
2160 } |
2279 } |
2161 } |
|
2162 // ----------------------------------------------------------------------------- |
|
2163 // OnCmdFindPhoneNumL |
|
2164 // Find phone numbers in the form. |
|
2165 // (other items were commented in a header). |
|
2166 // ----------------------------------------------------------------------------- |
|
2167 // |
|
2168 void CCalenMissedEventContainer::OnCmdFindPhoneNumL() |
|
2169 { |
|
2170 TRACE_ENTRY_POINT; |
|
2171 |
|
2172 BuildSearchBufferL(); |
|
2173 CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchPhoneNumberBin); |
|
2174 finder->ExecuteLD(); |
|
2175 |
|
2176 TRACE_EXIT_POINT; |
|
2177 } |
|
2178 |
|
2179 // ----------------------------------------------------------------------------- |
|
2180 // OnCmdFindUrlL |
|
2181 // Find urls in the form. |
|
2182 // (other items were commented in a header). |
|
2183 // ----------------------------------------------------------------------------- |
|
2184 // |
|
2185 void CCalenMissedEventContainer::OnCmdFindUrlL() |
|
2186 { |
|
2187 TRACE_ENTRY_POINT; |
|
2188 |
|
2189 BuildSearchBufferL(); |
|
2190 CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchURLBin); |
|
2191 finder->ExecuteLD(); |
|
2192 |
|
2193 TRACE_EXIT_POINT; |
|
2194 } |
|
2195 |
|
2196 // ----------------------------------------------------------------------------- |
|
2197 // OnCmdFindEmailL |
|
2198 // Find email addresses in the form. |
|
2199 // (other items were commented in a header). |
|
2200 // ----------------------------------------------------------------------------- |
|
2201 // |
|
2202 void CCalenMissedEventContainer::OnCmdFindEmailL() |
|
2203 { |
|
2204 TRACE_ENTRY_POINT; |
|
2205 |
|
2206 BuildSearchBufferL(); |
|
2207 CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchMailAddressBin); |
|
2208 finder->ExecuteLD(); |
|
2209 |
|
2210 TRACE_EXIT_POINT; |
|
2211 } |
2280 |
2212 |
2281 // end of file |
2213 // end of file |
2282 |
2214 |