[SCM] konsole packaging branch, master, updated. debian/16.08.3-1-8-g5eff185
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Dec 23 17:50:26 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/konsole.git;a=commitdiff;h=fa95567
The following commit has been merged in the master branch:
commit fa9556726abf53521c0ab7f291d85323ff3db96f
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date: Fri Dec 23 15:24:09 2016 +0100
Add new patch: Pre-process-the-e-custom-command-argument.patch
Closes: 848162
Thanks: Ben Longbons for reporting
---
...Pre-process-the-e-custom-command-argument.patch | 138 +++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 139 insertions(+)
diff --git a/debian/patches/Pre-process-the-e-custom-command-argument.patch b/debian/patches/Pre-process-the-e-custom-command-argument.patch
new file mode 100644
index 0000000..9fb763c
--- /dev/null
+++ b/debian/patches/Pre-process-the-e-custom-command-argument.patch
@@ -0,0 +1,138 @@
+From: Maximiliano Curia <maxy at gnuservers.com.ar>
+Date: Mon, 19 Dec 2016 22:26:46 +0100
+Subject: Pre process the -e custom command argument
+
+Special case parsing of -e, to avoid parsing parameters intended for the
+command to be executed.
+---
+ src/Application.cpp | 39 ++++++++++++++++++++++++++-------------
+ src/Application.h | 4 +++-
+ src/main.cpp | 8 ++++++--
+ 3 files changed, 35 insertions(+), 16 deletions(-)
+
+diff --git a/src/Application.cpp b/src/Application.cpp
+index 5b352ec..12ffe23 100644
+--- a/src/Application.cpp
++++ b/src/Application.cpp
+@@ -45,7 +45,7 @@
+
+ using namespace Konsole;
+
+-Application::Application(QSharedPointer<QCommandLineParser> parser) : m_parser(parser)
++Application::Application(QSharedPointer<QCommandLineParser> parser, const QStringList &customCommand) : m_parser(parser), m_customCommand(customCommand)
+ {
+ _backgroundInstance = 0;
+ }
+@@ -114,6 +114,22 @@ void Application::populateCommandLineParser(QCommandLineParser *parser)
+ parser->addOption(titleOption);
+ }
+
++QStringList Application::getCustomCommand(QStringList &args)
++{
++ int i = args.indexOf("-e");
++ QStringList customCommand;
++ if ((0 < i) && (i < (args.size() - 1))) {
++ // -e was specified with at least one extra argument
++ // if -e was specified without arguments, QCommandLineParser will deal
++ // with that
++ args.removeAt(i);
++ while (args.size() > i) {
++ customCommand << args.takeAt(i);
++ }
++ }
++ return customCommand;
++}
++
+ Application::~Application()
+ {
+ SessionManager::instance()->closeAllSessions();
+@@ -478,21 +494,16 @@ Profile::Ptr Application::processProfileChangeArgs(Profile::Ptr baseProfile)
+ }
+
+ // run a custom command
+- if (m_parser->isSet(QStringLiteral("e"))) {
+- QString commandExec = m_parser->value(QStringLiteral("e"));
+- QStringList commandArguments;
+-
+- if (m_parser->positionalArguments().count() == 0 &&
+- QStandardPaths::findExecutable(commandExec).isEmpty()) {
++ if (!m_customCommand.isEmpty()) {
++ // Example: konsole -e man ls
++ QString commandExec = m_customCommand[0];
++ QStringList commandArguments(m_customCommand);
++ if ((m_customCommand.size() == 1) &&
++ (QStandardPaths::findExecutable(commandExec).isEmpty())) {
+ // Example: konsole -e "man ls"
+- ShellCommand shellCommand(m_parser->value(QStringLiteral("e")));
++ ShellCommand shellCommand(commandExec);
+ commandExec = shellCommand.command();
+ commandArguments = shellCommand.arguments();
+- } else {
+- // Example: konsole -e man ls
+- commandArguments << commandExec;
+- for ( int i = 0 ; i < m_parser->positionalArguments().count() ; i++ )
+- commandArguments << m_parser->positionalArguments().at(i);
+ }
+
+ if (commandExec.startsWith(QLatin1String("./")))
+@@ -550,6 +561,8 @@ void Application::slotActivateRequested (QStringList args, const QString & /*wor
+ // In the current version it just strips it away
+ args.prepend(qApp->applicationFilePath());
+
++ m_customCommand = getCustomCommand(args);
++
+ // We can't re-use QCommandLineParser instances, it preserves earlier parsed values
+ QCommandLineParser *parser = new QCommandLineParser;
+ populateCommandLineParser(parser);
+diff --git a/src/Application.h b/src/Application.h
+index 8987d78..8ec7ab6 100644
+--- a/src/Application.h
++++ b/src/Application.h
+@@ -50,9 +50,10 @@ class Application : public QObject
+
+ public:
+ /** Constructs a new Konsole application. */
+- explicit Application(QSharedPointer<QCommandLineParser> parser);
++ explicit Application(QSharedPointer<QCommandLineParser> parser, const QStringList &customCommand);
+
+ static void populateCommandLineParser(QCommandLineParser *parser);
++ static QStringList getCustomCommand(QStringList &args);
+
+ ~Application();
+
+@@ -89,6 +90,7 @@ private:
+
+ MainWindow* _backgroundInstance;
+ QSharedPointer<QCommandLineParser> m_parser;
++ QStringList m_customCommand;
+ };
+ }
+ #endif // APPLICATION_H
+diff --git a/src/main.cpp b/src/main.cpp
+index 26d3da9..e77597a 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -112,9 +112,13 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* argv[])
+ parser->addHelpOption();
+ parser->addVersionOption();
+ about.setupCommandLine(parser.data());
++
++ QStringList args = QStringList(app->arguments());
++ QStringList customCommand = Application::getCustomCommand(args);
++
+ Application::populateCommandLineParser(parser.data());
+
+- parser->process(*app);
++ parser->process(args);
+ about.processCommandLine(parser.data());
+
+ // Enable user to force multiple instances
+@@ -158,7 +162,7 @@ extern "C" int Q_DECL_EXPORT kdemain(int argc, char* argv[])
+
+ // If we reach this location, there was no existing copy of Konsole
+ // running, so create a new instance.
+- Application konsoleApp(parser);
++ Application konsoleApp(parser, customCommand);
+
+ // The activateRequested() signal is emitted when a second instance
+ // of Konsole is started.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..87808e5
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+Pre-process-the-e-custom-command-argument.patch
--
konsole packaging
More information about the pkg-kde-commits
mailing list