summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/TextEditor.pluginspec8
-rw-r--r--src/plugins/texteditor/basefilefind.h2
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp7
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp4
-rw-r--r--src/plugins/texteditor/basetexteditor.h2
-rw-r--r--src/plugins/texteditor/findincurrentfile.cpp15
-rw-r--r--src/plugins/texteditor/findincurrentfile.h2
-rw-r--r--src/plugins/texteditor/findinfiles.cpp7
-rw-r--r--src/plugins/texteditor/findinfiles.h2
-rw-r--r--src/plugins/texteditor/itexteditor.cpp15
-rw-r--r--src/plugins/texteditor/itexteditor.h1
11 files changed, 44 insertions, 21 deletions
diff --git a/src/plugins/texteditor/TextEditor.pluginspec b/src/plugins/texteditor/TextEditor.pluginspec
index 0f089e49ed..1670ce1ca4 100644
--- a/src/plugins/texteditor/TextEditor.pluginspec
+++ b/src/plugins/texteditor/TextEditor.pluginspec
@@ -1,4 +1,4 @@
-<plugin name="TextEditor" version="2.0.93" compatVersion="2.0.93">
+<plugin name="TextEditor" version="2.1.81" compatVersion="2.1.81">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2010 Nokia Corporation</copyright>
<license>
@@ -14,8 +14,8 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<description>Text editor framework and the implementation of the basic text editor.</description>
<url>http://qt.nokia.com</url>
<dependencyList>
- <dependency name="Core" version="2.0.93"/>
- <dependency name="Find" version="2.0.93"/>
- <dependency name="Locator" version="2.0.93"/>
+ <dependency name="Core" version="2.1.81"/>
+ <dependency name="Find" version="2.1.81"/>
+ <dependency name="Locator" version="2.1.81"/>
</dependencyList>
</plugin>
diff --git a/src/plugins/texteditor/basefilefind.h b/src/plugins/texteditor/basefilefind.h
index b00c6a110c..83577aa60a 100644
--- a/src/plugins/texteditor/basefilefind.h
+++ b/src/plugins/texteditor/basefilefind.h
@@ -73,7 +73,7 @@ public:
const QList<Find::SearchResultItem> &items);
protected:
- virtual Utils::FileIterator *files() = 0;
+ virtual Utils::FileIterator *files() const = 0;
void writeCommonSettings(QSettings *settings);
void readCommonSettings(QSettings *settings, const QString &defaultFilter);
QWidget *createPatternWidget();
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 0b799c20df..e52a38899c 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -132,12 +132,7 @@ BaseTextDocument::BaseTextDocument()
m_lineTerminatorMode = NativeLineTerminator;
m_fileIsReadOnly = false;
m_isBinaryData = false;
- m_codec = QTextCodec::codecForLocale();
- QSettings *settings = Core::ICore::instance()->settings();
- if (QTextCodec *candidate = QTextCodec::codecForName(
- settings->value(QLatin1String("General/DefaultFileEncoding")).toByteArray()))
- m_codec = candidate;
-
+ m_codec = Core::EditorManager::instance()->defaultTextEncoding();
m_hasDecodingError = false;
}
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index eaa36330c7..c8d82f8a6c 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -4304,7 +4304,9 @@ bool BaseTextEditor::openLink(const Link &link)
return true;
}
- return openEditorAt(link.fileName, link.line, link.column);
+ return openEditorAt(link.fileName, link.line, link.column, QString(),
+ Core::EditorManager::IgnoreNavigationHistory
+ | Core::EditorManager::ModeSwitch);
}
void BaseTextEditor::updateLink(QMouseEvent *e)
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index aa19330753..c544e23b6b 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -648,4 +648,6 @@ private:
} // namespace TextEditor
+Q_DECLARE_METATYPE(TextEditor::BaseTextEditor::Link);
+
#endif // BASETEXTEDITOR_H
diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp
index 01c060133f..938a0de3f1 100644
--- a/src/plugins/texteditor/findincurrentfile.cpp
+++ b/src/plugins/texteditor/findincurrentfile.cpp
@@ -28,6 +28,7 @@
**************************************************************************/
#include "findincurrentfile.h"
+#include "itexteditor.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -40,6 +41,7 @@
#include <QtGui/QVBoxLayout>
using namespace Find;
+using namespace TextEditor;
using namespace TextEditor::Internal;
FindInCurrentFile::FindInCurrentFile(SearchResultWindow *resultWindow)
@@ -62,12 +64,15 @@ QString FindInCurrentFile::displayName() const
return tr("Current File");
}
-Utils::FileIterator *FindInCurrentFile::files()
+Utils::FileIterator *FindInCurrentFile::files() const
{
- QStringList fileList;
- if (isEnabled())
- fileList << m_currentFile->fileName();
- return new Utils::FileIterator(fileList);
+ Q_ASSERT(isEnabled());
+ QString fileName = m_currentFile->fileName();
+ QMap<QString, QTextCodec *> openEditorEncodings = ITextEditor::openedTextEditorsEncodings();
+ QTextCodec *codec = openEditorEncodings.value(fileName);
+ if (!codec)
+ codec = Core::EditorManager::instance()->defaultTextEncoding();
+ return new Utils::FileIterator(QStringList() << fileName, QList<QTextCodec *>() << codec);
}
bool FindInCurrentFile::isEnabled() const
diff --git a/src/plugins/texteditor/findincurrentfile.h b/src/plugins/texteditor/findincurrentfile.h
index b42064d99c..c6010dc0e2 100644
--- a/src/plugins/texteditor/findincurrentfile.h
+++ b/src/plugins/texteditor/findincurrentfile.h
@@ -61,7 +61,7 @@ public:
void readSettings(QSettings *settings);
protected:
- Utils::FileIterator *files();
+ Utils::FileIterator *files() const;
private slots:
void handleFileChange(Core::IEditor *editor);
diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp
index b6b02ef31b..3c8d56f05a 100644
--- a/src/plugins/texteditor/findinfiles.cpp
+++ b/src/plugins/texteditor/findinfiles.cpp
@@ -29,6 +29,8 @@
#include "findinfiles.h"
+#include <coreplugin/editormanager/editormanager.h>
+
#include <QtCore/QtDebug>
#include <QtCore/QSettings>
#include <QtCore/QDir>
@@ -63,10 +65,11 @@ void FindInFiles::findAll(const QString &txt, Find::FindFlags findFlags)
BaseFileFind::findAll(txt, findFlags);
}
-Utils::FileIterator *FindInFiles::files()
+Utils::FileIterator *FindInFiles::files() const
{
return new Utils::SubDirFileIterator(QStringList() << m_directory->currentText(),
- fileNameFilters());
+ fileNameFilters(),
+ Core::EditorManager::instance()->defaultTextEncoding());
}
QWidget *FindInFiles::createConfigWidget()
diff --git a/src/plugins/texteditor/findinfiles.h b/src/plugins/texteditor/findinfiles.h
index 569e5ce781..125f9714cd 100644
--- a/src/plugins/texteditor/findinfiles.h
+++ b/src/plugins/texteditor/findinfiles.h
@@ -59,7 +59,7 @@ public:
void readSettings(QSettings *settings);
protected:
- Utils::FileIterator *files();
+ Utils::FileIterator *files() const;
private slots:
void openFileBrowser();
diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp
index 0c196e7614..c62d951f79 100644
--- a/src/plugins/texteditor/itexteditor.cpp
+++ b/src/plugins/texteditor/itexteditor.cpp
@@ -31,6 +31,8 @@
#include <coreplugin/editormanager/editormanager.h>
+#include <QtCore/QTextCodec>
+
using namespace TextEditor;
QMap<QString, QString> ITextEditor::openedTextEditorsContents()
@@ -45,3 +47,16 @@ QMap<QString, QString> ITextEditor::openedTextEditorsContents()
}
return workingCopy;
}
+
+QMap<QString, QTextCodec *> TextEditor::ITextEditor::openedTextEditorsEncodings()
+{
+ QMap<QString, QTextCodec *> workingCopy;
+ foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors()) {
+ ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
+ if (!textEditor)
+ continue;
+ QString fileName = textEditor->file()->fileName();
+ workingCopy[fileName] = textEditor->textCodec();
+ }
+ return workingCopy;
+}
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
index 16af52ef1f..fb98bbb8f7 100644
--- a/src/plugins/texteditor/itexteditor.h
+++ b/src/plugins/texteditor/itexteditor.h
@@ -119,6 +119,7 @@ public:
virtual QTextCodec *textCodec() const = 0;
static QMap<QString, QString> openedTextEditorsContents();
+ static QMap<QString, QTextCodec *> openedTextEditorsEncodings();
signals:
void contentsChanged();