[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kspread
From:       Kazuki Ohta <mover () hct ! zaq ! ne ! jp>
Date:       2004-12-30 15:39:34
Message-ID: 20041230153934.87F311B976 () office ! kde ! org
[Download RAW message or body]

CVS commit by kzk: 

InputMethod support enhancement of KSpread.
Handle QIMEvent correctly.


  M +34 -0     kspread_canvas.cc   1.442
  M +2 -0      kspread_canvas.h   1.117
  M +8 -2      kspread_editors.cc   1.63
  M +2 -0      kspread_editors.h   1.20


--- koffice/kspread/kspread_canvas.cc  #1.441:1.442
@@ -142,4 +142,13 @@ bool KSpreadCanvas::eventFilter( QObject
       return true;
     }
+    break;
+  }
+  case QEvent::IMStart:
+  case QEvent::IMCompose:
+  case QEvent::IMEnd:
+  {
+      QIMEvent * imev = static_cast<QIMEvent *>(e);
+      processIMEvent( imev );
+      break;
   }
   default:
@@ -2355,4 +2364,29 @@ void KSpreadCanvas::keyPressEvent ( QKey
 }
 
+void KSpreadCanvas::processIMEvent( QIMEvent * event )
+{
+  m_pDoc->emitBeginOperation( false );
+  if ( !m_pEditor && !m_bChoose )
+  {
+    // Switch to editing mode
+    createEditor( CellEditor );
+    m_pEditor->handleIMEvent( event );
+  }
+  
+  QPoint cursor;
+  
+  if ( m_bChoose )
+  {
+    cursor = selectionInfo()->getChooseCursor();
+    /* if the cursor is unset, pretend we're starting at the regular cursor */
+    if (cursor.x() == 0 || cursor.y() == 0)
+      cursor = selectionInfo()->cursorPosition();
+  }
+  else
+    cursor = selectionInfo()->cursorPosition();
+ 
+  m_pDoc->emitEndOperation( QRect( cursor, cursor ) );
+}
+
 bool KSpreadCanvas::formatKeyPress( QKeyEvent * _ev )
 {

--- koffice/kspread/kspread_canvas.h  #1.116:1.117
@@ -502,4 +502,6 @@ private:
   bool processControlArrowKey(QKeyEvent *event);
 
+  void processIMEvent( QIMEvent * event );
+
   void updateChooseRect(const QPoint &newMarker, const QPoint &newAnchor);
 

--- koffice/kspread/kspread_editors.h  #1.19:1.20
@@ -48,4 +48,5 @@ public:
 
     virtual void handleKeyPressEvent( QKeyEvent* _ev ) = 0;
+    virtual void handleIMEvent( QIMEvent * _ev ) = 0;
     virtual void setEditorFont(QFont const & font, bool updateSize) = 0;
     virtual QString text() const = 0;
@@ -73,4 +74,5 @@ public:
 
     virtual void handleKeyPressEvent( QKeyEvent* _ev );
+    virtual void handleIMEvent( QIMEvent * _ev );
     virtual void setEditorFont(QFont const & font, bool updateSize);
     virtual QString text() const;

--- koffice/kspread/kspread_editors.cc  #1.62:1.63
@@ -278,5 +278,11 @@ void KSpreadTextEditor::handleKeyPressEv
   }
 
-  // Send the key event to the QLineEdit
+  // Send the key event to the KLineEdit
+  QApplication::sendEvent( m_pEdit, _ev );
+}
+
+void KSpreadTextEditor::handleIMEvent( QIMEvent * _ev )
+{
+    // send the IM event to the KLineEdit
   QApplication::sendEvent( m_pEdit, _ev );
 }
@@ -317,5 +323,5 @@ void KSpreadTextEditor::insertFormulaCha
 bool KSpreadTextEditor::eventFilter( QObject* o, QEvent* e )
 {
-    // Only interested in QLineEdit
+    // Only interested in KLineEdit
     if ( o != m_pEdit )
         return FALSE;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic