Commit 21bf0046 authored by hjk's avatar hjk Committed by hjk

editormanager: simplify use of interface

Less code on the user side, same meaning.

Change-Id: I14e54a5d2ed8e024a51cce74eaf7c8419ad544be
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 2ef2532b
...@@ -73,10 +73,7 @@ static void moveCursorToEndOfName(QTextCursor *tc) ...@@ -73,10 +73,7 @@ static void moveCursorToEndOfName(QTextCursor *tc)
// We cannot depend on this since CppEditor plugin code is internal and requires building the implementation files ourselves // We cannot depend on this since CppEditor plugin code is internal and requires building the implementation files ourselves
CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
{ {
EditorManager *editorManager = EditorManager::instance(); IEditor *editor = EditorManager::currentEditor();
if (!editorManager)
return 0;
IEditor *editor = editorManager->currentEditor();
if (!editor) if (!editor)
return 0; return 0;
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
......
...@@ -569,9 +569,9 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt ...@@ -569,9 +569,9 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt
return; return;
} }
Core::IEditor *editor = Core::ICore::editorManager()->openEditor(m_changeLog->fileName(), Core::IEditor *editor = Core::EditorManager::openEditor(m_changeLog->fileName(),
Constants::COMMIT_ID, Constants::COMMIT_ID,
Core::EditorManager::ModeSwitch); Core::EditorManager::ModeSwitch);
if (!editor) { if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit.")); outputWindow->appendError(tr("Unable to create an editor for the commit."));
return; return;
......
...@@ -594,10 +594,7 @@ void BookmarkManager::prev() ...@@ -594,10 +594,7 @@ void BookmarkManager::prev()
TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
{ {
Core::EditorManager *em = Core::EditorManager::instance(); Core::IEditor *currEditor = EditorManager::currentEditor();
Core::IEditor *currEditor = em->currentEditor();
if (!currEditor)
return 0;
return qobject_cast<TextEditor::ITextEditor *>(currEditor); return qobject_cast<TextEditor::ITextEditor *>(currEditor);
} }
......
...@@ -309,8 +309,7 @@ void Manager::gotoLocations(const QList<QVariant> &list) ...@@ -309,8 +309,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
bool currentPositionAvailable = false; bool currentPositionAvailable = false;
// what is open now? // what is open now?
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor(); if (Core::IEditor *editor = Core::EditorManager::currentEditor()) {
if (editor) {
// get current file name // get current file name
Core::IDocument *document = editor->document(); Core::IDocument *document = editor->document();
if (document) if (document)
......
...@@ -654,10 +654,9 @@ bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l, ...@@ -654,10 +654,9 @@ bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l,
bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage) bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage)
{ {
Core::EditorManager *em = Core::EditorManager::instance();
foreach(const Core::GeneratedFile &file, l) { foreach(const Core::GeneratedFile &file, l) {
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) { if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
if (!em->openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) { if (!Core::EditorManager::openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path())); *errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path()));
return false; return false;
......
...@@ -1095,9 +1095,9 @@ void DocumentManager::syncWithEditor(Core::IContext *context) ...@@ -1095,9 +1095,9 @@ void DocumentManager::syncWithEditor(Core::IContext *context)
if (!context) if (!context)
return; return;
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor(); Core::IEditor *editor = Core::EditorManager::currentEditor();
if (editor && (editor->widget() == context->widget()) && if (editor && editor->widget() == context->widget()
!editor->isTemporary()) && !editor->isTemporary())
setCurrentFile(editor->document()->fileName()); setCurrentFile(editor->document()->fileName());
} }
...@@ -1333,8 +1333,8 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName) ...@@ -1333,8 +1333,8 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
bool anyMatches = false; bool anyMatches = false;
if (const MimeType mt = ICore::mimeDatabase()->findByFile(QFileInfo(fileName))) { if (const MimeType mt = ICore::mimeDatabase()->findByFile(QFileInfo(fileName))) {
const EditorFactoryList factories = ICore::editorManager()->editorFactories(mt, false); const EditorFactoryList factories = EditorManager::editorFactories(mt, false);
const ExternalEditorList externalEditors = ICore::editorManager()->externalEditors(mt, false); const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false);
anyMatches = !factories.empty() || !externalEditors.empty(); anyMatches = !factories.empty() || !externalEditors.empty();
if (anyMatches) { if (anyMatches) {
// Add all suitable editors // Add all suitable editors
...@@ -1363,11 +1363,11 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName) ...@@ -1363,11 +1363,11 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
void DocumentManager::executeOpenWithMenuAction(QAction *action) void DocumentManager::executeOpenWithMenuAction(QAction *action)
{ {
QTC_ASSERT(action, return); QTC_ASSERT(action, return);
EditorManager *em = EditorManager::instance();
const QVariant data = action->data(); const QVariant data = action->data();
OpenWithEntry entry = qVariantValue<OpenWithEntry>(data); OpenWithEntry entry = qVariantValue<OpenWithEntry>(data);
if (entry.editorFactory) { if (entry.editorFactory) {
// close any open editors that have this file open, but have a different type. // close any open editors that have this file open, but have a different type.
EditorManager *em = EditorManager::instance();
QList<IEditor *> editorsOpenForFile = em->editorsForFileName(entry.fileName); QList<IEditor *> editorsOpenForFile = em->editorsForFileName(entry.fileName);
if (!editorsOpenForFile.isEmpty()) { if (!editorsOpenForFile.isEmpty()) {
foreach (IEditor *openEditor, editorsOpenForFile) { foreach (IEditor *openEditor, editorsOpenForFile) {
...@@ -1378,11 +1378,11 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action) ...@@ -1378,11 +1378,11 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
return; return;
} }
em->openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch); EditorManager::openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch);
return; return;
} }
if (entry.externalEditor) if (entry.externalEditor)
em->openExternalEditor(entry.fileName, entry.externalEditor->id()); EditorManager::openExternalEditor(entry.fileName, entry.externalEditor->id());
} }
void DocumentManager::slotExecuteOpenWithMenuAction(QAction *action) void DocumentManager::slotExecuteOpenWithMenuAction(QAction *action)
......
...@@ -111,6 +111,6 @@ void EditMode::grabEditorManager(Core::IMode *mode) ...@@ -111,6 +111,6 @@ void EditMode::grabEditorManager(Core::IMode *mode)
if (mode != this) if (mode != this)
return; return;
if (m_editorManager->currentEditor()) if (EditorManager::currentEditor())
m_editorManager->currentEditor()->widget()->setFocus(); EditorManager::currentEditor()->widget()->setFocus();
} }
...@@ -634,9 +634,9 @@ QList<IEditor *> EditorManager::editorsForDocument(IDocument *document) const ...@@ -634,9 +634,9 @@ QList<IEditor *> EditorManager::editorsForDocument(IDocument *document) const
return found; return found;
} }
IEditor *EditorManager::currentEditor() const IEditor *EditorManager::currentEditor()
{ {
return d->m_currentEditor; return m_instance->d->m_currentEditor;
} }
void EditorManager::emptyView(Core::Internal::EditorView *view) void EditorManager::emptyView(Core::Internal::EditorView *view)
...@@ -1047,12 +1047,12 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core ...@@ -1047,12 +1047,12 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core
void EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFlags flags) void EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFlags flags)
{ {
SplitterOrView *splitterOrView = d->m_splitter->findView(editor); SplitterOrView *splitterOrView = m_instance->d->m_splitter->findView(editor);
EditorView *view = (splitterOrView ? splitterOrView->view() : 0); EditorView *view = (splitterOrView ? splitterOrView->view() : 0);
// TODO an IEditor doesn't have to belong to a view, which makes this method a bit funny // TODO an IEditor doesn't have to belong to a view, which makes this method a bit funny
if (!view) if (!view)
view = currentEditorView(); view = m_instance->currentEditorView();
activateEditor(view, editor, flags); m_instance->activateEditor(view, editor, flags);
} }
Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags) Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags)
...@@ -1124,7 +1124,7 @@ static void mimeTypeFactoryRecursion(const MimeDatabase *db, ...@@ -1124,7 +1124,7 @@ static void mimeTypeFactoryRecursion(const MimeDatabase *db,
} }
EditorManager::EditorFactoryList EditorManager::EditorFactoryList
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) const EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly)
{ {
EditorFactoryList rc; EditorFactoryList rc;
const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>(); const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
...@@ -1135,7 +1135,7 @@ EditorManager::EditorFactoryList ...@@ -1135,7 +1135,7 @@ EditorManager::EditorFactoryList
} }
EditorManager::ExternalEditorList EditorManager::ExternalEditorList
EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly) const EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly)
{ {
ExternalEditorList rc; ExternalEditorList rc;
const ExternalEditorList allEditors = pluginManager()->getObjects<IExternalEditor>(); const ExternalEditorList allEditors = pluginManager()->getObjects<IExternalEditor>();
...@@ -1187,11 +1187,11 @@ IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName ...@@ -1187,11 +1187,11 @@ IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName
return 0; return 0;
} }
IEditor *editor = factories.front()->createEditor(this); IEditor *editor = factories.front()->createEditor(m_instance);
if (editor) if (editor)
connect(editor, SIGNAL(changed()), this, SLOT(handleEditorStateChange())); connect(editor, SIGNAL(changed()), m_instance, SLOT(handleEditorStateChange()));
if (editor) if (editor)
emit editorCreated(editor, fileName); emit m_instance->editorCreated(editor, fileName);
return editor; return editor;
} }
...@@ -1257,7 +1257,7 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName, ...@@ -1257,7 +1257,7 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId, IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
OpenEditorFlags flags, bool *newEditor) OpenEditorFlags flags, bool *newEditor)
{ {
return openEditor(currentEditorView(), fileName, editorId, flags, newEditor); return m_instance->openEditor(m_instance->currentEditorView(), fileName, editorId, flags, newEditor);
} }
int extractLineNumber(QString *fileName) int extractLineNumber(QString *fileName)
...@@ -1408,7 +1408,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId, ...@@ -1408,7 +1408,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
if (base.contains(dollar)) { if (base.contains(dollar)) {
int i = 1; int i = 1;
QSet<QString> docnames; QSet<QString> docnames;
foreach (IEditor *editor, openedEditors()) { foreach (IEditor *editor, m_instance->openedEditors()) {
QString name = editor->document()->fileName(); QString name = editor->document()->fileName();
if (name.isEmpty()) { if (name.isEmpty()) {
name = editor->displayName(); name = editor->displayName();
...@@ -1445,7 +1445,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId, ...@@ -1445,7 +1445,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
title = edt->displayName(); title = edt->displayName();
edt->setDisplayName(title); edt->setDisplayName(title);
addEditor(edt); m_instance->addEditor(edt);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return edt; return edt;
} }
......
...@@ -117,12 +117,12 @@ public: ...@@ -117,12 +117,12 @@ public:
}; };
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag) Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
IEditor *openEditor(const QString &fileName, const Id &editorId = Id(), static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
OpenEditorFlags flags = 0, bool *newEditor = 0); OpenEditorFlags flags = 0, bool *newEditor = 0);
IEditor *openEditorWithContents(const Id &editorId, static IEditor *openEditorWithContents(const Id &editorId,
QString *titlePattern = 0, const QString &contents = QString()); QString *titlePattern = 0, const QString &contents = QString());
bool openExternalEditor(const QString &fileName, const Id &editorId); static bool openExternalEditor(const QString &fileName, const Id &editorId);
QStringList getOpenFileNames() const; QStringList getOpenFileNames() const;
Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const; Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
...@@ -131,11 +131,11 @@ public: ...@@ -131,11 +131,11 @@ public:
QList<IEditor *> editorsForFileName(const QString &filename) const; QList<IEditor *> editorsForFileName(const QString &filename) const;
QList<IEditor *> editorsForDocument(IDocument *document) const; QList<IEditor *> editorsForDocument(IDocument *document) const;
IEditor *currentEditor() const; static IEditor *currentEditor();
QList<IEditor *> visibleEditors() const; QList<IEditor *> visibleEditors() const;
QList<IEditor*> openedEditors() const; QList<IEditor*> openedEditors() const;
void activateEditor(IEditor *editor, OpenEditorFlags flags = 0); static void activateEditor(IEditor *editor, OpenEditorFlags flags = 0);
void activateEditorForIndex(const QModelIndex &index, OpenEditorFlags = 0); void activateEditorForIndex(const QModelIndex &index, OpenEditorFlags = 0);
IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0); IEditor *activateEditorForDocument(Internal::EditorView *view, IDocument *document, OpenEditorFlags flags = 0);
...@@ -170,8 +170,8 @@ public: ...@@ -170,8 +170,8 @@ public:
void hideEditorStatusBar(const QString &id); void hideEditorStatusBar(const QString &id);
EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true) const; static EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true);
ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true) const; static ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true);
void setReloadSetting(IDocument::ReloadSetting behavior); void setReloadSetting(IDocument::ReloadSetting behavior);
IDocument::ReloadSetting reloadSetting() const; IDocument::ReloadSetting reloadSetting() const;
...@@ -238,7 +238,7 @@ public slots: ...@@ -238,7 +238,7 @@ public slots:
private: private:
QList<IDocument *> documentsForEditors(QList<IEditor *> editors) const; QList<IDocument *> documentsForEditors(QList<IEditor *> editors) const;
IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString()); static IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
void addEditor(IEditor *editor, bool isDuplicate = false); void addEditor(IEditor *editor, bool isDuplicate = false);
void removeEditor(IEditor *editor); void removeEditor(IEditor *editor);
......
...@@ -798,7 +798,6 @@ QByteArray SplitterOrView::saveState() const ...@@ -798,7 +798,6 @@ QByteArray SplitterOrView::saveState() const
<< static_cast<SplitterOrView*>(m_splitter->widget(1))->saveState(); << static_cast<SplitterOrView*>(m_splitter->widget(1))->saveState();
} else { } else {
IEditor* e = editor(); IEditor* e = editor();
EditorManager *em = ICore::editorManager();
// don't save state of temporary or ad-hoc editors // don't save state of temporary or ad-hoc editors
if (e && (e->isTemporary() || e->document()->fileName().isEmpty())) { if (e && (e->isTemporary() || e->document()->fileName().isEmpty())) {
...@@ -814,7 +813,7 @@ QByteArray SplitterOrView::saveState() const ...@@ -814,7 +813,7 @@ QByteArray SplitterOrView::saveState() const
if (!e) { if (!e) {
stream << QByteArray("empty"); stream << QByteArray("empty");
} else if (e == em->currentEditor()) { } else if (e == EditorManager::currentEditor()) {
stream << QByteArray("currenteditor") stream << QByteArray("currenteditor")
<< e->document()->fileName() << e->id().toString() << e->saveState(); << e->document()->fileName() << e->id().toString() << e->saveState();
} else { } else {
......
...@@ -37,6 +37,6 @@ ...@@ -37,6 +37,6 @@
Core::IDocument *Core::IEditorFactory::open(const QString &fileName) Core::IDocument *Core::IEditorFactory::open(const QString &fileName)
{ {
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id()); Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id());
return iface ? iface->document() : 0; return iface ? iface->document() : 0;
} }
...@@ -199,7 +199,7 @@ void OpenEditorsWidget::closeEditor(const QModelIndex &index) ...@@ -199,7 +199,7 @@ void OpenEditorsWidget::closeEditor(const QModelIndex &index)
{ {
EditorManager::instance()->closeEditor(index); EditorManager::instance()->closeEditor(index);
// work around selection changes // work around selection changes
updateCurrentItem(EditorManager::instance()->currentEditor()); updateCurrentItem(EditorManager::currentEditor());
} }
void OpenEditorsWidget::contextMenuRequested(QPoint pos) void OpenEditorsWidget::contextMenuRequested(QPoint pos)
......
...@@ -284,7 +284,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item) ...@@ -284,7 +284,7 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>(); EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
EditorManager::instance()->activateEditorForDocument(view, document, EditorManager::ModeSwitch); EditorManager::instance()->activateEditorForDocument(view, document, EditorManager::ModeSwitch);
} else { } else {
if (!EditorManager::instance()->openEditor( if (!EditorManager::openEditor(
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>(), item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>(),
Core::EditorManager::ModeSwitch)) { Core::EditorManager::ModeSwitch)) {
EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0)); EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0));
......
...@@ -245,15 +245,12 @@ void EditorToolBar::setCloseSplitIcon(const QIcon &icon) ...@@ -245,15 +245,12 @@ void EditorToolBar::setCloseSplitIcon(const QIcon &icon)
void EditorToolBar::closeEditor() void EditorToolBar::closeEditor()
{ {
if (!currentEditor()) IEditor *current = EditorManager::currentEditor();
if (!current)
return; return;
if (d->m_isStandalone) { if (d->m_isStandalone)
EditorManager *em = ICore::editorManager(); EditorManager::instance()->closeEditor(current);
if (IEditor *editor = currentEditor()) {
em->closeEditor(editor);
}
}
emit closeClicked(); emit closeClicked();
} }
...@@ -349,8 +346,8 @@ void EditorToolBar::listContextMenu(QPoint pos) ...@@ -349,8 +346,8 @@ void EditorToolBar::listContextMenu(QPoint pos)
void EditorToolBar::makeEditorWritable() void EditorToolBar::makeEditorWritable()
{ {
if (currentEditor()) if (IEditor *current = EditorManager::currentEditor())
ICore::editorManager()->makeFileWritable(currentEditor()->document()); EditorManager::instance()->makeFileWritable(current->document());
} }
void EditorToolBar::setCanGoBack(bool canGoBack) void EditorToolBar::setCanGoBack(bool canGoBack)
...@@ -372,15 +369,10 @@ void EditorToolBar::updateActionShortcuts() ...@@ -372,15 +369,10 @@ void EditorToolBar::updateActionShortcuts()
d->m_closeSplitButton->setToolTip(am->command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split"))); d->m_closeSplitButton->setToolTip(am->command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split")));
} }
IEditor *EditorToolBar::currentEditor() const
{
return ICore::editorManager()->currentEditor();
}
void EditorToolBar::checkEditorStatus() void EditorToolBar::checkEditorStatus()
{ {
IEditor *editor = qobject_cast<IEditor *>(sender()); IEditor *editor = qobject_cast<IEditor *>(sender());
IEditor *current = currentEditor(); IEditor *current = EditorManager::currentEditor();
if (current == editor) if (current == editor)
updateEditorStatus(editor); updateEditorStatus(editor);
...@@ -413,13 +405,13 @@ void EditorToolBar::updateEditorStatus(IEditor *editor) ...@@ -413,13 +405,13 @@ void EditorToolBar::updateEditorStatus(IEditor *editor)
d->m_lockButton->setEnabled(false); d->m_lockButton->setEnabled(false);
d->m_lockButton->setToolTip(tr("File is writable")); d->m_lockButton->setToolTip(tr("File is writable"));
} }
if (editor == currentEditor()) IEditor *current = EditorManager::currentEditor();
if (editor == current)
d->m_editorList->setToolTip( d->m_editorList->setToolTip(
currentEditor()->document()->fileName().isEmpty() current->document()->fileName().isEmpty()
? currentEditor()->displayName() ? current->displayName()
: QDir::toNativeSeparators(editor->document()->fileName()) : QDir::toNativeSeparators(editor->document()->fileName())
); );
} }
void EditorToolBar::setNavigationVisible(bool isVisible) void EditorToolBar::setNavigationVisible(bool isVisible)
......
...@@ -107,7 +107,6 @@ private slots: ...@@ -107,7 +107,6 @@ private slots:
private: private:
void updateToolBar(QWidget *toolBar); void updateToolBar(QWidget *toolBar);
IEditor *currentEditor() const;
EditorToolBarPrivate *d;