Exemple #1
0
int CAppView::TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints) {
	if(iEngine->IsDrawing())
		iEngine->StopDrawing();
	outText.Copy(inText);
	CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog(outText);
	CleanupStack::PushL(dlg);
	dlg->SetPromptL(title);
	dlg->SetPredictiveTextInputPermitted(true);
	dlg->SetMaxLength(outText.MaxLength());
	TBool answer = dlg->ExecuteLD(R_TEXTBOX_QUERY);
	CleanupStack::Pop(dlg);
	return answer ? 1 : 0;
}
Exemple #2
0
int CAppView::TextBox(const TDesC& title, const TDesC& inText, TDes& outText, int constraints) {
	int resourceId;
	int type = constraints & 0xFFF;
	switch(type) {
	case MA_TB_TYPE_ANY:
		resourceId = R_TEXTBOX_QUERY;
		break;
	case MA_TB_TYPE_EMAILADDR:
	case MA_TB_TYPE_NUMERIC:
	case MA_TB_TYPE_PHONENUMBER:
	case MA_TB_TYPE_URL:
	case MA_TB_TYPE_DECIMAL:
	case MA_TB_TYPE_SINGLE_LINE:
		resourceId = R_TEXTBOX_QUERY_SINGLE_LINE;
		break;
	default:
		return MA_TB_RES_TYPE_UNAVAILABLE;
	}

	if(iEngine->IsDrawing())
		iEngine->StopDrawing();

	outText.Copy(inText);
	CAknTextQueryDialog* dlg = new (ELeave) CMyAknTextQueryDialog(outText);
	CleanupStack::PushL(dlg);
	dlg->SetPromptL(title);
	dlg->SetMaxLength(outText.MaxLength());

	if(type == MA_TB_TYPE_NUMERIC || type == MA_TB_TYPE_PHONENUMBER || type == MA_TB_TYPE_DECIMAL)
		dlg->SetDefaultInputMode(EAknEditorNumericInputMode);

	bool predict = (constraints & (MA_TB_FLAG_PASSWORD | MA_TB_FLAG_SENSITIVE |
		MA_TB_FLAG_NON_PREDICTIVE)) == 0;
	if(!(type == MA_TB_TYPE_ANY || type == MA_TB_TYPE_SINGLE_LINE))
		predict = false;
	dlg->SetPredictiveTextInputPermitted(predict);

	TBool answer = dlg->ExecuteLD(resourceId);
	CleanupStack::Pop(dlg);
	return answer ? 1 : 0;
}
Exemple #3
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 CEmTubeSearchView::HandleCommandL( TInt aCommand )
	{
	TInt which = CurrentToActual();

	switch(aCommand)
		{
		case EMTVSendViaBluetoothCommand:
			{
			CSendUi* sendUi = CSendUi::NewLC();
			CMessageData* mdata = CMessageData::NewLC();
			mdata->AppendAttachmentL( iAppUi->SearchEntries()[ which ]->SavedFileName() );
			sendUi->CreateAndSendMessageL( KSenduiMtmBtUid, mdata );
			CleanupStack::PopAndDestroy( mdata );
			CleanupStack::PopAndDestroy( sendUi );
			}
		break;

		case EMTVSearchViewDownloadCommand:
			{
//			iAppUi->CancelDownloadImageL();
			iContainer->DownloadL( );
			}
		break;

		case EMTVAddToPlaylistCommand:
			{
			RArray<TInt> indices;
			CleanupClosePushL( indices );
			CAknSinglePopupMenuStyleListBox* plist = new(ELeave) CAknSinglePopupMenuStyleListBox;
			CleanupStack::PushL(plist);

		    CAknPopupList* popupList = CAknPopupList::NewL( plist, R_AVKON_SOFTKEYS_MENU_LIST, AknPopupLayouts::EPopupSNotePopupWindow);
		    CleanupStack::PushL(popupList);

		    plist->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
		    plist->CreateScrollBarFrameL(ETrue);
		    plist->ScrollBarFrame()->SetScrollBarVisibilityL(
		                               CEikScrollBarFrame::EOff,
		                               CEikScrollBarFrame::EAuto);

		    MDesCArray* itemList = plist->Model()->ItemTextArray();
		    CDesCArray* items = (CDesCArray*) itemList;

		    popupList->SetTitleL( KNullDesC() );

		    HBufC* txt = StringLoader::LoadLC( R_PLAYLIST_CREATE_NEW_TXT );
		    indices.Append( -1 );
		    items->AppendL( *txt );
		    CleanupStack::PopAndDestroy( txt );

		    TInt count = iManager->PlaylistsCount();
			for(TInt i=0;i<count;i++)
				{
				CEmTubePlaylist* pl = iManager->Playlist( i );
				if( pl->Editable() )
					{
					indices.Append( i );
			    	items->AppendL( pl->Name() );
					}
			    }

		    TInt popupOk = popupList->ExecuteLD();
		    if(popupOk)
		        {
		        TInt idx = indices[ plist->CurrentItemIndex() ];
				if( idx == -1 )
		        	{
					TBuf<64> name;
					CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog( name, CAknQueryDialog::ENoTone );
					dlg->SetPredictiveTextInputPermitted( ETrue );
					TInt ret = dlg->ExecuteLD( R_EMTV_ADD_PLAYLIST_DIALOG );
					if( ret )
						{
						iManager->AddPlaylistL( name, CEmTubePlaylist::EPlaylistUserDefined );
						idx = iManager->PlaylistsCount() - 1;
						}
		        	}

				if( idx >= 0 )
					{
					CEmTubePlaylist* pl = iManager->Playlist( idx );
					CVideoEntry* e = iAppUi->SearchEntries()[ which ];
					if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySearchEntries ||
							iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplayFavEntries )
						pl->AddEntryL( e->Url(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryRemote );
					else
						pl->AddEntryL( e->SavedFileName(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryLocal );
					}
		        }
		    CleanupStack::Pop( popupList );
		    CleanupStack::PopAndDestroy( plist );
		    CleanupStack::PopAndDestroy( &indices );
			}
		break;

		case EMTVSearchViewAddToFCommand:
			{
			iContainer->AddCurrentItemToFavsL();
			}
		break;

		case EMTVSearchViewRemoveFromFCommand:
			{
			iContainer->RemoveCurrentItemFromFavsL();
			}
		break;

		case EMTVSearchCommand:
			{
			if( iAppUi->SearchDialogL() )
				{
// TODO: when displaying featured (for example), new search (from menu) - change navi pane text
//				if(no tabs, one plugin)
//					iContainer->SetNaviPaneTextL();

				StartProgressBarL( EFalse );
				}
			}
		break;

		case EMTVSearchViewPlayCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySavedEntries )
					iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ]->SavedFileName(), iAppUi->SearchEntries()[ which ]->MediaTitle() );
				else
					iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ] );
				}
			}
		break;

		case EMTVDeleteClipCommand:
			{
			iContainer->DeleteSavedClipL();
			}
		break;

		case EMTVRenameClipCommand:
			{
			iContainer->RenameSavedClipL();
			}
		break;

		case EMTVShowRelatedCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				CVideoEntry* e = iAppUi->SearchEntries()[ which ];
				iAppUi->SearchString().Copy( e->RelatedUrl() );
				StartProgressBarL( EFalse );
				iAppUi->ClearSearchResults();
				iAppUi->SearchL( ERelatedClips, ERelevance, EPeriodIrrelevant );
				}
			}
		break;

		case EMTVShowUserCommand:
			{
			if( which != KErrNotFound )
				{
				iAppUi->CancelDownloadImageL();
				CVideoEntry* e = iAppUi->SearchEntries()[ which ];
				iAppUi->SearchString().Copy( e->AuthorVideosUrl() );
				StartProgressBarL( EFalse );
				iAppUi->ClearSearchResults();
				iAppUi->SearchL( EUserClips, EUpdated, EPeriodIrrelevant );
				}
			}
		break;

		case EMTVSearchViewDetailsCommand:
			{
			iContainer->ShowToolbar( EFalse );
			CEmTubeDetailsDialog::RunDialogL( iAppUi->SearchEntries()[ which ] );
			iContainer->ShowToolbar( ETrue );
			}
		break;

		case EMTVSearchViewBackCommand:
			{
			iContainer->ClearToolbar();
			iAppUi->CancelDownloadImageL();
			iAppUi->HandleCommandL( EMTVActivateMainViewCommand );
			}
		break;

		case EMTVProgressDialogCancel:
			{
			iAppUi->CancelDownloadImageL();
			if( iAppUi->SearchEntries().Count() )
				iContainer->CancelProgressL();
			else
				iAppUi->HandleCommandL( EMTVActivateMainViewCommand );
			}
		break;

		default:
			{
			iAppUi->HandleCommandL(aCommand);
			}
		break;
		}
	}