[kde-doc-english] [kde-baseapps] konqueror/src: Add an action to hide/show the status bar

Jonathan Marten jjm at keelhaul.me.uk
Wed Jun 27 09:37:05 UTC 2012


Git commit f4fbf758ce808b524322b4a812f1395f8e97efd7 by Jonathan Marten.
Committed on 25/06/2012 at 18:20.
Pushed by marten into branch 'master'.

Add an action to hide/show the status bar

Each view has its own status bar.  For the moment, this
action toggles the status bar of the current view only.

BUG:111162
REVIEW:105337
GUI:

M  +31   -2    konqueror/src/konqmainwindow.cpp
M  +2    -0    konqueror/src/konqmainwindow.h
M  +2    -1    konqueror/src/konqueror.rc

http://commits.kde.org/kde-baseapps/f4fbf758ce808b524322b4a812f1395f8e97efd7

diff --git a/konqueror/src/konqmainwindow.cpp b/konqueror/src/konqmainwindow.cpp
index 0b49be5..081509e 100644
--- a/konqueror/src/konqmainwindow.cpp
+++ b/konqueror/src/konqmainwindow.cpp
@@ -1312,8 +1312,12 @@ void KonqMainWindow::slotCreateNewWindow( const KUrl &url,
     if ( view ) {
         if ( !windowArgs.scrollBarsVisible() )
             view->disableScrolling();
-        if ( !windowArgs.isStatusBarVisible() )
+        if ( !windowArgs.isStatusBarVisible() ) {
             view->frame()->statusbar()->hide();
+            mainWindow->m_paShowStatusBar->setChecked( false );
+        } else {
+          mainWindow->m_paShowStatusBar->setChecked( true );
+        }
     }
 
     if ( !windowArgs.isResizable() )
@@ -1969,7 +1973,11 @@ void KonqMainWindow::slotPartActivated(KParts::Part *part)
   }
 
     kDebug() << "New current view" << newView;
-  m_currentView = newView;
+    m_currentView = newView;
+    if (newView) {
+      m_paShowStatusBar->setChecked( newView->frame()->statusbar()->isVisible() );
+    }
+
     if (!part) {
       //kDebug() << "No part activated - returning";
     unplugViewModeActions();
@@ -3245,6 +3253,22 @@ void KonqMainWindow::slotShowMenuBar()
   slotForceSaveMainWindowSettings();
 }
 
+void KonqMainWindow::slotShowStatusBar()
+{
+  if (m_currentView)
+    m_currentView->frame()->statusbar()->setVisible( m_paShowStatusBar->isChecked() );
+
+  // An alternative: this will change simultaneously all of the status bars on
+  // all of the current views.
+  //MapViews::const_iterator end = m_mapViews.constEnd();
+  //for (MapViews::const_iterator it = m_mapViews.constBegin(); it != end; ++it) {
+  //  KonqView* view = it.value();
+  //  view->frame()->statusbar()->setVisible(on);
+  //}
+
+  slotForceSaveMainWindowSettings();
+}
+
 void KonqMainWindow::slotUpdateFullScreen( bool set )
 {
   KToggleFullScreenAction::setFullScreen( this, set );
@@ -3778,6 +3802,9 @@ void KonqMainWindow::initActions()
   m_paShowMenuBar = KStandardAction::showMenubar( this, SLOT(slotShowMenuBar()), this );
   actionCollection()->addAction( KStandardAction::name(KStandardAction::ShowMenubar), m_paShowMenuBar );
 
+  m_paShowStatusBar = KStandardAction::showStatusbar( this, SLOT(slotShowStatusBar()), this );
+  actionCollection()->addAction( KStandardAction::name(KStandardAction::ShowStatusbar), m_paShowStatusBar );
+
   action = actionCollection()->addAction( "konqintro" );
   action->setText( i18n( "Kon&queror Introduction" ) );
   connect(action, SIGNAL(triggered()), SLOT(slotIntro()));
@@ -4303,6 +4330,8 @@ void KonqMainWindow::showEvent(QShowEvent *event)
   // view profiles store toolbar info, and that info is read after
   // construct time.
   m_paShowMenuBar->setChecked( !menuBar()->isHidden() );
+  if ( m_currentView )
+    m_paShowStatusBar->setChecked( m_currentView->frame()->statusbar()->isVisible() );
   updateBookmarkBar(); // hide if empty
 
   // Call parent method
diff --git a/konqueror/src/konqmainwindow.h b/konqueror/src/konqmainwindow.h
index 1666370..fd007e8 100644
--- a/konqueror/src/konqmainwindow.h
+++ b/konqueror/src/konqmainwindow.h
@@ -500,6 +500,7 @@ private Q_SLOTS:
   void slotCheckComboSelection();
 
   void slotShowMenuBar();
+  void slotShowStatusBar();
 
   void slotOpenURL( const KUrl& );
 
@@ -677,6 +678,7 @@ private: // members
   KToggleAction *m_ptaUseHTML;
 
   KToggleAction *m_paShowMenuBar;
+  KToggleAction *m_paShowStatusBar;
 
   KToggleFullScreenAction *m_ptaFullScreen;
 
diff --git a/konqueror/src/konqueror.rc b/konqueror/src/konqueror.rc
index f788484..d4e6792 100644
--- a/konqueror/src/konqueror.rc
+++ b/konqueror/src/konqueror.rc
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="69">
+<gui name="Konqueror" version="70">
 <MenuBar>
  <Menu name="file" noMerge="1"><text>&File</text>
   <Action name="new_window"/>
@@ -54,6 +54,7 @@
  <Menu name="settings" noMerge="1"><text>&Settings</text>
   <Merge name="StandardToolBarMenuHandler" />
   <Action name="options_show_menubar"/>
+  <Action name="options_show_statusbar"/>
   <ActionList name="toggleview" />
   <Separator/>
   <Action name="fullscreen"/>


More information about the kde-doc-english mailing list