forked from qt-creator/qt-creator
Fix external file change notification in case of multiple windows.
The notification was only done when the main window was activated which leads to funny results with external editor windows. Change-Id: I657ef7e429256f9c098b1fc744d40ffbc2bb5260 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -216,10 +216,9 @@ DocumentManager::DocumentManager(QMainWindow *mw)
|
||||
{
|
||||
d = new DocumentManagerPrivate(mw);
|
||||
m_instance = this;
|
||||
connect(d->m_mainWindow, SIGNAL(windowActivated()),
|
||||
this, SLOT(mainWindowActivated()));
|
||||
connect(ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)),
|
||||
this, SLOT(syncWithEditor(QList<Core::IContext*>)));
|
||||
qApp->installEventFilter(this);
|
||||
|
||||
readSettings();
|
||||
}
|
||||
@@ -812,19 +811,11 @@ void DocumentManager::changedFile(const QString &fileName)
|
||||
QTimer::singleShot(200, this, SLOT(checkForReload()));
|
||||
}
|
||||
|
||||
void DocumentManager::mainWindowActivated()
|
||||
{
|
||||
//we need to do this asynchronously because
|
||||
//opening a dialog ("Reload?") in a windowactivated event
|
||||
//freezes on Mac
|
||||
QTimer::singleShot(0, this, SLOT(checkForReload()));
|
||||
}
|
||||
|
||||
void DocumentManager::checkForReload()
|
||||
{
|
||||
if (d->m_changedFiles.isEmpty())
|
||||
return;
|
||||
if (QApplication::activeWindow() != d->m_mainWindow)
|
||||
if (!QApplication::activeWindow() || QApplication::activeModalWidget())
|
||||
return;
|
||||
|
||||
if (d->m_blockActivated)
|
||||
@@ -1365,6 +1356,15 @@ void DocumentManager::slotExecuteOpenWithMenuAction(QAction *action)
|
||||
executeOpenWithMenuAction(action);
|
||||
}
|
||||
|
||||
bool DocumentManager::eventFilter(QObject *obj, QEvent *e)
|
||||
{
|
||||
if (obj == qApp && e->type() == QEvent::ApplicationActivate) {
|
||||
// activeWindow is not necessarily set yet, do checkForReload asynchronously
|
||||
QTimer::singleShot(0, this, SLOT(checkForReload()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------- FileChangeBlocker
|
||||
|
||||
FileChangeBlocker::FileChangeBlocker(const QString &fileName)
|
||||
|
Reference in New Issue
Block a user