[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kate] /: CHANGELOG: support --encoding together with --stdin
From: Christoph Cullmann <cullmann () kde ! org>
Date: 2016-09-07 20:43:16
Message-ID: E1bhjgi-0000Io-JT () code ! kde ! org
[Download RAW message or body]
Git commit 50c656517729bd6e2cbc21d20c7b640df6948eef by Christoph Cullmann.
Committed on 07/09/2016 at 20:42.
Pushed by cullmann into branch 'master'.
CHANGELOG: support --encoding together with --stdin
BUG: 364169
M +3 -3 kate/kateapp.cpp
M +2 -1 kate/kateapp.h
M +2 -2 kate/kateappadaptor.cpp
M +2 -1 kate/kateappadaptor.h
M +1 -0 kate/main.cpp
M +4 -0 kwrite/main.cpp
http://commits.kde.org/kate/50c656517729bd6e2cbc21d20c7b640df6948eef
diff --git a/kate/kateapp.cpp b/kate/kateapp.cpp
index 31fe66c..2c6589e 100644
--- a/kate/kateapp.cpp
+++ b/kate/kateapp.cpp
@@ -200,7 +200,7 @@ bool KateApp::startupKate()
text.append(line + QLatin1Char('\n'));
} while (!line.isNull());
- openInput(text);
+ openInput(text, codec_name);
} else if (doc) {
activeKateMainWindow()->viewManager()->activateView(doc);
}
@@ -310,9 +310,9 @@ bool KateApp::setCursor(int line, int column)
return true;
}
-bool KateApp::openInput(const QString &text)
+bool KateApp::openInput(const QString &text, const QString &encoding)
{
- activeKateMainWindow()->viewManager()->openUrl(QUrl(), QString(), true);
+ activeKateMainWindow()->viewManager()->openUrl(QUrl(), encoding, true);
if (!activeKateMainWindow()->viewManager()->activeView()) {
return false;
diff --git a/kate/kateapp.h b/kate/kateapp.h
index 692614e..0d24d23 100644
--- a/kate/kateapp.h
+++ b/kate/kateapp.h
@@ -208,9 +208,10 @@ public:
* helper to handle stdin input
* open a new document/view, fill it with the text given
* @param text text to fill in the new doc/view
+ * @param encoding encoding to set for the document, if any
* @return success
*/
- bool openInput(const QString &text);
+ bool openInput(const QString &text, const QString &encoding);
//
// KTextEditor::Application interface, called by wrappers via invokeMethod
diff --git a/kate/kateappadaptor.cpp b/kate/kateappadaptor.cpp
index 57fcbe2..9477af0 100644
--- a/kate/kateappadaptor.cpp
+++ b/kate/kateappadaptor.cpp
@@ -96,9 +96,9 @@ bool KateAppAdaptor::setCursor(int line, int column)
return m_app->setCursor(line, column);
}
-bool KateAppAdaptor::openInput(QString text)
+bool KateAppAdaptor::openInput(QString text, QString encoding)
{
- return m_app->openInput(text);
+ return m_app->openInput(text, encoding);
}
bool KateAppAdaptor::activateSession(QString session)
diff --git a/kate/kateappadaptor.h b/kate/kateappadaptor.h
index be04c9f..b2de22c 100644
--- a/kate/kateappadaptor.h
+++ b/kate/kateappadaptor.h
@@ -82,9 +82,10 @@ public Q_SLOTS:
* helper to handle stdin input
* open a new document/view, fill it with the text given
* @param text text to fill in the new doc/view
+ * @param encoding encoding to set for the document, if any
* @return success
*/
- bool openInput(QString text);
+ bool openInput(QString text, QString encoding);
/**
* activate a given session
diff --git a/kate/main.cpp b/kate/main.cpp
index 18cafc5..7e01690 100644
--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -431,6 +431,7 @@ int main(int argc, char **argv)
QList<QVariant> dbusargs;
dbusargs.append(text);
+ dbusargs.append(codec ? QString::fromLatin1(codec->name()) : QString());
m.setArguments(dbusargs);
QDBusConnection::sessionBus().call(m);
diff --git a/kwrite/main.cpp b/kwrite/main.cpp
index dab9439..edca82a 100644
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -226,6 +226,10 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
KTextEditor::Document *doc = t->view()->document();
if (doc) {
+ // remember codec in document, e.g. to show the right one
+ if (codec) {
+ doc->setEncoding(QString::fromLatin1(codec->name()));
+ }
doc->setText(text);
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic