[uim-commit] r388 - trunk/qt/uim-kdehelper/src/pref
kzk at freedesktop.org
kzk at freedesktop.org
Sat Jan 29 08:35:36 PST 2005
Author: kzk
Date: 2005-01-29 08:35:32 -0800 (Sat, 29 Jan 2005)
New Revision: 388
Modified:
trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp
trunk/qt/uim-kdehelper/src/pref/customwidgets.h
trunk/qt/uim-kdehelper/src/pref/olisteditformbase.ui
Log:
* bug fix of uim-pref-qt
* uim-kdehelper/src/pref/customwidgets.h
- (updateText): new function
* uim-kdehelper/src/pref/customwidgets.cpp
- (updateText): new function
- (slotEditButtonClicked): add enabled item first for storing the
order of the list, and update the text of lineedit after list is
modified.
* uim-kdehelper/src/pref/olisteditformbase.ui
- change listview's column name
- make header unclickable and resizable
Modified: trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp 2005-01-29 00:56:42 UTC (rev 387)
+++ trunk/qt/uim-kdehelper/src/pref/customwidgets.cpp 2005-01-29 16:35:32 UTC (rev 388)
@@ -164,24 +164,8 @@
m_editButton = new QToolButton( this );
m_editButton->setText( "Edit" );
- initPtrList();
+ updateText();
- QString str = QString::null;
- if( m_custom->value->as_olist )
- {
- struct uim_custom_choice *item = NULL;
- int i = 0;
- for( item = m_custom->value->as_olist[0], i = 0;
- item;
- item = m_custom->value->as_olist[++i] )
- {
- if( i != 0 )
- str.append(",");
- str.append( _FU8(item->label) );
- }
- }
- m_lineEdit->setText( str );
-
QObject::connect( m_editButton, SIGNAL(clicked()),
this, SLOT(slotEditButtonClicked()) );
}
@@ -219,15 +203,25 @@
void CustomOrderedListEdit::slotEditButtonClicked()
{
OListEditForm *d = new OListEditForm( this );
+ initPtrList();
/*
- * Adding items
- * The item whose symbol doesn't match any valid_item's symbol is inactive.
+ * Adding Enabled Items
*/
+ for( struct uim_custom_choice *item = m_itemList.first();
+ item;
+ item = m_itemList.next() )
+ {
+ d->addCheckItem( true, _FU8(item->label) );
+ }
+ /*
+ * Adding Disabled Items
+ */
for( struct uim_custom_choice *valid_item = m_validItemList.first();
valid_item;
valid_item = m_validItemList.next() )
{
+ /* Exclude Enabled Item */
bool isActive = false;
for( struct uim_custom_choice *item = m_itemList.first();
item;
@@ -240,7 +234,10 @@
}
}
- d->addCheckItem( isActive, _FU8(valid_item->label) );
+ if( isActive == false )
+ {
+ d->addCheckItem( false, _FU8(valid_item->label) );
+ }
}
/* Exec Dialog */
@@ -253,7 +250,6 @@
QStringList activeItemLabelList = d->activeItemLabels();
for( unsigned int i = 0; i < activeItemLabelList.count(); i++ )
{
- qDebug("label = %s", (const char*)activeItemLabelList[i] );
struct uim_custom_choice *item = NULL;
int j = 0;
for( item = m_custom->range->as_olist.valid_items[0], j = 0;
@@ -268,17 +264,12 @@
activeItem->label = item->label ? strdup(item->label) : NULL;
activeItem->desc = item->desc ? strdup(item->desc) : NULL;
activeItemList.append( activeItem );
-
- qDebug("active sym2 = %s", (const char*)activeItemLabelList[i] );
- qDebug("active sym1 = %s", (const char*)_FU8(item->label) );
- qDebug("active sym = %s", (const char*)_FU8(activeItem->symbol) );
-
break;
}
}
}
- /* free old olist */
+ /* free old items */
for( unsigned int i = 0; i < m_itemList.count(); i++ )
{
free( m_custom->value->as_olist[i]->symbol );
@@ -300,10 +291,29 @@
setCustom( m_custom );
/* reload */
- initPtrList();
+ updateText();
}
}
+void CustomOrderedListEdit::updateText()
+{
+ QString str = QString::null;
+ if( m_custom->value->as_olist )
+ {
+ struct uim_custom_choice *item = NULL;
+ int i = 0;
+ for( item = m_custom->value->as_olist[0], i = 0;
+ item;
+ item = m_custom->value->as_olist[++i] )
+ {
+ if( i != 0 )
+ str.append(",");
+ str.append( _FU8(item->label) );
+ }
+ }
+ m_lineEdit->setText( str );
+}
+
OListEditForm::OListEditForm( QWidget *parent, const char *name )
: OListEditFormBase( parent, name )
{
Modified: trunk/qt/uim-kdehelper/src/pref/customwidgets.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/customwidgets.h 2005-01-29 00:56:42 UTC (rev 387)
+++ trunk/qt/uim-kdehelper/src/pref/customwidgets.h 2005-01-29 16:35:32 UTC (rev 388)
@@ -176,6 +176,7 @@
QPtrList<struct uim_custom_choice> m_validItemList;
QPtrList<struct uim_custom_choice> m_itemList;
protected:
+ void updateText();
void initPtrList();
void currentCustomValueChanged(){ emit customValueChanged(); }
signals:
Modified: trunk/qt/uim-kdehelper/src/pref/olisteditformbase.ui
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/olisteditformbase.ui 2005-01-29 00:56:42 UTC (rev 387)
+++ trunk/qt/uim-kdehelper/src/pref/olisteditformbase.ui 2005-01-29 16:35:32 UTC (rev 388)
@@ -42,13 +42,13 @@
<widget class="QListView">
<column>
<property name="text">
- <string>Column 1</string>
+ <string>Available Items</string>
</property>
<property name="clickable">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="resizable">
- <bool>false</bool>
+ <bool>true</bool>
</property>
</column>
<property name="name">
More information about the Uim-commit
mailing list