textinput/peninputarc/src/peninputclient/penclientimpl.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 46 bd83ceabce89
child 56 8152b1f1763a
equal deleted inserted replaced
46:bd83ceabce89 50:5a1685599b76
   990 // ---------------------------------------------------------------------------
   990 // ---------------------------------------------------------------------------
   991 //
   991 //
   992 TInt RPeninputServerImpl::AddPenUiActivationHandler(
   992 TInt RPeninputServerImpl::AddPenUiActivationHandler(
   993                       MPenUiActivationHandler* aHandler,TInt aType)
   993                       MPenUiActivationHandler* aHandler,TInt aType)
   994     {
   994     {
       
   995     // To avoid add repeatedly
       
   996     for (TInt i=0; i<iPenUiNotificationHandler.Count(); i++)
       
   997         {
       
   998         TUiNotificationHandler handler = iPenUiNotificationHandler[ i ];
       
   999         if( handler.iHandler == aHandler )
       
  1000             {
       
  1001             return KErrNone;
       
  1002             }
       
  1003         }
       
  1004     
   995     iPenUiNotificationHandler.Append(TUiNotificationHandler(aHandler,aType));
  1005     iPenUiNotificationHandler.Append(TUiNotificationHandler(aHandler,aType));
   996     return KErrNone;            
  1006     return KErrNone;            
   997     }
  1007     }
   998     
  1008     
   999 // ---------------------------------------------------------------------------
  1009 // ---------------------------------------------------------------------------
  1260     //iHandler is always there. No need to check it
  1270     //iHandler is always there. No need to check it
  1261     TInt ret = EFalse;
  1271     TInt ret = EFalse;
  1262     
  1272     
  1263     if(iStatus.Int() < 0)
  1273     if(iStatus.Int() < 0)
  1264         {
  1274         {
       
  1275         
       
  1276         // the pen input server has been terminated, so there is no need to post message again
       
  1277         // just notify the handler the message of ESignalServerExit      
       
  1278         if ( iStatus.Int() == KErrServerTerminated )
       
  1279             {
       
  1280             HandleServerTerminatedL();
       
  1281             return;
       
  1282             }
       
  1283         
  1265         //check server status
  1284         //check server status
  1266         RThread srvThread;
  1285         RThread srvThread;
  1267         TInt err = srvThread.Open(iSrvThreadId);
  1286         TInt err = srvThread.Open(iSrvThreadId);
  1268         TInt exitReason = 0;
  1287         TInt exitReason = 0;
  1269         if(err == KErrNone) //thread is just closed
  1288         if(err == KErrNone) //thread is just closed
  1272             srvThread.Close();
  1291             srvThread.Close();
  1273             //iPeninputServer->OnServerReady(-1000);
  1292             //iPeninputServer->OnServerReady(-1000);
  1274             }
  1293             }
  1275         if(err != KErrNone || exitReason != 0) //server has exited
  1294         if(err != KErrNone || exitReason != 0) //server has exited
  1276             {
  1295             {
  1277             iServerExit  = ETrue;
  1296             HandleServerTerminatedL();
  1278             iPeninputServer->HandleServerExit();             
       
  1279             iHandler->HandleServerEventL(ESignalServerExit);
       
  1280             return;
  1297             return;
  1281             }
  1298             }
  1282         }
  1299         }
  1283 
  1300 
  1284     if(iStatus.Int() == ESignalServerReady) //server has started
  1301     if(iStatus.Int() == ESignalServerReady) //server has started
  1298         iPeninputServer->RequestMessageNotification(iStatus);
  1315         iPeninputServer->RequestMessageNotification(iStatus);
  1299         SetActive();
  1316         SetActive();
  1300         }
  1317         }
  1301     }
  1318     }
  1302 
  1319 
       
  1320 // ---------------------------------------------------------------------------
       
  1321 // CPeninputServerObserver::HandleServerTerminatedL()
       
  1322 // ---------------------------------------------------------------------------
       
  1323 //    
       
  1324 void CPeninputServerObserver::HandleServerTerminatedL()
       
  1325     {
       
  1326     iServerExit  = ETrue;
       
  1327         
       
  1328     if ( iPeninputServer )
       
  1329         {
       
  1330         iPeninputServer->HandleServerExit();                 
       
  1331         }
       
  1332         
       
  1333     if ( iHandler )
       
  1334         {
       
  1335         iHandler->HandleServerEventL( ESignalServerExit ); 
       
  1336         }
       
  1337 
       
  1338     }    
       
  1339     
  1303 // ---------------------------------------------------------------------------
  1340 // ---------------------------------------------------------------------------
  1304 // CPeninputServerObserver::RunError
  1341 // CPeninputServerObserver::RunError
  1305 // ---------------------------------------------------------------------------
  1342 // ---------------------------------------------------------------------------
  1306 //
  1343 //
  1307 TInt CPeninputServerObserver::RunError(TInt /*aError*/)
  1344 TInt CPeninputServerObserver::RunError(TInt /*aError*/)