From 5b1276dc571ad8ce8ca9d419d77d89da596883aa Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 13 May 2009 11:13:04 +0000 Subject: [PATCH] Add for GotoAction the possibility to represent a named destination, instead of a viewport. svn path=/trunk/KDE/kdegraphics/okular/; revision=967385 --- core/action.cpp | 17 +++++++++++++++++ core/action.h | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/core/action.cpp b/core/action.cpp index df665b9f8..b047ddf5c 100644 --- a/core/action.cpp +++ b/core/action.cpp @@ -56,8 +56,14 @@ class Okular::GotoActionPrivate : public Okular::ActionPrivate { } + GotoActionPrivate( const QString &fileName, const QString &namedDestination ) + : ActionPrivate(), m_extFileName( fileName ), m_dest( namedDestination ) + { + } + QString m_extFileName; DocumentViewport m_vp; + QString m_dest; }; GotoAction::GotoAction( const QString& fileName, const DocumentViewport & viewport ) @@ -65,6 +71,11 @@ GotoAction::GotoAction( const QString& fileName, const DocumentViewport & viewpo { } +GotoAction::GotoAction( const QString& fileName, const QString& namedDestination ) + : Action( *new GotoActionPrivate( fileName, namedDestination ) ) +{ +} + GotoAction::~GotoAction() { } @@ -99,6 +110,12 @@ DocumentViewport GotoAction::destViewport() const return d->m_vp; } +QString GotoAction::destinationName() const +{ + Q_D( const GotoAction ); + return d->m_dest; +} + // ExecuteAction class Okular::ExecuteActionPrivate : public Okular::ActionPrivate diff --git a/core/action.h b/core/action.h index 6c2563f09..c45a13dd8 100644 --- a/core/action.h +++ b/core/action.h @@ -97,6 +97,16 @@ class OKULAR_EXPORT GotoAction : public Action */ GotoAction( const QString& fileName, const DocumentViewport & viewport ); + /** + * Creates a new goto action. + * + * @p fileName The name of an external file that shall be loaded. + * @p namedDestination The target named destination for the target document. + * + * @since 0.9 (KDE 4.3) + */ + GotoAction( const QString& fileName, const QString& namedDestination ); + /** * Destroys the goto action. */ @@ -127,6 +137,13 @@ class OKULAR_EXPORT GotoAction : public Action */ DocumentViewport destViewport() const; + /** + * Returns the document named destination the goto action points to. + * + * @since 0.9 (KDE 4.3) + */ + QString destinationName() const; + private: Q_DECLARE_PRIVATE( GotoAction ) Q_DISABLE_COPY( GotoAction )