Commit 840a526b authored by Pino Toscano's avatar Pino Toscano

Use the configured shortcuts for the PrevPage/NextPage/FirstPage/LastPage...

Use the configured shortcuts for the PrevPage/NextPage/FirstPage/LastPage actions in the presentation mode, and for the FindNext in the find ahead of the main view.

svn path=/trunk/playground/graphics/okular/; revision=554883
parent 7e412556
......@@ -40,7 +40,6 @@ More items (first items will enter 'In progress list' first):
-> bookmarks: fastmarks (new bookmark concept with tab-like signs, shortcuts, etc) (BR
-> viewport restoring: sometimes it seems to restore the viewport a bit under where it was
-> viewport restoring: save the zoom/viewCols/continuous setting between runs (BR97307+patch)
-> search: use shortcut for 'find next' action (not the default one) in find-ahead
-> core: Delay TOC (DocumentSynopsis) generation (and move it on thread)
-> core: add a way to handle "named xpdf links" in KPDFLink instead of resolving all
dests when displaying a page (speedups a lot generation of page with many links)
......@@ -89,7 +88,6 @@ More items (first items will enter 'In progress list' first):
-> presentation: 2 pages per view, for users reading ebooks with wide screens.
-> splash(xpdf): check lack of smoothness at low resolutions and antialiasing (BR94231)
-> goto 'logical' page (usually differs from pdf's page) (req. by Luca Burrelli)
-> use shortcuts for next and prev page even in presentation mode (by Tobias Koenig)
-> move some document related features from part to the document (see find, goto dialog, ...)
-> Albert: Read pdf specification and see if paths with length = 1 are allowed, in case they are allowed see how to fix 97131 without skipping paths with length = 1
-> tools: ruler, measure: distance, perimeter, ?area?, color picker
......@@ -107,6 +105,8 @@ Icons needed:
- COMMON (here in ToolBox): Toc, Annotations
Done (newest features come first):
-> CHG: search: use shortcut for 'find next' action (not the default one) in find-ahead
-> CHG: use shortcuts for next and prev page even in presentation mode (by Tobias Koenig)
-> ADD: bookmarks: go to next/previous actions (showing in thumbnailslist rmb popup too)
-> CHG: open dialog: switch to directory where the already opened (local) file is
-> ADD: toc: add search bar (a 'prune on type' lineedit like in thumbnails widget) (BR99349)
......
......@@ -1063,7 +1063,10 @@ void Part::slotShowEmbeddedFiles()
void Part::slotShowPresentation()
{
if ( !m_presentationWidget )
{
m_presentationWidget = new PresentationWidget( widget(), m_document );
m_presentationWidget->setupActions( actionCollection() );
}
}
void Part::slotHidePresentation()
......
......@@ -127,6 +127,7 @@ public:
KSelectAction * aRenderMode;
KToggleAction * aViewContinuous;
KAction * aPrevAction;
KActionCollection * actionCollection;
};
......@@ -212,6 +213,8 @@ PageView::~PageView()
void PageView::setupActions( KActionCollection * ac )
{
d->actionCollection = ac;
d->aOrientation=new KSelectAction( i18n( "&Orientation" ), ac, "view_orientation" );
d->aPaperSizes=new KSelectAction( i18n( "&Paper sizes" ), ac, "view_papersizes" );
QStringList rotations;
......@@ -776,8 +779,8 @@ if (d->document->handleEvent( e ) )
d->document->resetSearch( PAGEVIEW_SEARCH_ID );
}
}
// F3: go to next occurrency
else if( e->key() == KStdAccel::findNext().keyQt() )
// go to next occurrency
else if( e->key() == d->actionCollection->action( "find_next" )->shortcut().keyQt() )
{
// part doesn't get this key event because of the keyboard grab
d->findTimeoutTimer->stop(); // restore normal operation during possible messagebox is displayed
......
......@@ -19,12 +19,12 @@
#include <kcursor.h>
#include <krandom.h>
#include <qtoolbar.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kimageeffect.h>
#include <kmessagebox.h>
#include <kwin.h>
#include <kshortcut.h>
// system includes
#include <stdlib.h>
......@@ -178,6 +178,11 @@ bool PresentationWidget::canUnloadPixmap( int pageNumber )
return pageNumber != m_frameIndex;
}
void PresentationWidget::setupActions( KActionCollection * collection )
{
m_ac = collection;
}
// <widget events>
bool PresentationWidget::event( QEvent * e )
......@@ -206,13 +211,13 @@ void PresentationWidget::keyPressEvent( QKeyEvent * e )
{
if (m_width == -1) return;
if ( e->key() == Qt::Key_Left || e->key() == Qt::Key_Backspace || e->key() == Qt::Key_PageUp )
if ( e->key() == m_ac->action( "previous_page" )->shortcut().keyQt() || e->key() == Qt::Key_Left || e->key() == Qt::Key_Backspace || e->key() == Qt::Key_PageUp )
slotPrevPage();
else if ( e->key() == Qt::Key_Right || e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown )
else if ( e->key() == m_ac->action( "next_page" )->shortcut().keyQt() || e->key() == Qt::Key_Right || e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown )
slotNextPage();
else if ( e->key() == Qt::Key_Home )
else if ( e->key() == m_ac->action( "first_page" )->shortcut().keyQt() || e->key() == Qt::Key_Home )
slotFirstPage();
else if ( e->key() == Qt::Key_End )
else if ( e->key() == m_ac->action( "last_page" )->shortcut().keyQt() || e->key() == Qt::Key_End )
slotLastPage();
else if ( e->key() == Qt::Key_Escape )
{
......
......@@ -19,6 +19,7 @@
class QToolBar;
class QTimer;
class KActionCollection;
class KPDFDocument;
class KPDFPage;
......@@ -44,6 +45,9 @@ class PresentationWidget : public QDialog, public DocumentObserver
void notifyPageChanged( int pageNumber, int changedFlags );
bool canUnloadPixmap( int pageNumber );
// create actions that interact with this widget
void setupActions( KActionCollection * collection );
protected:
// widget events
bool event( QEvent * e );
......@@ -89,6 +93,7 @@ class PresentationWidget : public QDialog, public DocumentObserver
int m_frameIndex;
QStringList m_metaStrings;
QToolBar * m_topBar;
KActionCollection * m_ac;
private slots:
void slotNextPage();
......
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