mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
flag newly merged documents as dirty (triggering an 'are you sure' dialogue when closing without saving first)
This commit is contained in:
parent
3902513e65
commit
c92898a5bc
3 changed files with 15 additions and 2 deletions
|
@ -2256,7 +2256,7 @@ CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationM
|
||||||
mSavingOperation (*this, mProjectPath, encoding),
|
mSavingOperation (*this, mProjectPath, encoding),
|
||||||
mSaving (&mSavingOperation),
|
mSaving (&mSavingOperation),
|
||||||
mResDir(resDir),
|
mResDir(resDir),
|
||||||
mRunner (mProjectPath), mIdCompletionManager(mData)
|
mRunner (mProjectPath), mIdCompletionManager(mData), mDirty (false)
|
||||||
{
|
{
|
||||||
if (mContentFiles.empty())
|
if (mContentFiles.empty())
|
||||||
throw std::runtime_error ("Empty content file sequence");
|
throw std::runtime_error ("Empty content file sequence");
|
||||||
|
@ -2325,7 +2325,7 @@ int CSMDoc::Document::getState() const
|
||||||
{
|
{
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
if (!mUndoStack.isClean())
|
if (!mUndoStack.isClean() || mDirty)
|
||||||
state |= State_Modified;
|
state |= State_Modified;
|
||||||
|
|
||||||
if (mSaving.isRunning())
|
if (mSaving.isRunning())
|
||||||
|
@ -2417,6 +2417,9 @@ void CSMDoc::Document::reportMessage (const CSMDoc::Message& message, int type)
|
||||||
|
|
||||||
void CSMDoc::Document::operationDone (int type, bool failed)
|
void CSMDoc::Document::operationDone (int type, bool failed)
|
||||||
{
|
{
|
||||||
|
if (type==CSMDoc::State_Saving && !failed)
|
||||||
|
mDirty = false;
|
||||||
|
|
||||||
emit stateChanged (getState(), this);
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2493,3 +2496,8 @@ CSMWorld::IdCompletionManager &CSMDoc::Document::getIdCompletionManager()
|
||||||
{
|
{
|
||||||
return mIdCompletionManager;
|
return mIdCompletionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMDoc::Document::flagAsDirty()
|
||||||
|
{
|
||||||
|
mDirty = true;
|
||||||
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace CSMDoc
|
||||||
boost::filesystem::path mResDir;
|
boost::filesystem::path mResDir;
|
||||||
Blacklist mBlacklist;
|
Blacklist mBlacklist;
|
||||||
Runner mRunner;
|
Runner mRunner;
|
||||||
|
bool mDirty;
|
||||||
|
|
||||||
CSMWorld::IdCompletionManager mIdCompletionManager;
|
CSMWorld::IdCompletionManager mIdCompletionManager;
|
||||||
|
|
||||||
|
@ -152,6 +153,8 @@ namespace CSMDoc
|
||||||
|
|
||||||
CSMWorld::IdCompletionManager &getIdCompletionManager();
|
CSMWorld::IdCompletionManager &getIdCompletionManager();
|
||||||
|
|
||||||
|
void flagAsDirty();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void stateChanged (int state, CSMDoc::Document *document);
|
void stateChanged (int state, CSMDoc::Document *document);
|
||||||
|
|
|
@ -207,6 +207,8 @@ void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
|
||||||
this, SIGNAL (mergeDone (CSMDoc::Document*)));
|
this, SIGNAL (mergeDone (CSMDoc::Document*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target->flagAsDirty();
|
||||||
|
|
||||||
mMergeOperation->setTarget (target);
|
mMergeOperation->setTarget (target);
|
||||||
|
|
||||||
mMerge.start();
|
mMerge.start();
|
||||||
|
|
Loading…
Reference in a new issue