creator/src/enginewrapper.cpp
changeset 28 4cc0d1a608c1
parent 27 271e901a9423
child 31 e7a04a6385be
equal deleted inserted replaced
27:271e901a9423 28:4cc0d1a608c1
   114 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   115 
   115 
   116 void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax)
   116 void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax)
   117 {
   117 {
   118 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
   118 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
       
   119 	if(iProgressDialog){
       
   120         delete iProgressDialog;
       
   121         iProgressDialog = NULL;
       
   122 	}
   119     iProgressDialog = Notifications::showProgressBar(text, aMax);
   123     iProgressDialog = Notifications::showProgressBar(text, aMax);
   120 	connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled()));
   124 	connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled()));
   121 }
   125 }
   122 
   126 
   123 // ---------------------------------------------------------------------------
   127 // ---------------------------------------------------------------------------
   124 
   128 
   125 void EngineWrapper::IncrementProgressbarValue()
   129 void EngineWrapper::IncrementProgressbarValue()
   126 {
   130 {
   127     iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1);
   131     if(iProgressDialog)
       
   132         iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1);
   128 }
   133 }
   129 
   134 
   130 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   131 
   136 
   132 void EngineWrapper::CloseProgressbar()
   137 void EngineWrapper::CloseProgressbar()
   133 {
   138 {
   134     if(iProgressDialog){
   139     if(iProgressDialog){
       
   140         disconnect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled()));
   135         delete iProgressDialog;
   141         delete iProgressDialog;
   136         iProgressDialog = 0;
   142         iProgressDialog = NULL;
   137     }
   143     }
   138 }
   144 }
   139 
   145 
   140 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   141 
   147 
   224 	for (int i = 0; i < aFileNameArray->Count(); i++) {
   230 	for (int i = 0; i < aFileNameArray->Count(); i++) {
   225 		itemList.append(QString::fromUtf16(
   231 		itemList.append(QString::fromUtf16(
   226 				  aFileNameArray->MdcaPoint(i).Ptr(),
   232 				  aFileNameArray->MdcaPoint(i).Ptr(),
   227 				  aFileNameArray->MdcaPoint(i).Length()));
   233 				  aFileNameArray->MdcaPoint(i).Length()));
   228 	}
   234 	}
   229 	// TODO: HbSelectionDialog handle close & user choice
       
   230 	TBool success(EFalse);
   235 	TBool success(EFalse);
   231     try{
   236     try{
   232         CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
   237         CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
   233 	    success = ETrue;
   238 	    success = ETrue;
   234     }
   239     }
   239     return success;
   244     return success;
   240 }
   245 }
   241 
   246 
   242 // ---------------------------------------------------------------------------	
   247 // ---------------------------------------------------------------------------	
   243 
   248 
   244 bool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TFileName& aDirectory)
   249 TBool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TDes& aDirectory, MUIObserver* aObserver, TInt aUserData)
   245 {
   250 {
   246 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
   251 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
   247 	QString directory = QString((QChar*)aDirectory.Ptr(), aDirectory.Length());
   252 	TBool success(EFalse);
   248 	bool ret = Notifications::directoryQueryDialog(text, directory);
   253     try{
   249 	if (ret == true) {
   254         CreatorInputDialog::launch(text, aDirectory, aObserver, aUserData);
   250 		aDirectory = TFileName(directory.utf16());
   255         success = ETrue;
   251 	}
   256     }
   252 	return ret;
   257     catch (std::exception& e)
   253 
   258         {
       
   259         Notifications::error( QString("exception: ")+e.what() );
       
   260         }
       
   261     return success;
   254 }
   262 }
   255 
   263 
   256 
   264 
   257 // ---------------------------------------------------------------------------
   265 // ---------------------------------------------------------------------------
   258 
   266 
   312 		default: {
   320 		default: {
   313 			Notifications::error("Error in resource id.");
   321 			Notifications::error("Error in resource id.");
   314 			return ret;
   322 			return ret;
   315 		}
   323 		}
   316 	}
   324 	}
   317     // TODO: HbSelectionDialog handle close & user choice
       
   318 	TBool success(EFalse);
   325 	TBool success(EFalse);
   319     try{
   326     try{
   320         CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
   327         CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
   321         success = ETrue;
   328         success = ETrue;
   322     }
   329     }