void CManualSmsListContainer::SizeChangedForFindBox()
    {
    if ( iListBox && iFindBox )
        {
        // Initialize of resource ID for layout of findbox(These initial
        // values are layout for fixed findbox).
        TInt findWindowResourceId( R_AVKON_FIND_PANE );
        TInt listAreaResourceId( R_AVKON_LIST_GEN_PANE_X );        
        TBool flagsOfPopup( ETrue ); // Flag for find popup.
		TInt findWindowParentId = R_AVKON_MAIN_PANE_WITH_STATUS_PANE;
		
		// Calls HandleFindSizeChanged after creates findbox.
        AknFind::HandleFindSizeChanged(
            this, iListBox, iFindBox, flagsOfPopup, findWindowResourceId,
            listAreaResourceId, R_AVKON_LIST_GEN_PANE_WITH_FIND_POPUP,
            findWindowParentId );
        }
    }
Ejemplo n.º 2
0
TKeyResponse CSymellaSearchContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
	if (aType == EEventKey) 
	{
		switch (aKeyEvent.iCode) 
		{
		case EKeyUpArrow:
		case EKeyDownArrow:
			return iListBox->OfferKeyEventL(aKeyEvent, aType);
		case EKeyDevice3: //EKeyOk
			{
				if (CurrentItemIndex() >= 0)
				{
					HBufC* info = CTR->DlManager()->CreateHitInfoL(CurrentItemIndex());
					CleanupStack::PushL(info);

					/*CAknNoteDialog* note = new (ELeave) CAknNoteDialog;
					CleanupStack::PushL(note);
					note->SetTextL(*info);
					CleanupStack::Pop();
					note->PrepareLC(R_HIT_INFO_NOTE);
					note->RunLD();*/
					CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
					dlg->PrepareLC( R_MESSAGE_QUERY );
					dlg->SetMessageTextL(info->Des());
					dlg->QueryHeading()->SetTextL(_L("Hit info"));
					dlg->RunLD();

					CleanupStack::PopAndDestroy();
				}
			}
			break;
		case EKeyLeftArrow:
		case EKeyRightArrow:
		{
			// Empty FindBox Search Text		
			_LIT(KBlank, "");
			FindBox()->SetSearchTextL(KBlank);

			// Press Backspace on Empty FindBox to Close it
			TBool refresh = false;
			TKeyEvent key;
			key.iCode = 8;
			key.iScanCode = 1;
			key.iRepeats = 1;
			key.iModifiers = 0;
			AknFind::HandleFindOfferKeyEventL(key, EEventKey, this, ListBox(), FindBox(), ETrue, refresh);
		}
		break;
			
		default:
			{
				if (iFindBox)
				{
					

					TBool needRefresh( EFalse );
	            	TBool flagsOfPopup( EFalse );

					if ( AknFind::HandleFindOfferKeyEventL( aKeyEvent, aType, this,
		                                                    iListBox, iFindBox,
		                                                    ETrue,
		                                                    needRefresh ) ==
		                                                        EKeyWasConsumed )
		            {
		                if ( needRefresh )
		                {
		                	SizeChanged();
		                    DrawNow();
		                }

		                return EKeyWasConsumed;
		            }
				}
			}
			break;
		}
	}

	return EKeyWasNotConsumed;
}
TKeyResponse CManualSmsListContainer::OfferKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    // See if we have a selection
    TInt code = aKeyEvent.iCode;
	TInt active = iTabGroup->ActiveTabIndex();
    TInt count = iTabGroup->TabCount();

    switch(code)
        {
		// is navigator button pressed
		case EKeyLeftArrow:
            if ( active > 0 )
                {
					active--;										

					iTabGroup->SetActiveTabById(0); 
					
					if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
						iPhotosAppUi->iStoragePath = SMS_INBOX;
					
					if(iReadSmsAO != NULL)
					{
						iReadSmsAO->iInboxFlag	  = 0;
						iReadSmsAO->iSentItemFlag = 1;

						iReadSmsAO->ReleaseMtm();
						iReadSmsAO->PrepareMtm(SMS_INBOX);
					}

					TBuf<20> searchtext;
					searchtext.Copy(_L(""));
					iFindBox->SetSearchTextL(searchtext);

					SizeChanged();

					iCursorPos = 0;
					SetFileList(1);
					//iListBox->SetCurrentItemIndex(iCursorPos);
                }
            break;
		case EKeyRightArrow:
            if( (active + 1) < count )
                {
					active++;
		
					iTabGroup->SetActiveTabById(1); 
		
					if( iPhotosAppUi->iStoragePath == SMS_INBOX)
						iPhotosAppUi->iStoragePath = SMS_SENTITEMS;
					
					if(iReadSmsAO != NULL)
					{
						iReadSmsAO->iInboxFlag	  = 1;
						iReadSmsAO->iSentItemFlag = 0;

						iReadSmsAO->ReleaseMtm();
						iReadSmsAO->PrepareMtm(SMS_SENTITEMS);
					}

					TBuf<20> searchtext;
					searchtext.Copy(_L(""));
					iFindBox->SetSearchTextL(searchtext);

					SizeChanged();

					iCursorPos = 0;
					SetFileList(1);
					//iListBox->SetCurrentItemIndex(iCursorPos);
					}
            break;	
		case EKeyUpArrow:
			
			if(iCursorPos >= 0)
				iCursorPos--;

			if( iPhotosAppUi->iStoragePath == SMS_INBOX)
					{					
				if(iCursorPos == -1)
					iCursorPos = iInboxCount-1;
						}
			else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
						{
				if(iCursorPos == -1)
					iCursorPos = iSentItemCount-1;
						}

			//iCursorPos = iListBox->CurrentItemIndex();
			return iListBox->OfferKeyEventL(aKeyEvent, aType);
			break;
		case EKeyDownArrow:
			if( iPhotosAppUi->iStoragePath == SMS_INBOX)
						{
				if(iCursorPos < iInboxCount)
					iCursorPos++;

				if(iCursorPos == iInboxCount)
					iCursorPos = 0;
					}
			else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
			{
				if(iCursorPos < iSentItemCount)
					iCursorPos++;

				if(iCursorPos == iSentItemCount)
					iCursorPos = 0;
			}

			//iCursorPos = iListBox->CurrentItemIndex();
			return iListBox->OfferKeyEventL(aKeyEvent, aType);
            break;	
		case 63557:
			{
				TInt count=0;
			if( iPhotosAppUi->iStoragePath == SMS_INBOX)
			{
				count = iInboxCount;
			}
			else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
			{
				count = iSentItemCount;
			}

			if(count > 0)
				MarkUnMarkSelectedItem();
			}
			//return iListBox->OfferKeyEventL(aKeyEvent, aType);
			break;
        default:
            // Let Listbox take care of its key handling
            //return iListBox->OfferKeyEventL(aKeyEvent, aType);
            break;
        }
		
		if ( iListBox )
		{
			if ( iFindBox )
			{
				TBool needRefresh( EFalse );
				TBool flagsOfPopup( EFalse );
	
				// Offers the key event to find box.
				if ( AknFind::HandleFindOfferKeyEventL( aKeyEvent, aType, this,
														iListBox, iFindBox,
														flagsOfPopup,
														needRefresh ) ==EKeyWasConsumed )
				{
					if ( needRefresh )
					{
						SizeChangedForFindBox();
						DrawNow();
					}					
				}
				//return iListBox->OfferKeyEventL( aKeyEvent, aType );
			}
		//return iListBox->OfferKeyEventL( aKeyEvent, aType );
		}
   		return (TKeyResponse)0;
    }