Example #1
0
// ----------------------------------------------------
// CRhodesAppView::HandleCommandL(TInt aCommand)
// ----------------------------------------------------
//
void CRhodesAppView::HandleCommandL(TInt aCommand)
	{
		/*if ( iBrCtlInterface )
		{
			iBrCtlInterface->ClearCache();
		}*/
		
	    switch ( aCommand )
	    {
	        case ECmdAppRestoreSetting:
	        {
	            if (iBrCtlInterface)
	            {
	                TRect rect( Position(), Size() );
	                iBrCtlInterface->SetRect( rect );
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSmallScreen, 1);
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSecurityWarnings, 1);
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsAutoLoadImages, 1);
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsCSSFetchEnabled, 1);
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsECMAScriptEnabled, 1);
	                iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsBrowserUtf8Encoding, 1);
	            }
	            break;
	        }
	        case ECmdAppReload:
	        {
	            /*if (iBrCtlInterface)
	            {
	                iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandReload);
	            }*/
				webview_refresh();
				
				break;
	        }
	        case EAknSoftkeyBack:
        	{
        		if (iBrCtlInterface)
    			{
					//iBrCtlInterface->ClearCache();
		            TBrCtlDefs::TBrCtlElementType type = iBrCtlInterface->FocusedElementType();
		            
		            if(type == TBrCtlDefs::EElementActivatedInputBox )
		            	break;
    			}
    		}
	        case ECmdAppBack:
	        {
	            if (iBrCtlInterface)
	            {
					//iBrCtlInterface->ClearCache();
	                iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandBack);
	            }
	            break;
	        }
	        case ECmdAppForward:
	        {
	            if (iBrCtlInterface)
	            {
	                iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandForward);
				}
	            break;
	        }
	        case ECmdAppHome:
        	{
        		if (iBrCtlInterface)
        			{
        				iBrCtlInterface->LoadUrlL(iStartPage);
        			}
        		break;
        	}
	        case EOptions:
			{
				if (iBrCtlInterface)
					{
						iBrCtlInterface->LoadUrlL(iOptionsPage);
					    //iBrCtlInterface->ClearCache();
					}
				break;
			}	
	        case ECmdTakePicture:
	        	{
	        	iRhoCamera->StopViewFinder();
				iRhoCamera->StartViewFinderL();
	        	break;
	        	}
	        case ECmdChoosePicture:
	        	{
	        	ChoosePicture();	
	        	break;
	        	}
			case ELoggingOptions:
				{
					
					iBrCtlInterface->SetDimmed( ETrue);
					iBrCtlInterface->MakeVisible( EFalse );
					iBrCtlInterface->DrawNow();
					
					 CLogOptionsDialog::RunDlgLD();
					 
					 iBrCtlInterface->SetDimmed( EFalse );
					 iBrCtlInterface->MakeVisible( ETrue );
					 iBrCtlInterface->DrawNow();
					 
					 break;
				}
			case ELogView:
				{
					rho::String strText;
					LOGCONF().getLogText(strText);
						
					TPtrC8 ptr8((TUint8*)strText.c_str());
					HBufC *msg = HBufC::NewLC(ptr8.Length());
					msg->Des().Copy(ptr8);

					CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*msg);
					dlg->PrepareLC(R_STAT_QUERY_DIALOG);
					HBufC* title = iEikonEnv->AllocReadResourceLC(R_LOG_VIEW_DIALOG_TITLE);
					dlg->QueryHeading()->SetTextL(*title);
					CleanupStack::PopAndDestroy(); //title
					
					dlg->SetExtentToWholeScreen();
					dlg->RunLD();
					
					CleanupStack::PopAndDestroy(msg);
										
					break;
				}
	        /*case EAknSoftkeyCancel:
        	{
        		CEikButtonGroupContainer* current = CEikButtonGroupContainer::Current();
	        	if ( current )
        		{
	        		current->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
	        		current->SetFocus(EFalse, EDrawNow);
        		}
	        	break;
        	}*/
	        default:
	        	if (aCommand >= iCommandBase &&
	                aCommand < iCommandBase + TBrCtlDefs::ECommandIdWMLBase &&
	                iBrCtlInterface)
	                {
	                iBrCtlInterface->HandleCommandL(aCommand);
	                }

	            if (aCommand >= iCommandBase + TBrCtlDefs::ECommandIdWMLBase &&
	                aCommand < iCommandBase + TBrCtlDefs::ECommandIdRange &&
	                iBrCtlInterface)
	                {
	                iBrCtlInterface->HandleCommandL(aCommand);
	                }              
	            break;      
	    }
	    
	}