[Kst] branches/work/kst/1.5/kst/src/extensions/js

Adam Treat treat at kde.org
Thu Apr 12 21:52:51 CEST 2007


SVN commit 653178 by treat:

* Don't mess up tabs

BUG:143854


 M  +10 -18    js.cpp  
 M  +0 -1      js.h  


--- branches/work/kst/1.5/kst/src/extensions/js/js.cpp #653177:653178
@@ -240,23 +240,26 @@
       KMessageBox::sorry(app(), i18n("Could not load konsole part.  Please install kdebase."));
       return;
     }
-    _splitter = new QSplitter(Qt::Vertical, app());
+
+    if (!_splitter) {
+      _splitter = new QSplitter(Qt::Vertical, app());
+      _oldCentralWidget = app()->centralWidget();
+      _oldCentralWidget->reparent(_splitter, QPoint(0, 0));
+      _splitter->show();
+      app()->setCentralWidget(_splitter);
+    }
+
     KParts::Part *p = dynamic_cast<KParts::Part*>(f->create(_splitter, "kstcmd"));
     if (!p) {
       KMessageBox::sorry(app(), i18n("Konsole part appears to be incompatible.  Please install kdebase correctly."));
-      delete _splitter;
       return;
     }
 
-    _oldCentralWidget = app()->centralWidget();
-    _oldCentralWidget->reparent(_splitter, QPoint(0, 0));
     _splitter->moveToLast(p->widget());
-    app()->setCentralWidget(_splitter);
-
     connect(p, SIGNAL(destroyed()), this, SLOT(shellExited()));
     _konsolePart = p;
   }
-  _splitter->show();
+
   _konsolePart->widget()->show();
 #endif
 }
@@ -266,21 +269,10 @@
 #ifdef KST_HAVE_READLINE
   _showAction->setChecked(false);
   _konsolePart = 0L;
-  QTimer::singleShot(0, this, SLOT(restoreUI())); // konsole crashes otherwise
 #endif
 }
 
 
-void KstJS::restoreUI() {
-  if (_oldCentralWidget) {
-    _oldCentralWidget->reparent(app(), QPoint(0, 0));
-    app()->setCentralWidget(_oldCentralWidget);
-  }
-  delete _splitter;
-  _splitter = 0L;
-}
-
-
 void KstJS::hideConsole() {
 #ifdef KST_HAVE_READLINE
   if (_konsolePart) {
--- branches/work/kst/1.5/kst/src/extensions/js/js.h #653177:653178
@@ -56,7 +56,6 @@
 
   private slots:
     void shellExited();
-    void restoreUI();
     void doArgs();
 
   private:


More information about the Kst mailing list