Bug 109080 - Show Legend and Show Tooltip should be Hide Legend and Hide Tooltip when Legend and Tooltip are displayed
Summary: Show Legend and Show Tooltip should be Hide Legend and Hide Tooltip when Lege...
Status: RESOLVED FIXED
Alias: None
Product: kalzium
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Carsten Niehaus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 15:36 UTC by Anne-Marie Mahfouf
Modified: 2005-07-18 11:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anne-Marie Mahfouf 2005-07-14 15:36:06 UTC
Version:           1.4.2pre3 (using KDE 3.4.89 (>= 20050615), compiled sources)
Compiler:          Target: i586-mandriva-linux-gnu
OS:                Linux (i686) release 2.6.11-9.mm.6mdk

When the Legend is shown, the Menu item should say: Hide Legend and same for the tooltips. This would be consistent with the Settings menu which says: Show/Hide Toolbar.
At the moment, having Show Legend even when the legend is shown does not make sense.
Comment 1 Carsten Niehaus 2005-07-14 17:29:12 UTC
Ok, now all toggleactions are in the view menu, all only display as "Show foo".  The Show Toolbar cannot be changed as we are using xmlgui. But that is in the other menu so it is not that bad.


The accelerators don't clash :)
Comment 2 cniehaus 2005-07-18 11:28:42 UTC
SVN commit 435803 by cniehaus:

Change back to the Show/Hide-notation to make the menu
consistent.

CCBUG:109080


 M  +31 -16    kalzium.cpp  
 M  +4 -4      kalzium.h  
 M  +1 -0      spectrum.cpp  


--- trunk/KDE/kdeedu/kalzium/src/kalzium.cpp #435802:435803
@@ -56,13 +56,13 @@
 	QWidget *centralWidget = new QWidget( this, "centralWidget" );
 	m_pCentralLayout = new QVBoxLayout( centralWidget, PSE_MARGIN, -1, "CentralLayout" );
 	
-  QScrollView *helperSV = new QScrollView(centralWidget);
+	QScrollView *helperSV = new QScrollView(centralWidget);
 	m_pCentralLayout->addWidget(helperSV);
-  helperSV->viewport()->setPaletteBackgroundColor(paletteBackgroundColor());  
-  helperSV->setFrameShape(QFrame::NoFrame);
+	helperSV->viewport()->setPaletteBackgroundColor(paletteBackgroundColor());  
+	helperSV->setFrameShape(QFrame::NoFrame);
 
 	m_PSE = new PSE( data(), helperSV->viewport(), "PSE");
-  helperSV->addChild( m_PSE );
+	helperSV->addChild( m_PSE );
 	m_infoDialog = 0;
 	m_toolboxCurrent = 0;
 
@@ -75,19 +75,13 @@
 	setCentralWidget( centralWidget );
 	centralWidget->show();
 
+	setupSidebars();
 	setupActions();
-	setupSidebars();
 
-	if ( m_PSE->showLegend() )
-	{
-		m_pLegendAction->setChecked( true );
-	}
-	if ( m_PSE->tooltipsEnabled() )
-	{
-		m_pTooltipAction->setChecked( true );
-	}
 	if ( Prefs::showsidebar() )
 		m_dockWin->show();
+	else
+		m_dockWin->hide();
 	m_PSE->repaint();
 
 	// creating the glossary dialog and loading the glossaries we have
@@ -152,7 +146,7 @@
 	numeration_action->setCurrentItem(Prefs::numeration()); 
 	connect (numeration_action, SIGNAL(activated(int)), this, SLOT(slotSwitchtoNumeration(int)));
 
-	m_SidebarAction = new KToggleAction(i18n("Show &Sidebar"), "sidebar", 0, this, SLOT(slotShowHideSidebar()), actionCollection(), "view_sidebar");
+	m_SidebarAction = new KAction(i18n("Show &Sidebar"), "sidebar", 0, this, SLOT(slotShowHideSidebar()), actionCollection(), "view_sidebar");
 	
 	/*
 	 * the misc actions
@@ -162,9 +156,9 @@
 	m_pGlossaryAction = new KAction(i18n("&Glossary..."), "glossary", 0, this, SLOT(slotGlossary()), actionCollection(), "glossary");
 
 	//Legend
-	m_pLegendAction = new KToggleAction(i18n("Show &Legend"), "legend", 0, this, SLOT(slotShowLegend()), actionCollection(), "toggle_legend");
+	m_pLegendAction = new KAction(i18n("Show &Legend"), "legend", 0, this, SLOT(slotShowLegend()), actionCollection(), "toggle_legend");
 	
-	m_pTooltipAction = new KToggleAction(i18n("Show &Tooltip"), "tooltip", 0, this, SLOT(slotEnableTooltips()), actionCollection(), "toggle_tooltip");
+	m_pTooltipAction = new KAction(i18n("Show &Tooltip"), "tooltip", 0, this, SLOT(slotEnableTooltips()), actionCollection(), "toggle_tooltip");
 	
 	//the standardactions
 	KStdAction::preferences(this, SLOT(showSettingsDialog()), actionCollection());
@@ -172,6 +166,14 @@
 
 	slotShowScheme( Prefs::colorschemebox() );
 	slotSwitchtoNumeration( Prefs::numeration() );
+	
+	//FIXME I am calling this twice to toggle it twice.
+	slotShowLegend();
+	slotEnableTooltips();
+	slotShowHideSidebar();
+	slotShowLegend();
+	slotEnableTooltips();
+	slotShowHideSidebar();
 
 	// set the shell's ui resource file
 	setXMLFile("kalziumui.rc");
@@ -241,6 +243,11 @@
 	bool enabled = m_PSE->tooltipsEnabled();
 	enabled = !enabled;
 
+	if ( enabled )
+		m_pTooltipAction->setText( i18n( "Hide &Tooltips" ) );
+	else
+		m_pTooltipAction->setText( i18n( "Show &Tooltips" ) );
+
 	m_PSE->setTooltipsEnabled( enabled );
 	
 	Prefs::setTooltip( enabled ); 
@@ -252,10 +259,12 @@
 	if(m_PSE->showLegend())
 	{
 		m_PSE->showLegend(false);
+		m_pLegendAction->setText( i18n( "Show &Legend" ) );
 	}
 	else
 	{
 		m_PSE->showLegend(true);
+		m_pLegendAction->setText( i18n( "Hide &Legend" ) );
 	}
 	m_PSE->update();
 	
@@ -270,9 +279,15 @@
 void Kalzium::slotShowHideSidebar()
 {
 	if( m_dockWin->isShown() )
+	{
 		m_dockWin->hide();
+		m_SidebarAction->setText( i18n( "Show &Sidebar" ) );
+	}
 	else
+	{
 		m_dockWin->show();
+		m_SidebarAction->setText( i18n( "Hide &Sidebar" ) );
+	}
 }
 
 void Kalzium::slotShowScheme(int i)
--- trunk/KDE/kdeedu/kalzium/src/kalzium.h #435802:435803
@@ -1,5 +1,5 @@
 /***************************************************************************
-    copyright            : (C) 2003, 2004 by Carsten Niehaus
+    copyright            : (C) 2003, 2004, 2005 by Carsten Niehaus
     email                : cniehaus@kde.org
  ***************************************************************************/
 /***************************************************************************
@@ -98,9 +98,9 @@
 		KAction *m_pPlotAction,
 				*m_pGlossaryAction;
 		
-		KToggleAction *m_pTooltipAction;
-		KToggleAction *m_pLegendAction;
-		KToggleAction *m_SidebarAction;
+		KAction *m_pTooltipAction;
+		KAction *m_pLegendAction;
+		KAction *m_SidebarAction;
 
 		KToggleAction *m_actionNoScheme;
 		KToggleAction *m_actionGroups;
--- trunk/KDE/kdeedu/kalzium/src/spectrum.cpp #435802:435803
@@ -127,6 +127,7 @@
 
 void SpectrumWidget::paintEvent( QPaintEvent * /*e*/ )
 {
+	if ( !m_spectrum ) return;
 	QPainter p;
 	p.begin( this );
 	p.fillRect( 0, 0, width(), m_realHeight, Qt::black );