Commit 553e3397 authored by Eike Ziller's avatar Eike Ziller
Browse files

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: default avatarDaniel Teske <>
parent 82133aa5
......@@ -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*>)));
......@@ -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())
if (QApplication::activeWindow() != d->m_mainWindow)
if (!QApplication::activeWindow() || QApplication::activeModalWidget())
if (d->m_blockActivated)
......@@ -1365,6 +1356,15 @@ void DocumentManager::slotExecuteOpenWithMenuAction(QAction *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)
......@@ -142,13 +142,15 @@ signals:
/// emitted if one document changed its name e.g. due to save as
void documentRenamed(Core::IDocument *document, const QString &from, const QString &to);
bool eventFilter(QObject *obj, QEvent *e);
private slots:
void documentDestroyed(QObject *obj);
void fileNameChanged(const QString &oldName, const QString &newName);
void checkForNewFileName();
void checkForReload();
void changedFile(const QString &file);
void mainWindowActivated();
void syncWithEditor(const QList<Core::IContext *> &context);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment