// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCAknMessageQueryControlCaseL()
// ( menu item -4- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCAknMessageQueryControlCaseL()
    {
    CAknMessageQueryDialog* msgQueryDlg =
    CAknMessageQueryDialog::NewL( ( TDesC& )KTitle, CAknQueryDialog::ENoTone );
    CleanupStack::PushL( msgQueryDlg );
    _LIT( KTxtCAknMessageQueryDialog, "CAknMessageQueryDialog::NewL" );
    AssertNotNullL( msgQueryDlg, KTxtCAknMessageQueryDialog );

    msgQueryDlg->PrepareLC( R_BCTESTMIX50_EIKDIALOG );
    _LIT( KTxtPrepareLC, "CAknMessageQueryDialog::PrepareLC" );
    AssertTrueL( ETrue, KTxtPrepareLC );

    CAknMessageQueryControl* msgCtrl = static_cast< CAknMessageQueryControl* >
                        ( msgQueryDlg->Control( EAknMessageQueryContentId ) );
    _LIT( KTxtCAknMessageQueryControl,
          "CAknMessageQueryControl static_cast< CAknMessageQueryControl* >" );
    AssertNotNullL( msgCtrl, KTxtCAknMessageQueryControl );

    msgCtrl->LinkHighLighted();
    _LIT( KTxtLinkHighLighted, "CAknMessageQueryControl::LinkHighLighted" );
    AssertTrueL( ETrue, KTxtLinkHighLighted );

    CleanupStack::Pop( );   // PrepareLC
    CleanupStack::PopAndDestroy( msgQueryDlg );
    }
Example #2
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;
            }
        };
    }
void CYBrowserFileHandler1::HandleCommandL(TInt aCommand)
{
	switch (aCommand)
    { 
    case EAbout:
    	{
    		HBufC* Abbout = KtxAbbout().AllocLC();
			TPtr Pointter(Abbout->Des());
			CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
			dlg->PrepareLC(R_ABOUT_HEADING_PANE);
			dlg->SetHeaderTextL(KtxApplicationName);  
			dlg->RunLD();
			
			CleanupStack::PopAndDestroy(Abbout);
    	}
    	break;
    case EBacktoYBrowser:
    	if(iFileHandlerUtils)
    	{
    		iFileHandlerUtils->HandleExitL(this,MYBrowserFileHandlerUtils::ENoChangesMade);	
    	}
    	break; 
	default:
		break;
    };
}
	void DeleteItemL() {
		TInt idx=ListBox()->CurrentItemIndex();

		auto_ptr<HBufC> message(HBufC::NewL(256));
		message->Des()=_L("Really delete ");
		MListBoxModel* lbmodel=ListBox()->Model();
		CAknFilteredTextListBoxModel* model = STATIC_CAST( CAknFilteredTextListBoxModel*, lbmodel);

		TPtrC item=model->ItemText( idx );
		message->Des().Append( item.Mid(2) );
		message->Des().Append(_L("?"));

		{
			TPtrC16 m=message->Des();
			CAknMessageQueryDialog * dlg = CAknMessageQueryDialog::NewL(m);
			CleanupStack::PushL(dlg);
			dlg->PrepareLC(R_CONFIRMATION_QUERY);
			dlg->QueryHeading()->SetTextL(_L("Delete?"));
			CleanupStack::Pop(dlg);
			
			if ( dlg->RunLD() )
			{
				TInt realidx=model->Filter()->FilteredItemIndex(idx);
				iTagStorage->DeleteItemL(realidx);
				ListBox()->HandleItemRemovalL();
			}
		}	
	}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMgAppUi::HandleCommandL(TInt aCommand)
    {
    switch (aCommand)
    {
    case EChangeLayout:
    	#ifdef __SERIES60_3X__
    	{
    		if(Orientation() == EAppUiOrientationLandscape)
    		{
    			SetOrientationL(EAppUiOrientationPortrait);	
    		}
    		else
    		{
    			SetOrientationL(EAppUiOrientationLandscape);
    		}
    	}
    	#else

		#endif
    	break;

    case EAbout:
		{	
		#ifdef __SERIES60_3X__		
			HBufC* Abbout = KtxAboutText().AllocLC();
			TPtr Pointter(Abbout->Des());
			
			CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
			dlg->PrepareLC(R_ABOUT_HEADING_PANE);
			dlg->SetHeaderTextL(_L("About"));  
			dlg->RunLD();
				
			CleanupStack::PopAndDestroy(1);//,Abbout
		#else
		
		#endif
		}
    	break;
    case EClose:
    	{
    		// splash screen do nothing..
    	}
    	break;
#ifdef __SERIES60_3X__
    case EAknSoftkeyExit:
#endif
//    case EEikCmdExit:
		Exit();
        break;
    default:
    	if(iMainContainer)
    	{
    		iMainContainer->HandleViewCommandL(aCommand);
    	}
        break;
        }
    }
 /*
  * Save Form data, function to be executed when save option is selected. 
  * Creates the second form which allows for selecting the category.
  */
 TBool CYPagesForm1::SaveFormDataL()
{  
    CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (ControlOrNull(EYPagesPopup));
 	if (popupFieldText) {		
		TInt categoryIndex = popupFieldText->CurrentValueIndex();
		TBuf <30> KMyTextFile;
		KMyTextFile.Format(_L("D:\\YPages\\%d%d.txt"), iColor, categoryIndex);
		
		RFs fileServer;
 	    User :: LeaveIfError (fileServer.Connect());
 	    RFile file;
 	    User::LeaveIfError(file.Open(fileServer, KMyTextFile, EFileRead|EFileStreamText));
 	    CleanupClosePushL(file);
 	    
 	    TFileText fileText;
 	    fileText.Set(file);
 	    
 	    TBuf<100> buffer;
 	    buffer = _L("");

 	    RBuf rBuf;
 	    rBuf.Create(buffer);
 	    rBuf.CleanupClosePushL();
 	    
 	  
 	    TInt err = KErrNone;
 	    while(err != KErrEof) {
 			err = fileText.Read(buffer);
 	    
 			if ((err != KErrNone) && (err != KErrEof)) {
 				User :: Leave(err);
 			}
 			if (KErrNone == err) {
 				rBuf.ReAllocL(rBuf.Length() + buffer.Length()+2);
 				rBuf.Append(buffer);
 				rBuf.Append(_L("\n"));
 			}
 	    }
 	    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(rBuf);
 	    dlg->PrepareLC(R_ABOUT_HEADING_PANE);
   	    dlg->SetHeaderTextL(_L(""));  
   	    dlg->RunLD();
 	    		     
 	    CleanupStack::PopAndDestroy(&rBuf);
 	    CleanupStack::PopAndDestroy(&file);
 	    
 	    fileServer.Close();

 	
 	}

        

 	return ETrue;
 }
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);
		}
	}
void CYBrowserFileHandler1::HandleCommandL(TInt aCommand)
{
	if(iDebugFile.SubSessionHandle())
	{	
		iDebugFile.Write(_L8("cmd, "));
	}
	
	switch (aCommand)
    { 
	case EPlugAppHelpBack:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;
		}
		SetMenuL();
		DrawNow();
		break;
	case EPlugAppHelp:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;    		
			iMyHelpContainer = CMyHelpContainer::NewL();
		}
		SetMenuL();
		DrawNow();    		
		break;
    case EPlugAbout:
    	{			
    		HBufC* Abbout = KMailAbbout().AllocLC();
			TPtr Pointter(Abbout->Des());
			CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
			dlg->PrepareLC(R_ABOUT_HEADING_PANE);
			dlg->SetHeaderTextL(KMailAbboutName);  
			dlg->RunLD();
			
			CleanupStack::PopAndDestroy(Abbout);
    	}
    	break;
    case EBacktoYBrowser:
    	if(iFileHandlerUtils)
    	{
    		iFileHandlerUtils->HandleExitL(this,MYBrowserFileHandlerUtils::EChangesMade);	
    	}
    	break; 
	default:
		if(iMailBoxContainer)
		{
			iMailBoxContainer->HandleViewCommandL(aCommand);
		}
		break;
    };
}
//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;
}
void CBuddycloudCommunitiesContainer::HandleCommandL(TInt aCommand) {
	if(aCommand == EMenuEditItemCommand) {
		HandleItemSelectionL(iList->CurrentItemIndex());
	}
	else if(aCommand == EMenuDeleteCommand) {
		CAknMessageQueryDialog* aDialog = new (ELeave) CAknMessageQueryDialog();

		if(aDialog->ExecuteLD(R_DELETE_DIALOG) != 0) {
			iBuddycloudLogic->GetDescSetting(ESettingItemTwitterUsername).Zero();
			iBuddycloudLogic->GetDescSetting(ESettingItemTwitterPassword).Zero();
			
			iBuddycloudLogic->SendCommunityCredentials(ECommunityTwitter);
		}
	}
}
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 CPhotoListView::StoreFolder()
{
	int answer;
	TInt Index;
	if(iFolderStatus>=0)
	{
		TInt compareflag;
	    TBuf<160> folderName;
	
	    folderName.FillZ();
		folderName.Zero();
		folderName.SetLength(0);
		CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL(folderName, CAknQueryDialog::ENoTone );
		answer=( dlg->ExecuteLD( R_FOLDER_NAME_QUERY ) ); // new folder name
		if(answer)
		{
			iFolderStatus=0;			
			
			compareflag=iPhotosAppUi->CheckAndSaveFolderToDB(folderName);
	
			if(compareflag!=1)
			{
				comment.Copy(folderName);
				iNewFolder = 1;
				ReadandSendData();
			}
			else
			{
				CDesCArray* folderexist = iPhotosAppUi->FolderExist();
				//CEikonEnv::Static ()->AlertWin (folderexist->MdcaPoint(0)) ;
				TBuf<100> msg;
				msg.Copy(folderexist->MdcaPoint(0));
				CAknMessageQueryDialog* verdlg = CAknMessageQueryDialog::NewL(msg);	
				verdlg->PrepareLC(R_ABOUT_QUERY);
				verdlg->RunLD();				
				folderexist->Reset();
			}
		}
		else
		{
			Index=0;				
			iFolderStatus=0;
			iPublic_Photo=EFalse;

		}
	}
}	
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);
		}
	}
}
Example #15
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 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 #17
0
TBool CMLauncherAppUi::DisplayQueryOrNoteL(TMsgType aMsgType,TInt aTextResource,TInt aHeaderResource/*=-1*/,TInt aDlgResource/*=-1*/)
{
	switch(aMsgType)
	{
	case EMsgNotePersistent:aMsgType=EMsgBigNote;aHeaderResource=R_NOTE_HEADER;break;
	case EMsgWarningPersistent:aMsgType=EMsgBigNote;aHeaderResource=R_WARNING_HEADER;break;
	case EMsgErrorPersistent:aMsgType=EMsgBigNote;aHeaderResource=R_ERROR_HEADER;break;
	default:break; //to avoid a warning
	};
	
	switch(aMsgType)
	{
	case EMsgQueryYesNo:
	{
		CAknQueryDialog *dlgQuery=CAknQueryDialog::NewL();
		CleanupStack::PushL(dlgQuery);
		HBufC* queryPrompt=StringLoader::LoadLC(aTextResource);
		dlgQuery->SetPromptL(*queryPrompt);
		CleanupStack::PopAndDestroy(queryPrompt);
		CleanupStack::Pop(dlgQuery);
		return dlgQuery->ExecuteLD(R_QUERY_CONFIRMATION);
	};break;
	case EMsgBigNote:
	{
		HBufC* text=StringLoader::LoadLC(aTextResource);
		HBufC* header=StringLoader::LoadLC(aHeaderResource);
		CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(text,header);//takes ownership of text and header
		CleanupStack::Pop(2,text);
		if(aDlgResource<=0)aDlgResource=R_MSG_BIG_NOTE;
		dlg->ExecuteLD(aDlgResource);
	};break;
	
	default:
		Panic(EUnrecognizedMsgType);
	};//switch
	return EFalse; //so that we do not get a warning
}
Example #18
0
void CAppUi::HandleCommandL(TInt aCommand)
{
  switch (aCommand)
  {
    case EEikCmdExit:
      {
        TBuf < 15 > password;
        CAknTextQueryDialog *Dialog = CAknTextQueryDialog::NewL(password,
          CAknQueryDialog::ENoTone);
        Dialog->PrepareLC(R_ASK_PWD);
        Dialog->RunLD();

        TBuf < 20 > buf;
        buf.Copy(KPassword);

        if (password == buf)
        {
          Exit();
        }
        break;
      }
    case ESamCmdAbout:
      {
        TBuf < 1024 > msgAbout = _L(
          "mauru ~ a www.tumunu.com project\r\nBy Cleave Pokotea");

        CAknMessageQueryDialog *dlgAbout = CAknMessageQueryDialog::NewL
          (msgAbout);
        dlgAbout->PrepareLC(R_MAURU_ABOUT);
        dlgAbout->QueryHeading()->SetTextL(_L("About mauru"));
        dlgAbout->RunLD();
        break;
      }
    default:
      break;
  }
}
Example #19
0
TInt CMLauncherAppUi::IdleWorker()
{
	//LOG(ELogGeneral,1,"CMLauncherAppUi::IdleWorker: start");
	TInt otherJobs(EFalse);
	//TInt err(0);
	
	if(iMusicPlayerView && iCurrentView==iMusicPlayerView && iMusicPlayerView->IsImgProcessingOngoing())
	{
		iMusicPlayerView->iFlags|=CMusicPlayerView::EReactivateCIdleAfterImgProcessingEnds;
		iIdle->Cancel();
		LOG0("CMLauncherAppUi::IdleWorker: end (cancelled because ImgEngine is active!)");
		return 0; //no more work to do
	}
	iJobs|=EDoingJobs; //this is so that we do not re-schedule the CIdle AO during some job
	
	if(iJobs&EJobDisplayMessage)
	{
		LOG0("CMLauncherAppUi::IdleWorker: Displaying msg ...");
		//we have to display a message
		if(iDlgMsg)
		{
			CAknMessageQueryDialog *dlgMsg=iDlgMsg;
			iDlgMsg=NULL;
			dlgMsg->ExecuteLD(R_MESSAGE_DLG_OK_EMPTY);
		};

		if(iDlgNote)
		{
			CAknResourceNoteDialog *dlgNote=iDlgNote;
			iDlgNote=NULL;
			dlgNote->ExecuteLD(*iDlgNoteString);
			delete iDlgNoteString;
			iDlgNoteString=NULL;
		};
		iJobs&=~EJobDisplayMessage;
		LOG0("Displaying msg done!");
	}
	else if(iJobs&EJobClean)
	{
		LOG0("CMLauncherAppUi::IdleWorker: Cleaning ...");
		//we have to clean the Comm stuff
		CCommSender::DeleteInstance();
		if(iFlags&EDeleteBtKeepListening)
			CCommReceiver::GetInstanceL()->Clean(ETrue);
		else
			CCommReceiver::DeleteInstance();
		iJobs&=~EJobClean;
		LOG0("Cleaning done!");
	}
	else if(iMusicPlayerView && iCurrentView==iMusicPlayerView && iMusicPlayerView->iJobs)
		otherJobs|=iMusicPlayerView->IdleWorker();
	else if(iListView && iCurrentView==iListView && iListView->iJobs)
		otherJobs|=iListView->IdleWorker();
	else if(iJobs & EJobSubfolders)
	{
		//LOG0("CMLauncherAppUi::IdleWorker:  subfolders"); 
		__ASSERT_ALWAYS(MyDoc().iFilesTree->iCurrentParent,Panic(ECurrentParentIsNull));
		TBool update(EFalse);
		if(iIi==-1)
			iIi=0; //we are just started
		if(iIi<MyDoc().iFilesTree->iCurrentParent->ChildrenCount())
		{
			if(MyDoc().iFilesTree->MakeChildren(&(*MyDoc().iFilesTree->iCurrentParent->iChildren)[iIi]))
			{
				iFlags|=EListViewNeedsUpdatingProperties;
				//LOG0("Subfolder job: created some children"); 
			}
			iIi++;
			//update the view from time to time
			if((iFlags&EListViewNeedsUpdatingProperties) && !(iIi % KItemsUpdateView))
				update=ETrue;
		}
		else
		{
			//we are finishing
			iIi=-1;
			iJobs-=EJobSubfolders;
			if(iFlags&EListViewNeedsUpdatingProperties)
			{
				iFlags&=~EListViewNeedsUpdatingProperties;
				update=ETrue;
			};
		};
		if(update && iListView)
			iListView->CurrentListChanged(CFFListView::EProperties);
	}
	else if(iJobs & EJobStartDiscoveringSourcesAndParsingMetadata)
	{
		if(MyDoc().iPreferences->iCFlags&CMLauncherPreferences::ENoPreferencesFileFound)
		{
			HBufC* text(NULL);
#ifdef __TOUCH_ENABLED__
			if(AknLayoutUtils::PenEnabled())
				text=StringLoader::LoadLC(R_FFLIST_HELP_TEXT_TOUCH);
			else
#endif
				text=StringLoader::LoadLC(R_FFLIST_HELP_TEXT_NONTOUCH);

			HBufC* header=StringLoader::LoadLC(R_FFLIST_HELP_HEADER);
			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(text,header);//takes ownership of text and header
			CleanupStack::Pop(2,text);
			dlg->ExecuteLD(R_MSG_BIG_NOTE_NOWAIT);			
		}
		else if(MyDoc().iPreferences->iStartingDirs.Count()==0)
		{
			//there are preferences, but there is no source folder. We will try to discover them.

			//verific daca iPreferences->iSources.Count() e zero, si daca e pun o nota in care sa zic
			//ca se cauta sursele. Schimb si nota de deasupra, ca sa se intample ceva in background


		}
		//set the empty text to "searching for music", or something like that..
		MyDoc().iPreferences->iCFlags|=CMLauncherPreferences::EMusicSearchInProgress;
		if(iListView && iListView->iListContainer)
			iListView->iListContainer->SetListEmptyTextL();
		iJobs-=EJobStartDiscoveringSourcesAndParsingMetadata;
		iJobs|=EJobDiscoverSourcesAndParseMetadata;
		LOG0("EJobStartDiscoveringSourcesAndParsingMetadata->EJobDiscoverSourcesAndParseMetadata")
	}
	else if(iJobs & EJobDiscoverSourcesAndParseMetadata)
Example #20
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 #22
0
void CCrashContainer::HandleCommandL(TInt aCommand)
{	
	switch (aCommand)
    { 
	case EAppHelpBack:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;
		}
		SetMenuL();
		DrawNow();
		break;
	case EAppHelp:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;    		
			iMyHelpContainer = CMyHelpContainer::NewL();
		}
		SetMenuL();
		DrawNow();    		
		break;      
    case EItemInfo:
		if(iSelectionBox)
		{
			TInt CurrInd = iSelectionBox->CurrentItemIndex();
			if(CurrInd >= 0 && CurrInd <= iArray.Count())
			{
				if(iArray[CurrInd])
				{
		    		HBufC* Informmm = HBufC::NewLC(3000);
		    		
		    		TPtr Pointter(Informmm->Des());
		    		GetInfoBufferL(*iArray[CurrInd],Pointter);
		    		
					TPtr NewPointter(Informmm->Des());
					CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(NewPointter);
					dlg->PrepareLC(R_ABOUT_HEADING_PANE);
					dlg->SetHeaderTextL(KCrashApplicationName);  
					dlg->RunLD();
					
					CleanupStack::PopAndDestroy(Informmm);
		    	}
			}
		}
    	break;
    case ESetMeOn:
    	{
    		iServerIsOn = ETrue;
    		RExampleServerClient CrashClient;
			CrashClient.Connect();
			CrashClient.Close();
			
			ChangeIconAndNameL();
    	}
    	break;
	case ESetMeOff:
		{
			iServerIsOn = EFalse;
    		RExampleServerClient CrashClient;
			CrashClient.Connect();
			CrashClient.ShutServerDownNow();
			CrashClient.Close();
			
			ChangeIconAndNameL();
    	}
    	break;
	case EClearMe:
		{
			CAknQueryDialog* dlg = CAknQueryDialog::NewL();
			if(dlg->ExecuteLD(R_QUERY,_L("Clear list")))
			{
	    		RExampleServerClient CrashClient;
				CrashClient.Connect();
				CrashClient.ClearItemList();

				if(!iServerIsOn)
				{
					CrashClient.ShutServerDownNow();
				}

				CrashClient.Close();
				
				DisplayListBoxL();
				DisplayListBoxL();
			}
    	}
		DrawNow();
    	break;
    case EHideKill0:
    	{
    		iHideKill0 = ETrue;
    		DisplayListBoxL();
    		DisplayListBoxL();
    	}
    	DrawNow();
    	break;
	case EShowKill0:
    	{
    		iHideKill0 = EFalse;
    		DisplayListBoxL();
    		DisplayListBoxL();
    	}
    	DrawNow();
    	break;
	case EResetMe:
		{
    		DisplayListBoxL();
    	}
    	break;
    case EAbout:
    	{
    		HBufC* Abbout = KCrashAbbout().AllocLC();
			TPtr Pointter(Abbout->Des());
			CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
			dlg->PrepareLC(R_ABOUT_HEADING_PANE);
			dlg->SetHeaderTextL(KCrashApplicationName);  
			dlg->RunLD();
			
			CleanupStack::PopAndDestroy(Abbout);
    	}
    	break;
    case EBacktoYTasks:
    	if(iTasksHandlerExit)
    	{
    		if(!iServerIsOn)
    		{
    			CAknQueryDialog* dlg = CAknQueryDialog::NewL();
				if(dlg->ExecuteLD(R_QUERY,_L("Set Crash monitor on")))
				{
					RExampleServerClient CrashClient;
					CrashClient.Connect();
					CrashClient.Close();
				}
    		}
    	
    		iTasksHandlerExit->HandlerExitL(this);	
    	}
    	break; 
	default:
		break;
    };
}
Example #23
0
// ----------------------------------------------------
// CMobileOfficeAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CMobileOfficeAppUi::HandleCommandL(TInt aCommand)
{
		CheckDemo();
	
		switch ( aCommand )
        {
		case EAknSoftkeyExit:
		case EEikCmdExit:	
            {
				if (iDoorObserver)
					iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges );
				#ifndef FREEVERSION
					licMan.End();
				#endif
				Exit();
				break;
            }
        case EMobileOfficeCmdAppAbout:
            {
			
				HBufC* messageText = StringLoader::LoadLC( R_MOBILESEARCH_ABOUT );
				
				/*
				TBuf<500> nein;
				nein.Copy(*messageText);
				nein.Append(_L("\r\n"));
				nein.Append(_L("\r\n"));
				nein.Append(_L("Application: 1.1"));
				nein.Append(_L("\r\n"));
				*/
				CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *messageText );
				dlg->PrepareLC(R_MESSAGE_QUERY);
				HBufC* aboutTitleText = StringLoader::LoadLC( R_MOBILESEARCH_ABOUTTITLE );	
				dlg->QueryHeading()->SetTextL( *aboutTitleText );
				CleanupStack::PopAndDestroy( aboutTitleText );
				dlg->RunLD();
				CleanupStack::PopAndDestroy( messageText );
				break;
            }
		case EMobileOfficeCmdOpen:
            {
				TUid viewID = KEditorViewViewId;	
				ActivateLocalViewL(viewID);
				//SendFileL(iOpenDocument->Filename());

				
				break;
			
			}
	
		case EMobileOfficeCmdList:
            {
				TUid viewID = KViewId;
				ActivateLocalViewL(viewID);
				break;
			
			}
	
		case EMobileOfficeCmdProp:
            {
				TUid viewID = KView2Id;
				ActivateLocalViewL(viewID);
				break;
			
			}
	#ifndef FREEVERSION
		case EMobileOfficeCmdRegister:
			{
				Register();	
				break;		
			}
	#endif
		case EMobileOfficeCmdPicture:
            {
				TUid viewID = KViewImageViewId;
				ActivateLocalViewL(viewID);
				break;
			
			}
		case EMobileOfficeCmdNewText:
			{
				TUid viewID = KEditorViewViewId;	
				OpenDocument()->SetNextViewID(viewID);
				OpenDocument()->SetEditable(ETrue);
				ActivateLocalViewL(viewID);
				break;
			}
		case EMobileOfficeCmdBack:
            {
			
				ActivateLocalViewL(OpenDocument()->NextViewID());
				break;
			
			}
		case EMobileOfficeCmdHelp:
			{
				CArrayFix<TCoeHelpContext>* buf = AppHelpContextL();
				HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
			}
        default:
            break;      
        }
    }
Example #24
0
/*
-----------------------------------------------------------------------
-----------------------------------------------------------------------
*/
TBool CMgAppUi::ShowDisclaimerL(void)
{
	TBool OkToContinue(EFalse);

	if(KAppIsTrial){
        TFindFile AppFile(CCoeEnv::Static()->FsSession());
        if(KErrNone != AppFile.FindByDir(KtxDisclaimerFileName, KNullDesC))
        {
            HBufC* Abbout = KtxDisclaimer().AllocLC();
            TPtr Pointter(Abbout->Des());
            CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
            dlg->PrepareLC(R_DDD_HEADING_PANE);
            dlg->SetHeaderTextL(KtxDisclaimerTitle);  
            if(dlg->RunLD())
            {
                TFileName ShortFil;
                if(KErrNone ==CCoeEnv::Static()->FsSession().PrivatePath(ShortFil))
                {
                    TFindFile privFile(CCoeEnv::Static()->FsSession());
                    if(KErrNone == privFile.FindByDir(ShortFil, KNullDesC))
                    {
                        TParsePtrC hjelp(privFile.File());
                        ShortFil.Copy(hjelp.Drive());
                        ShortFil.Append(KtxDisclaimerFileName);
                    }
                }
    
            
                BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),ShortFil);
            
                RFile MyFile;
                if(KErrNone == MyFile.Create(CCoeEnv::Static()->FsSession(),ShortFil,EFileWrite))
                {
                    TTime NowTime;
                    NowTime.HomeTime();
                    
                    TBuf8<255> InfoLine;
                    InfoLine.Copy(_L8("Accepted on Date\t"));
                        
                    InfoLine.AppendNum(NowTime.DateTime().Day() + 1);
                    InfoLine.Append(_L8("."));
                    InfoLine.AppendNum((NowTime.DateTime().Month() + 1));
                    InfoLine.Append(_L8("."));
                    InfoLine.AppendNum(NowTime.DateTime().Year());
                    InfoLine.Append(_L8(" "));
                    InfoLine.Append(_L8("--"));
                    InfoLine.AppendNum(NowTime.DateTime().Hour());
                    InfoLine.Append(_L8(":"));		
                    TInt HelperInt = NowTime.DateTime().Minute();
                    if(HelperInt < 10)
                        InfoLine.AppendNum(0);
                    InfoLine.AppendNum(HelperInt);
                    InfoLine.Append(_L8(":"));
                    HelperInt = NowTime.DateTime().Second();
                    if(HelperInt < 10)
                        InfoLine.AppendNum(0);
                    InfoLine.AppendNum(HelperInt);
                    InfoLine.Append(_L8(" "));
                    
                    MyFile.Write(InfoLine);
                    MyFile.Close();
                }
                
                OkToContinue = ETrue;
            }
            
            CleanupStack::PopAndDestroy(Abbout);
        }
        else
        {
            OkToContinue = ETrue;
        }
	}
    else
    {
        OkToContinue = ETrue;
    }
	
	return OkToContinue;
}
Example #25
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 #27
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;
    }
}
Example #28
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMgAppUi::HandleCommandL(TInt aCommand)
    {
    switch (aCommand)
    {
    case EVisitDrJukka:
    	{
			OpenMobileWEBSiteL(this);
    	}
    	break;
    case EAbout:
		{
            HBufC* Abbout(NULL);
            
            if(KAppIsTrial)
                Abbout = KtxAboutText2().AllocLC();
            else
                Abbout = KtxAboutText1().AllocLC();
            
			TPtr Pointter(Abbout->Des());
		
		    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter); 
		    dlg->PrepareLC(R_AVKON_MESSAGE_QUERY_DIALOG);
		    dlg->QueryHeading()->SetTextL(KtxtApplicationName());
		    
		    TCallBack callback1(OpenMobileWEBSiteL);
		    dlg->SetLink(callback1);
		    dlg->SetLinkTextL(KMobileJukkaLink);

		    dlg->RunLD();
			
			CleanupStack::PopAndDestroy(Abbout);
		}
    	break;
    case EClose2:
    	if(iTimeOutTimer)
    	{
    		iTimeOutTimer->Cancel();
    		TimerExpired();
    	}
    	break;
    case EClose:
    case EAknSoftkeyExit:
    case EEikCmdExit:
    	if(iMainContainer)
		{
			TRAPD(Errr,iMainContainer->SaveValuesL());
		
			RemoveFromStack(iMainContainer);
			// will close the DB...	  
			delete iMainContainer;
			iMainContainer = NULL;
		}
		TRAPD(Errr,DoExitChecksNowL());
    	Exit();
        break;
    case EQuickExit:     
        Exit();
        break;        
    default:
    	if(iMainContainer)
    		iMainContainer->HandleViewCommandL(aCommand);
        break;
        }
    }
void CContextContactsDetailView::HandleCommandL(TInt aCommand)
{   
	CALLSTACKITEM_N(_CL("CContextContactsDetailView"), _CL("HandleCommandL"));


	switch ( aCommand )
        {
		case EAknSoftkeyBack:
		{
			ActivateParentViewL();
			break;
		}
		case EContextContactsCmdCreateSms:
		{
			if ( iContainer->IsCurrentPhoneNumber() )
			{
				TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() );
				CDesCArrayFlat* recip=new CDesCArrayFlat(1);
				CleanupStack::PushL(recip);
				CDesCArrayFlat* alias=new CDesCArrayFlat(1);
				CleanupStack::PushL(alias);
				recip->AppendL(no);
				alias->AppendL( *(iItem->GetContactTitleL()) );
				aPhoneHelper.send_sms(recip, alias);
				CleanupStack::PopAndDestroy(2); // recip, alias
			}
			else
			{
                                CPbkSmsAddressSelect* sel=new (ELeave) CPbkSmsAddressSelect();
#ifndef __S60V3__
				TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse));
#else
				TPtrC no(0, 0);
				CPbkSmsAddressSelect::TParams p(*iItem);
				TBool selected=sel->ExecuteLD(p);
				if (selected) {
					const TPbkContactItemField* f=p.SelectedField();
					if (f && f->StorageType()==KStorageTypeText) {
						no.Set(f->Text());
					}
				}
#endif

				if (no.Length()>0)
				{
					CDesCArrayFlat* recip=new CDesCArrayFlat(1);
					CleanupStack::PushL(recip);
					CDesCArrayFlat* alias=new CDesCArrayFlat(1);
					CleanupStack::PushL(alias);
					recip->AppendL(no);
					alias->AppendL( *(iItem->GetContactTitleL()) );
					aPhoneHelper.send_sms(recip, alias);
					CleanupStack::PopAndDestroy(2); // recip, alias
				}
			}			
			break;
		}
		case EContextContactsCmdCreateMms:
		{
			if ( (iContainer->IsCurrentMMS()) || (iContainer->IsCurrentPhoneNumber()) ) 
			{
				TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() );
				CDesCArrayFlat* recip=new CDesCArrayFlat(1);
				CleanupStack::PushL(recip);
				CDesCArrayFlat* alias=new CDesCArrayFlat(1);
				CleanupStack::PushL(alias);
				recip->AppendL(no);
				alias->AppendL(*(iItem->GetContactTitleL()));
				aPhoneHelper.send_mms(recip,alias);
				CleanupStack::PopAndDestroy(2); // recip, alias
			}
			else
			{
				CPbkMmsAddressSelect* sel=new (ELeave) CPbkMmsAddressSelect();
#ifndef __S60V3__
				TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse));
#else
				TPtrC no(0, 0);
				CPbkMmsAddressSelect::TParams p(*iItem);
				TBool selected=sel->ExecuteLD(p);
				if (selected) {
					const TPbkContactItemField* f=p.SelectedField();
					if (f && f->StorageType()==KStorageTypeText) {
						no.Set(f->Text());
					}
				}
#endif
				if ((no!=KNullDesC))
				{
					CDesCArrayFlat* recip=new CDesCArrayFlat(1);
					CleanupStack::PushL(recip);
					CDesCArrayFlat* alias=new CDesCArrayFlat(1);
					CleanupStack::PushL(alias);
					recip->AppendL(no);
					alias->AppendL(*(iItem->GetContactTitleL()));
					aPhoneHelper.send_mms(recip,alias);
					CleanupStack::PopAndDestroy(2); // recip,alias
				}
			}
			break;
		}
		case EContextContactsCmdCreateEmail:
		{
			if ( iContainer->IsCurrentMMS())
			{
				TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() );
				CDesCArrayFlat* recip=new CDesCArrayFlat(1);
				CleanupStack::PushL(recip);
				CDesCArrayFlat* alias=new CDesCArrayFlat(1);
				CleanupStack::PushL(alias);
				recip->AppendL(no);
				alias->AppendL(*(iItem->GetContactTitleL()));
				aPhoneHelper.send_email(recip,alias);
				CleanupStack::PopAndDestroy(2); // recip,alias
			}
			else
			{
				CPbkEmailAddressSelect* sel=new (ELeave) CPbkEmailAddressSelect();
#ifndef __S60V3__
				TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse));
#else
				TPtrC no(0, 0);
				CPbkEmailAddressSelect::TParams p(*iItem);
				TBool selected=sel->ExecuteLD(p);
				if (selected) {
					const TPbkContactItemField* f=p.SelectedField();
					if (f && f->StorageType()==KStorageTypeText) {
						no.Set(f->Text());
					}
				}
#endif
				if (no!=KNullDesC)
				{
					CDesCArrayFlat* recip=new CDesCArrayFlat(1);
					CleanupStack::PushL(recip);
					CDesCArrayFlat* alias=new CDesCArrayFlat(1);
					CleanupStack::PushL(alias);
					recip->AppendL(no);
					alias->AppendL(*(iItem->GetContactTitleL()));
					aPhoneHelper.send_email(recip, alias);
					CleanupStack::PopAndDestroy(2); // recip
				}
			}
			break;
		}
		case EContextContactsCmdCall:
		{
			if ( iContainer->IsCurrentPhoneNumber() )
			{
				TPtrC no( iItem->PbkFieldAt(iContainer->get_current_item_idx()).PbkFieldText() );
				aPhoneHelper.make_callL(no);
			}
			else
			{
				CPbkPhoneNumberSelect* sel=new (ELeave) CPbkPhoneNumberSelect();
#ifndef __S60V3__
				TPtrC no(sel->ExecuteLD(*iItem, NULL, EFalse));
#else
				TPtrC no(0, 0);
				CPbkPhoneNumberSelect::TParams p(*iItem);
				TBool selected=sel->ExecuteLD(p);
				if (selected) {
					const TPbkContactItemField* f=p.SelectedField();
					if (f && f->StorageType()==KStorageTypeText) {
						no.Set(f->Text());
					}
				}
#endif
				aPhoneHelper.make_callL(no);
			}
			break;
		}
		case EContextContactsCmdEdit:
		{
			aPhoneHelper.show_editor(iViewState->FocusedContactId(), false, iContainer->get_current_item_idx());
			Refresh();
			break;
		}
		case EContextContactsCmdDefaults:
		{
			CPbkContactItem * temp_item = pbkengine->OpenContactLCX(iViewState->FocusedContactId());
			CDefaultNumbersPopupList * popup = CDefaultNumbersPopupList::NewL(temp_item);
			CleanupStack::PushL(popup);
			popup->ExecuteLD();
			CleanupStack::Pop();//popup
			pbkengine->CommitContactL(*temp_item);
			CleanupStack::PopAndDestroy(2); // lock, temp_item

			Refresh();
			break;
		}
		case EContextContactsCmdGoToWeb:
		{
			TBuf<255> url;
			url.Copy(iContainer->GetWebAddress());
			if (url.Length() == 0) return;

			#ifndef __S60V3__
			// FIXME3RD
			#ifndef __WINS__
		
			#  ifndef __S60V2__

			auto_ptr<CDorisBrowserInterface> ido(CDorisBrowserInterface::NewL());
			ido->AppendL(CDorisBrowserInterface::EOpenURL_STRING, url);
			ido->ExecuteL();
		
			#  else
			HBufC8* addr8=HBufC8::NewLC(url.Length());
			TPtr8 addrp=addr8->Des();
			CC()->ConvertFromUnicode(addrp, url);
		
			TUid KUidOperaBrowserUid = {0x101F4DED};
			TUid KUidOperaRenderViewUid = {0};

			TVwsViewId viewId(KUidOperaBrowserUid, KUidOperaRenderViewUid);
		
			CVwsSessionWrapper* vws;
			vws=CVwsSessionWrapper::NewLC();
			vws->ActivateView(viewId, KUidOperaRenderViewUid, *addr8);
			CleanupStack::PopAndDestroy(2);
			#  endif

			#endif
			#endif
			break;
		}
		case EContextContactsCmdDelete:
		{
			//note: this isn't the behaviour of original contact app
			TInt idx = iContainer->get_current_item_idx();
			TInt id = iItem->PbkFieldAt(idx).PbkFieldId();
			TPbkContactItemField * field = iItem->FindField(id, idx);
			TInt length = field->Label().Length() + field->Text().Length() + 10;

			HBufC * header = CEikonEnv::Static()->AllocReadResourceL(R_DELETE);
			CleanupStack::PushL(header);
			HBufC * message= HBufC::NewL(length);
			CleanupStack::PushL(message);

			message->Des().Append(field->Label());
			message->Des().Append(_L(" ("));
			message->Des().Append(field->Text());
			message->Des().Append(_L(") ?"));

			CAknMessageQueryDialog * dlg = CAknMessageQueryDialog::NewL(*message);
			CleanupStack::PushL(dlg);
			dlg->PrepareLC(R_CONFIRMATION_QUERY);
			dlg->QueryHeading()->SetTextL(*header);
			CleanupStack::Pop(dlg);
			
			if ( dlg->RunLD() )
			{
				CPbkContactItem * temp_item = pbkengine->OpenContactLCX(iViewState->FocusedContactId());
				temp_item->RemoveField(iContainer->get_current_item_idx());
				pbkengine->CommitContactL(*temp_item);
				CleanupStack::PopAndDestroy(2);
			}
			CleanupStack::PopAndDestroy(2); //header, message
						
			Refresh();
			break;
		}
#ifdef __S60V3__
		case EContextContactsMenuMsgCurrent:
		case EContextContactsMenuMsg:
		{
			HandleCreateMessageL();
		}
			break;
#endif

		default:
		{
#ifndef __S60V3__
//FIXME3RD
			if (!iSendAppUi->CommandIsValidL(aCommand, TSendingCapabilities(0, 0, TSendingCapabilities::EAllMTMs)))
#endif
			{
				AppUi()->HandleCommandL( aCommand );
			}
#ifndef __S60V3__
			else
			{
				TUid mtm = iSendAppUi->MtmForCommand(aCommand);
				CArrayFixFlat<TInt> * c = new CArrayFixFlat<TInt>(1);
				CleanupStack::PushL(c);
				c->AppendL(iViewState->FocusedContactId());
				aPhoneHelper.send_as( mtm, c);
				CleanupStack::PopAndDestroy(1); // c
			}
#endif
			break;
		}
	}
}
Example #30
0
void CTraceContainer::HandleCommandL(TInt aCommand)
{	
	switch (aCommand)
    { 
	case EAppHelpBack:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;
		}
		SetMenuL();
		DrawNow();
		break;
	case EAppHelp:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;    		
			iMyHelpContainer = CMyHelpContainer::NewL();
		}
		SetMenuL();
		DrawNow();    		
		break;    
    case EItemInfo:
    	{
    /*		RExampleServerClient CrashClient;
			CrashClient.Connect();
			
			TExampleItem ItemBuffer;
			
			TFileName Bufferrr;
			TInt ItemCount(0);
			CrashClient.GetItemCount(ItemCount);
			for(TInt i=0; i < ItemCount; i++)
			{
				ItemBuffer.iIndex = i;
				CrashClient.GetItemL(ItemBuffer);	
				
				AddItemListL(ItemBuffer);
			}

			if(!iServerIsOn)
			{
				CrashClient.ShutServerDownNow();
			}

			CrashClient.Close();*/
    	}
    
    		
/*		if(iSelectionBox)
		{
			TInt CurrInd = iSelectionBox->CurrentItemIndex();
			if(CurrInd >= 0 && CurrInd <= iArray.Count())
			{
				if(iArray[CurrInd])
				{
		    		HBufC* Informmm = HBufC::NewLC(3000);
		    		
		    		TPtr Pointter(Informmm->Des());
		    		GetInfoBufferL(*iArray[CurrInd],Pointter);
		    		
					TPtr NewPointter(Informmm->Des());
					CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(NewPointter);
					dlg->PrepareLC(R_ABOUT_HEADING_PANE);
					dlg->SetHeaderTextL(KTraceApplicationName);  
					dlg->RunLD();
					
					CleanupStack::PopAndDestroy(Informmm);
		    	}
			}
		}*/
    	break;
    case ESettingsMe:
    	{
			iProfileSettings = new(ELeave)CProfileSettings();
			iProfileSettings->ConstructL();
    	}
    	SetMenuL();
    	DrawNow();
    	break;
    case ESettingsOk:
    	{
			if(iProfileSettings)
			{
				iProfileSettings->SaveValuesL();
				
			//	if(iServerIsOn)
				{
					RExampleServerClient CrashClient;
					CrashClient.Connect();
					CrashClient.ReReadSettings();
					CrashClient.Close();
				}
			}
    	
			delete iProfileSettings;
			iProfileSettings = NULL;
    	}
    	SetMenuL();
    	DrawNow();
    	break;
    case ESetMeOn:
    	{
    		iServerIsOn = ETrue;
    		RExampleServerClient CrashClient;
			CrashClient.Connect();
			
			CrashClient.StartTrace();
			
			CrashClient.Close();
			
			ChangeIconAndNameL();
			
			if(iTimeOutTimer)
			{
				iTimeOutTimer->Cancel();
			}
			else
			{
				iTimeOutTimer = CTimeOutTimer::NewL(EPriorityNormal,*this);
			}

			iTimeOutTimer->After(1000000);
    	}
    	break;
	case ESetMeOff:
		{
			iServerIsOn = EFalse;
    		RExampleServerClient CrashClient;
			CrashClient.Connect();
			CrashClient.ShutServerDownNow();
			CrashClient.Close();
			
			ChangeIconAndNameL();
			
			if(iTimeOutTimer)
			{
				iTimeOutTimer->Cancel();
			}
    	}
    	break;
	case EClearMe:
		{
			CAknQueryDialog* dlg = CAknQueryDialog::NewL();
			if(dlg->ExecuteLD(R_QUERY,_L("Clear list")))
			{
	    		RExampleServerClient CrashClient;
				CrashClient.Connect();
				CrashClient.ClearItemList();

				if(!iServerIsOn)
				{
					CrashClient.ShutServerDownNow();
				}
				else
				{	// re-start the trace
					CrashClient.StopTrace();
					CrashClient.StartTrace();
				}

				CrashClient.Close();
				
				iArray.ResetAndDestroy();
				// refresh info
			}
    	}
    	break;
	case EResetMe:
		{

				
    		// refresh info
    	}
    	break;
    case EAbout:
    	{
    		HBufC* Abbout = KTraceAbbout().AllocLC();
			TPtr Pointter(Abbout->Des());
			CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
			dlg->PrepareLC(R_ABOUT_HEADING_PANE);
			dlg->SetHeaderTextL(KTraceApplicationName);  
			dlg->RunLD();
			
			CleanupStack::PopAndDestroy(Abbout);
    	}
    	break;
    case EBacktoYTasks:
    	if(iTasksHandlerExit)
    	{
    		if(!iServerIsOn)
    		{
    			CAknQueryDialog* dlg = CAknQueryDialog::NewL();
				if(dlg->ExecuteLD(R_QUERY,_L("Set Trace on")))
				{
					RExampleServerClient CrashClient;
					CrashClient.Connect();
					CrashClient.Close();
				}
    		}
    	
    		iTasksHandlerExit->HandlerExitL(this);	
    	}
    	break; 
	default:
		break;
    };
}