[uim-commit] r557 - trunk/qt

kzk at freedesktop.org kzk at freedesktop.org
Sat Feb 5 14:50:34 PST 2005


Author: kzk
Date: 2005-02-05 14:50:31 -0800 (Sat, 05 Feb 2005)
New Revision: 557

Modified:
   trunk/qt/pref-customwidgets.cpp
   trunk/qt/pref-qt.cpp
Log:
* qt/pref-qt.cpp
  - setCaption
* qt/pref-customwidgets.cpp
  - handle key symbol properly


Modified: trunk/qt/pref-customwidgets.cpp
===================================================================
--- trunk/qt/pref-customwidgets.cpp	2005-02-05 17:24:29 UTC (rev 556)
+++ trunk/qt/pref-customwidgets.cpp	2005-02-05 22:50:31 UTC (rev 557)
@@ -39,6 +39,8 @@
 
 #define _FU8(String) QString::fromUtf8(String)
 
+#define DEBUG_KEY_EDIT 0
+
 CustomCheckBox::CustomCheckBox( struct uim_custom *c, QWidget *parent, const char *name )
     : QCheckBox( parent, name ),
       UimCustomItemIface( c )
@@ -578,7 +580,7 @@
 {
     setSpacing( 3 );
     m_lineEdit = new QLineEdit( this );
-    m_lineEdit->setReadOnly( false );
+    m_lineEdit->setReadOnly( true );
 
     m_editButton = new QToolButton( this );
     m_editButton->setText( _("Edit") );
@@ -826,15 +828,24 @@
     m_keyLineEdit->installEventFilter( this );
     m_okButton->installEventFilter( this );
     m_cancelButton->installEventFilter( this );
+
+    m_keyLineEdit->setInputMethodEnabled( false );
 }
 
 void KeyGrabForm::keyPressEvent( QKeyEvent *e )
 {
+#if DEBUG_KEY_EDIT
     qDebug( "key press!!! - %d:%d", e->key(), e->stateAfter() );
+#endif
 
     int qkey = e->key();
     QString keystr = "";
-    if ( e->stateAfter() & Qt::ShiftButton )
+    /*
+     * Ignore Shift modifier for printable char keys for
+     * easy-to-recognize key configuration.  uim-custom performs
+     * implicit shift key encoding/decoding appropriately.
+     */        
+    if ( ((qkey >= 256 || !isgraph(qkey))) && (e->stateAfter() & Qt::ShiftButton) )
     {
         if( qkey != Qt::Key_Shift )
             keystr.append( "<Shift>" );
@@ -925,6 +936,9 @@
     case Qt::Key_Mode_switch:
         editString.append( "Mode_switch" );
         break;
+    case Qt::Key_Henkan:
+        editString.append( "Henkan_Mode" );
+        break;
     case Qt::Key_Muhenkan:
         editString.append( "Muhenkan" );
         break;
@@ -960,14 +974,16 @@
         }
         else if( isascii( qkey ) )
         {
-            int key = qkey;
-            if( isupper( qkey ) )
+            QString ch = QChar( qkey );
+            if( e->stateAfter() & Qt::ShiftButton )
             {
-                key = tolower( qkey );
+                ch = ch.upper();
             }
-
-            QString str =  QChar( key );
-            editString.append( str );
+            else
+            {
+                ch = ch.lower();
+            }
+            editString.append( ch );
         }
         else
         {
@@ -984,7 +1000,9 @@
 
 
     keystr.append( editString );
+#if DEBUG_KEY_EDIT
     qDebug( "keystr = %s", (const char *)keystr.local8Bit() );
+#endif
 
     m_keystr = keystr;
 }

Modified: trunk/qt/pref-qt.cpp
===================================================================
--- trunk/qt/pref-qt.cpp	2005-02-05 17:24:29 UTC (rev 556)
+++ trunk/qt/pref-qt.cpp	2005-02-05 22:50:31 UTC (rev 557)
@@ -73,6 +73,8 @@
       uim_quit();
       QApplication::exit( -1 );
     }
+
+    setCaption( "uim-pref-qt" );
 }
 
 UimPrefDialog::~UimPrefDialog()



More information about the Uim-commit mailing list