mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 00:39:59 +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
@ -2256,7 +2256,7 @@ CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationM
|
||||
mSavingOperation (*this, mProjectPath, encoding),
|
||||
mSaving (&mSavingOperation),
|
||||
mResDir(resDir),
|
||||
mRunner (mProjectPath), mIdCompletionManager(mData)
|
||||
mRunner (mProjectPath), mIdCompletionManager(mData), mDirty (false)
|
||||
{
|
||||
if (mContentFiles.empty())
|
||||
throw std::runtime_error ("Empty content file sequence");
|
||||
@ -2325,7 +2325,7 @@ int CSMDoc::Document::getState() const
|
||||
{
|
||||
int state = 0;
|
||||
|
||||
if (!mUndoStack.isClean())
|
||||
if (!mUndoStack.isClean() || mDirty)
|
||||
state |= State_Modified;
|
||||
|
||||
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)
|
||||
{
|
||||
if (type==CSMDoc::State_Saving && !failed)
|
||||
mDirty = false;
|
||||
|
||||
emit stateChanged (getState(), this);
|
||||
}
|
||||
|
||||
@ -2493,3 +2496,8 @@ CSMWorld::IdCompletionManager &CSMDoc::Document::getIdCompletionManager()
|
||||
{
|
||||
return mIdCompletionManager;
|
||||
}
|
||||
|
||||
void CSMDoc::Document::flagAsDirty()
|
||||
{
|
||||
mDirty = true;
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ namespace CSMDoc
|
||||
boost::filesystem::path mResDir;
|
||||
Blacklist mBlacklist;
|
||||
Runner mRunner;
|
||||
bool mDirty;
|
||||
|
||||
CSMWorld::IdCompletionManager mIdCompletionManager;
|
||||
|
||||
@ -152,6 +153,8 @@ namespace CSMDoc
|
||||
|
||||
CSMWorld::IdCompletionManager &getIdCompletionManager();
|
||||
|
||||
void flagAsDirty();
|
||||
|
||||
signals:
|
||||
|
||||
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*)));
|
||||
}
|
||||
|
||||
target->flagAsDirty();
|
||||
|
||||
mMergeOperation->setTarget (target);
|
||||
|
||||
mMerge.start();
|
||||
|
Loading…
Reference in New Issue
Block a user