Author: ek.kato
Date: Thu Aug 28 23:44:12 2008
New Revision: 5538

Modified:
   trunk/qt4/immodule/candidatewindow.cpp
   trunk/qt4/immodule/qhelpermanager.cpp

Log:
* qt4/immodule/candidatewindow.cpp
  - (CandidateWindow::CandidateWindow)
  - (CandidateListView::sizeHint)
    - Adjust candidate window size.
* qt4/immodule/qhelpermanager.cpp
  - (contextList)
  - (QUimHelperManager::parseHelperStr)
  - (QUimHelperManager::parseHelperStrImChange)
    - Fix bug in the usage of contextList, which caused unexpected
      crashes.


Modified: trunk/qt4/immodule/candidatewindow.cpp
==============================================================================
--- trunk/qt4/immodule/candidatewindow.cpp      (original)
+++ trunk/qt4/immodule/candidatewindow.cpp      Thu Aug 28 23:44:12 2008
@@ -81,6 +81,8 @@
     cList->setVScrollBarMode( Q3ScrollView::AlwaysOff );
     cList->setHScrollBarMode( Q3ScrollView::AlwaysOff );
     cList->setAllColumnsShowFocus( true );
+ QSizePolicy sp( QSizePolicy::Preferred, QSizePolicy::Preferred, false );
+    cList->setSizePolicy( sp );
     QObject::connect( cList, SIGNAL( clicked( Q3ListViewItem * ) ),
this , SLOT( slotCandidateSelected( Q3ListViewItem * ) ) ); QObject::connect( cList, SIGNAL( selectionChanged( Q3ListViewItem * ) ),
@@ -88,6 +90,7 @@

     //setup NumberLabel
     numLabel = new QLabel( this, "candidateLabel" );
+    numLabel->adjustSize();

     stores.clear();

@@ -434,7 +437,7 @@

     // 2004-08-02 Kazuki Ohta <[EMAIL PROTECTED]>
     // FIXME!:
- // There may be more proper way. Now width is adjusted by indeterminal 3 spaces. + // There may be more proper way. Now width is adjusted by indeterminal 3 'J'.
     int maxCharIndex = 0, maxCharCount = 0;
     for ( int i = 0; i < childCount(); i++ )
     {
@@ -445,7 +448,7 @@
         }
     }
     QFontMetrics fm( font() );
- width = fm.width( itemAtIndex( maxCharIndex )->text( 0 ) + " " + itemAtIndex( maxCharIndex )->text( 1 ) ); + width = fm.width( itemAtIndex( maxCharIndex )->text( 0 ) + "JJJ" + itemAtIndex( maxCharIndex )->text( 1 ) );
     if ( width < MIN_CAND_WIDTH )
         width = MIN_CAND_WIDTH;


Modified: trunk/qt4/immodule/qhelpermanager.cpp
==============================================================================
--- trunk/qt4/immodule/qhelpermanager.cpp       (original)
+++ trunk/qt4/immodule/qhelpermanager.cpp       Thu Aug 28 23:44:12 2008
@@ -55,7 +55,7 @@
 extern QUimInputContext *focusedInputContext;
 extern bool disableFocusedContext;

-extern Q3PtrList<QUimInputContext> contextList;
+extern QList<QUimInputContext *> contextList;

 QUimHelperManager::QUimHelperManager( QObject *parent )
         : QObject( parent )
@@ -152,14 +152,14 @@
     else if ( str.startsWith( "prop_update_custom" ) )
     {
         // for custom api
-        QUimInputContext * cc;
         QStringList list = str.split( "\n" );
         if ( !list.isEmpty() && !list[ 0 ].isEmpty() &&
                 !list[ 1 ].isEmpty() && !list[ 2 ].isEmpty() )
         {
-            for ( cc = contextList.first(); cc; cc = contextList.next() )
+            QList<QUimInputContext *>::iterator it;
+            for ( it = contextList.begin(); it != contextList.end(); ++it )
             {
-                uim_prop_update_custom( cc->uimContext(),
+                uim_prop_update_custom( ( *it )->uimContext(),
                                        list[ 1 ].toUtf8(),
                                        list[ 2 ].toUtf8() );
                 break;  /* all custom variables are global */
@@ -178,7 +178,6 @@

 void QUimHelperManager::parseHelperStrImChange( const QString &str )
 {
-    QUimInputContext * cc;
     QStringList list = str.split( "\n" );
     QString im_name = list[ 1 ];
     QString im_name_sym = "'" + im_name;
@@ -195,11 +194,12 @@
     }
     else if ( str.startsWith( "im_change_whole_desktop" ) )
     {
-        for ( cc = contextList.first(); cc; cc = contextList.next() )
+        QList<QUimInputContext *>::iterator it;
+        for ( it = contextList.begin(); it != contextList.end(); ++it )
         {
-           uim_switch_im( cc->uimContext(), im_name.toUtf8() );
-            cc->readIMConf();
-            uim_prop_update_custom( cc->uimContext(),
+            uim_switch_im( ( *it )->uimContext(), im_name.toUtf8() );
+            ( *it )->readIMConf();
+            uim_prop_update_custom( ( *it )->uimContext(),
                                    "custom-preserved-default-im-name",
                                    im_name_sym.toUtf8() );
         }
@@ -208,11 +208,12 @@
     {
         if ( focusedInputContext )
         {
-            for ( cc = contextList.first(); cc; cc = contextList.next() )
+            QList<QUimInputContext *>::iterator it;
+            for ( it = contextList.begin(); it != contextList.end(); ++it )
             {
-                uim_switch_im( cc->uimContext(), im_name.toUtf8() );
-                cc->readIMConf();
-                uim_prop_update_custom( cc->uimContext(),
+                uim_switch_im( ( *it )->uimContext(), im_name.toUtf8() );
+                ( *it )->readIMConf();
+                uim_prop_update_custom( ( *it )->uimContext(),
                                         "custom-preserved-default-im-name",
                                         im_name_sym.toUtf8() );
             }

Reply via email to