Extract document-session save-version helper
This commit is contained in:
@@ -252,6 +252,8 @@ private:
|
||||
std::shared_ptr<NodeDialogSave> dialog_;
|
||||
};
|
||||
|
||||
void save_document_version(App& app, const pp::app::DocumentVersionTarget& target);
|
||||
|
||||
class LegacyDocumentVersionSaveServices final : public pp::app::DocumentVersionSaveServices {
|
||||
public:
|
||||
explicit LegacyDocumentVersionSaveServices(App& app) noexcept
|
||||
@@ -261,21 +263,26 @@ public:
|
||||
|
||||
void save_document_version(const pp::app::DocumentVersionTarget& target) override
|
||||
{
|
||||
const auto history_status = apply_document_history(pp::app::plan_document_version_save_history(target));
|
||||
if (!history_status.ok()) {
|
||||
LOG("Document version history effect failed: %s", history_status.message);
|
||||
}
|
||||
app_.doc_name = target.name;
|
||||
app_.doc_path = target.path;
|
||||
app_.canvas->m_canvas->m_unsaved = true;
|
||||
app_.title_update();
|
||||
project_save_after_snapshot(app_, app_.doc_path);
|
||||
save_document_version(app_, target);
|
||||
}
|
||||
|
||||
private:
|
||||
App& app_;
|
||||
};
|
||||
|
||||
void save_document_version(App& app, const pp::app::DocumentVersionTarget& target)
|
||||
{
|
||||
const auto history_status = apply_document_history(pp::app::plan_document_version_save_history(target));
|
||||
if (!history_status.ok()) {
|
||||
LOG("Document version history effect failed: %s", history_status.message);
|
||||
}
|
||||
app.doc_name = target.name;
|
||||
app.doc_path = target.path;
|
||||
app.canvas->m_canvas->m_unsaved = true;
|
||||
app.title_update();
|
||||
project_save_after_snapshot(app, app.doc_path);
|
||||
}
|
||||
|
||||
class LegacyCloseRequestServices final : public pp::app::CloseRequestServices {
|
||||
public:
|
||||
LegacyCloseRequestServices(App& app, bool& dialog_already_opened) noexcept
|
||||
|
||||
Reference in New Issue
Block a user