Fix update page action

svn path=/trunk/kdegraphics/kpdf/; revision=251187
This commit is contained in:
Laurent Montel 2003-09-15 09:35:55 +00:00
parent 07fc028972
commit c16b87bb50
2 changed files with 29 additions and 3 deletions

View file

@ -105,11 +105,12 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// set our XML-UI resource file
setXMLFile("kpdf_part.rc");
connect( m_outputDev, SIGNAL( ZoomIn() ), SLOT( slotZoomIn() ));
connect( m_outputDev, SIGNAL( ZoomOut() ), SLOT( slotZoomOut() ));
connect( m_outputDev, SIGNAL( ZoomIn() ), SLOT( zoomIn() ));
connect( m_outputDev, SIGNAL( ZoomOut() ), SLOT( zoomOut() ));
connect( m_outputDev, SIGNAL( ReadUp() ), SLOT( slotReadUp() ));
connect( m_outputDev, SIGNAL( ReadDown() ), SLOT( slotReadDown() ));
readSettings();
updateActionPage();
}
Part::~Part()
@ -118,6 +119,24 @@ Part::~Part()
writeSettings();
}
void Part::updateActionPage()
{
if ( m_doc )
{
m_firstPage->setEnabled(m_currentPage!=0);
m_lastPage->setEnabled(m_currentPage!=m_doc->getNumPages());
m_prevPage->setEnabled(m_currentPage!=0);
m_nextPage->setEnabled(m_currentPage!=m_doc->getNumPages());
}
else
{
m_firstPage->setEnabled(false);
m_lastPage->setEnabled(false);
m_prevPage->setEnabled(false);
m_nextPage->setEnabled(false);
}
}
void Part::slotReadUp()
{
if( !m_doc )
@ -177,6 +196,7 @@ void Part::slotGotoEnd()
m_currentPage = m_doc->getNumPages();
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->setPage(m_currentPage);
updateActionPage();
}
}
@ -188,6 +208,7 @@ void Part::slotGotoStart()
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->setPage(m_currentPage);
updateActionPage();
}
}
@ -199,6 +220,7 @@ bool Part::nextPage()
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->nextPage();
updateActionPage();
return true;
}
@ -220,6 +242,7 @@ bool Part::previousPage()
pdfpartview->pagesListBox->setCurrentItem(m_currentPage );
m_outputDev->previousPage();
updateActionPage();
return true;
}
@ -280,6 +303,7 @@ Part::displayPage(int pageNumber, float /*zoomFactor*/)
{
if (pageNumber <= 0 || pageNumber > m_doc->getNumPages())
return;
updateActionPage();
const double pageWidth = m_doc->getPageWidth (pageNumber) * m_zoomFactor;
const double pageHeight = m_doc->getPageHeight(pageNumber) * m_zoomFactor;

View file

@ -69,7 +69,7 @@ namespace KPDF
void displayPage(int pageNumber, float zoomFactor = 1.0);
void displayDestination(LinkDest*);
void updateActionPage();
protected:
/**
* This must be implemented by each part
@ -81,6 +81,8 @@ namespace KPDF
void writeSettings();
bool nextPage();
bool previousPage();
void updateAction();
protected slots:
void find() { /* stub */ };
void findNext() { /* stub */ };