Example #1
0
void CRhodesAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent)
	{
		if ( aType == (EEventUser + ECmdAppHome))
		{ 
			if ( iSyncEngineWrap )
				iSyncEngineWrap->ResumeThread();
			HandleCommandL(ECmdAppHome);
		}
		else if ( aType == (EEventUser + ECmdShowDebugWindow))
		{
			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			dlg->PrepareLC(R_STAT_QUERY_DIALOG);
			
			TPtrC8 titleptr8((const TUint8 *)g_szSource);
			HBufC *title = HBufC::NewLC(titleptr8.Length());
			title->Des().Copy(titleptr8);
			dlg->QueryHeading()->SetTextL(*title);
			CleanupStack::PopAndDestroy(title);
			
			TPtrC8 msgptr8((const TUint8 *)g_szMessage);
			HBufC *msg = HBufC::NewLC(msgptr8.Length());
			msg->Des().Copy(msgptr8);
			dlg->SetMessageTextL(*msg);
			CleanupStack::PopAndDestroy(msg);
			
			dlg->RunLD();
		}
		else
		{
			// Call the base class implementation
	        CEikAppUi::HandleApplicationSpecificEventL(aType, aEvent);
		}
	}
void CZXingBarcodeReaderAppUi::HandleCommandL (TInt aCommand )
    {
    switch (aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            {
            Exit();
            break;
            }
        case EAknSoftkeyBack:
            {
            iAppView->CancelCapturedPicture();
            UseOptionsExitCbaL();
            break;
            }
        case EAbout:
            {
            CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog ();
            dlg->PrepareLC (R_ABOUT_QUERY_DIALOG );
            HBufC* title = iEikonEnv->AllocReadResourceLC (R_ABOUT_DIALOG_TITLE );
            dlg->QueryHeading ()->SetTextL (*title );
            CleanupStack::PopAndDestroy (); //title
            HBufC* msg = iEikonEnv->AllocReadResourceLC (R_ABOUT_DIALOG_TEXT );
            dlg->SetMessageTextL (*msg );
            CleanupStack::PopAndDestroy (); //msg
            dlg->RunLD();
            break;
            }
        default:
            {
            break;
            }
        };
    }
Example #3
0
/*
------------------------------------------------------------------------------
------------------------------------------------------------------------------
*/
void CMovingBallAppUi::HandleCommandL( TInt aCommand )
	{
	switch( aCommand )
		{
		case EResset:
			if(iAppView)
			{
				iAppView->Reset();
			}
			break;
		case EBGLOff:
			if(iAppView)
			{
				iAppView->SetLights(EFalse);
			}
			break;
		case EBGLOn:
			if(iAppView)
			{
				iAppView->SetLights(ETrue);
			}
			break;
		case EClose:
			// do nothing..
			break;
		case EEikCmdExit:
		case EAknSoftkeyExit:
			Exit();
			break;
	    case EVisitDrJukka:
	    	{
				OpenMobileWEBSiteL(this);
	    	}
	    	break;			
		case EAbout:
			{	
				HBufC* Abbout = KtxAbbout().AllocLC();
					
				CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); 
				dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
				dlg->QueryHeading()->SetTextL(_L("About"));
				dlg->SetMessageTextL(*Abbout);
				
				TCallBack callback1(OpenMobileWEBSiteL);
				dlg->SetLink(callback1);
				dlg->SetLinkTextL(KMobileJukkaLink);
				
				dlg->RunLD(); 
				
				CleanupStack::PopAndDestroy(); //Abbout
			}
			break;
		default:
			if(iAppView)
			{
				iAppView->HandleViewCommandL(aCommand);
			}
			break;
		}
	}
void CBuddycloudCommunitiesContainer::HandleItemSelectionL(TInt aIndex) {
	if(aIndex == ECommunityFacebook) {
		CAknMessageQueryDialog* aMessageDialog = new (ELeave) CAknMessageQueryDialog();
		aMessageDialog->PrepareLC(R_EXIT_DIALOG);
		
		HBufC* aFacebookText = iEikonEnv->AllocReadResourceLC(R_LOCALIZED_STRING_SETTINGS_FACEBOOK_TEXT);
		aMessageDialog->SetHeaderTextL(_L("Facebook"));
		aMessageDialog->SetMessageTextL(*aFacebookText);
		CleanupStack::PopAndDestroy(); // aFacebookText

		TCallBack aCallback(FacebookLaunchCallback);
		aMessageDialog->SetLink(aCallback);
		aMessageDialog->SetLinkTextL(_L("http://apps.facebook.com/buddycloud"));
		
		if(aMessageDialog->RunLD() != 0) {		
			aCallback.CallBack();
		}
	}
	else if(aIndex == ECommunityTwitter) {
		CAknMultiLineDataQueryDialog* aDialog = 
					CAknMultiLineDataQueryDialog::NewL(iBuddycloudLogic->GetDescSetting(ESettingItemTwitterUsername), 
					iBuddycloudLogic->GetDescSetting(ESettingItemTwitterPassword));

		if(aDialog->ExecuteLD(R_CREDENTIALS_DIALOG) != 0) {
			iBuddycloudLogic->SendCommunityCredentials(ECommunityTwitter);
		}
	}
}
void CCdlExplorerContainer::PropertiesL()
	{
	CCdlExplorable* selected = CurrentSelected();
	if (selected)
		{
		TBuf<256> buf;
		selected->Properties(buf);
		CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog;
		dialog->SetMessageTextL(buf);
		dialog->ExecuteLD(R_PROPERTIES_MESSAGE_QUERY);
		}
	}
//handle keys
TKeyResponse CSymellaTransfersContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,	TEventCode aType)
{
if (aType == EEventKey) 
	{
		switch (aKeyEvent.iCode) 
		{
			case EKeyUpArrow:
			case EKeyDownArrow:
				return iListBox->OfferKeyEventL(aKeyEvent, aType);

			case EKeyDevice3: //EKeyOk
				{
					TInt index = iListBox->CurrentItemIndex();
					if ( index >= 0)
					{
						if (CTR->DlManager()->GetDownloadState(index) == CSADownload::EComplete)
						{
							iView->HandleCommandL(ESymellaCmdOpenWithApp);
						}
						else
						{
							HBufC* info = CTR->DlManager()->CreateDownloadStatusInfoL(index);
							CleanupStack::PushL(info);
							
							CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
							CleanupStack::PushL(dlg);
							dlg->PrepareLC( R_MESSAGE_QUERY );
							dlg->SetMessageTextL(info->Des());
							dlg->QueryHeading()->SetTextL(_L("Download info"));
							CleanupStack::Pop();
							dlg->RunLD();

							CleanupStack::PopAndDestroy();
						}
					}
				}
				break;

			case EKeyBackspace:
			case EKeyDelete:
				{
					iView->HandleCommandL(ESymellaCmdRemoveDownload);
				}
				break;

			default:;
		}
	}

	return EKeyWasNotConsumed;
}
TBool ShowModalAboutDlgL(const TInt& aTextHeaderId,const TDesC& aDes)
	{
	CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog();
	
	dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
	
	HBufC* title = StringLoader::LoadLC(aTextHeaderId);
	dlg->QueryHeading()->SetTextL(*title);
	CleanupStack::PopAndDestroy(); //title
		
	dlg->SetMessageTextL(aDes);
		
	dlg->RunLD();
		
	return ETrue;
	}
void CAafAppFileBrowserView::ShowFileProperties()
{
	__LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() begins");

	if (!IsCurrentItemDir())
	{
		TEntry fileEntry;
		TFileName folderPath;

		__LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() step 01");

		// File description
		iBrowserEngine->GetFileDescription2L(iListBox->CurrentItemIndex(), fileEntry, folderPath);

		// Load dialog from resources
		CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); 
		dlg->PrepareLC(R_FILEPROPERTIES_DIALOG);
	
		// Set dialog title
		dlg->QueryHeading()->SetTextL(fileEntry.iName);		

		// Form dialog body text
		folderPath = TFileName(KNullDesC);
		_LIT(KSizeString, "Size:\t%d Kb\n\nDate,\ntime:\t");
		folderPath.Format(KSizeString, fileEntry.iSize/(1 << 10));

		TBuf<30> dateString(KNullDesC);
		_LIT(KDateString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B");

		fileEntry.iModified.FormatL(dateString, KDateString);		

		folderPath.Append(dateString);		

		dlg->SetMessageTextL(folderPath);

		__LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() step 02");

		// Run dialog
		dlg->RunLD(); 
	}

	__LOGSTR_TOFILE("CSupAppFileBrowserView::ShowFileProperties() ends");
}
Example #9
0
void CMLauncherAppUi::ShowErrorCleanCommL(TMsgType aErrorType, HBufC* aErrorString, TInt aErr, TBool aClean, TBool aKeepListening)
{
	//write the message into the LOG as well
	CleanupStack::PushL(aErrorString);
	LOG(ELogGeneral,1,"CMLauncherAppUi::ShowErrorCleanCommL: error type=%d, error=%d, error text: %S",aErrorType,aErr,aErrorString);
	//LOG(*);

	// if we are going to switch the view in this function, we would need to postpone showing the error
	// message until the new view is activated. Otherwise the activation will delete out error
	TBool showErrorAfterViewSwitch(EFalse);
	//first, we close the stuff!
	__ASSERT_ALWAYS((!(aErrorType==EMsgError || aErrorType==EMsgErrorPersistent) || aClean),Panic(EBTErrorAndNoClean));

	if(aClean)
	{
		if((iDirection==EDirectionReceiving && CCommReceiver::GetInstanceL()->iActiveRequest==CCommCommon::EActiveRequestTransferPlaylist) ||
		   (iDirection==EDirectionSending && CCommSender::GetInstanceL()->iActiveRequest==CCommCommon::EActiveRequestTransferPlaylist))
		{
			if(iCurrentView==iFiletransferView)
				showErrorAfterViewSwitch=ETrue; //the view will be changed!
			PlaylistTransferCompleteL();//this cleans the data as well (delete the socket)
		}
		else
		    Clean(aKeepListening);
	};

	LOG0("CMLauncherAppUi::ShowErrorCleanCommL: closing stuff ended, now we show the error message");
	if(aErrorType==EMsgNotePersistent || aErrorType==EMsgWarningPersistent || aErrorType==EMsgErrorPersistent)
	{
		//this is a different type of note
		CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog;
		CleanupStack::PushL(dlg);

		dlg->SetMessageTextL(*aErrorString);
		HBufC* header(NULL);
		switch(aErrorType)
		{
		case EMsgNotePersistent:header=StringLoader::LoadLC(R_NOTE_HEADER);break;
		case EMsgWarningPersistent:header=StringLoader::LoadLC(R_WARNING_HEADER);break;
		case EMsgErrorPersistent:header=StringLoader::LoadLC(R_ERROR_HEADER);break;
		default:LOG0("CMLauncherAppUi::ShowErrorCleanCommL: switch(aErrorType)/persistent: %d not handled",aErrorType);Panic(ESwitchValueNotHandled);
		};

		dlg->SetHeaderTextL(*header);
		CleanupStack::PopAndDestroy(header);

		if(showErrorAfterViewSwitch && iListView)
		{
			iDlgMsg=dlg;
			iListView->iFlags|=CFFListView::EHasMessage2Display;
			LOG0("Show dialog postponed after view change");
		}
		else
		{
			iDlgMsg=dlg;
			DisplayMessageL();
		};
		CleanupStack::Pop(dlg);
		CleanupStack::PopAndDestroy(aErrorString);
	}
	else
	{
		CAknResourceNoteDialog *note(NULL);
		switch(aErrorType)
		{
		case EMsgError:note=new(ELeave)CAknErrorNote;break;
		case EMsgWarning:note=new(ELeave)CAknWarningNote;break;
		case EMsgNote:note=new(ELeave)CAknInformationNote;break;
		default:LOG0("CMLauncherAppUi::ShowErrorCleanCommL: switch(aErrorType)/note: %d not handled",aErrorType);Panic(ESwitchValueNotHandled);
		};
		if(showErrorAfterViewSwitch && iListView)
		{
			iDlgNote=note;
			iDlgNoteString=aErrorString;
			iListView->iFlags|=CFFListView::EHasMessage2Display;
			CleanupStack::Pop(aErrorString);
			LOG0("Show note postponed after view change");
		}
		else
		{
			iDlgNote=note;
			iDlgNoteString=aErrorString;
			CleanupStack::Pop(aErrorString);
			DisplayMessageL();
		};
	};

	LOG(ELogGeneral,-1,"CMLauncherAppUi::ShowErrorCleanCommL: end");
};
// ---------------------------------------------------------
// CSymTorrentFilesView::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CSymTorrentFilesView::HandleCommandL(TInt aCommand)
{   
    switch ( aCommand )
        {
        case ESymTorrentCmdDetailsFromTorrentDetails:
            {
            iAppUi->ActivateTorrentDetailViewL();
            break;
            }
            
        case ESymTorrentCmdDownloadstate:
            {
            iAppUi->ActivateDownloadStateViewL();
            break;
            }
            
        case ESymTorrentCmdOpenFile:
            {
            TInt index = iFilesContainer->FilesListBox()->CurrentItemIndex();
					
			if (index >= 0)
			{
				CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
            	const CSTFile* file = torrent->File(iFilesContainer->FilesListBox()->CurrentItemIndex());
            	
            	if (file->IsDownloaded())        
					static_cast<CSymTorrentAppUi*>(AppUi())->OpenFileL(file->Path());
			}	
            		
            break;
            }
            
        case ESymTorrentCmdFileDetails:
            {
            
            CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
            const CSTFile* file = torrent->File(iFilesContainer->FilesListBox()->CurrentItemIndex());
			HBufC* info = file->CreateFileInfoL();
			CleanupStack::PushL(info);	

			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			CleanupStack::PushL(dlg);
			dlg->PrepareLC( R_DATA_DIALOG );
			dlg->SetMessageTextL(*info);
			dlg->QueryHeading()->SetTextL(_L("File details"));
			CleanupStack::Pop(); //dlg
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
            break;
            }
            
        case EAknSoftkeyBack:
            {
            iAppUi->ActivateMainViewL();
            break;
            }
            
        case ESymTorrentCmdDontDownloadAnyFile:
        	{
        		CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
        		torrent->SetAllFilesSkippedL(ETrue);
	        	iFilesContainer->RebuildListL();
	        	iFilesContainer->DrawDeferred();
        	}
        	break;
        	
        case ESymTorrentCmdDownloadAllFiles:
        	{
        		CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
        		torrent->SetAllFilesSkippedL(EFalse);
	        	iFilesContainer->RebuildListL();
	        	iFilesContainer->DrawDeferred();
        	}
        	break;
        	
        case ESymTorrentCmdDontDownloadFile:
	        {
	        	TInt index = iFilesContainer->FilesListBox()->CurrentItemIndex();
	        	CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
	        	torrent->SetFileSkippedL(index, ETrue);
	        	iFilesContainer->RebuildListL();
	        	iFilesContainer->DrawDeferred();
	        }
	        break;
	        
        case ESymTorrentCmdDownloadFile:
	        {
	        	TInt index = iFilesContainer->FilesListBox()->CurrentItemIndex();
	        	CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
	        	torrent->SetFileSkippedL(index, EFalse);
	        	iFilesContainer->RebuildListL();
	        	iFilesContainer->DrawDeferred();
	        }
	        break;
	        
        case ESymTorrentCmdStopSeeding:	
    	case ESymTorrentCmdStopTorrent:
    	{    	
    		CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
			if (torrent)
				torrent->StopL();
    	}
    	break;
    	
    	case ESymTorrentCmdStartSeeding:
    	case ESymTorrentCmdStartTorrent:
    	{    	
    		CSTTorrent* torrent = iTorrentMgr->Torrent(iAppUi->SelectedTorrentIndex());
			if (torrent)
			{
				if (torrent->HasEnoughDiskSpaceToDownload())
				{					
					torrent->StartL();
					static_cast<CSymTorrentAppUi*>(AppUi())->ActivateDownloadStateViewL();
				}
				else
					if (iEikonEnv->QueryWinL(_L("There is not enough memory for full download. Do you want to continue?"), _L("")))
					{
						torrent->StartL();
						static_cast<CSymTorrentAppUi*>(AppUi())->ActivateDownloadStateViewL();
					}
			}
    	}
    	break;
	        
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
}
Example #11
0
// ----------------------------------------------------
// CSymellaAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CSymellaAppUi::HandleCommandL(TInt aCommand)
{
    switch ( aCommand )
    {
		case ESymellaCmdConnect:
		{
			CTR->ConnectL();
		}
		break;

		case ESymellaCmdSelectGenre:
		{
			TInt index = 0;
			CAknListQueryDialog* queryDialog = new(ELeave) CAknListQueryDialog(&index);
			if(queryDialog->ExecuteLD(R_SYMELLA_GENRE_SELECTION_LIST))
			{
				CTR->SetGenre(index);
			}
		}
		break;

		case ESymellaCmdResetHostCache:
		{
			// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Are you sure you want to reset the hostcache?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{				
				CTR->HostCache().Reset();				
			}		

		}
		break;

		case ESymellaCmdDisconnect:
		{
			CTR->DisconnectL();
		}
		break;

		case ESymellaCmdConnectInfo:
		{
			HBufC* info = CTR->CreateConnectInfoL();
			CleanupStack::PushL(info);

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

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAbout:
		{
			TBuf<30> time;
			TBuf<50> date;
			date.Copy(_L8(__DATE__));
			time.Copy(_L8(__TIME__));
			_LIT(KBuild, "Built on ");
			HBufC* info = HBufC::NewLC(TPtrC(KAbout).Length() + 64 /*+ TPtrC(KEngineVersion).Length() */+
				TPtrC(KBuild).Length() + date.Length() + 4);
			TPtr des = info->Des();
			des.Append(_L("Version "));
			des.Append(SYMELLA_VERSION_LIT);
			des.Append(KAbout);
			//des.Append(KEngineVersion);
			des.Append(KBuild);
			des.Append(date);

			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			CleanupStack::PushL(dlg);
			dlg->PrepareLC( R_MESSAGE_QUERY );
			dlg->SetMessageTextL(des);
			dlg->QueryHeading()->SetTextL(_L("Symella S60"));
			CleanupStack::Pop(); //dlg
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAddNode:
            {
				// Create dialog to allow user to view/edit connection details
				TBuf<100> hostName;
				//hostName.Copy(_L(""));
			          hostName.Copy(_L("192.168.0.100"));
				TInt port = 6346;

				CAknMultiLineDataQueryDialog* dialog =
					CAknMultiLineDataQueryDialog::NewL(hostName, port);

				// Display and execute dialog, and act according to return value
				if (dialog->ExecuteLD(R_ADD_NODE_DIALOG))
				{
					TInetAddr addr;

					if (addr.Input(hostName) == KErrNone)
					{
						addr.SetPort(port);
						CTR->HostCache().AddUltrapeerL(addr);
					}                              
				}
            }
            break;
           
    	case EAknCmdExit:
        case EEikCmdExit:
        {
        	PREFERENCES->SaveWebCachesL();
    		LOG->WriteLineL(_L("Saving hostcache..."));
			CTR->HostCache().SaveHostCacheL();
			LOG->WriteLineL(_L("Symella terminating"));
			Exit();	
        }
    	break;
    	
    	case EAknSoftkeyBack:
		case EAknSoftkeyExit:
		{			
        	// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Quit Symella?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{
			//	((CSymellaSearchView*)View(TUid::Uid(1)))->CloseFindBoxL();
				PREFERENCES->SaveWebCachesL();
				LOG->WriteLineL(_L("Saving hostcache..."));
				CTR->HostCache().SaveHostCacheL();
				LOG->WriteLineL(_L("Symella terminating"));
				Exit();								
			}		
        }			
        break;

		case ESymellaCmdSearch:
		{
			TBuf<256> query;
			query.Copy(CTR->SearchString());
			CAknTextQueryDialog* dlg = 
				new (ELeave) CAknTextQueryDialog(query, CAknQueryDialog::ENoTone);

			dlg->SetPredictiveTextInputPermitted(ETrue);
			if (! dlg->ExecuteLD(R_SEARCH_QUERY)) 
				break;
			
			HBufC8* query8 = HBufC8::NewLC(query.Length());
			TPtr8 query8Ptr(query8->Des());
			query8Ptr.Copy(query);
			CTR->SearchL(*query8);
			CleanupStack::PopAndDestroy(); // query8
			
			iTabGroup->SetActiveTabByIndex(1);
            ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(1)));

			LOG->WriteL(_L("Searching for: "));
			LOG->WriteLineL(query);
		}
		break;

		case ESymellaCmdSettings:
		{
			ActivateLocalViewL(KSettingsViewId);
		}
		break;

        default:
            break;      
    }
}
void CTTGPSLoggerPositioningMethod::EditItemL(TBool aCalledFromMenu) // edit text
    {
	CDesC16ArrayFlat *itemArray = new (ELeave) CDesC16ArrayFlat(20);
	CDesC16ArrayFlat *itemArrayDetails = new (ELeave) CDesC16ArrayFlat(20);
	CleanupStack::PushL(itemArray); // in case the appends leave
	CleanupStack::PushL(itemArrayDetails); // in case the appends leave
	RPositionServer iPositionServer;
	RPositioner iPositioner;
	User::LeaveIfError(iPositionServer.Connect());
	User::LeaveIfError(iPositioner.Open(iPositionServer));
	itemArray->AppendL(_L("(Info on all modules)"));
	itemArray->AppendL(_L("(Default)"));
	TUint aModules = 0;
	TInt defaultModule=-1;

	// Get the available numbers of modules
	User::LeaveIfError(iPositionServer.GetNumModules(aModules));
    TPositionModuleInfo info;
	TPositionModuleId aModuleId;
	iPositionServer.GetDefaultModuleId(aModuleId);

	// Prepare itemArray and itemArrayDetails
    for(TUint i = 0; i < aModules; i++)
    	{
    	if ((iPositionServer.GetModuleInfoByIndex(i,info) == KErrNone) && (info.IsAvailable()))
    		{
    		TBuf<200> smallBuffer;
    		smallBuffer.Zero();
    		info.GetModuleName(smallBuffer);
    		itemArray->AppendL(smallBuffer);

			TBuf<200> buffer;
			buffer.Zero();
			info.GetModuleName(buffer);
			buffer.Append(_L(" ("));
			if (info.DeviceLocation() & TPositionModuleInfo::EDeviceExternal)
				buffer.Append(_L("External "));
			if (info.DeviceLocation() & TPositionModuleInfo::EDeviceInternal)
				buffer.Append(_L("Internal "));
			if (info.DeviceLocation() & TPositionModuleInfo::EDeviceUnknown)
				buffer.Append(_L("Unknown "));
			if (info.TechnologyType()& TPositionModuleInfo::ETechnologyAssisted)
				buffer.Append(_L("Assisted "));
			if (info.TechnologyType()& TPositionModuleInfo::ETechnologyTerminal)
				buffer.Append(_L("GPS, "));
			if (info.TechnologyType()& TPositionModuleInfo::ETechnologyNetwork)
				buffer.Append(_L("Network, "));
			if (info.TechnologyType()& TPositionModuleInfo::ETechnologyUnknown)
				buffer.Append(_L("Unknown tech, "));
			if (buffer.Mid(buffer.Length()-2, 2).Compare( _L(", ")) == KErrNone)
				buffer.Replace(buffer.Length()-2, 2, _L(")"));
			if (buffer.Mid(buffer.Length()-1, 1).Compare( _L(" "))  == KErrNone)
				buffer.Replace(buffer.Length()-1, 1, _L(")"));
			if ( info.ModuleId() == aModuleId)
				{
				buffer.Append(_L(" [Default]"));
				defaultModule=i;
				}
    		itemArrayDetails->AppendL(buffer);    		
    		}
    	}	
	iPositioner.Close();
	iPositionServer.Close();

	// Present list of positioning methods
	TInt selectIndex;
    selectIndex=iPosMethod+1;
    HBufC* title = NULL;
	title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_DIALOG_POSITIONING_TITLE); // Select positioning method:
    CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog(&selectIndex);
    dialog->PrepareLC(R_TTGP_DIALOG_LISTQUERY);
    dialog->QueryHeading()->SetTextL(*title);
    dialog->SetItemTextArray(itemArray);
    dialog->SetOwnershipType(ELbmDoesNotOwnItemArray);
    TInt answer = dialog->RunLD();
    CleanupStack::PopAndDestroy(); // title
    // Check answer
    if (answer)
    	{
        if (selectIndex==0) // (Info on all modules)
    		{
    		TBuf<1000> aText;
    		aText.Zero();
    		for (TInt i=0;i<itemArrayDetails->Count();i++)
    			{
    			aText.AppendFormat(_L("%d. "), i+1);
    			aText.Append(itemArrayDetails->MdcaPoint(i));
    			if (i<itemArrayDetails->Count()-1)
    				aText.Append(_L("\n"));
    			}
    		HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_AVAILABLEPOSITIONING_TITLE); // Available modules:
    		CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog();
    		CleanupStack::PushL(dialog);
    		dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK);
    		dialog->QueryHeading()->SetTextL(*title);
    		dialog->SetMessageTextL(aText);
    		CleanupStack::Pop(); // dialog
    		dialog->RunLD();
    		CleanupStack::PopAndDestroy(); // title
    		}
        else
        if (selectIndex==1) // Default module
        	{
        	if (defaultModule>-1)
        		{
        		// Present default module name
        		HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module:
        		CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog();
        		CleanupStack::PushL(dialog);
        		dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK);
        		dialog->QueryHeading()->SetTextL(*title);
        		dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(defaultModule));
        		CleanupStack::Pop(); // dialog
        		dialog->RunLD();
        		CleanupStack::PopAndDestroy(); // title
        		}
    		iPosMethod=0; // default module selected
    		C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod);
    		C_APPUI->Engine()->Requester()->StartL();
        	}
        else
        if (selectIndex>1) // Custom selection of the module
        	{
    		HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module:
    		CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog();
    		CleanupStack::PushL(dialog);
    		dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK);
    		dialog->QueryHeading()->SetTextL(*title);
    		dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(selectIndex-2));
    		CleanupStack::Pop(); // dialog
    		dialog->RunLD();
    		CleanupStack::PopAndDestroy(); // title
    		iPosMethod=selectIndex-1;
    		C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod);
    		C_APPUI->Engine()->Requester()->StartL();
    		}
    	UpdateListBoxTextL();
    	}
    CleanupStack::PopAndDestroy(); // itemArrayDetails
    CleanupStack::PopAndDestroy(); // itemArray
    }
Example #13
0
// -----------------------------------------------------------------------------
// CHelloS60AppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CHelloS60AppUi::HandleCommandL(TInt aCommand)
{
    switch (aCommand)
    {
    case EEikCmdExit:
    case EAknSoftkeyExit:
        Exit();
        break;

    case ECommand1:
    {

        // Load a string from the resource file and display it
        HBufC* textResource = StringLoader::LoadLC(R_COMMAND1_TEXT);
        CAknInformationNote* informationNote;

        informationNote = new (ELeave) CAknInformationNote;

        // Show the information Note with
        // textResource loaded with StringLoader.
        informationNote->ExecuteLD(*textResource);

        // Pop HBuf from CleanUpStack and Destroy it.
        CleanupStack::PopAndDestroy(textResource);
    }
    break;
    case ECommand2:
    {
        RFile rFile;

        //Open file where the stream text is
        User::LeaveIfError(rFile.Open(CCoeEnv::Static()->FsSession(),
                                      KFileName, EFileStreamText));//EFileShareReadersOnly));// EFileStreamText));
        CleanupClosePushL(rFile);

        // copy stream from file to RFileStream object
        RFileReadStream inputFileStream(rFile);
        CleanupClosePushL(inputFileStream);

        // HBufC descriptor is created from the RFileStream object.
        HBufC* fileData = HBufC::NewLC(inputFileStream, 32);

        CAknInformationNote* informationNote;

        informationNote = new (ELeave) CAknInformationNote;
        // Show the information Note
        informationNote->ExecuteLD(*fileData);

        // Pop loaded resources from the cleanup stack
        CleanupStack::PopAndDestroy(3); // filedata, inputFileStream, rFile
    }
    break;
    case EHelp:
    {

        CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
        HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
    }
    break;
    case EAbout:
    {

        CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog();
        dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
        HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE);
        dlg->QueryHeading()->SetTextL(*title);
        CleanupStack::PopAndDestroy(); //title
        HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
        dlg->SetMessageTextL(*msg);
        CleanupStack::PopAndDestroy(); //msg
        dlg->RunLD();
    }
    break;
    default:
        Panic( EHelloS60Ui);
        break;
    }
}
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;
}
Example #15
0
// -----------------------------------------------------------------------------
// CRhodesAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CRhodesAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case EEikCmdExit:
		case EAknSoftkeyExit:
			
			if ( iSyncEngineWrap )
				iSyncEngineWrap->TerminateThread();
			
			Exit();
			break;
		case EHelp:
			{

			CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
			HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
			}
			break;
		case EAbout:
			{

			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
			HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE);
			dlg->QueryHeading()->SetTextL(*title);
			CleanupStack::PopAndDestroy(); //title
			HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
			dlg->SetMessageTextL(*msg);
			CleanupStack::PopAndDestroy(); //msg
			dlg->RunLD();
			}
			break;
#ifdef ENABLE_RUBY_VM_STAT			
		case EStat:
			{
			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			dlg->PrepareLC(R_STAT_QUERY_DIALOG);
			HBufC* title = iEikonEnv->AllocReadResourceLC(R_STAT_DIALOG_TITLE);
			dlg->QueryHeading()->SetTextL(*title);
			CleanupStack::PopAndDestroy(); //title
			char buf[500] = {0};
			sprintf( buf,    "stat:\n___________________\n"
							 "iceq stat:\n "
							 "iseq binread: %u%s\n"
							 "iseq marshal: %u%s\n"
							 "require_compiled: %u%s\n"
							 "httpd thread loaded: %d\n"
							 "sync thread loaded: %d\n",
							 g_iseq_binread_msec, "msec",
							 g_iseq_marshal_load_msec, "msec",
							 g_require_compiled_msec, "msec",
							 g_httpd_thread_loaded,
							 g_sync_thread_loaded);
			
			TPtrC8 ptr8((TUint8*)buf);
			HBufC *msg = HBufC::NewLC(ptr8.Length());
			msg->Des().Copy(ptr8);
			dlg->SetMessageTextL(*msg);
			CleanupStack::PopAndDestroy(msg);
			dlg->RunLD();
			}	
			break;
#endif			
		default:
			iAppView->HandleCommandL(aCommand);
			break;
		}
	}