10#include <KLocalizedString>
16#include "sourcereference_p.h"
20class Okular::ActionPrivate
27 virtual ~ActionPrivate()
29 qDeleteAll(m_nextActions);
32 ActionPrivate(
const ActionPrivate &) =
delete;
33 ActionPrivate &operator=(
const ActionPrivate &) =
delete;
39Action::Action(ActionPrivate &dd)
69 return d->m_nextActions;
75 qDeleteAll(d->m_nextActions);
76 d->m_nextActions = actions;
81class Okular::GotoActionPrivate :
public Okular::ActionPrivate
86 , m_extFileName(fileName)
91 GotoActionPrivate(
const QString &fileName,
const QString &namedDestination)
93 , m_extFileName(fileName)
94 , m_dest(namedDestination)
104 :
Action(*new GotoActionPrivate(fileName, viewport))
109 :
Action(*new GotoActionPrivate(fileName, namedDestination))
125 return d->m_extFileName.isEmpty() ? (d->m_vp.isValid() ?
i18n(
"Go to page %1", d->m_vp.pageNumber + 1) :
QLatin1String(
"")) :
i18n(
"Open external file");
131 return !d->m_extFileName.isEmpty();
137 return d->m_extFileName;
154class Okular::ExecuteActionPrivate :
public Okular::ActionPrivate
157 ExecuteActionPrivate(
const QString &file,
const QString ¶meters)
160 , m_parameters(parameters)
169 :
Action(*new ExecuteActionPrivate(file, parameters))
185 return i18n(
"Execute '%1'...", d->m_fileName);
191 return d->m_fileName;
197 return d->m_parameters;
202class Okular::BrowseActionPrivate :
public Okular::ActionPrivate
205 explicit BrowseActionPrivate(
const QUrl &url)
215 :
Action(*new BrowseActionPrivate(url))
232 int row = 0, col = 0;
233 if (extractLilyPondSourceReference(d->m_url, &source, &row, &col)) {
234 return sourceReferenceToolTip(source, row, col);
236 return d->m_url.toDisplayString();
247class Okular::DocumentActionPrivate :
public Okular::ActionPrivate
252 , m_type(documentActionType)
260 :
Action(*new DocumentActionPrivate(documentActionType))
284 return i18n(
"First Page");
286 return i18n(
"Previous Page");
288 return i18n(
"Next Page");
290 return i18n(
"Last Page");
294 return i18n(
"Forward");
298 return i18n(
"Start Presentation");
300 return i18n(
"End Presentation");
302 return i18n(
"Find...");
304 return i18n(
"Go To Page...");
314class Okular::SoundActionPrivate :
public Okular::ActionPrivate
317 SoundActionPrivate(
double volume,
bool sync,
bool repeat,
bool mix,
Okular::Sound *sound)
327 ~SoundActionPrivate()
override
340 :
Action(*new SoundActionPrivate(volume, sync, repeat, mix, sound))
355 return i18n(
"Play sound...");
390class Okular::ScriptActionPrivate :
public Okular::ActionPrivate
405 :
Action(*new ScriptActionPrivate(type, script))
421 switch (d->m_scriptType) {
423 return i18n(
"JavaScript Script");
432 return d->m_scriptType;
443class Okular::MovieActionPrivate :
public Okular::ActionPrivate
448 , m_operation(operation)
449 , m_annotation(nullptr)
458 :
Action(*new MovieActionPrivate(operation))
473 return i18n(
"Play movie...");
479 return d->m_operation;
491 return d->m_annotation;
496class Okular::RenditionActionPrivate :
public Okular::ActionPrivate
501 , m_operation(operation)
503 , m_scriptType(scriptType)
505 , m_annotation(nullptr)
517 :
Action(*new RenditionActionPrivate(operation, movie, scriptType, script))
534 switch (d->m_operation) {
537 switch (d->m_scriptType) {
539 return i18n(
"JavaScript Script");
544 return i18n(
"Play movie");
546 return i18n(
"Stop movie");
548 return i18n(
"Pause movie");
550 return i18n(
"Resume movie");
557 return d->m_operation;
569 return d->m_scriptType;
587 return d->m_annotation;
590BackendOpaqueAction::BackendOpaqueAction()
591 :
Action(*new ActionPrivate())
Encapsulates data that describes an action.
ActionType
Describes the type of action.
@ Execute
Execute a command or external application.
@ Goto
Goto a given page or external document.
@ DocAction
Start a custom action.
@ BackendOpaque
Calls back to the backend with the action.
@ Browse
Browse a given website.
@ Script
Executes a Script code.
@ Rendition
Play a movie and/or execute a Script code.
The Browse action browses an url by opening a web browser or email client, depending on the url proto...
ActionType actionType() const override
Returns the action type.
~BrowseAction() override
Destroys the browse action.
BrowseAction(const QUrl &url)
Creates a new browse action.
QUrl url() const
Returns the url to browse.
QString actionTip() const override
Returns the action tip.
The DocumentAction action contains an action that is performed on the current document.
DocumentActionType documentActionType() const
Returns the type of action.
~DocumentAction() override
Destroys the document action.
ActionType actionType() const override
Returns the action type.
DocumentActionType
Describes the possible action types.
@ PageNext
Jump to next page.
@ Presentation
Start presentation.
@ PageLast
Jump to last page.
@ PageFirst
Jump to first page.
@ HistoryForward
Go forward in page history.
@ EndPresentation
End presentation.
@ PagePrev
Jump to previous page.
@ HistoryBack
Go back in page history.
DocumentAction(enum DocumentActionType documentActionType)
Creates a new document action.
QString actionTip() const override
Returns the action tip.
The Execute action executes an external application.
ActionType actionType() const override
Returns the action type.
QString fileName() const
Returns the file name of the application to execute.
QString actionTip() const override
Returns the action tip.
~ExecuteAction() override
Destroys the execute action.
ExecuteAction(const QString &fileName, const QString ¶meters)
Creates a new execute action.
QString parameters() const
Returns the parameters of the application to execute.
The Goto action changes the viewport to another page or loads an external document.
QString actionTip() const override
Returns the action tip.
ActionType actionType() const override
Returns the action type.
bool isExternal() const
Returns whether the goto action points to an external document.
QString destinationName() const
Returns the document named destination the goto action points to.
GotoAction(const QString &fileName, const DocumentViewport &viewport)
Creates a new goto action.
~GotoAction() override
Destroys the goto action.
QString fileName() const
Returns the filename of the external document.
DocumentViewport destViewport() const
Returns the document viewport the goto action points to.
The Movie action executes an operation on a video on activation.
QString actionTip() const override
Returns the action tip.
void setAnnotation(MovieAnnotation *annotation)
Sets the annotation that is associated with the movie action.
~MovieAction() override
Destroys the movie action.
MovieAnnotation * annotation() const
Returns the annotation or 0 if no annotation has been set.
MovieAction(OperationType operation)
Creates a new movie action.
OperationType operation() const
Returns the operation type.
ActionType actionType() const override
Returns the action type.
OperationType
Describes the possible operation types.
Contains information about a movie object.
The Rendition action executes an operation on a video or executes some JavaScript code on activation.
ScriptType scriptType() const
Returns the type of script.
QString actionTip() const override
Returns the action tip.
~RenditionAction() override
Destroys the rendition action.
ScreenAnnotation * annotation() const
Returns the annotation or 0 if no annotation has been set.
void setAnnotation(ScreenAnnotation *annotation)
Sets the annotation that is associated with the rendition action.
ActionType actionType() const override
Returns the action type.
RenditionAction(OperationType operation, Okular::Movie *movie, enum ScriptType scriptType, const QString &script)
Creates a new rendition action.
Okular::Movie * movie() const
Returns the movie object or 0 if no movie object was set on construction time.
OperationType
Describes the possible operation types.
@ Stop
Stop playing the video.
@ Resume
Resume playing the video.
@ None
Execute only the JavaScript.
@ Play
Start playing the video.
QString script() const
Returns the script code.
OperationType operation() const
Returns the operation type.
The Script action executes a Script code.
QString actionTip() const override
Returns the action tip.
ScriptType scriptType() const
Returns the type of action.
ScriptAction(enum ScriptType type, const QString &script)
Creates a new Script action.
~ScriptAction() override
Destroys the browse action.
ActionType actionType() const override
Returns the action type.
QString script() const
Returns the code.
The Sound action plays a sound on activation.
SoundAction(double volume, bool synchronous, bool repeat, bool mix, Okular::Sound *sound)
Creates a new sound action.
~SoundAction() override
Destroys the sound action.
bool mix() const
Returns whether the sound shall be mixed.
bool synchronous() const
Returns whether the sound shall be played synchronous.
ActionType actionType() const override
Returns the action type.
double volume() const
Returns the volume of the sound.
bool repeat() const
Returns whether the sound shall be repeated.
QString actionTip() const override
Returns the action tip.
Okular::Sound * sound() const
Returns the sound object which contains the sound data.
Contains information about a sound object.
QString i18n(const char *text, const TYPE &arg...)
ScriptType
Describes the possible script types.
@ JavaScript
JavaScript code.