Commit 43285ccc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add goto end / goto start

svn path=/trunk/kdegraphics/kpdf/; revision=251007
parent b1d28c85
......@@ -81,6 +81,13 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
actionCollection(), "previous_page");
KStdAction::next (this, SLOT(slotNextPage()),
actionCollection(), "next_page" );
m_firstPage = KStdAction::firstPage( this, SLOT( slotGotoStart() ),
actionCollection(), "goToStart" );
m_firstPage->setWhatsThis( i18n( "Moves to the first page of the document" ) );
m_lastPage = KStdAction::lastPage( this, SLOT( slotGotoEnd() ),
actionCollection(), "goToEnd" );
m_lastPage->setWhatsThis( i18n( "Moves to the last page of the document" ) );
// set our XML-UI resource file
setXMLFile("kpdf_part.rc");
......@@ -90,6 +97,27 @@ Part::~Part()
{
}
void Part::slotGotoEnd()
{
if ( m_doc && m_doc->getNumPages() > 0 );
{
m_currentPage = m_doc->getNumPages();
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->setPage(m_currentPage);
}
}
void Part::slotGotoStart()
{
if ( m_doc && m_doc->getNumPages() > 0 );
{
m_currentPage = 1;
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->setPage(m_currentPage);
}
}
void Part::slotNextPage()
{
m_currentPage = pdfpartview->pagesListBox->currentItem() + 1;
......@@ -144,7 +172,6 @@ Part::openFile()
if (!m_doc->isOk())
return false;
// just for fun, set the status bar
// emit setStatusBarText( QString::number( m_doc->getNumPages() ) );
......@@ -159,9 +186,7 @@ Part::openFile()
pdfpartview->pagesListBox->update();
displayPage(1);
m_outputDev->setPDFDocument(m_doc);
return true;
}
......
......@@ -87,6 +87,8 @@ namespace KPDF
void forward() { /* stub */ };
void slotNextPage();
void slotPreviousPage();
void slotGotoEnd();
void slotGotoStart();
void displayNextPage();
void displayPreviousPage();
......@@ -97,6 +99,8 @@ namespace KPDF
PDFDoc* m_doc;
PageWidget* m_outputDev;
PDFPartView * pdfpartview;
KAction* m_firstPage;
KAction* m_lastPage;
KToggleAction* m_fitToWidth;
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kpdf_part" version="4">
<kpartgui name="kpdf_part" version="5">
<MenuBar>
<Menu name="edit"><text>&amp;Edit</text>
<Action name="find"/>
......@@ -25,5 +25,8 @@
<Separator/>
<Action name="zoom_in"/>
<Action name="zoom_out"/>
<Separator/>
<Action name="goToStart"/>
<Action name="goToEnd"/>
</ToolBar>
</kpartgui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment