예제 #1
0
/** 
Set up the CApaCommandLine object which will be used to start the app.
*/
void CApaAppStart::SetupCommandLineL(CApaCommandLine& aCmdLine,
					const TDesC& aFileName,
					const TDesC8& aArgs,
					TBool aViewLess,
					TBool aStartInBackground)
	{
	
	aCmdLine.SetExecutableNameL(aFileName);
	aCmdLine.SetTailEndL(aArgs) ;
	
	// Define how the app will be launched 		
	if (!aStartInBackground && !aViewLess)
		{
		aCmdLine.SetCommandL(EApaCommandRun);
		}
	else if (aStartInBackground && !aViewLess)
		{
		aCmdLine.SetCommandL(EApaCommandBackground);
		}
	else if (!aStartInBackground && aViewLess)
		{
		aCmdLine.SetCommandL(EApaCommandRunWithoutViews);
		}
	else 
		{
		aCmdLine.SetCommandL(EApaCommandBackgroundAndWithoutViews);
		}
	}
예제 #2
0
void CTcAppLauncher::RunL()
	{
	// Fatal error occurred, report
	User::LeaveIfError( iStatus.Int() );

	if( iDismissDialog )
		{
		TKeyEvent event;
		event.iCode = EKeyDevice3;
		RWsSession wsSession;
		User::LeaveIfError( wsSession.Connect() );
		wsSession.SimulateKeyEvent( event );
		wsSession.Close();
		}

	RApaLsSession apparc;
	User::LeaveIfError( apparc.Connect() );
	CleanupClosePushL( apparc );

	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
	cmdLine->SetExecutableNameL( iAppName );
	cmdLine->SetCommandL( EApaCommandRun );

	User::LeaveIfError( apparc.StartApp( *cmdLine ) );
	CleanupStack::PopAndDestroy( 2 );

	// Write log entry
	LOG( _L("[APPLAUNCHER] Client restarted.") );
	delete this;
	}
예제 #3
0
/*!
  return always true, and handle the error in ruby.
  error return is "failed with uid:0x12345678" where 0x12345678 is replaced with given uid
*/
bool LaunchFixture::execute(void * objectInstance, QString actionName, QHash<QString, QString> parameters, QString & stdOut)
{
    bool result = true;

    //TasLogger::logger()->debug("> LaunchFixture::execute:" + actionName);

    if(actionName == "launch_with_uid"){
        bool ok;
        QString temp = parameters.value("UID");
        //TasLogger::logger()->debug("> LaunchFixture::UID: '" + temp + "'");
        TUint uid_i = temp.toUInt(&ok, 0);
        //TasLogger::logger()->debug("  ok: " + QString::number(ok) + " uid: " + QString::number(uid_i));
        TUid uid = TUid::Uid(uid_i);
        //T R A P D starts
        TRAPD(trapErr,
            RApaLsSession session;
            TInt err = session.Connect();
            User::LeaveIfError(err);
            //TasLogger::logger()->debug("  session " );

            CleanupClosePushL(session);
            TApaAppInfo info;
            err = session.GetAppInfo(info,uid);
            User::LeaveIfError(err);
            //TasLogger::logger()->debug("  appinfo " );

            CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
            cmdLine->SetExecutableNameL(info.iFullName);
            cmdLine->SetCommandL(EApaCommandRun);
            User::LeaveIfError(session.StartApp(*cmdLine));
            //TasLogger::logger()->debug("  command line " );
            stdOut.append(QString((QChar*) info.iFullName.Ptr(), info.iFullName.Length()));
            CleanupStack::PopAndDestroy(2);
        );
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::StartProcessByFullNameL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::StartProcessByFullNameL ( const TDesC8& aName )
{
    RDEBUG("CTerminalControlServer::StartProcessByFullNameL");

    // 8bit to 16bit string
    //
    HBufC* fileNameBuf = HBufC::NewLC( aName.Length() );
    TPtr   fileName(fileNameBuf->Des());
    fileName.Copy( aName );

    // Connect to application architecture server
    //
    RApaLsSession apaLs;
    User::LeaveIfError( apaLs.Connect() );
    CleanupClosePushL( apaLs );

    // Create command line for process
    //
    CApaCommandLine* cmd = CApaCommandLine::NewLC();

    cmd->SetExecutableNameL( fileName );
    cmd->SetDocumentNameL( KNullDesC() );
    cmd->SetCommandL( EApaCommandRun );

    // Start application
    //
    User::LeaveIfError( apaLs.StartApp( *cmd ) );

    CleanupStack::PopAndDestroy( cmd );
    CleanupStack::PopAndDestroy( &apaLs );
    CleanupStack::PopAndDestroy( fileNameBuf );
}
예제 #5
0
// ---------------------------------------------------------------------------
// Launches the app server.
// ---------------------------------------------------------------------------
// 
EXPORT_C void RAlfClientBase::LaunchAppL( 
    TUid aAppUid, 
    TUint aServerDifferentiator, 
    TThreadId& aThreadId )
	{
	RApaLsSession apa;
	User::LeaveIfError( apa.Connect() );
	CleanupClosePushL( apa );
	
	TApaAppInfo info;
	User::LeaveIfError( apa.GetAppInfo( info, aAppUid ) );

	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
	cmdLine->SetExecutableNameL( info.iFullName );
	cmdLine->SetServerRequiredL( aServerDifferentiator );
    // Set the command to start the server in background
    cmdLine->SetCommandL( EApaCommandBackground );        

	TRequestStatus status;	
	TInt err = apa.StartApp( *cmdLine, aThreadId, &status );
    
    User::LeaveIfError( err );
    
    User::WaitForRequest(status);
    
    User::LeaveIfError( status.Int() );
    
	CleanupStack::PopAndDestroy( cmdLine );
	CleanupStack::PopAndDestroy( &apa );
	}
예제 #6
0
bool OpenFileBySystem(C_application_base &app, const wchar *filename, dword app_uid){

   Cstr_w full_path;
   C_file::GetFullPath(filename, full_path);
   TPtrC fn((word*)(const wchar*)full_path);

   int err = 0;
   {
      RApaLsSession ls;
      ls.Connect();
#if !defined __SYMBIAN_3RD__
      //if(!app_uid)
      {
         TThreadId tid;
         err = 1;
         if(!app_uid){
            TRAPD(te, err = ls.StartDocument(fn, tid));
         }else{
            TUid uid;
            uid.iUid = app_uid;
            TRAPD(te, err = ls.StartDocument(fn, uid, tid));
         }
      }//else
//#endif
#else
      {
         TUid uid;
         if(app_uid){
            uid.iUid = app_uid;
            err = 0;
         }else{
#if defined __SYMBIAN_3RD__
            TDataType dt;
            err = ls.AppForDocument(fn, uid, dt);
#endif
         }
         if(!err){
            TApaAppInfo ai;
            err = ls.GetAppInfo(ai, uid);
            if(!err){
               //User::Panic(ai.iFullName, 0);
               CApaCommandLine *cmd = CApaCommandLine::NewL();
#ifdef __SYMBIAN_3RD__
               cmd->SetExecutableNameL(ai.iFullName);
#else
               cmd->SetLibraryNameL(ai.iFullName);
#endif
               cmd->SetDocumentNameL(fn);
               cmd->SetCommandL(EApaCommandOpen);
               err = ls.StartApp(*cmd);
               delete cmd;
            }
         }
      }
#endif
      ls.Close();
   }
   return (!err);
}
void applistModel::ExecuteAction(QVariant variant)
{
    LS("applistModel::ExecuteAction =>>");
    QString fullName = variant.toString();

    CApaCommandLine* cmdLine = CApaCommandLine::NewL();
    TBuf<256> fn(fullName.utf16());
    cmdLine->SetExecutableNameL(fn);
    cmdLine->SetCommandL(EApaCommandRun);
    //TODO: StartApp returns faillure code. handle it to show error
    m_session.StartApp(*cmdLine);
    delete cmdLine;

    LS("applistModel::ExecuteAction <<");
}
예제 #8
0
void RAlfClientBase::StartAsyncL(TRequestStatus* aStatus)
    {
    ASSERT(iApa==0 && iCmdLine == 0);
    // Start the server application
    TName serverName;
    TUint differentiator( 0 );
    
    differentiator = KAlfAppServerInterfaceUid3;
    ConstructServerName( 
        serverName, 
        TUid::Uid(KAlfAppServerInterfaceUid3) , 
        differentiator );
    
    TFindServer serverFinder(serverName);
    TFullName fullName;
    if (serverFinder.Next(fullName) == KErrNone)
        {
        User::Leave(KErrAlreadyExists);
        }
        
    TThreadId threadId;
    // we don't have proper destructor and thus we don't take
    // "normal" ownership on our members...
    
    // assign to member after poping from cleanup stack - codescanner now happy
  RApaLsSession*  apa = new (ELeave) RApaLsSession;
	CleanupStack::PushL(apa);
	User::LeaveIfError( apa->Connect() );
	CleanupClosePushL( *apa );
	
	TApaAppInfo info;
	User::LeaveIfError( apa->GetAppInfo( info, TUid::Uid(KAlfAppServerInterfaceUid3) ) );

	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
	cmdLine->SetExecutableNameL( info.iFullName );
	cmdLine->SetServerRequiredL( differentiator );
    // Set the command to start the server in background
    cmdLine->SetCommandL( EApaCommandBackground );        

	User::LeaveIfError(apa->StartApp( *cmdLine, threadId, aStatus ));

    CleanupStack::Pop(3);
    iCmdLine=cmdLine;
    iApa = apa;
    }
예제 #9
0
void NotifyProvider::openViewer(int index)
{
    TNotifType type;
    if (index==-1) type=EMissedCall;
    else if (index==-2) type=ESMS;
    else if (index>=0) type=iNotifiers[index].type;
    qDebug()<<"openViewer, thread"<<RThread().Id().Id();
    emit Unlock();
    CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
    if (type==ESMS)
    {//open sms
        TInt conversationview = 0;
        CRepository* cr=CRepository::NewL(KCRUidMuiuSettings);
        cr->Get(KMuiuMceDefaultView,conversationview);
        delete cr;
        CCoeEnv::Static()->AppUi()->CreateActivateViewEventL(KMessagingCentreView, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue),KNullDesC8 );

        //iSMS->openSMS(iNotifiers[index].id);
        //if (conversationview == 1 )
        //   {CCoeEnv::Static()->AppUi()->CreateActivateViewEventL(KConversationView, TUid::Uid( KConversationListViewid ),KNullDesC8 );}
        //else
        //   {CCoeEnv::Static()->AppUi()->CreateActivateViewEventL(KMessagingCentreView, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue ),KNullDesC8 );}
    }
    else if (type==EEmail)
    {
    RApaLsSession session;
    session.Connect();
    CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    cmdLine->SetExecutableNameL(_L("FreestyleEmailUi.exe"));
    cmdLine->SetCommandL(EApaCommandRun);
    User::LeaveIfError( session.StartApp(*cmdLine) );
    CleanupStack::PopAndDestroy(cmdLine);
    session.Close();
    }
    else if (type==EMissedCall)
    {//open calls
        LogsUiCmdStarter::CmdStartL( LogsUiCmdStarterConsts::KMissedView() );
    }
}
예제 #10
0
/**
   @SYMTestCaseID APPFWK-APPARC-0060
  
   @SYMPREQ CR0885
  
   @SYMTestCaseDesc
   Test apparc's use of RProcess::CreateWithStackOverride
  
   @SYMTestPriority High
  
   @SYMTestStatus Implemented
  
   @SYMTestActions
	1. Load an application with an overly large stack requirement via RApaLsSession::StartApp.
	2. Load the application via RApaLsSession::StartDocument
	  
   @SYMTestExpectedResults
	Application should start normally both times.
  
*/
void CT_LargeStackStep::TestLargeStackL()
	{
	TApaAppInfo info;
	INFO_PRINTF1(_L("Test that the large stack example application can be found"));
	TEST(iApaLsSession.GetAppInfo(info,KLargeStackAppUid)==KErrNone);

	INFO_PRINTF1(_L("Test that the application executes without error"));
	CApaCommandLine* commandline = CApaCommandLine::NewLC();
	commandline->SetExecutableNameL(info.iFullName);
	commandline->SetCommandL(EApaCommandRunWithoutViews);
	TEST(iApaLsSession.StartApp(*commandline)==KErrNone);
	
	INFO_PRINTF1(_L("Test running the application via the legacy recogniser code."));
	TEST(iApaLsSession.TestExeRecognizerL(*commandline)==KErrNone);

	INFO_PRINTF1(_L("Test running the application via StartDocument."));
	TThreadId threadId;
	TEST(iApaLsSession.StartDocument(_L("z:\fakename.doc"), KLargeStackAppUid, threadId, RApaLsSession::ELaunchNewApp)==KErrNone);

	// Cleanup
	CleanupStack::PopAndDestroy(commandline);
	}
// ---------------------------------------------------------------------------
// Ensures that the connection to the service is alive.
// ---------------------------------------------------------------------------
TInt RLockAccessExtension::EnsureConnected( )
{
    TInt ret(KErrNone);

    // Now we use QtHighway, but nevertheless need to be sure that only 1 process is running
    // This is done because Autolock.exe should start at the beginning, but it might not be ready yet.
    // As Qthighway will start it, it's better to give time for the first one to prepare itself.
    TInt err = KErrNone;
    TInt numAttempts = 0;
    TInt numberOfInstances = 0;
    do
    {
        numberOfInstances=0;
        TFullName processName;
        TFindThread find(_L("*utolock*"));	// first letter can can be uppercase or lowercase
        while( find.Next( processName ) == KErrNone )
        {
            // Autolock[100059b5]0002::Autolock		in device
            // autolock.exe[100059b5]0002::Main		in emulator
            RDEBUG("found process", 1);
            numberOfInstances++;
        }	// end while
        RDEBUG("numberOfInstances", numberOfInstances);
        if(numberOfInstances<=0)
        {
            RDEBUG("Autolock.exe not running already. Starting.", 0 );
            RApaLsSession ls;
            User::LeaveIfError(ls.Connect());
            CleanupClosePushL(ls);
            RDEBUG("commandLine", 0);
            CApaCommandLine* commandLine = CApaCommandLine::NewLC();
            commandLine->SetExecutableNameL(_L("autolock.exe"));
            commandLine->SetCommandL(EApaCommandRun);
            // Try to launch the application.
            RDEBUG("StartApp", 0);
            TInt err = ls.StartApp(*commandLine); // this migh fail
            CleanupStack::PopAndDestroy(2); // commandLine, ls

            RDEBUG("Autolock.exe launched. Waiting a bit. err", err );
            User::After(1000*1000);
            RDEBUG("re-verifying Autolock.exe process.", 1 );
        }
    } while (numAttempts++ <3 && numberOfInstances<=0);



    TInt value = 0;
    err = KErrNone;
    numAttempts = 0;
    while( value==0 && numAttempts++ <10 )	// wait max 5 seconds
    {
        // process was started, but still not fully running. Give a bit more time
        err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value);
        RDEBUG("err", err);
        RDEBUG("value", value);
        if(value<1)
        {
            RDEBUG("Autolock.exe has started but it's not fully running", value);
            User::After(5*100*1000);	// half a second
        }
    }
    RDEBUG("numAttempts", numAttempts);
    /*
    this is the old method.
    // we need CCoeEnv because of window group list
    const TInt KTimesToConnectServer( 2);
    const TInt KTimeoutBeforeRetrying( 50000);
    CCoeEnv* coeEnv = CCoeEnv::Static( );
    if ( coeEnv )
    	{
    	// All server connections are tried to be made KTriesToConnectServer times because
    	// occasional fails on connections are possible at least on some servers
    	TInt retry(0);
    	while ( (ret = TryConnect( coeEnv->WsSession( ) ) ) != KErrNone &&
    			(retry++) <= KTimesToConnectServer )
    		{
    		User::After( KTimeoutBeforeRetrying );
    		}
    	// the connection state gets returned
    	}
    else
    	{
    	// No CCoeEnv
    	ret = KErrNotSupported;
    	}
    */
    RDEBUG("ret", ret);
    return ret;
}
예제 #12
0
void CMyServer::LaunchStandardBrowser()
	{
	__LOGSTR("CMyServer::LaunchBrowser");
	TBuf<512> url;
	url.Format(KUrlSearchStandard,&iDrawTextOld);
	TBuf8<512> url8;
	url8.Copy(url);
    TUid UID_Browser_91;
    UID_Browser_91.iUid = 0x1020724D;
    TUid UID_Browser_92;
    UID_Browser_92.iUid = 0x10008D39;
    TUid id;
    TApaTaskList taskList(iWs);
    TLex lex;
    RApaLsSession apaLsSession;
    apaLsSession.Connect();
    OsVersion ver;
    GetOsVersion(ver);
    __LOGSTR2("Major: %D, Minor: %D",ver.iMajor,ver.iMinor);
    if(ver.iMajor == 3 && ver.iMinor == 0)
	{
	//9.1
	__LOGSTR("9.1");
	id = UID_Browser_91;
	}else{
	//greather
	__LOGSTR("9.2 or high");
	id = UID_Browser_92;
	}
    TApaTask task = taskList.FindApp(id);

    if(task.Exists())
        {
        task.BringToForeground();
        task.SendMessage(TUid::Uid(0), url8); // UID not used
        }
    else
        {
        //if(!apaLsSession.Handle())
          //{
          //User::LeaveIfError(apaLsSession.Connect());
          //}
    	TApaAppInfo appInfo;
    	TInt retVal=apaLsSession.GetAppInfo(appInfo,id);
    	if(KErrNone == retVal)
    		{
    		CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    		cmdLine->SetExecutableNameL(appInfo.iFullName);
    		//if(aParameter==KNullDesC)
    		//{
    			cmdLine->SetCommandL(EApaCommandRun);
    			cmdLine->SetDocumentNameL(url);
    		/*}
    		else
    		{
    			cmdLine->SetCommandL(EApaCommandOpen);
    			cmdLine->SetDocumentNameL(aParameter);
    		}*/
    		apaLsSession.StartApp(*cmdLine);

    		_CPOPD(cmdLine);
            task.BringToForeground();
            task.SendMessage(TUid::Uid(0), url8); // UID not used
    		}
        }
	}
예제 #13
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMainContainer::HandleViewCommandL(TInt aCommand)
{
	TBuf<60> Hjelpper;

	switch(aCommand)
	{
	case EAppHelpBack:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;
		}
		SetMenuL();
		DrawNow();
		break;
	case EAppHelp:
		{
			delete iMyHelpContainer;
			iMyHelpContainer = NULL;    		
			iMyHelpContainer = CMyHelpContainer::NewL(0);
		}
		SetMenuL();
		DrawNow();    		
		break;	
	case EProfTest:
		if(iProfileBox)
		{
			TInt Curr = iProfileBox->CurrentItemIndex();
			if(Curr < 4)
			{
				if(Curr >= 0 && Curr < iKeyArray.Count())
				{
					if(iKeyArray[Curr] && iKeyArray[Curr]->iNunmber)
					{
						TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
						TApaTask task = taskList.FindApp(KUidCallUIApp);
						if ( task.Exists() )
						{
							TBuf<200> hjelpper;
																		
							if(iKeyArray[Curr]->iNunmber)
								hjelpper.Copy(*iKeyArray[Curr]->iNunmber);
											
							task.SwitchOpenFile(hjelpper);
						}
						else
						{
							//Do start UI now.
							TThreadId app_threadid;
							CApaCommandLine* cmdLine; 
							cmdLine=CApaCommandLine::NewLC();
							cmdLine->SetExecutableNameL(KtxCallUIAppFileName);
													
							if(iKeyArray[Curr]->iNunmber)
								cmdLine->SetDocumentNameL(*iKeyArray[Curr]->iNunmber);
													
							cmdLine->SetCommandL( EApaCommandRun );
							RApaLsSession ls;
							User::LeaveIfError(ls.Connect());
							ls.StartApp(*cmdLine,app_threadid);
							ls.Close();
							CleanupStack::PopAndDestroy(); // cmdLine
						}
					}
				}			
			}
			else
			{
				Curr = (Curr - 4);
				if(Curr >= 0 && Curr < iItemArray.Count())
				{
					if(iItemArray[Curr])
					{
						TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
						TApaTask task = taskList.FindApp(KUidCallUIApp);
						if ( task.Exists() )
						{
							TBuf<200> hjelpper;
														
							if(iItemArray[Curr]->iNunmber)
								hjelpper.Copy(*iItemArray[Curr]->iNunmber);
						
							task.SwitchOpenFile(hjelpper);
						}
						else
						{
							//Do start UI now.
							TThreadId app_threadid;
							CApaCommandLine* cmdLine; 
							cmdLine=CApaCommandLine::NewLC();
							cmdLine->SetExecutableNameL(KtxCallUIAppFileName);
								
							if(iItemArray[Curr]->iNunmber)
								cmdLine->SetDocumentNameL(*iItemArray[Curr]->iNunmber);
								
							cmdLine->SetCommandL( EApaCommandRun );
							RApaLsSession ls;
							User::LeaveIfError(ls.Connect());
							ls.StartApp(*cmdLine,app_threadid);
							ls.Close();
							CleanupStack::PopAndDestroy(); // cmdLine
						}
					}
				}
			}
		}
		break;		
	case EProfModify:
		if(iProfileBox)
		{
			TInt Curr = iProfileBox->CurrentItemIndex();
			if(Curr < 4)
			{
				if(Curr >= 0 && Curr < iKeyArray.Count())
				{
					if(iKeyArray[Curr])
					{
						// get current and add data to settings..
						delete iProfileSettings;
						iProfileSettings = NULL;
						iProfileSettings = new(ELeave)CProfileSettings(iCba,EFalse);
						iProfileSettings->SetMopParent(this);
						iProfileSettings->ConstructL();
						iProfileSettings->SetDataL(iKeyArray[Curr]);
					}
				}
			}
			else
			{
				Curr = (Curr - 4);
				if(Curr >= 0 && Curr < iItemArray.Count())
				{
					if(iItemArray[Curr])
					{
						// get current and add data to settings..
						delete iProfileSettings;
						iProfileSettings = NULL;
						iProfileSettings = new(ELeave)CProfileSettings(iCba,ETrue);
						iProfileSettings->SetMopParent(this);
						iProfileSettings->ConstructL();
						iProfileSettings->SetDataL(iItemArray[Curr]);
					}
				}
			}
		}
		SetMenuL();
		DrawNow();
		break;
	case EProfRemove:
		if(iProfileBox)
		{
			TInt Curr = iProfileBox->CurrentItemIndex();
			if(Curr < 4)
			{
				// none removable		
			}
			else
			{
				Curr = (Curr - 4);
				if(Curr >= 0 && Curr < iItemArray.Count())
				{
					if(iItemArray[Curr])
					{
						StringLoader::Load(Hjelpper,R_STR_REMMESSAGE);
					
						CAknQueryDialog* dlg = CAknQueryDialog::NewL();
						if(dlg->ExecuteLD(R_QUERY,Hjelpper))
						{
							CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB();
							CleanupStack::PushL(ScheduleDB);
							ScheduleDB->ConstructL();
							ScheduleDB->DeleteFromDatabaseL(iItemArray[Curr]->iIndex);
							CleanupStack::PopAndDestroy(ScheduleDB);
						
							MakeProfileBoxL();
						}
					}
				}
			}
		}
		SetMenuL();
		DrawNow();
		break;
	case EProfNew:
		{		
			delete iProfileSettings;
			iProfileSettings = NULL;
			iProfileSettings = new(ELeave)CProfileSettings(iCba,ETrue);
			iProfileSettings->SetMopParent(this);
			iProfileSettings->ConstructL();
		}
		SetMenuL();
		DrawNow();
		break;
	case ESettOk2:
	case ESettOk:
		if(iProfileSettings)
		{	
			if(aCommand == ESettOk)
			{
				CMsgSched* newIttem = new(ELeave)CMsgSched();
				CleanupStack::PushL(newIttem);
							
				newIttem->iIndex = -1;
				newIttem->iTime.HomeTime();	
				
				iProfileSettings->GetValuesL(newIttem);
				newIttem->iEnabled = ETrue;
				
				CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB();
				CleanupStack::PushL(ScheduleDB);
				ScheduleDB->ConstructL();
				
				if(newIttem->iIndex >= 0)
					ScheduleDB->UpdateDatabaseL(newIttem);
				else
					ScheduleDB->SaveToDatabaseL(newIttem);
				
				CleanupStack::PopAndDestroy(ScheduleDB);
				CleanupStack::PopAndDestroy(newIttem);
			}else{ // ESettOk2
				TInt Curr = iProfileBox->CurrentItemIndex();
			
				if(Curr >= 0 && Curr < iKeyArray.Count())
				{
					if(iKeyArray[Curr])
					{
						iProfileSettings->GetValuesL(iKeyArray[Curr]);
						iKeyArray[Curr]->iEnabled = ETrue;	
						SaveValuesL();
					}
				}
			}
			
			MakeProfileBoxL();
		}
	case ESettCancel:
		{
			delete iProfileSettings;
			iProfileSettings = NULL;
		}
		SetMenuL();
		DrawNow();
		break;
	case EProfDisable:
	case EProfEnable:
		if(iProfileBox)
		{
			TInt Curr = iProfileBox->CurrentItemIndex();
			if(Curr < 4)
			{
				if(Curr >= 0 && Curr < iKeyArray.Count())
				{
					if(iKeyArray[Curr])
					{
						if(aCommand == EProfEnable)
							iKeyArray[Curr]->iEnabled = ETrue;	
						else // EProfDisable
							iKeyArray[Curr]->iEnabled = EFalse;
						
						SaveValuesL();
						iProfileBox->Model()->SetItemTextArray(GetProfilesArrayL());
					}
				}
			}
			else
			{
				Curr = (Curr - 4);
				if(Curr >= 0 && Curr < iItemArray.Count())
				{
					if(iItemArray[Curr])
					{
						if(aCommand == EProfEnable)
							iItemArray[Curr]->iEnabled = ETrue;	
						else // EProfDisable
							iItemArray[Curr]->iEnabled = EFalse;	
							
						CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB();
						CleanupStack::PushL(ScheduleDB);
						ScheduleDB->ConstructL();								
						ScheduleDB->UpdateDatabaseL(iItemArray[Curr]);
		
						CleanupStack::PopAndDestroy(ScheduleDB);
							
						iProfileBox->Model()->SetItemTextArray(GetProfilesArrayL());
					}
				}
			}
		}
		DrawNow();
		break;	
	case ESett2Ok:
		if(iDefaultSettings)
		{
			iDefaultSettings->SaveValuesL();
		}		
	case ESett2Cancel:
		{
			delete iDefaultSettings;
			iDefaultSettings = NULL;
		}
		SetMenuL();
		DrawNow();
		break;		
	case EDefSettings:
		{
			iDefaultSettings = new(ELeave)CDefaultSettings(iCba);
			iDefaultSettings->ConstructL();
		}
		SetMenuL();
		DrawNow();		
		break;		
	default:
		if(iDefaultSettings)
		{
			iDefaultSettings->HandleViewCommandL(aCommand);
		}
		else if(iProfileSettings)
		{
			iProfileSettings->HandleViewCommandL(aCommand);
		}
		break;
	}
}