creator/engine/src/creator_scriptentry.cpp
changeset 23 c9bf25a20c9f
parent 19 4b22a598b890
child 52 36d60d12b4af
equal deleted inserted replaced
19:4b22a598b890 23:c9bf25a20c9f
    82 
    82 
    83 void CCommandParser::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
    83 void CCommandParser::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
    84     {
    84     {
    85     User::LeaveIfNull(iSearchArray);
    85     User::LeaveIfNull(iSearchArray);
    86     
    86     
    87     if( aUserData == EGetingScript && aPositiveAction && iSearchArray->Count() )
    87     if( aUserData == EGetingScript )
    88         {
    88         {
    89         iObserver->FileChosenL( ETrue, iSearchArray->MdcaPoint(iSelectedItem) );
    89         if(aPositiveAction)
       
    90             {
       
    91             iObserver->ScriptChosenL( ETrue, iSearchArray->MdcaPoint(iSelectedItem) );
       
    92             }
       
    93         else
       
    94             {
       
    95             iObserver->ScriptChosenL( EFalse );
       
    96             }
    90         }
    97         }
    91     else if( aUserData == EGetingRandomDataFile && aPositiveAction && iSearchArray->Count() )
    98     else if( aUserData == EGetingRandomDataFile && aPositiveAction && iSearchArray->Count() )
    92         {
    99         {
    93         TFileName fileName;
   100         if(aPositiveAction)
    94         if (iSelectedItem == (iSearchArray->Count() - 1))
   101             {
       
   102             TFileName fileName;
       
   103             if (iSelectedItem == (iSearchArray->Count() - 1))
    95                 {
   104                 {
    96                 // "default" (resource file) selected
   105                 // "default" (resource file) selected
    97                 fileName.Copy(KNullDesC);
   106                 fileName.Copy(KNullDesC);
    98                 }
   107                 }
    99             else
   108             else
   100                 {
   109                 {
   101                 // xml file selected
   110                 // xml file selected
   102                 fileName.Copy(iSearchArray->MdcaPoint(iSelectedItem));
   111                 fileName.Copy(iSearchArray->MdcaPoint(iSelectedItem));
   103                 }
   112                 }
   104         iObserver->FileChosenL( ETrue, fileName );
   113             iObserver->RandomDataFileChosenL( ETrue, fileName );
   105         }
   114             }
   106     else
   115         else
   107         {
   116             {
   108         iObserver->FileChosenL( EFalse );
   117             iObserver->RandomDataFileChosenL( EFalse );
   109         }
   118             }
   110     delete iSearchArray;
   119         }
   111     iSearchArray = NULL;
       
   112     iObserver = NULL;
       
   113     }
   120     }
   114 
   121 
   115 // ---------------------------------------------------------------------------
   122 // ---------------------------------------------------------------------------
   116 //#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
   123 //#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
   117 void CCommandParser::OpenScriptL() {}
   124 void CCommandParser::OpenScriptL() {}
   125     
   132     
   126     TBool ret = EFalse;
   133     TBool ret = EFalse;
   127 
   134 
   128     // init the search array
   135     // init the search array
   129     delete iSearchArray;
   136     delete iSearchArray;
       
   137     iSearchArray = NULL;
   130     iSearchArray = new(ELeave) CDesCArrayFlat(20);
   138     iSearchArray = new(ELeave) CDesCArrayFlat(20);
   131 
   139 
   132     // wait dialog
   140     // wait dialog
   133 	// TODO
   141 	// TODO
   134     //CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC();
   142     //CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC();
   379 
   387 
   380     }
   388     }
   381 #endif
   389 #endif
   382 */
   390 */
   383 
   391 
   384 TBool CCommandParser::GetRandomDataFilenameL(TDes& aFilename)
   392 TBool CCommandParser::GetRandomDataFilenameL(MCommandParserObserver *aObserver)
   385     {    
   393     {    
   386     LOGSTRING("Creator: CCommandParser::GetRandomDataFilenameL");
   394     LOGSTRING("Creator: CCommandParser::GetRandomDataFilenameL");
   387     TBool ret = EFalse;
   395     TBool ret = EFalse;
       
   396 
       
   397     User::LeaveIfNull( aObserver );
       
   398     iObserver = aObserver;
       
   399     iSelectedItem = 0;
   388 
   400 
   389     // init the search array
   401     // init the search array
   390     if (iSearchArray)
   402     if (iSearchArray)
   391     	{
   403     	{
   392     	delete iSearchArray;
   404     	delete iSearchArray;
   464             }
   476             }
   465 
   477 
   466         // add "default" (resource file) to list
   478         // add "default" (resource file) to list
   467         fileNameArray->AppendL(_L("Default"));
   479         fileNameArray->AppendL(_L("Default"));
   468 
   480 
   469 		ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, &iSelectedItem, this);
   481 		ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, &iSelectedItem, this, EGetingRandomDataFile);
   470         CleanupStack::PopAndDestroy(fileNameArray);
   482         CleanupStack::PopAndDestroy(fileNameArray);
   471         }
   483         }
   472     else  // no random data files found from the search paths
   484     else  // no random data files found from the search paths
   473         {
   485         {
   474         iEngine->GetEngineWrapper()->ShowNote(_L("No random data files found"));
   486         iEngine->GetEngineWrapper()->ShowNote(_L("No random data files found"));