Commit 5c900d20 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Revert "DocumentManager: Support expect/unexpect directory changes"

Doesn't work

This reverts commit f6ec8c33.

Change-Id: I84ecb956bd8ad2358228e11630e95ac03c903c21
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 91d8ecbd
......@@ -52,7 +52,6 @@
#include <QFile>
#include <QFileInfo>
#include <QFileSystemWatcher>
#include <QSet>
#include <QSettings>
#include <QTimer>
#include <QAction>
......@@ -157,7 +156,6 @@ struct DocumentManagerPrivate
QString m_projectsDirectory;
bool m_useProjectsDirectory;
QString m_buildDirectory;
QSet<QString> m_expectedDirectories;
// When we are callling into a IDocument
// we don't want to receive a changed()
// signal
......@@ -549,46 +547,6 @@ void DocumentManager::unexpectFileChange(const QString &fileName)
updateExpectedState(fixedResolvedName);
}
static QString dirWithTrailingSlash(const QString &directory)
{
static const QChar slash(QLatin1Char('/'));
return directory.endsWith(slash) ? directory : directory + slash;
}
/*!
* Any subsequent change to any file inside \a directory is treated as
* an expected file change.
*
* \see DocumentManager::unexpectDirectoryChange(const QString &directory)
*/
void DocumentManager::expectDirectoryChange(const QString &directory)
{
QTC_ASSERT(!directory.isEmpty(), return);
d->m_expectedDirectories.insert(dirWithTrailingSlash(directory));
}
/*!
* Any subsequent change to any file inside \a directory is unexpected again.
*
* \see DocumentManager::expectDirectoryChange(const QString &directory)
*/
void DocumentManager::unexpectDirectoryChange(const QString &directory)
{
QTimer *timer = new QTimer;
timer->setProperty("directory", QString(dirWithTrailingSlash(directory)));
connect(timer, SIGNAL(timeout()), instance(), SLOT(clearExpectedDirectory()));
timer->setSingleShot(true);
timer->start(300);
}
void DocumentManager::clearExpectedDirectory()
{
if (QTimer *timer = qobject_cast<QTimer *>(sender())) {
d->m_expectedDirectories.remove(timer->property("directory").toString());
timer->deleteLater();
}
}
/*!
Tries to save the files listed in \a documents. The \a cancelled argument is set to true
......@@ -945,18 +903,9 @@ void DocumentManager::checkForReload()
continue;
// was the change unexpected?
if ((currentState.modified != expectedState.modified
|| currentState.permissions != expectedState.permissions)
if ((currentState.modified != expectedState.modified || currentState.permissions != expectedState.permissions)
&& !expectedFileNames.contains(fileName)) {
bool expectedDir = false;
foreach (const QString &expectedDirectory, d->m_expectedDirectories) {
if (fileName.startsWith(expectedDirectory)) {
expectedDir = true;
break;
}
}
if (!expectedDir)
trigger = IDocument::TriggerExternal;
trigger = IDocument::TriggerExternal;
}
// find out the type
......
......@@ -74,9 +74,6 @@ public:
static void expectFileChange(const QString &fileName);
static void unexpectFileChange(const QString &fileName);
static void expectDirectoryChange(const QString &directory);
static void unexpectDirectoryChange(const QString &directory);
// recent files
static void addToRecentFiles(const QString &fileName, const Id &editorId = Id());
Q_SLOT void clearRecentFiles();
......@@ -153,7 +150,6 @@ private slots:
void changedFile(const QString &file);
void mainWindowActivated();
void syncWithEditor(const QList<Core::IContext *> &context);
void clearExpectedDirectory();
};
/*! The FileChangeBlocker blocks all change notifications to all IDocument * that
......
......@@ -29,7 +29,6 @@
#include "command.h"
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h>
......@@ -202,8 +201,6 @@ void Command::execute()
if (d->m_jobs.empty())
return;
if (d->m_expectChanges)
Core::DocumentManager::expectDirectoryChange(d->m_workingDirectory);
// For some reason QtConcurrent::run() only works on this
QFuture<void> task = QtConcurrent::run(this, &Command::run);
QString binary = QFileInfo(d->m_binaryPath).baseName();
......@@ -306,9 +303,6 @@ void Command::run()
Core::ICore::vcsManager()->emitRepositoryChanged(d->m_workingDirectory);
}
if (d->m_expectChanges)
Core::DocumentManager::unexpectDirectoryChange(d->m_workingDirectory);
// As it is used asynchronously, we need to delete ourselves
this->deleteLater();
}
......
Markdown is supported
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