Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=a131a8d83c956697f01fed162e30c2180adf29a7

commit a131a8d83c956697f01fed162e30c2180adf29a7
Author: crazy <[email protected]>
Date:   Fri Mar 17 13:39:32 2017 +0100

konsole-16.12.3-2-x86_64
* fix -e arg .. ( backported from git )

diff --git a/source/kde5/konsole/FrugalBuild b/source/kde5/konsole/FrugalBuild
index ea99c2f..3fa85bc 100644
--- a/source/kde5/konsole/FrugalBuild
+++ b/source/kde5/konsole/FrugalBuild
@@ -3,14 +3,16 @@

pkgname=konsole
pkgver=16.12.3
-pkgrel=1
+pkgrel=2
pkgdesc="KDE Terminal emulator."
archs=("x86_64")
_F_kde_project="applications"
Finclude kf5
+source+=(fix-e-arg.patch)
groups+=('kde5-apps')
depends=("kparts>=$_F_kf5_full" "kinit>=$_F_kf5_full" 
"knotifyconfig>=$_F_kf5_full" "kpty>=$_F_kf5_full")
makedepends+=('kdoctools')
-sha1sums=('da16d047f6f8b2c18c30925b975918451d0d30bd')
+sha1sums=('da16d047f6f8b2c18c30925b975918451d0d30bd' \
+          '91b45b2eebcee4abe51813be76debd85cd5e4a87')

# optimization OK
diff --git a/source/kde5/konsole/fix-e-arg.patch 
b/source/kde5/konsole/fix-e-arg.patch
new file mode 100644
index 0000000..09106b4
--- /dev/null
+++ b/source/kde5/konsole/fix-e-arg.patch
@@ -0,0 +1,144 @@
+From a779c8314a7d27bb4691c220f793540e6f84f6c9 Mon Sep 17 00:00:00 2001
+From: Maximiliano Curia <[email protected]>
+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.
+
+REVIEW: 129677
+---
+ 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 6651fe7..6e8e1ee 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;
+ }
+@@ -115,6 +115,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();
+@@ -480,21 +496,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("./")))
+@@ -552,6 +563,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 f4bb5af..fb53560 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.
+--
+cgit v0.11.2
+
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to