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

kzk@freedesktop.org kzk@freedesktop.org
Sun Jan 9 10:50:27 PST 2005


Author: kzk
Date: 2005-01-09 10:50:24 -0800 (Sun, 09 Jan 2005)
New Revision: 196

Added:
   trunk/qt/uim-kdehelper/src/pref/customwidgets.h
Modified:
   trunk/qt/uim-kdehelper/src/pref/Makefile.am
   trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
   trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
Log:
* uim-pref-qt now has an ability to change the configuration
  of uim. Althogh some part is not completed yet, now it can
  do the basic operaton.

* uim-kdehelper/src/pref/uim-pref-qt.cpp
* uim-kdehelper/src/pref/uim-pref-qt.cpp
  - implement custom symbol handling
  - implement saving function

* uim-kdehelper/src/pref/customwidgets.h
  - new file

* uim-kdehelper/src/pref/Makefile.am
  - add customwidgets.h


Modified: trunk/qt/uim-kdehelper/src/pref/Makefile.am
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/Makefile.am	2005-01-09 18:46:01 UTC (rev 195)
+++ trunk/qt/uim-kdehelper/src/pref/Makefile.am	2005-01-09 18:50:24 UTC (rev 196)
@@ -1,7 +1,7 @@
 INCLUDES = $(all_includes)
 METASOURCES = AUTO
 
-noinst_HEADERS = uim-pref-qt.h
+noinst_HEADERS = uim-pref-qt.h customwidgets.h
 
 bin_PROGRAMS = uim-pref-qt
 uim_pref_qt_SOURCES = uim-pref-qt.cpp

Added: trunk/qt/uim-kdehelper/src/pref/customwidgets.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/customwidgets.h	2005-01-09 18:46:01 UTC (rev 195)
+++ trunk/qt/uim-kdehelper/src/pref/customwidgets.h	2005-01-09 18:50:24 UTC (rev 196)
@@ -0,0 +1,280 @@
+/*
+
+ Copyright (c) 2003,2004,2005 uim Project http://uim.freedesktop.org/
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of authors nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+*/
+#ifndef _CUSTOMWIDGETS_H_
+#define _CUSTOMWIDGETS_H_
+
+#include <uim/uim.h>
+#include <uim/uim-custom.h>
+
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+#include <qtoolbutton.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+#include <qsplitter.h>
+#include <qlistview.h>
+#include <qvbox.h>
+#include <qspinbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qfiledialog.h>
+#include <qcombobox.h>
+
+class UimCustomItemIface
+{
+public:
+    UimCustomItemIface( struct uim_custom *c = NULL )
+    {
+        m_custom = c;
+    }
+    virtual ~UimCustomItemIface()
+    {
+        if( m_custom ) uim_custom_free( m_custom );
+    }
+
+protected:
+    void setCustom( struct uim_custom *custom )
+    {
+        uim_bool rv = uim_custom_set( custom );
+        if( rv )
+            currentCustomValueChanged();
+        else
+            qFatal( "Failed to set value for \"%s\".", custom->symbol );
+    }
+
+    virtual void currentCustomValueChanged() = 0;
+
+protected:
+    struct uim_custom *m_custom;
+};
+
+class CustomCheckBox : public QCheckBox, public UimCustomItemIface
+{
+    Q_OBJECT
+
+public:
+    CustomCheckBox( struct uim_custom *c, QWidget *parent, const char *name = 0 )
+        : QCheckBox( parent, name ),
+          UimCustomItemIface( c )
+    {
+        QObject::connect( this, SIGNAL(toggled(bool)),
+                          this, SLOT(slotCustomToggled(bool)) );
+    }
+
+protected slots:
+    void slotCustomToggled( bool check )
+    {
+        qDebug("toggled!!!!!!!");
+        
+        Q_ASSERT( m_custom->type == UCustom_Bool );
+
+        m_custom->value->as_bool = check;
+        setCustom( m_custom );
+    }
+
+protected:
+    void currentCustomValueChanged(){ emit customValueChanged(); }
+signals:
+    void customValueChanged();
+};
+
+class CustomSpinBox : public QSpinBox, public UimCustomItemIface
+{
+    Q_OBJECT
+
+public:
+    CustomSpinBox( struct uim_custom *c, QWidget *parent, const char *name = 0 )
+        : QSpinBox( parent, name ),
+          UimCustomItemIface( c )
+    {
+        QObject::connect( this, SIGNAL(valueChanged(int)),
+                          this, SLOT(slotCustomValueChanged(int)) );
+    }
+
+public slots:
+    void slotCustomValueChanged( int value )
+    {
+        qDebug("value Changed!!!!!!!");
+        Q_ASSERT( m_custom->type == UCustom_Int );
+
+        m_custom->value->as_int = value;
+        setCustom( m_custom );
+    }
+
+protected:
+    void currentCustomValueChanged(){ emit customValueChanged(); }    
+signals:
+    void customValueChanged();
+};
+
+class CustomLineEdit : public QLineEdit, public UimCustomItemIface
+{
+    Q_OBJECT
+
+public:
+    CustomLineEdit( struct uim_custom *c, QWidget *parent, const char *name = 0 )
+        : QLineEdit( parent, name ),
+          UimCustomItemIface( c )
+    {
+        QObject::connect( this, SIGNAL(textChanged(const QString&)),
+                          this, SLOT(slotCustomTextChanged(const QString&)) );
+    }
+
+public slots:
+    void slotCustomTextChanged( const QString &text )
+    {
+        qDebug("text changed!");
+        Q_ASSERT( m_custom->type == UCustom_Str );
+
+        free( m_custom->value->as_str );
+        m_custom->value->as_str = strdup( (const char*)text.utf8() );
+
+        setCustom( m_custom );
+    }
+
+protected:
+    void currentCustomValueChanged(){ emit customValueChanged(); }    
+signals:
+    void customValueChanged();
+};
+
+class CustomPathnameEdit : public QHBox, public UimCustomItemIface
+{
+    Q_OBJECT
+
+public:
+    CustomPathnameEdit( struct uim_custom *c, QWidget *parent, const char *name = 0 )
+        : QHBox( parent, name ),
+          UimCustomItemIface( c )
+    {
+        setSpacing( 6 );
+        m_lineEdit = new QLineEdit( this );
+        m_lineEdit->setText( m_custom->value->as_pathname );
+        QObject::connect( m_lineEdit, SIGNAL(textChanged(const QString &)),
+                          this, SLOT(slotCustomTextChanged(const QString &)) );
+        QToolButton *m_fileButton = new QToolButton( this );
+        m_fileButton->setText( "File" );
+        QObject::connect( m_fileButton, SIGNAL(clicked()),
+                          this, SLOT(slotPathnameButtonClicked()) );
+    }
+
+    void setText( const QString & str )
+    {
+        m_lineEdit->setText( str );
+    }
+
+protected slots:
+    void slotPathnameButtonClicked()
+    {
+        QFileDialog* fd = new QFileDialog( this, "file dialog" );
+        fd->setMode( QFileDialog::Directory );
+        if ( fd->exec() == QDialog::Accepted )
+        {
+            QString fileName = fd->selectedFile();
+            m_lineEdit->setText( fileName );
+        }
+    }
+
+    void slotCustomTextChanged( const QString & text )
+    {
+        qDebug("path text changed!!!!!");
+        Q_ASSERT( m_custom->type == UCustom_Pathname );
+
+        free( m_custom->value->as_pathname );
+        m_custom->value->as_pathname = strdup( (const char*)text.utf8() );
+
+        setCustom( m_custom );
+    }
+
+private:
+    QLineEdit *m_lineEdit;
+    QToolButton *m_filebutton;
+
+protected:
+    void currentCustomValueChanged(){ emit customValueChanged(); }
+signals:
+    void customValueChanged();
+};
+
+class CustomChoiceCombo : public QComboBox, public UimCustomItemIface
+{
+    Q_OBJECT
+
+public:
+    CustomChoiceCombo( struct uim_custom *c, QWidget *parent, const char *name = 0 )
+        : QComboBox( parent, name ),
+          UimCustomItemIface( c )
+    {
+        QObject::connect( this, SIGNAL(highlighted(int)),
+                          this, SLOT(slotHighlighted(int)) );
+    }
+
+public slots:
+    void slotHighlighted( int index )
+    {
+        qDebug("highlighted!!!!");
+        Q_ASSERT( m_custom->type == UCustom_Pathname );
+
+        struct uim_custom_choice **valid_items = m_custom->range->as_choice.valid_items;
+        struct uim_custom_choice *choice = NULL;
+        if( valid_items )
+        {
+            for( int i = 0; valid_items[i]; i++ )
+            {
+                if( i == index )
+                    choice = valid_items[i];
+            }
+        }
+
+        free( m_custom->value->as_choice->symbol );
+        free( m_custom->value->as_choice->label );
+        free( m_custom->value->as_choice->desc );
+
+        m_custom->value->as_choice->symbol = strdup( choice->symbol );
+        m_custom->value->as_choice->label  = strdup( choice->label );
+        m_custom->value->as_choice->desc   = strdup( choice->desc );
+
+        setCustom( m_custom );
+    }
+
+protected:
+    void currentCustomValueChanged(){ emit customValueChanged(); }
+signals:
+    void customValueChanged();
+};
+
+#endif /* Not def: _CUSTOMWIDGETS_H_ */

Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-01-09 18:46:01 UTC (rev 195)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-01-09 18:50:24 UTC (rev 196)
@@ -1,4 +1,37 @@
+/*
+
+ Copyright (c) 2003,2004,2005 uim Project http://uim.freedesktop.org/
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of authors nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+*/
 #include "uim-pref-qt.h"
+#include "customwidgets.h"
 
 #include <qvbox.h>
 #include <qhbox.h>
@@ -11,24 +44,32 @@
 #include <qsplitter.h>
 #include <qlistview.h>
 #include <qvbox.h>
+#include <qspinbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qfiledialog.h>
+#include <qcombobox.h>
 
+
 UimPrefDialog::UimPrefDialog( QWidget *parent, const char *name )
-    : QDialog( parent, name )
+    : QDialog( parent, name ),
+      m_isValueChanged( false )
 {
     uim_init();
     uim_custom_init();
-    char **g = uim_custom_primary_groups();
-//    setupWidgets();
+
+    setupWidgets();
 }
 
 UimPrefDialog::~UimPrefDialog()
 {
-    uim_quit();    
+    uim_quit();
 }
 
 void UimPrefDialog::setupWidgets()
 {
-    createMainWidgets();    
+    createMainWidgets();
     createGroupWidgets();
 }
 
@@ -40,6 +81,10 @@
 
     m_groupListView = new QListView( mainSplitter );
     m_groupListView->addColumn( "Group" );
+    m_groupListView->setSelectionMode( QListView::Single );
+    m_groupListView->setSorting( -1 );
+    QObject::connect( m_groupListView, SIGNAL(selectionChanged( QListViewItem * )),
+                      this, SLOT(slotSelectionChanged( QListViewItem * )) );
 
     QWidget *leftSideWidget = new QWidget( mainSplitter );
     QVBoxLayout *leftVLayout = new QVBoxLayout( leftSideWidget );
@@ -49,16 +94,25 @@
     buttonHLayout->insertStretch( 0 );
     buttonHLayout->setMargin( 10 );
     buttonHLayout->setSpacing( 6 );
-    buttonHLayout->addWidget( new QPushButton("Apply", buttonHWidget) );
-    buttonHLayout->addWidget( new QPushButton("OK", buttonHWidget) );
-    buttonHLayout->addWidget( new QPushButton("Cancel", buttonHWidget ) );
+    QPushButton *applyButton  = new QPushButton( "Apply" , buttonHWidget );
+    QObject::connect( applyButton, SIGNAL(clicked()),
+                      this, SLOT(slotApply()) );
+    QPushButton *okButton     = new QPushButton( "OK"    , buttonHWidget );
+    QObject::connect( okButton, SIGNAL(clicked()),
+                      this, SLOT(slotOK()) );
+    QPushButton *cancelButton = new QPushButton( "Cancel", buttonHWidget );
+    QObject::connect( cancelButton, SIGNAL(clicked()),
+                      this, SLOT(slotCancel()) );
+    buttonHLayout->addWidget( applyButton );
+    buttonHLayout->addWidget( okButton );
+    buttonHLayout->addWidget( cancelButton );
     leftVLayout->setMargin( 10 );
     leftVLayout->setSpacing( 6 );
-    leftVLayout->addWidget( m_groupWidgetStack );    
+    leftVLayout->addWidget( m_groupWidgetStack );
     leftVLayout->insertStretch( 1 );
     leftVLayout->addWidget( buttonHWidget );
 
-    mainVLayout->addWidget( mainSplitter );   
+    mainVLayout->addWidget( mainSplitter );
 }
 
 void UimPrefDialog::createGroupWidgets()
@@ -67,22 +121,21 @@
     char **grp = NULL;
     for( grp = primary_groups; *grp; grp++ )
     {
-        ;
+        struct uim_custom_group *group = uim_custom_group_get( *grp );
+        
+        new QListViewItem( m_groupListView, *grp );
 
-        /*
-        struct uim_custom_group *group = uim_custom_group_get( *grp );
-        m_groupWidgetStack->addWidget( createGroupWidget( *grp ) );        
+        QWidget *w = createGroupWidget( *grp );
+        m_groupWidgetsDict.insert( *grp, w );
+        m_groupWidgetStack->addWidget( w );
+        
         uim_custom_group_free( group );
-        */
     }
 }
 
 QWidget* UimPrefDialog::createGroupWidget( const char *group_name )
 {
     QVBox *vbox = new QVBox( m_groupWidgetStack );
-    new QPushButton( "FEFEFE", vbox );
-    return vbox;
-    
     struct uim_custom_group *group;
     char **custom_syms, ** custom_sym;
 
@@ -95,25 +148,153 @@
     {
         for( custom_sym = custom_syms; *custom_sym; custom_sym++ )
         {
-//            addCustom( *custom_sym );
-            ;
+            /* add various widgets to the vbox */
+            addCustom( vbox, *custom_sym );
         }
 
-        uim_custom_symbol_list_free( custom_syms );        
+        uim_custom_symbol_list_free( custom_syms );
     }
-    
+
     uim_custom_group_free( group );
+
+    /* buttom up all widgets */
+    vbox->setStretchFactor( new QWidget( vbox ), 1 );
+    return vbox;
 }
 
-void UimPrefDialog::accept()
+void UimPrefDialog::addCustom( QVBox *vbox, const char *custom_sym )
 {
-    done( QDialog::Accepted );
+    struct uim_custom *custom = uim_custom_get( custom_sym );
+    if( custom )
+    {
+        switch( custom->type )
+        {
+        case UCustom_Bool:
+            addCustomTypeBool( vbox, custom );
+            break;
+        case UCustom_Int:
+            addCustomTypeInteger( vbox, custom );
+            break;
+        case UCustom_Str:
+            addCustomTypeString( vbox, custom );
+            break;
+        case UCustom_Pathname:
+            addCustomTypePathname( vbox, custom );
+            break;
+        case UCustom_Choice:
+            addCustomTypeChoice( vbox, custom );
+            break;
+        case UCustom_Key:
+            addCustomTypeKey( vbox, custom );
+            break;
+        default:
+            qFatal( "Invalid custom type: %d\n", custom->type );
+            uim_custom_free( custom );
+            break;
+        }
+    } else {
+        qFatal( "Failed to get uim_custom object for %s.", custom_sym );
+    }
 }
-void UimPrefDialog::reject()
+
+void UimPrefDialog::addCustomTypeBool( QVBox *vbox, struct uim_custom *custom )
 {
-    done( QDialog::Rejected );
+    CustomCheckBox *checkBox = new CustomCheckBox( custom, vbox );
+    checkBox->setText( custom->label );
+    checkBox->setChecked( custom->value->as_bool );
+    QObject::connect( checkBox, SIGNAL(customValueChanged()),
+                      this, SLOT(slotCustomValueChanged()) );
 }
 
+void UimPrefDialog::addCustomTypeInteger( QVBox *vbox, struct uim_custom *custom )
+{
+    QHBox *hbox = new QHBox( vbox );
+    hbox->setSpacing( 6 );
+    QLabel *label = new QLabel( custom->label, hbox );
+    CustomSpinBox *spinBox = new CustomSpinBox( custom, hbox );
+    spinBox->setValue( custom->value->as_int );
+    spinBox->setMinValue( custom->range->as_int.min );
+    spinBox->setMaxValue( custom->range->as_int.max );
+    label->setBuddy( spinBox );
+
+    QObject::connect( spinBox, SIGNAL(customValueChanged()),
+                      this, SLOT(slotCustomValueChanged()) );
+}
+
+void UimPrefDialog::addCustomTypeString( QVBox *vbox, struct uim_custom *custom )
+{
+    QHBox *hbox = new QHBox( vbox );
+    hbox->setSpacing( 6 );
+    QLabel *label = new QLabel( custom->label, hbox );
+    CustomLineEdit *lineEdit = new CustomLineEdit( custom, hbox );
+    lineEdit->setText( custom->value->as_str );
+    label->setBuddy( lineEdit );
+
+    QObject::connect( lineEdit, SIGNAL(customValueChanged()),
+                      this, SLOT(slotCustomValueChanged()) );
+}
+
+void UimPrefDialog::addCustomTypePathname( QVBox *vbox, struct uim_custom *custom )
+{
+    QHBox *hbox = new QHBox( vbox );
+    hbox->setSpacing( 6 );
+    QLabel *label = new QLabel( custom->label, hbox );
+    CustomPathnameEdit *pathnameEdit = new CustomPathnameEdit( custom, hbox );
+    pathnameEdit->setText( custom->value->as_pathname );
+    label->setBuddy( pathnameEdit );
+
+    QObject::connect( pathnameEdit, SIGNAL(customValueChanged()),
+                      this, SLOT(slotCustomValueChanged()) );
+}
+
+void UimPrefDialog::addCustomTypeChoice( QVBox *vbox, struct uim_custom *custom )
+{
+    QHBox *hbox = new QHBox( vbox );
+    hbox->setSpacing( 6 );
+    QLabel *label = new QLabel( custom->label, hbox );
+
+    CustomChoiceCombo *choiceCombo = new CustomChoiceCombo( custom, hbox );
+    char *default_symbol = NULL;
+    int default_index = -1;
+    int index = 0;
+    struct uim_custom_choice **item = custom->range->as_choice.valid_items;
+    while( *item )
+    {
+        int count = choiceCombo->count();
+        choiceCombo->insertItem( (*item)->label, count - 1 ); // insert item at last
+
+        if( QString::compare( default_symbol, (*item)->symbol ) == 0 )
+            default_index = index;
+
+        index++;
+        item++;
+    }
+    choiceCombo->setCurrentItem( default_index );
+
+    label->setBuddy( choiceCombo );
+
+    QObject::connect( choiceCombo, SIGNAL(customValueChanged()),
+                      this, SLOT(slotCustomValueChanged()) );
+}
+
+void UimPrefDialog::addCustomTypeKey( QVBox *vbox, struct uim_custom *custom )
+{
+    // FIXME: not implemented yet
+    ;
+}
+
+void UimPrefDialog::slotSelectionChanged( QListViewItem * item )
+{
+    // switch group widget
+    QString grpname = item->text( 0 );
+    m_groupWidgetStack->raiseWidget( m_groupWidgetsDict[grpname] );
+}
+
+void UimPrefDialog::slotCustomValueChanged()
+{
+    m_isValueChanged = true;    
+}
+
 int main( int argc, char **argv )
 {
     QApplication a( argc, argv );
@@ -124,7 +305,34 @@
 
     return a.exec();
 }
-void UimPrefDialog::addCustom( QVBox *vbox, const char *custom_sym )
+
+void UimPrefDialog::slotApply()
 {
-    ;
+    if( !m_isValueChanged )
+        return;
+
+    qDebug("start saving....");
+
+    uim_custom_save();
+    uim_custom_broadcast();
+
+    m_isValueChanged = false;
 }
+
+void UimPrefDialog::slotOK()
+{
+    if( m_isValueChanged )
+    {
+        // save
+        slotApply();
+    }
+
+    // quit
+    accept();
+}
+
+void UimPrefDialog::slotCancel()
+{
+    // quit
+    reject();
+}

Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-01-09 18:46:01 UTC (rev 195)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-01-09 18:50:24 UTC (rev 196)
@@ -1,3 +1,35 @@
+/*
+
+ Copyright (c) 2003,2004,2005 uim Project http://uim.freedesktop.org/
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of authors nor the names of its contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+*/
 #ifndef _UIM_PREF_QT_H_
 #define _UIM_PREF_QT_H_
 
@@ -2,6 +34,7 @@
 #include <qdialog.h>
-#include <qmap.h>
+#include <qdict.h>
 #include <qlistview.h>
 #include <qwidgetstack.h>
 #include <qvbox.h>
+#include <qcheckbox.h>
 
@@ -23,14 +56,27 @@
     void createMainWidgets();
     void createGroupWidgets();
     QWidget* createGroupWidget( const char *grpname );
+
     void addCustom( QVBox *vbox, const char *custom_sym );
+    void addCustomTypeBool( QVBox *vbox, struct uim_custom *custom );
+    void addCustomTypeInteger( QVBox *vbox, struct uim_custom *custom );
+    void addCustomTypeString( QVBox *vbox, struct uim_custom *custom );
+    void addCustomTypePathname( QVBox *vbox, struct uim_custom *custom );
+    void addCustomTypeChoice( QVBox *vbox, struct uim_custom *custom );
+    void addCustomTypeKey( QVBox *vbox, struct uim_custom *custom );
 
 protected slots:
-    void accept();
-    void reject();
+    void slotApply();
+    void slotOK();
+    void slotCancel();
 
+    void slotSelectionChanged( QListViewItem * );
+    void slotCustomValueChanged();
+
 private:
-    QMap<QString, QWidget*>  pageWidgets;
+    bool m_isValueChanged;    
+    
+    QDict<QWidget>  m_groupWidgetsDict;
     QString m_currentPageName;
 
     QListView *m_groupListView;



More information about the Uim-commit mailing list