forked from qt-creator/qt-creator
Merge BaseTextEditorWidget::editorDocument() and ::baseTextDocument()
Doesn't really make sense to have the additional IDocument *editorDocument() method. Change-Id: I0a7420eb1afaa76f63c3f7e9c4b373acf624ffb9 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -713,7 +713,7 @@ void AndroidManifestEditorWidget::updateSdkVersions()
|
||||
|
||||
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
|
||||
{
|
||||
Core::InfoBar *infoBar = editorDocument()->infoBar();
|
||||
Core::InfoBar *infoBar = baseTextDocument()->infoBar();
|
||||
QString text;
|
||||
if (line < 0)
|
||||
text = tr("Could not parse file: '%1'.").arg(errorMessage);
|
||||
@@ -731,7 +731,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
|
||||
|
||||
void AndroidManifestEditorWidget::hideInfoBar()
|
||||
{
|
||||
Core::InfoBar *infoBar = editorDocument()->infoBar();
|
||||
Core::InfoBar *infoBar = baseTextDocument()->infoBar();
|
||||
infoBar->removeInfo(infoBarId);
|
||||
m_timerParseCheck.stop();
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
|
||||
// TODO: Resolve variables
|
||||
|
||||
QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
|
||||
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
|
||||
QString fileName = dir.filePath(buffer);
|
||||
QFileInfo fi(fileName);
|
||||
if (fi.exists()) {
|
||||
|
||||
@@ -1077,7 +1077,7 @@ void CPPEditorWidget::updateOutlineNow()
|
||||
return;
|
||||
|
||||
const Snapshot snapshot = m_modelManager->snapshot();
|
||||
Document::Ptr document = snapshot.document(editorDocument()->filePath());
|
||||
Document::Ptr document = snapshot.document(baseTextDocument()->filePath());
|
||||
|
||||
if (!document)
|
||||
return;
|
||||
@@ -1672,7 +1672,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
|
||||
// We can use the semanticInfo's snapshot (and avoid locking), but not its
|
||||
// document, since it doesn't contain expanded macros.
|
||||
LookupContext context(semanticInfo.snapshot.document(editorDocument()->filePath()),
|
||||
LookupContext context(semanticInfo.snapshot.document(baseTextDocument()->filePath()),
|
||||
semanticInfo.snapshot);
|
||||
|
||||
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
|
||||
@@ -1841,7 +1841,7 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
|
||||
m_declDefLink = link;
|
||||
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
|
||||
m_declDefLink->targetFile->fileName());
|
||||
if (editorDocument() != targetDocument) {
|
||||
if (baseTextDocument() != targetDocument) {
|
||||
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
|
||||
connect(baseTextDocument->document(), SIGNAL(contentsChanged()),
|
||||
this, SLOT(abortDeclDefLink()));
|
||||
@@ -1876,7 +1876,7 @@ void CPPEditorWidget::abortDeclDefLink()
|
||||
|
||||
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
|
||||
m_declDefLink->targetFile->fileName());
|
||||
if (editorDocument() != targetDocument) {
|
||||
if (baseTextDocument() != targetDocument) {
|
||||
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
|
||||
disconnect(baseTextDocument->document(), SIGNAL(contentsChanged()),
|
||||
this, SLOT(abortDeclDefLink()));
|
||||
|
||||
@@ -85,7 +85,7 @@ void CppElementEvaluator::execute()
|
||||
return;
|
||||
|
||||
const Snapshot &snapshot = m_modelManager->snapshot();
|
||||
Document::Ptr doc = snapshot.document(m_editor->editorDocument()->filePath());
|
||||
Document::Ptr doc = snapshot.document(m_editor->baseTextDocument()->filePath());
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
}
|
||||
|
||||
// Now we prefer the doc from the snapshot with macros expanded.
|
||||
Document::Ptr doc = snapshot.document(m_widget->editorDocument()->filePath());
|
||||
Document::Ptr doc = snapshot.document(m_widget->baseTextDocument()->filePath());
|
||||
if (!doc) {
|
||||
doc = documentFromSemanticInfo;
|
||||
if (!doc)
|
||||
@@ -639,7 +639,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
if (Symbol *d = r.declaration()) {
|
||||
if (d->isDeclaration() || d->isFunction()) {
|
||||
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
|
||||
if (m_widget->editorDocument()->filePath() == fileName) {
|
||||
if (m_widget->baseTextDocument()->filePath() == fileName) {
|
||||
if (unsigned(lineNumber) == d->line()
|
||||
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
|
||||
result = r; // take the symbol under cursor.
|
||||
|
||||
@@ -142,12 +142,12 @@ void CppIncludeHierarchyWidget::perform()
|
||||
return;
|
||||
|
||||
m_model->clear();
|
||||
m_model->buildHierarchy(m_editor, widget->editorDocument()->filePath());
|
||||
m_model->buildHierarchy(m_editor, widget->baseTextDocument()->filePath());
|
||||
if (m_model->isEmpty())
|
||||
return;
|
||||
|
||||
m_inspectedFile->setup(widget->editorDocument()->displayName(),
|
||||
widget->editorDocument()->filePath());
|
||||
m_inspectedFile->setup(widget->baseTextDocument()->displayName(),
|
||||
widget->baseTextDocument()->filePath());
|
||||
|
||||
//expand "Includes"
|
||||
m_treeView->expand(m_model->index(0, 0));
|
||||
|
||||
@@ -87,7 +87,7 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
|
||||
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CPPEditorWidget *editor,
|
||||
TextEditor::AssistReason reason)
|
||||
: DefaultAssistInterface(editor->document(), editor->position(),
|
||||
editor->editorDocument()->filePath(), reason)
|
||||
editor->baseTextDocument()->filePath(), reason)
|
||||
, m_editor(editor)
|
||||
, m_semanticInfo(editor->semanticInfo())
|
||||
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
|
||||
|
||||
@@ -436,8 +436,7 @@ void InvokeCompletionTokenAction::run(CPPEditorWidget *editorWidget)
|
||||
// editorWidget->setFocus();
|
||||
QApplication::processEvents();
|
||||
|
||||
BaseTextDocument *doc = qobject_cast<BaseTextDocument *>(editorWidget->editorDocument());
|
||||
TestActionsTestCase::undoChangesInDocument(doc);
|
||||
TestActionsTestCase::undoChangesInDocument(editorWidget->baseTextDocument());
|
||||
}
|
||||
|
||||
class RunAllQuickFixesTokenAction : public TestActionsTestCase::AbstractAction
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
QStringList completions;
|
||||
CppCompletionAssistInterface *ai
|
||||
= new CppCompletionAssistInterface(editorWidget->document(), position,
|
||||
editorWidget->editorDocument()->filePath(),
|
||||
editorWidget->baseTextDocument()->filePath(),
|
||||
ExplicitlyInvoked, snapshot,
|
||||
QStringList(), QStringList());
|
||||
CppCompletionAssistProcessor processor;
|
||||
|
||||
@@ -713,7 +713,7 @@ void QmlLiveTextPreview::showSyncWarning(
|
||||
|
||||
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
|
||||
if (editor) {
|
||||
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
|
||||
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
|
||||
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
|
||||
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
|
||||
if (toolsClient && toolsClient->supportReload())
|
||||
@@ -734,7 +734,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
|
||||
{
|
||||
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
|
||||
if (editor) {
|
||||
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
|
||||
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
|
||||
infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class QDesignerFormWindowInterface;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace TextEditor {
|
||||
class BaseTextDocument;
|
||||
class PlainTextEditor;
|
||||
}
|
||||
|
||||
|
||||
@@ -278,9 +278,9 @@ void GitEditor::init()
|
||||
VcsBase::VcsBaseEditorWidget::init();
|
||||
Core::Id editorId = editor()->id();
|
||||
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|
||||
new GitSubmitHighlighter(baseTextDocument().data());
|
||||
new GitSubmitHighlighter(baseTextDocument());
|
||||
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
|
||||
new GitRebaseHighlighter(baseTextDocument().data());
|
||||
new GitRebaseHighlighter(baseTextDocument());
|
||||
}
|
||||
|
||||
void GitEditor::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
|
||||
|
||||
@@ -157,7 +157,7 @@ GLSLTextEditorWidget::GLSLTextEditorWidget(QWidget *parent) :
|
||||
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
|
||||
|
||||
new Highlighter(baseTextDocument().data());
|
||||
new Highlighter(baseTextDocument());
|
||||
|
||||
// if (m_modelManager) {
|
||||
// m_semanticHighlighter->setModelManager(m_modelManager);
|
||||
|
||||
@@ -59,7 +59,7 @@ EditorWidget::EditorWidget(QWidget *parent)
|
||||
setCodeFoldingSupported(true);
|
||||
|
||||
setIndenter(new PythonIndenter());
|
||||
new PythonHighlighter(baseTextDocument().data());
|
||||
new PythonHighlighter(baseTextDocument());
|
||||
}
|
||||
|
||||
EditorWidget::~EditorWidget()
|
||||
|
||||
@@ -167,7 +167,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
|
||||
}
|
||||
}
|
||||
|
||||
QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
|
||||
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
|
||||
QString fileName = dir.filePath(buffer);
|
||||
QFileInfo fi(fileName);
|
||||
if (fi.exists()) {
|
||||
|
||||
@@ -143,7 +143,7 @@ void QmakeManager::addLibrary()
|
||||
ProFileEditorWidget *editor =
|
||||
qobject_cast<ProFileEditorWidget*>(Core::EditorManager::currentEditor()->widget());
|
||||
if (editor)
|
||||
addLibrary(editor->editorDocument()->filePath(), editor);
|
||||
addLibrary(editor->baseTextDocument()->filePath(), editor);
|
||||
}
|
||||
|
||||
void QmakeManager::addLibraryContextMenu()
|
||||
|
||||
@@ -610,7 +610,7 @@ void QmlJSTextEditorWidget::reparseDocumentNow()
|
||||
{
|
||||
m_updateDocumentTimer->stop();
|
||||
|
||||
const QString fileName = editorDocument()->filePath();
|
||||
const QString fileName = baseTextDocument()->filePath();
|
||||
m_modelManager->updateSourceFiles(QStringList() << fileName, false);
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ static void appendExtraSelectionsForMessages(
|
||||
|
||||
void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
|
||||
{
|
||||
if (editorDocument()->filePath() != doc->fileName())
|
||||
if (baseTextDocument()->filePath() != doc->fileName())
|
||||
return;
|
||||
|
||||
if (doc->editorRevision() != editorRevision()) {
|
||||
@@ -684,7 +684,7 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
|
||||
void QmlJSTextEditorWidget::modificationChanged(bool changed)
|
||||
{
|
||||
if (!changed && m_modelManager)
|
||||
m_modelManager->fileChangedOnDisk(editorDocument()->filePath());
|
||||
m_modelManager->fileChangedOnDisk(baseTextDocument()->filePath());
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
|
||||
@@ -1060,7 +1060,7 @@ void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
|
||||
connect(m_outlineCombo, SIGNAL(activated(int)), this, SLOT(jumpToOutlineElement(int)));
|
||||
connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
|
||||
|
||||
connect(editorDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
|
||||
connect(baseTextDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
|
||||
|
||||
editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
|
||||
}
|
||||
@@ -1150,12 +1150,12 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q
|
||||
|
||||
void QmlJSTextEditorWidget::findUsages()
|
||||
{
|
||||
m_findReferences->findUsages(editorDocument()->filePath(), textCursor().position());
|
||||
m_findReferences->findUsages(baseTextDocument()->filePath(), textCursor().position());
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::renameUsages()
|
||||
{
|
||||
m_findReferences->renameUsages(editorDocument()->filePath(), textCursor().position());
|
||||
m_findReferences->renameUsages(baseTextDocument()->filePath(), textCursor().position());
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::showContextPane()
|
||||
|
||||
@@ -48,7 +48,7 @@ using namespace Internal;
|
||||
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget *editor,
|
||||
TextEditor::AssistReason reason)
|
||||
: DefaultAssistInterface(editor->document(), editor->position(),
|
||||
editor->editorDocument()->filePath(), reason)
|
||||
editor->baseTextDocument()->filePath(), reason)
|
||||
, m_editor(editor)
|
||||
, m_semanticInfo(editor->semanticInfo())
|
||||
, m_currentFile(QmlJSRefactoringChanges::file(m_editor, m_semanticInfo.document))
|
||||
|
||||
@@ -568,7 +568,7 @@ void SemanticHighlighter::applyResults(int from, int to)
|
||||
if (m_startRevision != m_editor->editorRevision())
|
||||
return;
|
||||
|
||||
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
|
||||
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
|
||||
QTC_ASSERT(baseTextDocument, return);
|
||||
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
|
||||
QTC_ASSERT(highlighter, return);
|
||||
@@ -584,7 +584,7 @@ void SemanticHighlighter::finished()
|
||||
if (m_startRevision != m_editor->editorRevision())
|
||||
return;
|
||||
|
||||
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
|
||||
TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
|
||||
QTC_ASSERT(baseTextDocument, return);
|
||||
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
|
||||
QTC_ASSERT(highlighter, return);
|
||||
|
||||
@@ -220,7 +220,7 @@ TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() cons
|
||||
|
||||
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
|
||||
{
|
||||
Core::IDocument *doc = m_xmlSourceWidget->editorDocument();
|
||||
Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
|
||||
if (doc) {
|
||||
doc->setFilePath(filePath);
|
||||
// setFilePath() call leads to a textChanged() signal emitted
|
||||
|
||||
@@ -493,7 +493,7 @@ BaseTextEditor *BaseTextEditorWidget::editor() const
|
||||
d->m_codeAssistant->configure(d->m_editor);
|
||||
connect(this, SIGNAL(textChanged()),
|
||||
d->m_editor, SIGNAL(contentsChanged()));
|
||||
connect(qobject_cast<BaseTextDocument *>(d->m_editor->document()),SIGNAL(mimeTypeChanged()),
|
||||
connect(baseTextDocument(),SIGNAL(mimeTypeChanged()),
|
||||
d->m_codeAssistant.data(), SLOT(reconfigure()));
|
||||
}
|
||||
return d->m_editor;
|
||||
@@ -632,7 +632,7 @@ void BaseTextEditorWidget::setChangeSet(const Utils::ChangeSet &changeSet)
|
||||
}
|
||||
}
|
||||
|
||||
Core::IDocument *BaseTextEditorWidget::editorDocument() const
|
||||
BaseTextDocument *BaseTextEditorWidget::baseTextDocument() const
|
||||
{
|
||||
return d->m_document.data();
|
||||
}
|
||||
@@ -2084,12 +2084,6 @@ void BaseTextEditorWidget::duplicateFrom(BaseTextEditorWidget *widget)
|
||||
d->m_document = widget->d->m_document;
|
||||
}
|
||||
|
||||
QSharedPointer<BaseTextDocument> BaseTextEditorWidget::baseTextDocument() const
|
||||
{
|
||||
return d->m_document;
|
||||
}
|
||||
|
||||
|
||||
void BaseTextEditorWidget::setBaseTextDocument(const QSharedPointer<BaseTextDocument> &doc)
|
||||
{
|
||||
if (!doc.isNull()) {
|
||||
@@ -2467,11 +2461,11 @@ BaseTextEditorWidgetPrivate::~BaseTextEditorWidgetPrivate()
|
||||
|
||||
void BaseTextEditorWidgetPrivate::setupDocumentSignals(const QSharedPointer<BaseTextDocument> &document)
|
||||
{
|
||||
QSharedPointer<BaseTextDocument> oldDocument = q->baseTextDocument();
|
||||
if (!oldDocument.isNull()) {
|
||||
BaseTextDocument *oldDocument = q->baseTextDocument();
|
||||
if (oldDocument) {
|
||||
q->disconnect(oldDocument->document(), 0, q, 0);
|
||||
q->disconnect(oldDocument.data(), 0, q, 0);
|
||||
q->disconnect(q, 0, oldDocument.data(), 0);
|
||||
q->disconnect(oldDocument, 0, q, 0);
|
||||
q->disconnect(q, 0, oldDocument, 0);
|
||||
}
|
||||
|
||||
QTextDocument *doc = document->document();
|
||||
@@ -6131,7 +6125,7 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
|
||||
if (a && a->isEnabled())
|
||||
menu->addAction(a);
|
||||
|
||||
QSharedPointer<BaseTextDocument> doc = baseTextDocument();
|
||||
BaseTextDocument *doc = baseTextDocument();
|
||||
if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {
|
||||
a = Core::ActionManager::command(Constants::SWITCH_UTF8BOM)->action();
|
||||
if (a && a->isEnabled()) {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#ifndef BASETEXTEDITOR_H
|
||||
#define BASETEXTEDITOR_H
|
||||
|
||||
#include "basetextdocument.h"
|
||||
#include "itexteditor.h"
|
||||
#include "codeassist/assistenums.h"
|
||||
|
||||
@@ -69,7 +70,6 @@ namespace Internal {
|
||||
|
||||
class ITextMarkable;
|
||||
|
||||
class BaseTextDocument;
|
||||
class BaseTextEditor;
|
||||
class FontSettings;
|
||||
class BehaviorSettings;
|
||||
@@ -135,12 +135,12 @@ public:
|
||||
const Utils::ChangeSet &changeSet() const;
|
||||
void setChangeSet(const Utils::ChangeSet &changeSet);
|
||||
|
||||
// EditorInterface
|
||||
Core::IDocument *editorDocument() const;
|
||||
BaseTextDocument *baseTextDocument() const;
|
||||
|
||||
// IEditor
|
||||
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
|
||||
void gotoLine(int line, int column = 0);
|
||||
|
||||
int position(ITextEditor::PositionOperation posOp = ITextEditor::Current,
|
||||
@@ -358,7 +358,6 @@ public:
|
||||
void duplicateFrom(BaseTextEditorWidget *editor);
|
||||
|
||||
protected:
|
||||
QSharedPointer<BaseTextDocument> baseTextDocument() const;
|
||||
void setBaseTextDocument(const QSharedPointer<BaseTextDocument> &doc);
|
||||
|
||||
void setDefaultPath(const QString &defaultPath);
|
||||
@@ -593,9 +592,10 @@ public:
|
||||
|
||||
friend class BaseTextEditorWidget;
|
||||
BaseTextEditorWidget *editorWidget() const { return m_editorWidget; }
|
||||
BaseTextDocument *baseTextDocument() { return m_editorWidget->baseTextDocument(); }
|
||||
|
||||
// IEditor
|
||||
Core::IDocument *document() { return m_editorWidget->editorDocument(); }
|
||||
Core::IDocument *document() { return m_editorWidget->baseTextDocument(); }
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
|
||||
QByteArray saveState() const { return m_editorWidget->saveState(); }
|
||||
|
||||
@@ -71,7 +71,7 @@ PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
|
||||
m_commentDefinition.clearCommentStyles();
|
||||
|
||||
// If configure() is called immediately the whole document is considered modified
|
||||
connect(editorDocument(), SIGNAL(changed()), this, SLOT(configure()), Qt::QueuedConnection);
|
||||
connect(baseTextDocument(), SIGNAL(changed()), this, SLOT(configure()), Qt::QueuedConnection);
|
||||
connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure()));
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ void PlainTextEditorWidget::setTabSettings(const TextEditor::TabSettings &ts)
|
||||
void PlainTextEditorWidget::configure()
|
||||
{
|
||||
MimeType mimeType;
|
||||
if (editorDocument())
|
||||
mimeType = MimeDatabase::findByFile(editorDocument()->filePath());
|
||||
if (baseTextDocument())
|
||||
mimeType = MimeDatabase::findByFile(baseTextDocument()->filePath());
|
||||
configure(mimeType);
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ void PlainTextEditorWidget::configure(const MimeType &mimeType)
|
||||
|
||||
setCodeFoldingSupported(true);
|
||||
}
|
||||
} else if (editorDocument()) {
|
||||
const QString &fileName = editorDocument()->filePath();
|
||||
} else if (baseTextDocument()) {
|
||||
const QString &fileName = baseTextDocument()->filePath();
|
||||
if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
|
||||
m_isMissingSyntaxDefinition = false;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileNam
|
||||
{ }
|
||||
|
||||
RefactoringFile::RefactoringFile(BaseTextEditorWidget *editor)
|
||||
: m_fileName(editor->editorDocument()->filePath())
|
||||
: m_fileName(editor->baseTextDocument()->filePath())
|
||||
, m_document(0)
|
||||
, m_editor(editor)
|
||||
, m_openEditor(false)
|
||||
|
||||
Reference in New Issue
Block a user