|
|
|
@ -4094,9 +4094,35 @@ QString Document::bookmarkedPageRange() const |
|
|
|
return range; |
|
|
|
return range; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct ExecuteNextActionsHelper : public QObject { |
|
|
|
struct ExecuteNextActionsHelper : public QObject, private DocumentObserver { |
|
|
|
Q_OBJECT |
|
|
|
Q_OBJECT |
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
explicit ExecuteNextActionsHelper(Document *doc) |
|
|
|
|
|
|
|
: m_doc(doc) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
doc->addObserver(this); |
|
|
|
|
|
|
|
connect(doc, &Document::aboutToClose, this, [this] { b = false; }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~ExecuteNextActionsHelper() override |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_doc->removeObserver(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void notifySetup(const QVector<Okular::Page *> & /*pages*/, int setupFlags) override |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (setupFlags == DocumentChanged || setupFlags == UrlChanged) { |
|
|
|
|
|
|
|
b = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool shouldExecuteNextAction() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return b; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
Document *const m_doc; |
|
|
|
bool b = true; |
|
|
|
bool b = true; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -4107,8 +4133,7 @@ void Document::processAction(const Action *action) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Don't execute next actions if the action itself caused the closing of the document
|
|
|
|
// Don't execute next actions if the action itself caused the closing of the document
|
|
|
|
ExecuteNextActionsHelper executeNextActions; |
|
|
|
const ExecuteNextActionsHelper executeNextActionsHelper(this); |
|
|
|
connect(this, &Document::aboutToClose, &executeNextActions, [&executeNextActions] { executeNextActions.b = false; }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (action->actionType()) { |
|
|
|
switch (action->actionType()) { |
|
|
|
case Action::Goto: { |
|
|
|
case Action::Goto: { |
|
|
|
@ -4311,7 +4336,7 @@ void Document::processAction(const Action *action) |
|
|
|
} break; |
|
|
|
} break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (executeNextActions.b) { |
|
|
|
if (executeNextActionsHelper.shouldExecuteNextAction()) { |
|
|
|
const QVector<Action *> nextActions = action->nextActions(); |
|
|
|
const QVector<Action *> nextActions = action->nextActions(); |
|
|
|
for (const Action *a : nextActions) { |
|
|
|
for (const Action *a : nextActions) { |
|
|
|
processAction(a); |
|
|
|
processAction(a); |
|
|
|
|