Branch: master

34cc40d9 2014-10-02 23:12:28 Timothy Pearson
Fix layout issues when starting root tdecmshell plugins
This resolves Bug 1888
M kcontrol/kcontrol/modules.cpp
M kcontrol/kcontrol/modules.h
diff --git a/kcontrol/kcontrol/modules.cpp b/kcontrol/kcontrol/modules.cpp
index 3029490..e40d625 100644
--- a/kcontrol/kcontrol/modules.cpp
+++ b/kcontrol/kcontrol/modules.cpp
@@ -48,7 +48,7 @@
 
 ConfigModule::ConfigModule(const KService::Ptr &s)
   : TDECModuleInfo(s), _changed(false), _module(0), _embedWidget(0),
-    _rootProcess(0), _embedLayout(0), _embedFrame(0), _embedStack(0)
+    _rootProcess(0), _embedFrame(0), _embedStack(0)
 {
 }
 
@@ -102,13 +102,10 @@
   delete _embedFrame;
   _embedFrame = 0;
   kapp->syncX();
-  
+
   if(_module)
     _module->close(true);
   _module = 0;
-
-  delete _embedLayout;
-  _embedLayout = 0;
 
   TDECModuleLoader::unloadModule(*this);
   _changed = false;
@@ -137,21 +134,18 @@
 
   delete _rootProcess;
   delete _embedWidget;
-  delete _embedLayout;
   delete _embedStack;
 
   // create an embed widget that will embed the
   // tdecmshell running as root
-  _embedLayout = new TQVBoxLayout(_module->parentWidget());
-  _embedFrame = new TQVBox( _module->parentWidget() );
+  TQWidget* parentWidget = _module->parentWidget();
+  _embedFrame = new TQVBox( parentWidget );
   _embedFrame->setFrameStyle( TQFrame::Box | TQFrame::Raised );
   TQPalette pal( red );
-  pal.setColor( TQColorGroup::Background,
-		_module->parentWidget()->colorGroup().background() );
+  pal.setColor( TQColorGroup::Background, parentWidget->colorGroup().background() );
   _embedFrame->setPalette( pal );
   _embedFrame->setLineWidth( 2 );
   _embedFrame->setMidLineWidth( 2 );
-  _embedLayout->addWidget(_embedFrame,1);
   // cannot reparent anything else inside QXEmbed, so put the busy label separately
   _embedStack = new TQWidgetStack(_embedFrame);
   _embedWidget = new KControlEmbed(_embedStack);
@@ -220,8 +214,6 @@
   _embedStack = 0;
   delete _embedFrame;
   _embedWidget = 0;
-  delete _embedLayout;
-  _embedLayout = 0;
   _module->show();
 }
 
@@ -236,9 +228,6 @@
 
   delete _rootProcess;
   _rootProcess = 0;
-
-  delete _embedLayout;
-  _embedLayout = 0;
 
   delete _module;
   _module=0;
diff --git a/kcontrol/kcontrol/modules.h b/kcontrol/kcontrol/modules.h
index b5b4a80..63ddee6 100644
--- a/kcontrol/kcontrol/modules.h
+++ b/kcontrol/kcontrol/modules.h
@@ -81,7 +81,6 @@
   ProxyWidget *_module;
   QXEmbed     *_embedWidget;
   TDEProcess    *_rootProcess;
-  TQVBoxLayout *_embedLayout;
   TQVBox       *_embedFrame;
   TQWidgetStack *_embedStack;