[PATCH] Re: kxkb gui butchered?

Navindra Umanee navindra at cs.mcgill.ca
Fri Aug 16 10:09:16 BST 2002


Hi,

> I wanted to fix the bug where unchecking "Enable Keyboard layouts"
> failed to disable the other tabs (because unchecking "Enable Keyboard
> Layouts" means that kxkb does not get launched at all).

I went ahead and did my patch anyway.  Is it good?  Can I commit?

Thanks,
Navin.
-------------- next part --------------
Index: kcmlayout.cpp
===================================================================
RCS file: /home/kde/kdebase/kxkb/kcmlayout.cpp,v
retrieving revision 1.50
diff -u -r1.50 kcmlayout.cpp
--- kcmlayout.cpp	2002/07/12 09:59:23	1.50
+++ kcmlayout.cpp	2002/08/16 09:04:53
@@ -82,10 +82,10 @@
   : KCModule(parent, name), rules(0)
 {
   QVBoxLayout *main = new QVBoxLayout(this, 0,0);
-  QTabWidget *tab = new QTabWidget(this);
-  main->addWidget(tab);
+  tabWidget = new QTabWidget(this);
+  main->addWidget(tabWidget);
 
-  QWidget *layout = new QWidget(this);
+  layout = new QWidget(this);
   QVBoxLayout *vvbox = new QVBoxLayout(layout, KDialog::marginHint(), KDialog::spacingHint());
 
   enableCheckbox = new QCheckBox( i18n( "&Enable keyboard layouts" ), layout );
@@ -198,18 +198,20 @@
   connect(addVariantCombo, SIGNAL(activated(int)), this, SLOT(addVariantChanged()));
 
 
-  misc = new KeyboardConfig(tab);
+  misc = new KeyboardConfig(tabWidget);
   connect( misc, SIGNAL( changed(bool) ), SIGNAL( changed(bool) ));
 
   //Read rules - we _must_ read _before_ creating xkb-options comboboxes
   ruleChanged("xfree86");
 
-  QWidget *options_tab = makeOptionsTab(this);
+  options_tab = makeOptionsTab(this);
 
-  tab->addTab(options_tab, i18n("&Options"));
-  tab->addTab(layout, i18n("&Layout"));
-  tab->addTab(misc, i18n("Adva&nced"));
+  tabWidget->addTab(layout, i18n("&Layout"));
+  tabWidget->addTab(options_tab, i18n("&Options"));
+  tabWidget->addTab(misc, i18n("Adva&nced"));
 
+  connect( enableCheckbox, SIGNAL( toggled( bool )), this, SLOT( setTabsEnabled( bool )));
+
   load();
 }
 
@@ -433,6 +435,11 @@
 	emit KCModule::changed(true);
 }
 
+void LayoutConfig::setTabsEnabled(bool enabled)
+{
+  tabWidget->setTabEnabled(options_tab, enabled);
+  tabWidget->setTabEnabled(misc, enabled);
+}
 
 void LayoutConfig::load()
 {
Index: kcmlayout.h
===================================================================
RCS file: /home/kde/kdebase/kxkb/kcmlayout.h,v
retrieving revision 1.13
diff -u -r1.13 kcmlayout.h
--- kcmlayout.h	2002/06/30 21:15:02	1.13
+++ kcmlayout.h	2002/08/16 09:04:53
@@ -47,6 +47,8 @@
   void changed();
   void checkAccess();
 
+  void setTabsEnabled(bool);
+
 private:
 
   QComboBox *ruleCombo;
@@ -67,9 +69,14 @@
 
   QListView *additional;
   QCheckBox *enableCheckbox; 
-  KCModule *misc;
   QGroupBox *grp1;
   QGroupBox *grp2;
+
+  // top level tab widget + tablets
+  QTabWidget *tabWidget;
+  QWidget *options_tab;
+  QWidget *layout;
+  KCModule *misc;
 
   QWidget* makeOptionsTab(QWidget* parent);
 


More information about the kde-core-devel mailing list