aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-19 09:52:23 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-19 09:52:23 (GMT)
commit5bf99370ec0ee3dbe2b3e33351d8216029efc6da (patch)
treef2fda309e8619c00d85486cf4c52630b97b1fbca
parent1deece7853c5542f70482e6a9487fca001aa5cd5 (diff)
remove hack to set default encoding
-rw-r--r--src/include/ktexteditor/editor.h12
-rw-r--r--src/src/ktexteditor.cpp35
-rw-r--r--src/utils/kateconfig.cpp5
3 files changed, 13 insertions, 39 deletions
diff --git a/src/include/ktexteditor/editor.h b/src/include/ktexteditor/editor.h
index 2ba0ff7..59d343a 100644
--- a/src/include/ktexteditor/editor.h
+++ b/src/include/ktexteditor/editor.h
@@ -177,18 +177,8 @@ public:
/**
* Get the current default encoding for this Editor part.
* \return default encoding
- * \since 4.5
*/
- const QString &defaultEncoding() const;
-
-protected:
- /**
- * Set the current default encoding for this Editor part.
- * Editor part implementation should call this internally on creation and config changes.
- * \param defaultEncoding new default encoding
- * \since 4.5
- */
- void setDefaultEncoding(const QString &defaultEncoding);
+ QString defaultEncoding () const;
/*
* Configuration management.
diff --git a/src/src/ktexteditor.cpp b/src/src/ktexteditor.cpp
index 4641d00..0cf0557 100644
--- a/src/src/ktexteditor.cpp
+++ b/src/src/ktexteditor.cpp
@@ -44,37 +44,34 @@
#include "annotationinterface.h"
#include "kateglobal.h"
+#include "kateconfig.h"
using namespace KTextEditor;
-class KTextEditor::EditorPrivate
-{
-public:
- EditorPrivate()
- {
- }
- QString defaultEncoding;
-};
-
Editor::Editor(QObject *parent)
: QObject(parent)
- , d(new KTextEditor::EditorPrivate())
+ , d(nullptr)
{
}
Editor::~Editor()
{
- delete d;
}
-const QString &Editor::defaultEncoding() const
+Editor *KTextEditor::Editor::instance()
{
- return d->defaultEncoding;
+ /**
+ * Just use internal KateGlobal::self()
+ */
+ return KateGlobal::self();
}
-void Editor::setDefaultEncoding(const QString &defaultEncoding)
+QString Editor::defaultEncoding () const
{
- d->defaultEncoding = defaultEncoding;
+ /**
+ * return default encoding in global config object
+ */
+ return KateGlobal::self()->documentConfig()->encoding ();
}
bool View::insertText(const QString &text)
@@ -86,14 +83,6 @@ bool View::insertText(const QString &text)
return doc->insertText(cursorPosition(), text, blockSelection());
}
-Editor *KTextEditor::Editor::instance()
-{
- /**
- * Just use internal KateGlobal::self()
- */
- return KateGlobal::self();
-}
-
ConfigPage::ConfigPage(QWidget *parent)
: QWidget(parent)
, d(0)
diff --git a/src/utils/kateconfig.cpp b/src/utils/kateconfig.cpp
index 61bc9f4..b13cf39 100644
--- a/src/utils/kateconfig.cpp
+++ b/src/utils/kateconfig.cpp
@@ -908,11 +908,6 @@ bool KateDocumentConfig::setEncoding(const QString &encoding)
configStart();
m_encodingSet = true;
m_encoding = QString::fromLatin1(codec->name());
-
- if (isGlobal()) {
- KateGlobal::self()->setDefaultEncoding(m_encoding);
- }
-
configEnd();
return true;
}