1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 07:49:56 +00:00

flag newly merged documents as dirty (triggering an 'are you sure' dialogue when closing without saving first)

(cherry picked from commit c92898a5bc)

Conflicts:
	apps/opencs/model/doc/document.cpp
	apps/opencs/model/doc/document.hpp
This commit is contained in:
Marc Zinnschlag 2015-08-23 12:37:45 +02:00 committed by cc9cii
parent 973c65bc82
commit 024a5405e0
3 changed files with 16 additions and 2 deletions

View file

@ -2258,7 +2258,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
mSaving (&mSavingOperation),
mResDir(resDir),
mRunner (mProjectPath), mPhysics(boost::shared_ptr<CSVWorld::PhysicsSystem>()),
mIdCompletionManager(mData)
mIdCompletionManager(mData), mDirty (false)
{
if (mContentFiles.empty())
throw std::runtime_error ("Empty content file sequence");
@ -2322,7 +2322,7 @@ int CSMDoc::Document::getState() const
{
int state = 0;
if (!mUndoStack.isClean())
if (!mUndoStack.isClean() || mDirty)
state |= State_Modified;
if (mSaving.isRunning())
@ -2414,6 +2414,9 @@ void CSMDoc::Document::reportMessage (const CSMDoc::Message& message, int type)
void CSMDoc::Document::operationDone (int type, bool failed)
{
if (type==CSMDoc::State_Saving && !failed)
mDirty = false;
emit stateChanged (getState(), this);
}
@ -2498,3 +2501,8 @@ CSMWorld::IdCompletionManager &CSMDoc::Document::getIdCompletionManager()
{
return mIdCompletionManager;
}
void CSMDoc::Document::flagAsDirty()
{
mDirty = true;
}

View file

@ -67,6 +67,8 @@ namespace CSMDoc
Blacklist mBlacklist;
Runner mRunner;
boost::shared_ptr<CSVWorld::PhysicsSystem> mPhysics;
bool mDirty;
CSMWorld::IdCompletionManager mIdCompletionManager;
// It is important that the undo stack is declared last, because on desctruction it fires a signal, that is connected to a slot, that is
@ -150,6 +152,8 @@ namespace CSMDoc
CSMWorld::IdCompletionManager &getIdCompletionManager();
void flagAsDirty();
signals:
void stateChanged (int state, CSMDoc::Document *document);

View file

@ -213,6 +213,8 @@ void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
this, SIGNAL (mergeDone (CSMDoc::Document*)));
}
target->flagAsDirty();
mMergeOperation->setTarget (target);
mMerge.start();