bool ParseLockCommand(CSocketIOPtr s, const char *command) { char *cmd,*p; char *param; bool bRet = true; size_t client; if(!*command) return bRet; // Empty line cmd = strdup(command); { ClientLock lock; client = SockToClient[s->getsocket()]; } p=lock_strchr(cmd,' '); if(!p) { s->printf("001 FAIL Syntax error\n"); } else { if(!*p) param = p; else param = p+1; *p='\0'; if(!strcmp(cmd,"Client")) DoClient(s,client,param); else if(!strcmp(cmd,"Lock")) DoLock(s,client,param); else if(!strcmp(cmd,"Unlock")) DoUnlock(s,client,param); else if(!strcmp(cmd,"Version")) DoVersion(s,client,param); else if(!strcmp(cmd,"Modified")) DoModified(s,client,param); else if(!strcmp(cmd,"Monitor")) DoMonitor(s,client,param); else if(!strcmp(cmd,"Clients")) DoClients(s,client,param); else if(!strcmp(cmd,"Locks")) DoLocks(s,client,param); else if(!strcmp(cmd,"Close")) { DoClose(s,client,param); bRet=false; } else s->printf("001 FAIL Unknown command '%s'\n",cmd); } free(cmd); return bRet; }
TKeyResponse CAknKeyLockControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { if (!iOfferLockEnabled && !iKeyLockEnabled) return EKeyWasNotConsumed; if ( (aType == EEventKey && aKeyEvent.iRepeats == 0) || (aType == EEventKeyDown && aKeyEvent.iScanCode == EStdKeyDevice2) // Power key ) { // If power key pressed, tell SysAp about if if(aKeyEvent.iScanCode == EStdKeyDevice2) { SendMessageToSysAp(EEikKeyLockPowerKeyPressed); } if (iOfferLockEnabled) { switch (aKeyEvent.iCode) { case EKeyOK: { DoExitOfferKeylock(); EnableKeylock(); } case EKeyLeftArrow: case EKeyRightArrow: case EKeyUpArrow: case EKeyDownArrow: case EKeyApplication: return EKeyWasConsumed; break; default: // Normal response - send it to the cba via the control stack return EKeyWasNotConsumed; } } else if (iKeyLockEnabled) { if (iLockedNoteDisplayed) { // See if 'Unlock' has been pressed if (aKeyEvent.iCode == EKeyCBA1) { if ( iFeatureKeypadNoSlider ) { iConfirmationNoteAsterisk->ShowNote( CAknNoteDialog::EShortTimeout, CAknNoteDialog::EConfirmationTone); } else { iConfirmationNote->ShowNote( CAknNoteDialog::EShortTimeout, CAknNoteDialog::EConfirmationTone); } iUnlockConfirmation = ETrue; iLockedNote->CancelNote(); } // Locked note is on-screen - discard key return EKeyWasConsumed; } else if (iUnlockConfirmation) { // Confirmation note is on-screen - check for OK if ( ( aKeyEvent.iCode == KAknAsterisk && iFeatureKeypadNoSlider ) || ( aKeyEvent.iCode == EKeyCBA2 && !iFeatureKeypadNoSlider ) ) { DoUnlock(); if ( iFeatureKeypadNoSlider ) { //Show note "Now press *". //Note is shown when user has pressed "Unlock" when keypad is in locked state iConfirmationNoteAsterisk->CancelNote(); } else { iConfirmationNote->CancelNote(); } } else { if ( aKeyEvent.iCode != EKeyCBA1 ) ShowLockedNote(); } } else { // Normal response - send it to the cba TKeyResponse cbaResponse = iKeyLockCba->ButtonGroup()-> AsControl()->OfferKeyEventL(aKeyEvent, aType); if (cbaResponse == EKeyWasNotConsumed) { if ( !iFeatureKeypadNoSlider ) { // Selection key causes same action as 'Unlock' if (aKeyEvent.iCode == EKeyOK) { iConfirmationNote->ShowNote( CAknNoteDialog::EShortTimeout, CAknNoteDialog::EConfirmationTone); iUnlockConfirmation = ETrue; } else { ShowLockedNote(); } } else { if ( !(iEcsNote->iNoteOnScreen && aKeyEvent.iCode == EKeyYes) ) { if ( !iAutolockEnabled ) { ShowLockedNote(); } else { if(aKeyEvent.iScanCode == EStdKeyDevice2) { SendMessageToSysAp(EEikKeyLockPowerKeyPressed); return EKeyWasConsumed; } switch ( aKeyEvent.iCode ) { case EKeyLeftArrow: case EKeyRightArrow: case EKeyUpArrow: case EKeyDownArrow: case EKeyApplication: case EKeyCamera: case EKeyVolumeUp: case EKeyVolumeDown: case EKeySide: return EKeyWasConsumed; case EKeyOK: case EKeyPhoneSend: case EKeyPhoneEnd: case EKeyBackspace: if ( !iPhoneQueryOnScreen ) { return EKeyWasConsumed; } default: break; } if ( iPhoneQueryOnScreen ) { return EKeyWasNotConsumed; } iPhoneNumber.Zero(); if (aKeyEvent.iScanCode == EStdKeyHash) { iPhoneNumber.Append( KAknHash ); } else { iPhoneNumber.Append( aKeyEvent.iScanCode ); } ProcessCommandL( KKeyLockControlAnyKey ); } } } } } } } return EKeyWasConsumed; }
static INT_PTR CALLBACK UnlockWindowProc( IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam) { PGINA_CONTEXT pgContext; INT result = WLX_SAS_ACTION_NONE; pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); switch (uMsg) { case WM_INITDIALOG: pgContext = (PGINA_CONTEXT)lParam; SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); SetLockMessage(hwndDlg, IDC_LOCKMSG, pgContext); SetDlgItemTextW(hwndDlg, IDC_USERNAME, pgContext->UserName); SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD)); if (pgContext->bDisableCAD == TRUE) EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE); pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); return TRUE; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc; if (pgContext->hBitmap) { hdc = BeginPaint(hwndDlg, &ps); DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); EndPaint(hwndDlg, &ps); } return TRUE; } case WM_DESTROY: DeleteObject(pgContext->hBitmap); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: if (DoUnlock(hwndDlg, pgContext, &result)) EndDialog(hwndDlg, result); return TRUE; case IDCANCEL: EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); return TRUE; } break; } return FALSE; }