[uim-commit] r465 - trunk/qt/uim-kdehelper/src/pref

kzk at freedesktop.org kzk at freedesktop.org
Tue Feb 1 09:54:26 PST 2005


Author: kzk
Date: 2005-02-01 09:54:23 -0800 (Tue, 01 Feb 2005)
New Revision: 465

Modified:
   trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp
   trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
   trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
Log:
* uim-kdehelper/src/pref/uim-pref-qt.cpp
  - (GroupPageWidget::setupWidgets): Hide the "main" subgroup's
    QVGroupBox when it has no contents.
    But this commit seems very adhoc to me... "main" subgroup should
    have its contents.
  - (UimPrefDialog::createGroupWidgets): add sanity check

* uim-kdehelper/src/pref/uim-pref-qt.h
  - (SubgroupData::getMainSubgroupGroupVBox): new func
  - (SubgroupData::searchGroupVBoxByCustomSym): constize
* uim-kdehelper/src/pref/customwidgets.cpp
  - add sanity check


Modified: trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp	2005-02-01 17:53:54 UTC (rev 464)
+++ trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp	2005-02-01 17:54:23 UTC (rev 465)
@@ -48,6 +48,9 @@
 
 void CustomCheckBox::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Bool )
+        return;
+    
     setEnabled( m_custom->is_active );
 
     if( m_custom->is_active )
@@ -85,6 +88,9 @@
 
 void CustomSpinBox::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Int )
+        return;
+
     setEnabled( m_custom->is_active );
 
     if( m_custom->is_active )
@@ -124,6 +130,9 @@
 
 void CustomLineEdit::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Str )
+        return;
+    
     setEnabled( m_custom->is_active );
 
     if( m_custom->is_active )
@@ -171,6 +180,9 @@
 
 void CustomPathnameEdit::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Pathname )
+        return;
+    
     m_lineEdit->setEnabled( m_custom->is_active );
     m_fileButton->setEnabled( m_custom->is_active );
 
@@ -214,7 +226,7 @@
 CustomChoiceCombo::CustomChoiceCombo( struct uim_custom *c, QWidget *parent, const char *name)
     : QComboBox( parent, name ),
       UimCustomItemIface( c )
-{
+{    
     QObject::connect( this, SIGNAL(activated(int)),
                       this, SLOT(slotActivated(int)) );
 
@@ -223,6 +235,9 @@
 
 void CustomChoiceCombo::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Choice )
+        return;
+
     setEnabled( m_custom->is_active );
 
     clear();
@@ -307,6 +322,9 @@
 
 void CustomOrderedListEdit::update()
 {
+    if( !m_custom || m_custom->type != UCustom_OrderedList )
+        return;
+    
     m_lineEdit->setEnabled( m_custom->is_active );
     m_editButton->setEnabled( m_custom->is_active );
 
@@ -587,6 +605,9 @@
 
 void CustomKeyEdit::update()
 {
+    if( !m_custom || m_custom->type != UCustom_Key )
+        return;
+
     m_lineEdit->setEnabled( m_custom->is_active );
     m_editButton->setEnabled( m_custom->is_active );
 

Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-02-01 17:53:54 UTC (rev 464)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-02-01 17:54:23 UTC (rev 465)
@@ -52,6 +52,7 @@
 #include <qfiledialog.h>
 #include <qcombobox.h>
 #include <qlayout.h>
+#include <qobjectlist.h>
 
 /*
  * FIXME! : 2004-01-14 Kazuki Ohta <mover at hct.zaq.ne.jp>
@@ -147,6 +148,8 @@
     for( grp = primary_groups; *grp; grp++ )
     {
         struct uim_custom_group *group = uim_custom_group_get( *grp );
+        if( group == NULL )
+            continue;
 
         /* insert item in uim's order */
         QListViewItem *item = NULL;
@@ -310,6 +313,17 @@
         uim_custom_symbol_list_free( custom_syms );
     }
 
+    /* 2004-02-02 Kazuki Ohta <mover at hct.zaq.ne.jp>
+     *
+     * This is very adhoc hack!!
+     * if "main" subgroup's gvbox dosn't have child, hides it!
+     */
+    QVGroupBox *mainSubgroupGroupVBox = sd->getMainSubgroupGroupVBox();
+    if( mainSubgroupGroupVBox && !mainSubgroupGroupVBox->children()->isEmpty() )
+    {
+        mainSubgroupGroupVBox->hide();
+    }
+
     /* free */
     delete sd;
     uim_custom_group_free( group );
@@ -519,7 +533,7 @@
     gvboxMap.clear();    
 }
 
-QVGroupBox * SubgroupData::searchGroupVBoxByCustomSym( const char *custom_sym )
+QVGroupBox * SubgroupData::searchGroupVBoxByCustomSym( const char *custom_sym ) const
 {
     QVGroupBox *b = gvboxMap[QString(custom_sym)];
     if( b == NULL )

Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-02-01 17:53:54 UTC (rev 464)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-02-01 17:54:23 UTC (rev 465)
@@ -129,8 +129,10 @@
 public:
     SubgroupData( QWidget *parentWidget, const char *parent_group_name );
     ~SubgroupData();
-    QVGroupBox *searchGroupVBoxByCustomSym( const char *custom_sym );
 
+    QVGroupBox *getMainSubgroupGroupVBox() const{ return m_defaultGVBox; }
+    QVGroupBox *searchGroupVBoxByCustomSym( const char *custom_sym ) const;
+
 protected:
     QVGroupBox *m_defaultGVBox;
     QMap<QString, QVGroupBox*> gvboxMap;



More information about the Uim-commit mailing list