60 #include <peninputlongpressbutton.h> |
60 #include <peninputlongpressbutton.h> |
61 |
61 |
62 // Constants |
62 // Constants |
63 const TInt KPeninputVkbWndInvalidIndex = -1; |
63 const TInt KPeninputVkbWndInvalidIndex = -1; |
64 const TInt KInvalidImg = -1 ; |
64 const TInt KInvalidImg = -1 ; |
|
65 const TInt KKeyCodeSize = 1; |
|
66 const TInt KKeyDouble = 2; |
65 |
67 |
66 _LIT( KVkbWindowResourceFile, "z:\\resource\\plugins\\peninputssqwin.rsc" ); |
68 _LIT( KVkbWindowResourceFile, "z:\\resource\\plugins\\peninputssqwin.rsc" ); |
67 _LIT( KConfigurationResourceFile, "z:\\resource\\plugins\\peninputssqwinconfiginfo_" ); |
69 _LIT( KConfigurationResourceFile, "z:\\resource\\plugins\\peninputssqwinconfiginfo_" ); |
68 _LIT( KResourceFileExtName, ".rsc" ); |
70 _LIT( KResourceFileExtName, ".rsc" ); |
69 |
71 |
548 HandleVirtualKeyLatchedEvent( aEventType, aCtrl, aEventData ); |
550 HandleVirtualKeyLatchedEvent( aEventType, aCtrl, aEventData ); |
549 } |
551 } |
550 break; |
552 break; |
551 case EEventVirtualKeyUnLatched: |
553 case EEventVirtualKeyUnLatched: |
552 { |
554 { |
553 UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf ); |
555 // Sumbit Deadkey |
|
556 TRAP_IGNORE( SubmitDeadKeyL( iNewDeadKeyBuf ) ); |
|
557 |
554 TBool deadKeyChange = EFalse; |
558 TBool deadKeyChange = EFalse; |
555 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
559 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
556 iNewDeadKeyBuf = KNullDesC; |
560 iNewDeadKeyBuf = KNullDesC; |
557 } |
561 } |
558 break; |
562 break; |
576 case EPeninputLayoutEventSpace: |
580 case EPeninputLayoutEventSpace: |
577 { |
581 { |
578 TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet ); |
582 TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet ); |
579 if ( latchedFlag ) |
583 if ( latchedFlag ) |
580 { |
584 { |
581 TInt length = aEventData.Length() + iNewDeadKeyBuf.Length(); |
585 HBufC* newCharBuf = HBufC::New( KKeyDouble * iNewDeadKeyBuf.Length() |
582 HBufC* newCharBuf = HBufC::New( length ); |
586 + aEventData.Length() ); |
583 if ( newCharBuf ) |
587 if( newCharBuf ) |
584 { |
588 { |
|
589 CPeninputSplitQwertyLayout* layout |
|
590 = static_cast<CPeninputSplitQwertyLayout*>( UiLayout() ); |
|
591 if( layout->IsEnableITI() ) |
|
592 { |
|
593 // If ITI is open, double same keys should be send for one dead key, |
|
594 // core will handle them as one key. |
|
595 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
596 } |
585 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
597 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
586 newCharBuf->Des().Append( aEventData ); |
598 newCharBuf->Des().Append( aEventData ); |
587 } |
599 } |
588 |
600 |
589 UnLatchDeadKey( iNewDeadKeyBuf ); |
601 UnLatchDeadKey( iNewDeadKeyBuf ); |
590 |
602 |
591 TBool deadKeyChange = EFalse; |
603 TBool deadKeyChange = EFalse; |
592 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
604 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
774 { |
787 { |
775 // Update the new and old DeadKey buffer |
788 // Update the new and old DeadKey buffer |
776 iOldDeadKeyBuf = iNewDeadKeyBuf; |
789 iOldDeadKeyBuf = iNewDeadKeyBuf; |
777 iNewDeadKeyBuf = deadKey; |
790 iNewDeadKeyBuf = deadKey; |
778 |
791 |
779 // When type another DeadKey, submit the previous one. |
792 // Submit old Deadkey |
780 UiLayout()->SignalOwner( ESignalKeyEvent, iOldDeadKeyBuf ); |
793 TRAP_IGNORE( SubmitDeadKeyL( iOldDeadKeyBuf ) ); |
|
794 |
781 // Unlatch the previous DeadKey |
795 // Unlatch the previous DeadKey |
782 UnLatchDeadKey(iOldDeadKeyBuf); |
796 UnLatchDeadKey( iOldDeadKeyBuf ); |
783 } |
797 } |
784 else |
798 else |
785 { |
799 { |
786 iNewDeadKeyBuf = deadKey; |
800 iNewDeadKeyBuf = deadKey; |
787 |
801 |
793 // Send the char to FEP |
807 // Send the char to FEP |
794 // Not submit the DeadKey when latch it. |
808 // Not submit the DeadKey when latch it. |
795 // UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf ); |
809 // UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf ); |
796 } |
810 } |
797 |
811 |
|
812 // --------------------------------------------------------------------------- |
|
813 // Submit dead key |
|
814 // --------------------------------------------------------------------------- |
|
815 // |
|
816 void CPeninputSplitQwertyWindow::SubmitDeadKeyL( const TDesC& abuf ) |
|
817 { |
|
818 HBufC* newCharBuf = HBufC::NewL( KKeyDouble * abuf.Length() ); |
|
819 if( newCharBuf ) |
|
820 { |
|
821 CPeninputSplitQwertyLayout* layout |
|
822 = static_cast<CPeninputSplitQwertyLayout*>( UiLayout() ); |
|
823 if( layout->IsEnableITI() ) |
|
824 { |
|
825 // If ITI is open, double same keys should be send for one dead key, |
|
826 // core will handle them as one key. |
|
827 newCharBuf->Des().Append( abuf ); |
|
828 } |
|
829 newCharBuf->Des().Append( abuf ); |
|
830 |
|
831 // Submit DeadKey |
|
832 UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf ); |
|
833 delete newCharBuf; |
|
834 newCharBuf = NULL; |
|
835 } |
|
836 } |
798 // --------------------------------------------------------------------------- |
837 // --------------------------------------------------------------------------- |
799 // Handle virtual key up event |
838 // Handle virtual key up event |
800 // --------------------------------------------------------------------------- |
839 // --------------------------------------------------------------------------- |
801 // |
840 // |
802 TBool CPeninputSplitQwertyWindow::HandleVirtualKeyUpEvent(TInt aEventType, |
841 TBool CPeninputSplitQwertyWindow::HandleVirtualKeyUpEvent(TInt aEventType, |
1680 // Handle dead key event |
1719 // Handle dead key event |
1681 // --------------------------------------------------------------------------- |
1720 // --------------------------------------------------------------------------- |
1682 // |
1721 // |
1683 TBool CPeninputSplitQwertyWindow::HandleDeadKeyL( TInt aEventType, |
1722 TBool CPeninputSplitQwertyWindow::HandleDeadKeyL( TInt aEventType, |
1684 const TDesC& aEventData ) |
1723 const TDesC& aEventData ) |
1685 { |
1724 { |
1686 // Set DeadKey to unlatched state |
1725 // Set DeadKey to unlatched state |
1687 TBool deadKeyChange = EFalse; |
1726 TBool deadKeyChange = EFalse; |
1688 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
1727 iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange ); |
1689 UnLatchDeadKey( iNewDeadKeyBuf ); |
1728 UnLatchDeadKey( iNewDeadKeyBuf ); |
1690 |
1729 |
|
1730 // Handle dead key when ITI is enable |
|
1731 CPeninputSplitQwertyLayout* layout |
|
1732 = static_cast<CPeninputSplitQwertyLayout*>( UiLayout() ); |
|
1733 if ( layout->IsEnableITI() ) |
|
1734 { |
|
1735 TBuf<KKeyCodeSize> buf; |
|
1736 TKeyEvent* event = (TKeyEvent*) aEventData.Ptr(); |
|
1737 buf.Append( event->iCode ); |
|
1738 |
|
1739 HBufC* newCharBuf = HBufC::NewL( iNewDeadKeyBuf.Length() + buf.Length() ); |
|
1740 if( newCharBuf ) |
|
1741 { |
|
1742 newCharBuf->Des().Append( iNewDeadKeyBuf ); |
|
1743 newCharBuf->Des().Append( buf ); |
|
1744 |
|
1745 // Submit DeadKey + Key at the same time |
|
1746 UiLayout()->SignalOwner(ESignalKeyEvent,*newCharBuf); |
|
1747 |
|
1748 delete newCharBuf; |
|
1749 newCharBuf = NULL; |
|
1750 } |
|
1751 |
|
1752 return ETrue; |
|
1753 } |
|
1754 |
1691 // Get the accent char |
1755 // Get the accent char |
1692 HBufC* newCharBuf = HBufC::NewL( 1 ); |
1756 HBufC* newCharBuf = HBufC::NewL( KKeyCodeSize ); |
1693 |
1757 |
1694 TBool handled = HandleAccentCharEvent( aEventType, |
1758 TBool handled = HandleAccentCharEvent( aEventType, |
1695 aEventData, |
1759 aEventData, |
1696 iNewDeadKeyBuf, |
1760 iNewDeadKeyBuf, |
1697 newCharBuf ); |
1761 newCharBuf ); |
1700 { |
1764 { |
1701 // Send ths accent key to FEP |
1765 // Send ths accent key to FEP |
1702 UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf ); |
1766 UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf ); |
1703 iNewDeadKeyBuf = KNullDesC; |
1767 iNewDeadKeyBuf = KNullDesC; |
1704 delete newCharBuf; |
1768 delete newCharBuf; |
|
1769 newCharBuf = NULL; |
1705 return ETrue; |
1770 return ETrue; |
1706 } |
1771 } |
1707 |
1772 |
1708 delete newCharBuf; |
1773 delete newCharBuf; |
|
1774 newCharBuf = NULL; |
1709 |
1775 |
1710 return EFalse; |
1776 return EFalse; |
1711 } |
1777 } |
1712 |
1778 |
1713 // -------------------------------------------------------------------------- |
1779 // -------------------------------------------------------------------------- |
1714 // Handle resource of button(base on language direction) |
1780 // Handle resource of button(base on language direction) |
1715 // -------------------------------------------------------------------------- |
1781 // -------------------------------------------------------------------------- |
1716 // |
1782 // |