--- src/plugins/coreplugin/documentmanager.cpp +++ src/plugins/coreplugin/documentmanager.cpp @@ -59,12 +59,13 @@ #include #include #include #include #include #include +#include /*! \class Core::DocumentManager \mainclass \inheaderfile documentmanager.h \brief The DocumentManager class manages a set of IDocument objects. @@ -894,30 +895,48 @@ void DocumentManager::changedFile(const QString &fileName) { const bool wasempty = d->m_changedFiles.isEmpty(); if (d->m_states.contains(fileName)) d->m_changedFiles.insert(fileName); + qDebug() << Q_FUNC_INFO; + qDebug() << "- fileName" << fileName; + qDebug() << "- wasempty" << wasempty; + qDebug() << "- changedFiles" << d->m_changedFiles; + if (wasempty && !d->m_changedFiles.isEmpty()) QTimer::singleShot(200, this, SLOT(checkForReload())); + qDebug() << "+ leaving" << Q_FUNC_INFO; } void DocumentManager::checkForReload() { - if (d->m_changedFiles.isEmpty()) + qDebug() << Q_FUNC_INFO; + qDebug() << "- changedFiles" << d->m_changedFiles; + if (d->m_changedFiles.isEmpty()) { + qDebug() << "+ leaving" << Q_FUNC_INFO; return; - if (!QApplication::activeWindow()) + } + if (!QApplication::activeWindow()) { + qDebug() << "- no window active"; + qDebug() << "+ leaving" << Q_FUNC_INFO; return; + } if (QApplication::activeModalWidget()) { // a modal dialog, recheck later + qDebug() << "- has active modal widget"; QTimer::singleShot(200, this, SLOT(checkForReload())); + qDebug() << "+ leaving" << Q_FUNC_INFO; return; } - if (d->m_blockActivated) + if (d->m_blockActivated) { + qDebug() << "- block is activated"; + qDebug() << "+ leaving" << Q_FUNC_INFO; return; + } d->m_blockActivated = true; IDocument::ReloadSetting defaultBehavior = EditorManagerPrivate::reloadSetting(); Utils::ReloadPromptAnswer previousReloadAnswer = Utils::ReloadCurrent; Utils::FileDeletedPromptAnswer previousDeletedAnswer = Utils::FileDeletedSave; @@ -945,12 +964,13 @@ void DocumentManager::checkForReload() changedIDocuments.insert(document); } // clean up. do this before we may enter the main loop, otherwise we would // lose consecutive notifications. d->m_changedFiles.clear(); + qDebug() << "- cleared changedFiles"; // collect information about "expected" file names // we can't do the "resolving" already in expectFileChange, because // if the resolved names are different when unexpectFileChange is called // we would end up with never-unexpected file names QSet expectedFileNames; @@ -1126,13 +1146,13 @@ void DocumentManager::checkForReload() it.next(); saveDocument(it.key(), it.value()); it.key()->checkPermissions(); } d->m_blockActivated = false; - + qDebug() << "+ leaving" << Q_FUNC_INFO; // dump(); } /*! Adds the \a fileName to the list of recent files. Associates the file to be reopened with the editor that has the specified \a editorId, if possible.