[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kghostview
From: Waldo Bastian <bastian () kde ! org>
Date: 2004-06-12 14:46:55
Message-ID: 20040612144655.A716925B7 () office ! kde ! org
[Download RAW message or body]
CVS commit by waba:
Disable most actions when no document is loaded.
They causes crashes otherwise.
M +19 -8 kgv_view.cpp 1.182
M +2 -0 kgv_view.h 1.80
--- kdegraphics/kghostview/kgv_view.cpp #1.181:1.182
@@ -262,8 +262,8 @@ KGVPart::KGVPart( QWidget* parentWidget,
_zoomTo->setCurrentItem( idx );
- new KAction( i18n( "&Fit to Page Width" ), 0, this,
+ _fitWidth = new KAction( i18n( "&Fit to Page Width" ), 0, this,
SLOT( slotFitToPage() ), actionCollection(),
"fit_to_page");
- new KAction( i18n( "&Fit to Screen" ), Key_S, this,
+ _fitScreen = new KAction( i18n( "&Fit to Screen" ), Key_S, this,
SLOT( slotFitToScreen() ), actionCollection(),
"fit_to_screen");
@@ -347,4 +347,6 @@ KGVPart::KGVPart( QWidget* parentWidget,
items.prepend( i18n( "Auto ") );
_selectMedia->setItems( items );
+
+ updatePageDepActions();
}
@@ -419,4 +421,5 @@ bool KGVPart::closeURL()
_fileWatcher->removeFile( m_file );
_mimetype = QString::null;
+ updatePageDepActions();
stateChanged( "initState" );
return KParts::ReadOnlyPart::closeURL();
@@ -575,11 +578,15 @@ void KGVPart::updateZoomActions()
void KGVPart::updatePageDepActions()
{
- if( !( document() && document()->isOpen() ) )
- return;
+ bool hasDoc = document() && document()->isOpen();
- _prevPage->setEnabled( !_docManager->atFirstPage() );
- _firstPage->setEnabled( !_docManager->atFirstPage() );
- _nextPage->setEnabled( !_docManager->atLastPage() );
- _lastPage->setEnabled( !_docManager->atLastPage() );
+ _fitWidth->setEnabled( hasDoc );
+ _fitScreen->setEnabled( hasDoc );
+
+ _prevPage->setEnabled( hasDoc && !_docManager->atFirstPage() );
+ _firstPage->setEnabled( hasDoc && !_docManager->atFirstPage() );
+ _nextPage->setEnabled( hasDoc && !_docManager->atLastPage() );
+ _lastPage->setEnabled( hasDoc && !_docManager->atLastPage() );
+ _gotoPage->setEnabled( hasDoc &&
+ !(_docManager->atFirstPage() && _docManager->atLastPage()) );
updateReadUpDownActions();
@@ -589,5 +596,9 @@ void KGVPart::updateReadUpDownActions()
{
if( !( document() && document()->isOpen() ) )
+ {
+ _readUp->setEnabled( false );
+ _readDown->setEnabled( false );
return;
+ }
if( _docManager->atFirstPage() && _pageView->atTop() )
--- kdegraphics/kghostview/kgv_view.h #1.79:1.80
@@ -192,4 +192,6 @@ private:
KAction* _zoomOut;
KSelectAction* _zoomTo;
+ KAction * _fitWidth;
+ KAction * _fitScreen;
KAction* _prevPage;
KAction* _nextPage;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic