Commit 4ad59a89 authored by Albert Astals Cid's avatar Albert Astals Cid

ADD: Make kpdf aware of Find and GoToPage actions

FIX: Update cursor correctly when a link moves to a page and the cursor is over a link on that page

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=374750
parent b20b0aee
......@@ -110,6 +110,10 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a )
link = new KPDFLinkAction( KPDFLinkAction::HistoryForward );
else if ( !strcmp( name, "Quit" ) )
link = new KPDFLinkAction( KPDFLinkAction::Quit );
else if ( !strcmp( name, "GoToPage" ) )
link = new KPDFLinkAction( KPDFLinkAction::GoToPage );
else if ( !strcmp( name, "Find" ) )
link = new KPDFLinkAction( KPDFLinkAction::Find );
else
kdDebug() << "Unknown named action: '" << name << "'" << endl;
}
......
......@@ -88,6 +88,8 @@ More items (first items will enter 'In progress list' first):
-> set a marker on the pdf file to immediately start presentation when opening it (by Tobias Koenig)
Done (newest feature comes firts):
-> ADD: Make kpdf aware of Find and GoToPage actions
-> FIX: Update cursor correctly when a link moves to a page and the cursor is over a link on that page
-> ADD: Asyncronous PDF Generator implementation (for the user: faster UI, preloading, etc..)
-> FIX: Memory manager (free cache if needed, avoid disk swap and oom)
-> ADD: Presentation View (only the 'glitter' transition implemented for now)
......
......@@ -481,6 +481,12 @@ void KPDFDocument::processLink( const KPDFLink * link )
case KPDFLinkAction::Quit:
kapp->quit();
break;
case KPDFLinkAction::Find:
emit linkFind();
break;
case KPDFLinkAction::GoToPage:
emit linkGoToPage();
break;
}
} break;
......
......@@ -105,6 +105,10 @@ class KPDFDocument : public QObject // only for a private slot..
void processLink( const KPDFLink * link );
bool print( KPrinter &printer );
signals:
void linkFind();
void linkGoToPage();
private:
// memory management related functions
void mCleanupMemory( int observerId );
......
......@@ -89,6 +89,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// build the document
m_document = new KPDFDocument();
connect( m_document, SIGNAL( linkFind() ), this, SLOT( slotFind() ) );
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
// widgets: ^searchbar (toolbar containing label and SearchWidget)
// m_searchToolBar = new KToolBar( parentWidget, "searchBar" );
......
......@@ -91,7 +91,7 @@ class KPDFLinkAction : public KPDFLink
{
public:
// define types of actions
enum ActionType { PageFirst, PagePrev, PageNext, PageLast, HistoryBack, HistoryForward, Quit };
enum ActionType { PageFirst, PagePrev, PageNext, PageLast, HistoryBack, HistoryForward, Quit, Find, GoToPage };
// query for action type
ActionType actionType() const { return m_type; }
......
......@@ -16,6 +16,7 @@
* (at your option) any later version. *
***************************************************************************/
#include <qcursor.h>
#include <qpainter.h>
#include <qtimer.h>
#include <qpushbutton.h>
......@@ -282,6 +283,11 @@ void PageView::pageSetCurrent( int pageNumber, const QRect & viewport )
// update zoom text if in a ZoomFit/* zoom mode
if ( d->zoomMode != ZoomFixed )
updateZoomText();
// that is here because of that
// you clicked on a link that brought you to another page
// the page was on the cache and you have to update the cursor
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
}
bool PageView::canUnloadPixmap( int pageNumber )
......@@ -305,6 +311,10 @@ void PageView::notifyPixmapChanged( int pageNumber )
QRect expandedRect = (*iIt)->geometry();
expandedRect.addCoords( -1, -1, 3, 3 );
updateContents( expandedRect );
// that is here because of that
// you clicked on a link that brought you to another page
// the page was not on the cache so the updateCursor from pageSetCurrent does not work
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
break;
}
}
......@@ -612,7 +622,6 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
switch ( d->mouseMode )
{
case MouseNormal:{ // do Follow Link or Display RMB
setCursor( arrowCursor );
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
if ( leftButton && pageItem )
{
......
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