void CTTGPSLoggerSelectMemorySettingItem::EditItemL(TBool aCalledFromMenu) // edit text
    {
    CDesC16Array *itemArray = CCoeEnv::Static()->ReadDesCArrayResourceL(R_TTGP_ARRAY_DIALOG_MEMORY1);
    CleanupStack::PushL(itemArray);
	if(!TTGPSLoggerCommon::CheckDiskL(EDriveF, EFalse))
		itemArray->Delete(3);
	if(!TTGPSLoggerCommon::CheckDiskL(EDriveE, EFalse))
		itemArray->Delete(2);
	if(!TTGPSLoggerCommon::CheckDiskL(EDriveC, EFalse))
		itemArray->Delete(1);
    TInt selectIndex;
    selectIndex=iMemory;
    HBufC* title = NULL;
	title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_DIALOG_MEMORY_TITLE);
    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
    if (answer)
		switch (selectIndex)
			{
			case 0: // (Drive info)
				{
				// drive info
				TTGPSLoggerCommon::CheckDiskL(-1, ETrue);
				break;
				}
			case 1: // Phone Memory
				if(TTGPSLoggerCommon::CheckDiskL(EDriveC, ETrue))
					iMemory=selectIndex;
				break;
			case 2: // Memory Card
				if(TTGPSLoggerCommon::CheckDiskL(EDriveE, ETrue))
					iMemory=selectIndex;
				break;
			case 3: // Mass Memory
				if(TTGPSLoggerCommon::CheckDiskL(EDriveF, ETrue))
					iMemory=selectIndex;
				break;
			}
	UpdateListBoxTextL();
    CleanupStack::PopAndDestroy(); // itemArray
    }
Example #2
0
void CStarDictAppUi::ShowDictionaryListL()
{
	TDesC *name, *path;
	TBuf<KDataBaseNameSizeMax> str;

	CDesCArray *itemTextArray = new (ELeave) CDesCArrayFlat(16);
	CleanupStack::PushL(itemTextArray);

	for(TInt i=0; i<iDictFactory->GetDataBaseCount(); i++)
	{
		name = path = NULL;
		if (iDictFactory->GetDataBaseName(i, &name, &path) && name)
		{
			str.Copy(*name);
		}
		else
		{
			TBuf<100> resourceString;
			CEikonEnv::Static()->ReadResource(resourceString,
											  R_CORRUPT_STRING);
			str.Copy(resourceString);
		}

		itemTextArray->AppendL(str);
	}

	TInt itemSelected(0), prevSelection;
	CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog(&itemSelected);
	listQuery->PrepareLC(R_DICTIONARY_LIST_DIALOG);
	listQuery->SetItemTextArray(itemTextArray);
	listQuery->SetOwnershipType(ELbmDoesNotOwnItemArray);

	prevSelection = iDictFactory->GetCurrentDataBase();
	if (prevSelection >= 0 && prevSelection < itemTextArray->Count())
	{
		listQuery->ListBox()->SetCurrentItemIndex(prevSelection);
	}
	if(listQuery->RunLD())
	{
		iDictFactory->SetCurrentDataBase(itemSelected);
		iStarDictContainerView->SetDictionaryName((*itemTextArray)[itemSelected]);
		iStarDictContainerView->UpdateListBox();
	}
	CleanupStack::PopAndDestroy();
}
// ---------------------------------------------------------
// CFepSetupContainer::InstallFepL
// ---------------------------------------------------------
//
void CFepSetupContainer::InstallFepL()
	{
	TBuf<KFormatBufSize> formatingBuf;

    TInt index( 0 );
    CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &index );
    dlg->PrepareLC( R_FEPSETUP_LIST_QUERY );
    dlg->SetItemTextArray( iNamesOfAvailableFeps );
    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );

    // Execute the dialog
	TInt answer = dlg->RunLD();

    if( answer == EAknSoftkeyOk )
		{
#ifndef __SERIES60_3X__ // Series60 1.x/2.x API
		iEikonEnv->InfoMsg( TParsePtrC( iFileNamesOfAvailableFeps->MdcaPoint( index )).Name());

		// The code below is to check whether the selected Fep is already installed.
		HBufC* fepToInstall = iFileNamesOfAvailableFeps->MdcaPoint( index ).AllocL();
		CleanupStack::PushL( fepToInstall );
		TPtr fepToInstallPtr( fepToInstall->Des() );
        fepToInstallPtr.LowerCase(); // remove case-sensitivity
		TPtrC fepToInstallPtrC( TParsePtrC( fepToInstallPtr ).Name()); // file name parsing

		HBufC* currentFep = iCoeEnv->NameOfInstalledFepL();
		
		CleanupStack::PushL( currentFep );
		TPtr currentFepPtr( currentFep->Des() );
        currentFepPtr.LowerCase(); // remove case-sensitivity
		TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing

		if( fepToInstallPtrC.Compare( currentFepPtrC ) == 0) // Already installed?
			{
			formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtrC );
			}
		else
			{
			// Loads the specified FEP DLL into all running applications.
			// The current loaded FEP, if any, will be unloaded.
			iCoeEnv->InstallFepL( iFileNamesOfAvailableFeps->MdcaPoint( index ));

			formatingBuf.Format( KFepInstalled, &fepToInstallPtrC );
			}

		CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote();
		confirmationDialog->ExecuteLD( formatingBuf );

		CleanupStack::PopAndDestroy( 2 ); // currentFep, fepToInstall;

#else // Series60 3.x API

		TPtrC fepToInstallPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( index )).Name()); // file name parsing
		iEikonEnv->InfoMsg( fepToInstallPtr );

		// The code below is to check whether the selected Fep is already installed.
		TUid fepToInstallUid = iFepUids[index];
		TUid currentFepUid = iEikonEnv->FepUid();
		
		if( currentFepUid == fepToInstallUid )
			{
			formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtr );
			}
		else
			{
			// Loads the specified FEP DLL into all running applications.
			// The current loaded FEP, if any, will be unloaded.
			iCoeEnv->InstallFepL( fepToInstallUid );

			formatingBuf.Format( KFepInstalled, &fepToInstallPtr );
			}
		CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote();
		confirmationDialog->ExecuteLD( formatingBuf );			
#endif		
		}
	else
		{
		iEikonEnv->InfoMsg( KNoFep );
		}
	}
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
    }