Commit 537f7253 authored by Laurent Montel's avatar Laurent Montel

Add goto page action

svn path=/trunk/kdegraphics/kpdf/; revision=251362
parent 3653d2a8
......@@ -16,6 +16,7 @@
#include <kparts/genericfactory.h>
#include <kdebug.h>
#include <kurldrag.h>
#include <kinputdialog.h>
#include "part.h"
......@@ -105,6 +106,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
actionCollection(), "goToEnd" );
m_lastPage->setWhatsThis( i18n( "Moves to the last page of the document" ) );
m_gotoPage = KStdAction::gotoPage( this, SLOT( slotGoToPage() ),
actionCollection(), "goToPage" );
// set our XML-UI resource file
setXMLFile("kpdf_part.rc");
connect( m_outputDev, SIGNAL( ZoomIn() ), SLOT( zoomIn() ));
......@@ -123,6 +126,26 @@ Part::~Part()
writeSettings();
}
void Part::slotGoToPage()
{
if ( m_doc )
{
bool ok = false;
int num = KInputDialog::getInteger(i18n("Go to Page"), i18n("Page:"), 1,
1, m_doc->getNumPages(), 1, 10, &ok/*, _part->widget()*/);
if (ok)
goToPage( num -1 );
}
}
void Part::goToPage( int page )
{
m_currentPage = page;
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
m_outputDev->setPage(m_currentPage);
updateActionPage();
}
void Part::slotOpenUrlDropped( const KURL &url )
{
openURL(url );
......
......@@ -85,6 +85,7 @@ namespace KPDF
bool nextPage();
bool previousPage();
void updateAction();
void goToPage( int page );
protected slots:
void find() { /* stub */ };
......@@ -97,7 +98,7 @@ namespace KPDF
void slotPreviousPage();
void slotGotoEnd();
void slotGotoStart();
void slotGoToPage();
void displayNextPage();
void displayPreviousPage();
......@@ -116,6 +117,7 @@ namespace KPDF
KAction* m_lastPage;
KAction* m_prevPage;
KAction* m_nextPage;
KAction *m_gotoPage;
KToggleAction* m_showScrollBars;
KToggleAction* m_showPageList;
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kpdf_part" version="8">
<kpartgui name="kpdf_part" version="9">
<MenuBar>
<Menu name="edit"><text>&amp;Edit</text>
<Action name="find"/>
......@@ -17,6 +17,8 @@
<Separator/>
<Action name="previous_page"/>
<Action name="next_page"/>
<Separator/>
<Action name="goToPage"/>
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
<Action name="show_scrollbars"/>
......
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