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

kzk at freedesktop.org kzk at freedesktop.org
Mon Jan 31 07:38:13 PST 2005


Author: kzk
Date: 2005-01-31 07:38:10 -0800 (Mon, 31 Jan 2005)
New Revision: 427

Modified:
   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.h
  - (UimPrefDialog::m_applyButton): new variable

* uim-kdehelper/src/pref/uim-pref-qt.cpp
  - (UimPrefDialog::UimPrefDialog): exit when uim_custom_enable()
    failed.
  - (UimPrefDialog::setupWidgets): change button's order in
    accordance with KDE's HIG.
  - (UimPrefDialog::slotCustomValueChanged): enable apply button
  - (UimPrefDialog::slotApply): disable apply button


Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-01-31 14:57:28 UTC (rev 426)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp	2005-01-31 15:38:10 UTC (rev 427)
@@ -62,6 +62,7 @@
  * #include "uim/gettext.h"
  */
 #include <libintl.h>
+#include <unistd.h>
 
 #define _FU8(String) QString::fromUtf8(String)
 
@@ -74,6 +75,8 @@
       setupWidgets();
     } else {
       qDebug("uim_custom_enable() failed.");
+      uim_quit();
+      exit(-1);
     }
 }
 
@@ -114,19 +117,20 @@
     QPushButton *defaultButton = new QPushButton( "Defaults", buttonHWidget );
     QObject::connect( defaultButton, SIGNAL(clicked()),
                       this, SLOT(slotSetDefault()) );
-    QPushButton *applyButton = new QPushButton( "Apply" , buttonHWidget );
-    QObject::connect( applyButton, SIGNAL(clicked()),
-                      this, SLOT(slotApply()) );
-    QPushButton *okButton = new QPushButton( "OK"    , buttonHWidget );
+    QPushButton *okButton = new QPushButton( "OK", buttonHWidget );
     QObject::connect( okButton, SIGNAL(clicked()),
                       this, SLOT(slotOK()) );
+    m_applyButton = new QPushButton( "Apply", buttonHWidget );
+    m_applyButton->setEnabled( false );
+    QObject::connect( m_applyButton, SIGNAL(clicked()),
+                      this, SLOT(slotApply()) );
     QPushButton *cancelButton = new QPushButton( "Cancel", buttonHWidget );
     QObject::connect( cancelButton, SIGNAL(clicked()),
                       this, SLOT(slotCancel()) );
     buttonHLayout->addWidget( defaultButton );
     buttonHLayout->addStretch();
-    buttonHLayout->addWidget( applyButton );
     buttonHLayout->addWidget( okButton );
+    buttonHLayout->addWidget( m_applyButton );
     buttonHLayout->addWidget( cancelButton );
     leftVLayout->setSpacing( 6 );
     leftVLayout->addWidget( m_groupWidgetStack );
@@ -176,11 +180,14 @@
     /* switch group widget */
     QString grpname = item->text( 0 );
     m_groupWidgetStack->raiseWidget( m_groupWidgetsDict[grpname] );
+
+    m_applyButton->setEnabled( false );
 }
 
 void UimPrefDialog::slotCustomValueChanged()
 {
-    m_isValueChanged = true;    
+    m_isValueChanged = true;
+    m_applyButton->setEnabled( true );
 }
 
 void UimPrefDialog::confirmChange()
@@ -217,6 +224,7 @@
     uim_custom_broadcast();
 
     m_isValueChanged = false;
+    m_applyButton->setEnabled( false );
 }
 
 void UimPrefDialog::slotOK()

Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-01-31 14:57:28 UTC (rev 426)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h	2005-01-31 15:38:10 UTC (rev 427)
@@ -84,6 +84,8 @@
 
     QListView *m_groupListView;
     QWidgetStack *m_groupWidgetStack;
+
+    QPushButton *m_applyButton;
 };
 
 //---------------------------------------------------------------------------------



More information about the Uim-commit mailing list