filebrowser/engine/FBFileUtils.cpp
changeset 23 c9bf25a20c9f
parent 19 4b22a598b890
child 29 1c71b77fbc93
equal deleted inserted replaced
19:4b22a598b890 23:c9bf25a20c9f
   202     iTimer.Cancel();
   202     iTimer.Cancel();
   203 	}
   203 	}
   204 
   204 
   205 // --------------------------------------------------------------------------------------------
   205 // --------------------------------------------------------------------------------------------
   206 
   206 
   207 void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& /*aLabel*/)
   207 void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& aLabel)
   208     {
   208     {
   209     if (iCommandArray->Count() >= 2)
   209     if (iCommandArray->Count() >= 2)
   210         {
   210         {
   211         // init progress bar
   211         // init progress bar
   212 //        iProgressDialog = new(ELeave) CAknProgressDialog((reinterpret_cast<CEikDialog**>(&iProgressDialog)), ETrue);
   212 //        iProgressDialog = new(ELeave) CAknProgressDialog((reinterpret_cast<CEikDialog**>(&iProgressDialog)), ETrue);
   215 //        iProgressDialog->SetCurrentLabelL( EAknCtNote, aLabel );
   215 //        iProgressDialog->SetCurrentLabelL( EAknCtNote, aLabel );
   216 //        iProgressInfo = iProgressDialog->GetProgressInfoL();
   216 //        iProgressInfo = iProgressDialog->GetProgressInfoL();
   217 //        iProgressInfo->SetFinalValue( CommandArrayCount() );
   217 //        iProgressInfo->SetFinalValue( CommandArrayCount() );
   218 //        iProgressDialog->RunLD();
   218 //        iProgressDialog->RunLD();
   219 //        iProgressDialog->MakeVisible( ETrue );        
   219 //        iProgressDialog->MakeVisible( ETrue );        
       
   220         iEngine->FileBrowserUI()->ShowProgressDialog(aLabel, 0, CommandArrayCount());
       
   221         isProgressDialog = ETrue;
   220         }
   222         }
   221     else if (iCommandArray->Count() >= 1)
   223     else if (iCommandArray->Count() >= 1)
   222         {
   224         {
   223         // init wait dialog
   225         // init wait dialog
   224 //        iWaitDialog = new(ELeave) CAknWaitDialog((reinterpret_cast<CEikDialog**>(&iWaitDialog)), ETrue);
   226 //        iWaitDialog = new(ELeave) CAknWaitDialog((reinterpret_cast<CEikDialog**>(&iWaitDialog)), ETrue);
   225 //        iWaitDialog->SetCallback(this);
   227 //        iWaitDialog->SetCallback(this);
   226 //        iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE);
   228 //        iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE);
   227 //        iWaitDialog->SetTextL( aLabel );
   229 //        iWaitDialog->SetTextL( aLabel );
   228 //        iWaitDialog->RunLD();
   230 //        iWaitDialog->RunLD();
       
   231         iEngine->FileBrowserUI()->ShowWaitDialog(aLabel);
       
   232         isWaitDialog = ETrue;
   229         }
   233         }
   230     else
   234     else
   231         {
   235         {
   232         // no commands, just do nothing
   236         // no commands, just do nothing
   233         return;
   237         return;
   249     {
   253     {
   250     // make sure the engine isn't active, should never happen
   254     // make sure the engine isn't active, should never happen
   251     __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333));
   255     __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333));
   252 
   256 
   253     // execute a command after a very short delay (25ms)
   257     // execute a command after a very short delay (25ms)
       
   258     if (isWaitDialog)
       
   259         {
       
   260         iEngine->FileBrowserUI()->ProcessEvents();
       
   261         }
       
   262     if (isProgressDialog)
       
   263         {
       
   264         TInt newValue = iCurrentEntry;
       
   265         iEngine->FileBrowserUI()->SetProgressValue(newValue);
       
   266         }
   254     iTimer.After(iStatus, 25);
   267     iTimer.After(iStatus, 25);
   255     SetActive();
   268     SetActive();
   256     }
   269     }
   257 
   270 
   258 // --------------------------------------------------------------------------------------------
   271 // --------------------------------------------------------------------------------------------
   363         
   376         
   364         // deactive secure backup if it was activated by a file command
   377         // deactive secure backup if it was activated by a file command
   365         iFileOps->DeActivateSecureBackUpViaFileOp();
   378         iFileOps->DeActivateSecureBackUpViaFileOp();
   366 
   379 
   367         // dismiss any wait/progress dialogs        
   380         // dismiss any wait/progress dialogs        
       
   381         if (isWaitDialog)
       
   382             {
       
   383             iEngine->FileBrowserUI()->CancelWaitDialog();
       
   384             isWaitDialog = EFalse;
       
   385             }
       
   386         if (isProgressDialog)
       
   387             {
       
   388             iEngine->FileBrowserUI()->CancelProgressDialog();
       
   389             isProgressDialog = EFalse;
       
   390             }
   368 //        if (iWaitDialog)
   391 //        if (iWaitDialog)
   369 //            {
   392 //            {
   370 //            TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); 
   393 //            TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); 
   371 //            iWaitDialog = NULL;
   394 //            iWaitDialog = NULL;
   372 //            }
   395 //            }
   420             CleanupStack::PopAndDestroy();  //textResolver
   443             CleanupStack::PopAndDestroy();  //textResolver
   421             }
   444             }
   422 
   445 
   423         RefreshViewL();
   446         RefreshViewL();
   424 
   447 
   425 		}
   448             }
   426 	else
   449 	else
   427 		{
   450             {
   428 		// maintain requests
   451             // maintain requests
   429 		iCurrentEntry++;
   452             iCurrentEntry++;
   430 
   453 
   431         //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
   454             //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
   432 
   455 
   433         ExecuteCommand();
   456             ExecuteCommand();
   434 		}
   457             }
   435     }    
   458     }    
   436 // --------------------------------------------------------------------------------------------
   459 // --------------------------------------------------------------------------------------------
   437 
   460 
   438 // This callback function is called when cancel button of the progress bar was pressed
   461 // This callback function is called when cancel button of the progress bar was pressed
   439 void CFileBrowserFileUtils::DialogDismissedL(TInt aButtonId)
   462 void CFileBrowserFileUtils::DialogDismissedL(/*TInt aButtonId*/)
   440     {
   463     {
   441 //    iProgressDialog = NULL;
   464 //    iProgressDialog = NULL;
   442 //    iProgressInfo = NULL;
   465 //    iProgressInfo = NULL;
   443 //    iWaitDialog = NULL;
   466 //    iWaitDialog = NULL;
   444     
   467     
   445     // check if cancel button was pressed
   468     // check if cancel button was pressed
   446     if (aButtonId == EAknSoftkeyCancel)
   469 //    if (aButtonId == EAknSoftkeyCancel)
   447         {
   470 //        {
   448         // cancel the active object, command executer 
   471         // cancel the active object, command executer 
   449         Cancel();
   472         Cancel();
   450         
   473         
   451         iFileOps->CancelOp();
   474         iFileOps->CancelOp();
   452         
   475         
   453         ResetCommandArray();
   476         ResetCommandArray();
   454 
   477 
       
   478         isProgressDialog = EFalse;
       
   479 
   455         iEngine->FileBrowserUI()->ShowInformationNote(_L("Cancelled"), _L(""));
   480         iEngine->FileBrowserUI()->ShowInformationNote(_L("Cancelled"), _L(""));
   456         }
   481 //        }
   457     }
   482     }
   458     
   483     
   459 // --------------------------------------------------------------------------------------------
   484 // --------------------------------------------------------------------------------------------
   460 
   485 
   461 void CFileBrowserFileUtils::AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters)
   486 void CFileBrowserFileUtils::AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters)