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

List:       kde-commits
Subject:    kdebase/ksysguard/gui
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-08-03 16:12:14
Message-ID: 20040803161214.36E359A40 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Fix updating of status bar.


  M +15 -26    ksysguard.cc   1.84
  M +1 -2      ksysguard.h   1.26


--- kdebase/ksysguard/gui/ksysguard.cc  #1.83:1.84
@@ -121,7 +121,4 @@ TopLevel::TopLevel( const char *name )
 
   KStdAction::revert( this, SLOT( resetWorkSheets() ), actionCollection() );
-  mActionStatusBar = KStdAction::showStatusbar( this, SLOT( showStatusBar() ),
-                                                actionCollection() );
-  mActionStatusBar->setChecked( false );
 
   new KAction( i18n( "Configure &Style..." ), "colorize", 0, this,
@@ -281,20 +278,14 @@ void TopLevel::initStatusBar()
   KSGRD::SensorMgr->sendRequest( "localhost", "mem/swap/used?",
                                  (KSGRD::SensorClient*)this, 5 );
-}
 
-void TopLevel::connectHost()
-{
-  KSGRD::SensorMgr->engageHost( "" );
-}
+  updateStatusBar();
 
-void TopLevel::disconnectHost()
-{
-  mSensorBrowser->disconnect();
+  KToggleAction *sb = dynamic_cast<KToggleAction*>(action("options_show_statusbar"));
+  if (sb)
+     connect(sb, SIGNAL(toggled(bool)), this, SLOT(updateStatusBar()));
 }
 
-void TopLevel::showStatusBar()
+void TopLevel::updateStatusBar()
 {
-  if ( mActionStatusBar->isChecked() ) {
-    statusBar()->show();
     if ( mTimerId == -1 )
       mTimerId = startTimer( 2000 );
@@ -302,11 +293,14 @@ void TopLevel::showStatusBar()
     // call timerEvent to fill the status bar with real values
     timerEvent( 0 );
-  } else {
-    statusBar()->hide();
-    if ( mTimerId != -1 ) {
-      killTimer( mTimerId );
-      mTimerId = -1;
-    }
-  }
+}
+
+void TopLevel::connectHost()
+{
+  KSGRD::SensorMgr->engageHost( "" );
+}
+
+void TopLevel::disconnectHost()
+{
+  mSensorBrowser->disconnect();
 }
 
@@ -395,9 +389,4 @@ void TopLevel::readProperties( KConfig *
 
   applyMainWindowSettings( cfg );
-
-  if ( !statusBar()->isHidden() ) {
-    mActionStatusBar->setChecked( true );
-    showStatusBar();
-  }
 }
 

--- kdebase/ksysguard/gui/ksysguard.h  #1.25:1.26
@@ -81,5 +81,5 @@ class TopLevel : public KMainWindow, pub
     void connectHost();
     void disconnectHost();
-    void showStatusBar();
+    void updateStatusBar();
     void editToolbars();
     void editStyle();
@@ -91,5 +91,4 @@ class TopLevel : public KMainWindow, pub
     QSplitter* mSplitter;
     KRecentFilesAction* mActionOpenRecent;
-    KToggleAction* mActionStatusBar;
 
     SensorBrowser* mSensorBrowser;


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

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