[rkward] /: Add --autoreuse command line option. This allows to do away with the separate rkward-open.desktop file.

Thomas Friedrichsmeier null at kde.org
Sat Oct 13 12:12:44 BST 2018


Git commit 160609f476c5d03f9573610935322d1635f7c695 by Thomas Friedrichsmeier.
Committed on 13/10/2018 at 11:10.
Pushed by tfry into branch 'master'.

Add --autoreuse command line option. This allows to do away with the separate rkward-open.desktop file.

--autoreuse acts like --reuse, if and only if one or more urls are specified on the command line.

M  +1    -0    ChangeLog
M  +5    -0    doc/rkward/man-rkward.1.docbook
M  +1    -1    rkward/CMakeLists.txt
M  +2    -1    rkward/main.cpp
D  +0    -77   rkward/org.kde.rkward-open.desktop
M  +1    -1    rkward/org.kde.rkward.desktop

https://commits.kde.org/rkward/160609f476c5d03f9573610935322d1635f7c695

diff --git a/ChangeLog b/ChangeLog
index 76e49b23..bf3010f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.7.1 - UNRELEASED
+- Add command-line option --autoreuse to avoid shipping two separate .desktop files
 - <select> elements in plugin dialogs can be set to accept only a single selection
 - New R functions rk.capture.output() and and rk.end.capture.output()
 - Allow to reference current script file in plugins      TODO: Test this
diff --git a/doc/rkward/man-rkward.1.docbook b/doc/rkward/man-rkward.1.docbook
index 0cda2d32..8ff350ed 100644
--- a/doc/rkward/man-rkward.1.docbook
+++ b/doc/rkward/man-rkward.1.docbook
@@ -40,6 +40,7 @@
 <group choice="opt"><option>--backend-debugger</option> <replaceable> debugger_command</replaceable></group>
 <group choice="opt"><option>--r-executable</option> <replaceable> path_to_executable</replaceable></group>
 <group choice="opt"><option>--reuse</option></group>
+<group choice="opt"><option>--autoreuse</option></group>
 <group choice="opt"><option>--nowarn-external</option></group>
 <arg choice="opt">KDE Generic Options</arg>
 <arg choice="opt">Qt Generic Options</arg>
@@ -86,6 +87,10 @@
 <listitem><para>If an instance of &rkward; is already running, bring that to the front, and open <replaceable>files_to_open</replaceable>. Note that all other command line options will be ignored in case an instance is reused.</para></listitem>
 </varlistentry>
 <varlistentry>
+<term><option>--autoreuse</option></term>
+<listitem><para>Behaves like <option>--reuse</option>, if any file arguments are also given, starts a new instance, otherwise. Intended for use in the .desktop file.</para></listitem>
+</varlistentry>
+<varlistentry>
 <term><option>--nowarn-external</option></term>
 <listitem><para>Usually, when invoking &rkward; plugins from the command line (&ie; when <replaceable>files_to_open</replaceable> contains &URL;s of the form <replaceable>rkward://runplugin/...</replaceable>), &rkward; will show a warning that such &URL;s <emphasis>could</emphasis> be used to trigger malicious actions on your system. This warning applies specifically to links found on untrusted websites, or other untrusted external sources. If you want to script &rkward; locally, you can avoid this warning by adding --nowarn-external to the command line.</para></listitem>
 </varlistentry>
diff --git a/rkward/CMakeLists.txt b/rkward/CMakeLists.txt
index 7bc7f567..7fb1fa5f 100755
--- a/rkward/CMakeLists.txt
+++ b/rkward/CMakeLists.txt
@@ -110,6 +110,6 @@ ELSE()
     INSTALL(TARGETS rkward DESTINATION ${BIN_INSTALL_DIR})
 ENDIF()
 
-INSTALL(FILES org.kde.rkward.desktop org.kde.rkward-open.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
+INSTALL(FILES org.kde.rkward.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
 INSTALL(FILES vnd.rkward.r.xml DESTINATION ${XDG_MIME_INSTALL_DIR})
 INSTALL(FILES rkward.protocol DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/rkward/main.cpp b/rkward/main.cpp
index 9bab0702..90403bb7 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -213,6 +213,7 @@ int main (int argc, char *argv[]) {
 	parser.addOption (QCommandLineOption ("backend-debugger", i18n ("Debugger for the backend. (Enclose any debugger arguments in single quotes ('') together with the command. Make sure to re-direct stdout!)"), "command", QString ()));
 	parser.addOption (QCommandLineOption ("r-executable", i18n ("Use specified R installation, instead of the one configured at compile time (note: rkward R library must be installed to that installation of R)"), "command", QString ()));
 	parser.addOption (QCommandLineOption ("reuse", i18n ("Reuse a running RKWard instance (if available). If a running instance is reused, only the file arguments will be interpreted, all other options will be ignored.")));
+	parser.addOption (QCommandLineOption ("autoreuse", i18n ("Behaves like --reuse, if any file arguments are also given, starts a new instance, otherwise. Intended for use in the .desktop file.")));
 	parser.addOption (QCommandLineOption ("nowarn-external", i18n ("When used in conjunction with rkward://runplugin/-URLs specified on the command line, suppresses the warning about application-external (untrusted) links.")));
 	parser.addPositionalArgument ("files", i18n ("File or files to open, typically a workspace, or an R script file. When loading several things, you should specify the workspace, first."), "[Files...]");
 
@@ -267,7 +268,7 @@ int main (int argc, char *argv[]) {
 	}
 
 	// Handle --reuse option, by placing a dbus-call to existing RKWard process (if any) and exiting
-	if (parser.isSet ("reuse")) {
+	if (parser.isSet ("reuse") || (parser.isSet ("autoreuse") && !url_args.isEmpty ())) {
 		if (!QDBusConnection::sessionBus ().isConnected ()) {
 			RK_DEBUG (DEBUG_ALL, DL_WARNING, "Could not connect to session dbus");
 		} else {
diff --git a/rkward/org.kde.rkward-open.desktop b/rkward/org.kde.rkward-open.desktop
deleted file mode 100644
index 0d67fa16..00000000
--- a/rkward/org.kde.rkward-open.desktop
+++ /dev/null
@@ -1,77 +0,0 @@
-# KDE Config File
-[Desktop Entry]
-Name=RKWard
-Name[bs]=RKWard
-Name[ca]=RKWard
-Name[ca at valencia]=RKWard
-Name[cs]=RKWard
-Name[de]=RKWard
-Name[es]=RKWard
-Name[fi]=RKWard
-Name[gl]=RKWard
-Name[it]=RKWard
-Name[nl]=RKWard
-Name[pl]=RKWard
-Name[pt]=RKWard
-Name[pt_BR]=RKWard
-Name[ru]=RKWard
-Name[sk]=RKWard
-Name[sv]=RKWard
-Name[uk]=RKWard
-Name[x-test]=xxRKWardxx
-GenericName=GUI for R
-GenericName[ca]=IGU pel R
-GenericName[ca at valencia]=IGU pel R
-GenericName[cs]=Grafické prostředí pro R
-GenericName[de]=Benutzeroberfläche (GUI) für R
-GenericName[es]=Interfaz gráfica para R
-GenericName[gl]=Interface gráfica para R
-GenericName[it]=GUI per R
-GenericName[nl]=GUI voor R
-GenericName[pl]=Interfejs dla R
-GenericName[pt]=Interface para o R
-GenericName[pt_BR]=Interface gráfica para R
-GenericName[sk]=GUI pre R
-GenericName[sv]=Grafiskt användargränssnitt för R
-GenericName[uk]=Графічний інтерфейс до R
-GenericName[x-test]=xxGUI for Rxx
-Comment=GUI for the R-project
-Comment[bs]=GUI za R-projekct
-Comment[ca]=IGU pel projecte R
-Comment[ca at valencia]=IGU pel projecte R
-Comment[cs]=Grafické prostředí pro projekt v R
-Comment[de]=Benutzeroberfläche für R-Projekt
-Comment[es]=Interfaz gráfica para el proyecto R
-Comment[fi]=R-kielen graafinen käyttöliittymä
-Comment[gl]=Interface gráfica para o proxecto R.
-Comment[it]=GUI per il progetto R
-Comment[nl]=GUI voor het R-project
-Comment[pl]=Interfejs użytkownika dla projektu R
-Comment[pt]=Interface gráfica para o projecto R
-Comment[pt_BR]=Interface gráfica para o R-project
-Comment[sk]=GUI pre R-project
-Comment[sv]=Grafiskt användargränssnitt för R-projektet
-Comment[uk]=Графічний інтерфейс проекту R
-Comment[x-test]=xxGUI for the R-projectxx
-Icon=rkward
-X-DBUS-ServiceName=org.kde.rkward-open
-Exec=rkward --reuse %F
-Terminal=false
-Type=Application
-X-DocPath=rkward/index.html
-Categories=Science;Math;NumericalAnalysis;
-Keywords=statistics;data;r;
-Keywords[ca]=estadística;dades;r;
-Keywords[ca at valencia]=estadística;dades;r;
-Keywords[cs]=statistika;data;r;
-Keywords[es]=estadísticas;datos;r;
-Keywords[gl]=estatísticas;datos;r;
-Keywords[it]=statistiche;dati;r;
-Keywords[nl]=statistics;data;r;
-Keywords[pt]=estatísticas;dados;r;
-Keywords[pt_BR]=estatística;dados;r;
-Keywords[sv]=statistik;data;r;
-Keywords[uk]=statistics;data;r;статистика;дані;р;
-Keywords[x-test]=xxstatisticsxx;xxdataxx;xxrxx;
-MimeType=text/r;application/rdata;
-# vi: encoding=utf-8
diff --git a/rkward/org.kde.rkward.desktop b/rkward/org.kde.rkward.desktop
index 08df35ca..85eed5f3 100755
--- a/rkward/org.kde.rkward.desktop
+++ b/rkward/org.kde.rkward.desktop
@@ -55,7 +55,7 @@ Comment[uk]=Графічний інтерфейс проекту R
 Comment[x-test]=xxGUI for the R-projectxx
 Icon=rkward
 X-DBUS-ServiceName=org.kde.rkward
-Exec=rkward -qwindowtitle %c
+Exec=rkward --autoreuse %F
 Terminal=false
 Type=Application
 X-DocPath=rkward/index.html



More information about the rkward-tracker mailing list