[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/componentchooser
From:       Matthias Kretz <kretz () kde ! org>
Date:       2003-09-23 13:17:25
[Download RAW message or body]

CVS commit by mkretz: 

wow, this is the most broken KCM I've encountered, yet:
- fixed internal changed handling (for the CfgComponents)
- implemented the load() method
- fixed the rest of the setChanged stuff


  M +24 -3     componentchooser.cpp   1.22
  M +5 -1      kcm_componentchooser.cpp   1.10


--- kdebase/kcontrol/componentchooser/componentchooser.cpp  #1.21:1.22
@@ -69,4 +69,5 @@ void CfgComponent::save(KConfig *cfg) {
                 store->sync();
                 delete store;
+                emit changed(false);
 }
 
@@ -383,10 +384,29 @@ ComponentChooser::~ComponentChooser()
 
 void ComponentChooser::load() {
+        if( configWidget )
+        {
+                CfgPlugin * plugin = static_cast<CfgPlugin*>(
+                                configWidget->qt_cast( "CfgPlugin" ) );
+                if( plugin )
+                {
+                        KSimpleConfig *cfg=new KSimpleConfig(latestEditedService);
+                        plugin->load( cfg );
+                        delete cfg;
+                }
+        }
 }
 
 void ComponentChooser::save() {
+        if( configWidget )
+        {
+                CfgPlugin * plugin = static_cast<CfgPlugin*>(
+                                configWidget->qt_cast( "CfgPlugin" ) );
+                if( plugin )
+                {
         KSimpleConfig *cfg=new KSimpleConfig(latestEditedService);
-                if (configWidget) \
static_cast<CfgPlugin*>(configWidget->qt_cast("CfgPlugin"))->save(cfg); +             \
plugin->save( cfg );  delete cfg;
+                }
+        }
 }
 
@@ -409,2 +429,3 @@ void ComponentChooser::restoreDefault() 
 }
 
+// vim: sw=4 ts=4 noet

--- kdebase/kcontrol/componentchooser/kcm_componentchooser.cpp  #1.9:1.10
@@ -26,17 +26,21 @@ KCMComponentChooser::KCMComponentChooser
         (new QVBoxLayout(this))->setAutoAdd(true);
         m_chooser=new ComponentChooser(this,"ComponentChooser");
-        connect(m_chooser,SIGNAL(changed(bool)),this,SIGNAL(changed(bool)));
+        connect(m_chooser,SIGNAL(changed(bool)),this,SLOT(setChanged(bool)));
+        setButtons( Help | Apply );
 }
 
 void KCMComponentChooser::load(){
         m_chooser->load();
+        setChanged(false);
 }
 
 void KCMComponentChooser::save(){
         m_chooser->save();
+        setChanged(false);
 }
 
 void KCMComponentChooser::defaults(){
         m_chooser->restoreDefault();
+        setChanged(true);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic