Commit dd43d990 authored by Eike Ziller's avatar Eike Ziller

Rename IDocument::fileName --> filePath

That is what it actually is, wrt how Qt API calls it.

Change-Id: Ied02055debf6aad75556b0d9d22e8ba2f72be555
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent cee16022
......@@ -85,7 +85,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
editorWidget->convertPosition(pos, &line, &column);
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->fileName());
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->filePath());
QTC_ASSERT(doc, return 0);
// fetch the expression's code
......
......@@ -54,13 +54,13 @@ bool AndroidManifestDocument::save(QString *errorString, const QString &fileName
QString AndroidManifestDocument::defaultPath() const
{
QFileInfo fi(fileName());
QFileInfo fi(filePath());
return fi.absolutePath();
}
QString AndroidManifestDocument::suggestedFileName() const
{
QFileInfo fi(fileName());
QFileInfo fi(filePath());
return fi.fileName();
}
......
......@@ -500,7 +500,7 @@ void AndroidManifestEditorWidget::preSave()
syncToEditor();
if (m_setAppName) {
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->fileName()).absolutePath();
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName);
if (f.open(QIODevice::ReadOnly)) {
......@@ -524,7 +524,7 @@ void AndroidManifestEditorWidget::preSave()
m_setAppName = false;
}
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->fileName()).absolutePath();
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath();
if (!m_lIconPath.isEmpty()) {
copyIcon(LowDPI, baseDir, m_lIconPath);
m_lIconPath.clear();
......@@ -644,7 +644,7 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
m_versionCode->setValue(manifest.attribute(QLatin1String("android:versionCode")).toInt());
m_versionNameLinedit->setText(manifest.attribute(QLatin1String("android:versionName")));
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->fileName()).absolutePath();
QString baseDir = QFileInfo(static_cast<AndroidManifestDocument *>(editor()->document())->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName);
......
......@@ -40,7 +40,7 @@ AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QStr
Core::IDocument(project),
m_project(project)
{
setFileName(fileName);
setFilePath(fileName);
}
bool AutotoolsProjectFile::save(QString *errorString, const QString &fileName, bool autoSave)
......
......@@ -39,7 +39,7 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
ProjectNode(projectFile->fileName()),
ProjectNode(projectFile->filePath()),
m_project(project),
m_projectFile(projectFile)
{
......
......@@ -690,7 +690,7 @@ bool BazaarPlugin::submitEditorAboutToClose()
// Whether local commit or not
if (commitWidget->isLocalOptionEnabled())
extraOptions += QLatin1String("--local");
m_client->commit(m_submitRepository, files, editorDocument->fileName(), extraOptions);
m_client->commit(m_submitRepository, files, editorDocument->filePath(), extraOptions);
}
return true;
}
......
......@@ -199,18 +199,18 @@ public:
{
QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive
const QString fileNameToUse
= fn.isEmpty() ? fileName() : fn;
if (m_widget->save(errorString, fileName(), fileNameToUse)) {
setFileName(fileNameToUse);
= fn.isEmpty() ? filePath() : fn;
if (m_widget->save(errorString, filePath(), fileNameToUse)) {
setFilePath(fileNameToUse);
return true;
} else {
return false;
}
}
void setFileName(const QString &newName) {
void setFilePath(const QString &newName) {
m_widget->editor()->setDisplayName(QFileInfo(newName).fileName());
IDocument::setFileName(newName);
IDocument::setFilePath(newName);
}
bool open(QString *errorString, const QString &fileName, quint64 offset = 0) {
......@@ -228,7 +228,7 @@ public:
return false;
if (file.open(QIODevice::ReadOnly)) {
file.close();
setFileName(fileName);
setFilePath(fileName);
m_widget->setSizes(offset, file.size());
return true;
}
......@@ -244,7 +244,7 @@ public:
private slots:
void provideData(quint64 block)
{
const QString fn = fileName();
const QString fn = filePath();
if (fn.isEmpty())
return;
QFile file(fn);
......@@ -266,7 +266,7 @@ private slots:
void provideNewRange(quint64 offset)
{
open(0, fileName(), offset);
open(0, filePath(), offset);
}
public:
......@@ -278,7 +278,7 @@ public:
bool isModified() const { return m_widget->isMemoryView() ? false : m_widget->isModified(); }
bool isFileReadOnly() const {
const QString fn = fileName();
const QString fn = filePath();
if (m_widget->isMemoryView() || fn.isEmpty())
return false;
const QFileInfo fi(fn);
......@@ -294,7 +294,7 @@ public:
emit changed();
} else {
emit aboutToReload();
const bool success = open(errorString, fileName());
const bool success = open(errorString, filePath());
emit reloadFinished(success);
return success;
}
......@@ -349,7 +349,7 @@ public:
bool createNew(const QString & /* contents */ = QString()) {
m_widget->clear();
m_file->setFileName(QString());
m_file->setFilePath(QString());
return true;
}
bool open(QString *errorString, const QString &fileName, const QString &realFileName) {
......
......@@ -426,7 +426,7 @@ void BookmarkManager::toggleBookmark()
if (!editor)
return;
toggleBookmark(editor->document()->fileName(), editor->currentLine());
toggleBookmark(editor->document()->filePath(), editor->currentLine());
}
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
......@@ -545,7 +545,7 @@ void BookmarkManager::documentPrevNext(bool next)
{
TextEditor::ITextEditor *editor = currentTextEditor();
int editorLine = editor->currentLine();
QFileInfo fi(editor->document()->fileName());
QFileInfo fi(editor->document()->filePath());
if (!m_bookmarksMap.contains(fi.path()))
return;
......@@ -649,7 +649,7 @@ BookmarkManager::State BookmarkManager::state() const
if (!editor)
return HasBookMarks;
const QFileInfo fi(editor->document()->fileName());
const QFileInfo fi(editor->document()->filePath());
const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path());
if (dit == m_bookmarksMap.constEnd())
......@@ -845,14 +845,14 @@ void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor,
TextEditor::ITextEditor::MarkRequestKind kind)
{
if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->document())
toggleBookmark(textEditor->document()->fileName(), line);
toggleBookmark(textEditor->document()->filePath(), line);
}
void BookmarkManager::handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor, const QPoint &pos,
int line)
{
if (textEditor->document()) {
const QFileInfo fi(textEditor->document()->fileName());
const QFileInfo fi(textEditor->document()->filePath());
Bookmark *mark = findBookmark(fi.path(), fi.fileName(), line);
operateTooltip(textEditor, pos, mark);
}
......
......@@ -185,7 +185,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu)
{
m_bookmarkMarginActionLineNumber = lineNumber;
m_bookmarkMarginActionFileName = editor->document()->fileName();
m_bookmarkMarginActionFileName = editor->document()->filePath();
menu->addAction(m_bookmarkMarginAction);
if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
......
......@@ -465,7 +465,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
if (Core::IEditor *editor = Core::EditorManager::currentEditor()) {
// get current file name
if (Core::IDocument *document = editor->document())
fileName = document->fileName();
fileName = document->filePath();
// if text file - what is current position?
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
......
......@@ -287,7 +287,7 @@ ParserTreeItem::ConstPtr Parser::parse()
QString prjName(prj->displayName());
QString prjType(prjName);
if (prj->document())
prjType = prj->document()->fileName();
prjType = prj->document()->filePath();
SymbolInformation inf(prjName, prjType);
QStringList projectList = addProjectNode(item, prj->rootProjectNode());
......
......@@ -554,7 +554,7 @@ bool ClearCasePlugin::submitEditorAboutToClose()
// Submit editor closing. Make it write out the check in message
// and retrieve files
const QFileInfo editorFile(editorDocument->fileName());
const QFileInfo editorFile(editorDocument->filePath());
const QFileInfo changeFile(m_checkInMessageFileName);
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true; // Oops?!
......
......@@ -52,7 +52,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)), m_useNinja(false)
{
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
m_buildDirectory = project->shadowBuildDirectory(project->document()->fileName(),
m_buildDirectory = project->shadowBuildDirectory(project->document()->filePath(),
parent->kit(),
displayName());
}
......@@ -181,7 +181,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
info.sourceDirectory = project->projectDirectory();
info.environment = Utils::Environment::systemEnvironment();
parent->kit()->addToEnvironment(info.environment);
info.buildDirectory = project->shadowBuildDirectory(project->document()->fileName(),
info.buildDirectory = project->shadowBuildDirectory(project->document()->filePath(),
parent->kit(),
buildConfigurationName);
info.kit = parent->kit();
......
......@@ -99,7 +99,7 @@ void CMakeEditor::build()
foreach (ProjectExplorer::Project *p, projects) {
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
if (cmakeProject) {
if (cmakeProject->isProjectFile(document()->fileName())) {
if (cmakeProject->isProjectFile(document()->filePath())) {
ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
break;
}
......@@ -219,7 +219,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
QDir dir(QFileInfo(editorDocument()->fileName()).absolutePath());
QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
......@@ -250,12 +250,12 @@ CMakeDocument::CMakeDocument()
QString CMakeDocument::defaultPath() const
{
QFileInfo fi(fileName());
QFileInfo fi(filePath());
return fi.absolutePath();
}
QString CMakeDocument::suggestedFileName() const
{
QFileInfo fi(fileName());
QFileInfo fi(filePath());
return fi.fileName();
}
......@@ -76,9 +76,9 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca
if (cmakeProject) {
foreach (const CMakeBuildTarget &ct, cmakeProject->buildTargets()) {
if (ct.title.contains(entry)) {
Locator::FilterEntry entry(this, ct.title, cmakeProject->document()->fileName());
Locator::FilterEntry entry(this, ct.title, cmakeProject->document()->filePath());
entry.extraInfo = FileUtils::shortNativePath(
FileName::fromString(cmakeProject->document()->fileName()));
FileName::fromString(cmakeProject->document()->filePath()));
result.append(entry);
}
}
......@@ -97,7 +97,7 @@ void CMakeLocatorFilter::accept(Locator::FilterEntry selection) const
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
foreach (ProjectExplorer::Project *p, projects) {
cmakeProject = qobject_cast<CMakeProject *>(p);
if (cmakeProject && cmakeProject->document()->fileName() == selection.internalData.toString())
if (cmakeProject && cmakeProject->document()->filePath() == selection.internalData.toString())
break;
cmakeProject = 0;
}
......
......@@ -222,7 +222,7 @@ bool CMakeProject::parseCMakeLists()
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors())
if (isProjectFile(editor->document()->fileName()))
if (isProjectFile(editor->document()->filePath()))
editor->document()->infoBar()->removeInfo(Core::Id("CMakeEditor.RunCMake"));
// Find cbp file
......@@ -845,7 +845,7 @@ void CMakeProject::editorChanged(Core::IEditor *editor)
disconnect(m_lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
if (m_dirtyUic) {
const QString contents = formWindowEditorContents(m_lastEditor);
updateCodeModelSupportFromEditor(m_lastEditor->document()->fileName(), contents);
updateCodeModelSupportFromEditor(m_lastEditor->document()->filePath(), contents);
m_dirtyUic = false;
}
}
......@@ -866,7 +866,7 @@ void CMakeProject::editorAboutToClose(Core::IEditor *editor)
disconnect(m_lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
if (m_dirtyUic) {
const QString contents = formWindowEditorContents(m_lastEditor);
updateCodeModelSupportFromEditor(m_lastEditor->document()->fileName(), contents);
updateCodeModelSupportFromEditor(m_lastEditor->document()->filePath(), contents);
m_dirtyUic = false;
}
}
......@@ -899,7 +899,7 @@ void CMakeProject::buildStateChanged(ProjectExplorer::Project *project)
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
: Core::IDocument(parent), m_project(parent)
{
setFileName(fileName);
setFilePath(fileName);
}
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
......
......@@ -137,7 +137,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(IDocument *document, QWidget *parent,
, d(new ReadOnlyFilesDialogPrivate(document, displaySaveAs))
, ui(new Ui::ReadOnlyFilesDialog)
{
initDialog(QStringList() << document->fileName());
initDialog(QStringList() << document->filePath());
}
ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> documents, QWidget *parent)
......@@ -147,7 +147,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> documents, QWi
{
QStringList files;
foreach (IDocument *document, documents)
files << document->fileName();
files << document->filePath();
initDialog(files);
}
......
......@@ -62,7 +62,7 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
foreach (IDocument *document, items) {
QString visibleName;
QString directory;
QString fileName = document->fileName();
QString fileName = document->filePath();
if (fileName.isEmpty()) {
visibleName = document->suggestedFileName();
} else {
......
......@@ -264,8 +264,8 @@ static void addFileInfo(const QString &fileName, IDocument *document, bool isLin
(The added file names are guaranteed to be absolute and cleaned.) */
static void addFileInfo(IDocument *document)
{
const QString fixedName = DocumentManager::fixFileName(document->fileName(), DocumentManager::KeepLinks);
const QString fixedResolvedName = DocumentManager::fixFileName(document->fileName(), DocumentManager::ResolveLinks);
const QString fixedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::KeepLinks);
const QString fixedResolvedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::ResolveLinks);
addFileInfo(fixedResolvedName, document, false);
if (fixedName != fixedResolvedName)
addFileInfo(fixedName, document, true);
......@@ -284,7 +284,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
foreach (IDocument *document, documents) {
if (document && !d->m_documentsWithoutWatch.contains(document)) {
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
connect(document, SIGNAL(fileNameChanged(QString,QString)), m_instance, SLOT(fileNameChanged(QString,QString)));
connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
d->m_documentsWithoutWatch.append(document);
}
}
......@@ -295,7 +295,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
if (document && !d->m_documentsWithWatch.contains(document)) {
connect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName()));
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
connect(document, SIGNAL(fileNameChanged(QString,QString)), m_instance, SLOT(fileNameChanged(QString,QString)));
connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
addFileInfo(document);
}
}
......@@ -385,14 +385,14 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
foreach (IDocument *document, documentsToRename) {
d->m_blockedIDocument = document;
removeFileInfo(document);
document->setFileName(to);
document->setFilePath(to);
addFileInfo(document);
d->m_blockedIDocument = 0;
}
emit m_instance->allDocumentsRenamed(from, to);
}
void DocumentManager::fileNameChanged(const QString &oldName, const QString &newName)
void DocumentManager::filePathChanged(const QString &oldName, const QString &newName)
{
IDocument *doc = qobject_cast<IDocument *>(sender());
QTC_ASSERT(doc, return);
......@@ -593,7 +593,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu
foreach (IDocument *document, documents) {
if (document->isModified()) {
QString name = document->fileName();
QString name = document->filePath();
if (name.isEmpty())
name = document->suggestedFileName();
......@@ -659,7 +659,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu
bool DocumentManager::saveDocument(IDocument *document, const QString &fileName, bool *isReadOnly)
{
bool ret = true;
QString effName = fileName.isEmpty() ? document->fileName() : fileName;
QString effName = fileName.isEmpty() ? document->filePath() : fileName;
expectFileChange(effName); // This only matters to other IDocuments which refer to this file
bool addWatcher = removeDocument(document); // So that our own IDocument gets no notification at all
......@@ -746,7 +746,7 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
{
if (!document)
return QLatin1String("");
QString absoluteFilePath = document->fileName();
QString absoluteFilePath = document->filePath();
const QFileInfo fi(absoluteFilePath);
QString fileName = fi.fileName();
QString path = fi.absolutePath();
......@@ -957,7 +957,7 @@ void DocumentManager::checkForReload()
success = document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents);
} else {
// Ask about content change
previousAnswer = Utils::reloadPrompt(document->fileName(), document->isModified(), QApplication::activeWindow());
previousAnswer = Utils::reloadPrompt(document->filePath(), document->isModified(), QApplication::activeWindow());
switch (previousAnswer) {
case Utils::ReloadAll:
case Utils::ReloadCurrent:
......@@ -977,9 +977,9 @@ void DocumentManager::checkForReload()
// Ask about removed file
bool unhandled = true;
while (unhandled) {
switch (Utils::fileDeletedPrompt(document->fileName(), trigger == IDocument::TriggerExternal, QApplication::activeWindow())) {
switch (Utils::fileDeletedPrompt(document->filePath(), trigger == IDocument::TriggerExternal, QApplication::activeWindow())) {
case Utils::FileDeletedSave:
documentsToSave.insert(document, document->fileName());
documentsToSave.insert(document, document->filePath());
unhandled = false;
break;
case Utils::FileDeletedSaveAs:
......@@ -1001,7 +1001,7 @@ void DocumentManager::checkForReload()
}
if (!success) {
if (errorString.isEmpty())
errorStrings << tr("Cannot reload %1").arg(QDir::toNativeSeparators(document->fileName()));
errorStrings << tr("Cannot reload %1").arg(QDir::toNativeSeparators(document->filePath()));
else
errorStrings << errorString;
}
......@@ -1039,7 +1039,7 @@ void DocumentManager::syncWithEditor(const QList<Core::IContext *> &context)
return;
foreach (IContext *c, context) {
if (editor->widget() == c->widget()) {
setCurrentFile(editor->document()->fileName());
setCurrentFile(editor->document()->filePath());
break;
}
}
......
......@@ -146,7 +146,7 @@ protected:
private slots:
void documentDestroyed(QObject *obj);
void fileNameChanged(const QString &oldName, const QString &newName);
void filePathChanged(const QString &oldName, const QString &newName);
void checkForNewFileName();
void checkForReload();
void changedFile(const QString &file);
......
......@@ -631,7 +631,7 @@ QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) cons
QList<IEditor *> found;
QString fixedname = DocumentManager::fixFileName(filename, DocumentManager::KeepLinks);
foreach (IEditor *editor, openedEditors()) {
if (fixedname == DocumentManager::fixFileName(editor->document()->fileName(), DocumentManager::KeepLinks))
if (fixedname == DocumentManager::fixFileName(editor->document()->filePath(), DocumentManager::KeepLinks))
found << editor;
}
return found;
......@@ -1130,11 +1130,11 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
// remove the editors
foreach (IEditor *editor, acceptedEditors) {
emit editorAboutToClose(editor);
if (!editor->document()->fileName().isEmpty()
if (!editor->document()->filePath().isEmpty()
&& !editor->isTemporary()) {
QByteArray state = editor->saveState();
if (!state.isEmpty())
d->m_editorStates.insert(editor->document()->fileName(), QVariant(state));
d->m_editorStates.insert(editor->document()->filePath(), QVariant(state));
}
removeEditor(editor);
......@@ -1486,7 +1486,7 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
const bool addWatcher = !isTemporary;
DocumentManager::addDocument(editor->document(), addWatcher);
if (!isTemporary)
DocumentManager::addToRecentFiles(editor->document()->fileName(), editor->id());
DocumentManager::addToRecentFiles(editor->document()->filePath(), editor->id());
}
emit editorOpened(editor);
}
......@@ -1716,7 +1716,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
int i = 1;
QSet<QString> docnames;
foreach (IEditor *editor, m_instance->openedEditors()) {
QString name = editor->document()->fileName();
QString name = editor->document()->filePath();
if (name.isEmpty())
name = editor->displayName();
else
......@@ -1764,7 +1764,7 @@ bool EditorManager::hasEditor(const QString &fileName) const
void EditorManager::restoreEditorState(IEditor *editor)
{
QTC_ASSERT(editor, return);
QString fileName = editor->document()->fileName();
QString fileName = editor->document()->filePath();
editor->restoreState(d->m_editorStates.value(fileName).toByteArray());
}
......@@ -1783,7 +1783,7 @@ bool EditorManager::saveDocument(IDocument *documentParam)
document->checkPermissions();
const QString &fileName = document->fileName();
const QString &fileName = document->filePath();
if (fileName.isEmpty())
return saveDocumentAs(document);
......@@ -1821,10 +1821,10 @@ void EditorManager::autoSave()
IDocument *document = editor->document();
if (!document->isModified() || !document->shouldAutoSave())
continue;
if (document->fileName().isEmpty()) // FIXME: save them to a dedicated directory
if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
continue;
QString errorString;
if (!document->autoSave(&errorString, autoSaveName(document->fileName())))
if (!document->autoSave(&errorString, autoSaveName(document->filePath())))
errors << errorString;
}
if (!errors.isEmpty())
......@@ -1862,14 +1862,14 @@ bool EditorManager::saveDocumentAs(IDocument *documentParam)
const QString &filter = ICore::mimeDatabase()->allFiltersString();
QString selectedFilter =
ICore::mimeDatabase()->findByFile(QFileInfo(document->fileName())).filterString();
ICore::mimeDatabase()->findByFile(QFileInfo(document->filePath())).filterString();
const QString &absoluteFilePath =
DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);
if (absoluteFilePath.isEmpty())
return false;
if (absoluteFilePath != document->fileName()) {
if (absoluteFilePath != document->filePath()) {
// close existing editors for the new file name
const QList<IEditor *> existList = editorsForFileName(absoluteFilePath);
if (!existList.isEmpty())
......@@ -1906,7 +1906,7 @@ void EditorManager::addDocumentToRecentFiles(IDocument *document)
}
}
if (!isTemporary)
DocumentManager::addToRecentFiles(document->fileName(), editorId);
DocumentManager::addToRecentFiles(document->filePath(), editorId);
}
void EditorManager::gotoNextDocHistory()
......@@ -1947,12 +1947,12 @@ void EditorManager::vcsOpenCurrentEditor()
if (!curEditor)
return;
const QString directory = QFileInfo(curEditor->document()->fileName()).absolutePath();
const QString directory = QFileInfo(curEditor->document()->filePath()).absolutePath();
IVersionControl *versionControl = ICore::vcsManager()->findVersionControlForDirectory(directory);
if (!versionControl || versionControl->openSupportMode() == IVersionControl::NoOpen)
return;
if (!versionControl->vcsOpen(curEditor->document()->fileName())) {