Git commit 57d3ecd7d44fc4671a0ed0b2884c89bb6b87aeee by Thomas Friedrichsmeier. Committed on 08/06/2024 at 22:10. Pushed by tfry into branch 'master'.
Documentation updates M +8 -3 doc/rkward/man-rkward.1.docbook M +4 -3 rkward/main.cpp M +4 -4 rkward/rkward.cpp M +1 -1 rkward/rkward.h https://invent.kde.org/education/rkward/-/commit/57d3ecd7d44fc4671a0ed0b2884c89bb6b87aeee diff --git a/doc/rkward/man-rkward.1.docbook b/doc/rkward/man-rkward.1.docbook index c7caae5a8..03a2bf739 100644 --- a/doc/rkward/man-rkward.1.docbook +++ b/doc/rkward/man-rkward.1.docbook @@ -21,8 +21,8 @@ SPDX-License-Identifier: GFDL-1.2-no-invariants-or-later OR GPL-2.0-or-later <address><email>rkward-de...@kde.org</email></address> </affiliation> </author> -<date>2023-11-30</date> -<releaseinfo>RKWard 0.7.5</releaseinfo> +<date>2024-05-26</date> +<releaseinfo>RKWard 0.8.0</releaseinfo> <productname>KDE Applications</productname> </refentryinfo> @@ -98,7 +98,12 @@ SPDX-License-Identifier: GFDL-1.2-no-invariants-or-later OR GPL-2.0-or-later </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> +<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> +<para>(If used in combination with --reuse, then *both* commands in question will need to be invoked with --nowarn-external, in order to suppress the warning.)</para></listitem> +</varlistentry> +<varlistentry> +<term><option>--setup</option></term> +<listitem><para>Act as if a new version of RKWard had been installed, importantly re-installing the R support package, and showing the setup wizard. This feature is mostly targetted at developers, and testers.</para></listitem> </varlistentry> <varlistentry> <term><option>--quirkmode</option></term> diff --git a/rkward/main.cpp b/rkward/main.cpp index 9deb10d0d..8029ccbb3 100644 --- a/rkward/main.cpp +++ b/rkward/main.cpp @@ -325,8 +325,7 @@ int main (int argc, char *argv[]) { if (!app_singleton.isPrimaryInstance()) { QByteArray call; QDataStream stream(&call, QIODevice::WriteOnly); - // TODO: nowarn-external - stream << QVariant(QStringLiteral("openAnyUrl")) << QVariant(url_args) << QVariant(parser.isSet("nowarn-external")); + stream << QVariant(QStringLiteral("openAnyUrl")) << args[RKCommandLineArgs::UrlArgs] << args[RKCommandLineArgs::NoWarnExternal]; app_singleton.sendMessageWithTimeout(call, 1000); // TODO: should always debug to terminal in this case! RK_DEBUG (DEBUG_ALL, DL_INFO, "Reusing running instance"); @@ -392,7 +391,9 @@ int main (int argc, char *argv[]) { stream >> urls; stream >> nowarn; if (call == QStringLiteral("openAnyUrl")) { - main->openUrlsFromCommandLineOrDBus(!nowarn.toBool(), urls.toStringList()); + QTimer::singleShot(0, main, [nowarn, urls, main]() { + main->openUrlsFromCommandLineOrExternal(nowarn.toBool(), urls.toStringList()); + }); } else { RK_DEBUG (APP, DL_ERROR, "Unrecognized SingleApplication call"); } diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp index 1905784d1..73fa7329a 100644 --- a/rkward/rkward.cpp +++ b/rkward/rkward.cpp @@ -224,7 +224,6 @@ void RKWardMainWindow::doPostInit () { RK_TRACE (APP); QStringList open_urls = RKCommandLineArgs::get(RKCommandLineArgs::UrlArgs).toStringList(); - bool warn_external = !RKCommandLineArgs::get(RKCommandLineArgs::NoWarnExternal).toBool(); QString evaluate_code = RKCommandLineArgs::get(RKCommandLineArgs::Evaluate).toString(); initPlugins (); @@ -258,7 +257,7 @@ void RKWardMainWindow::doPostInit () { // the help window will be on top if (RKSettingsModuleGeneral::showHelpOnStartup ()) toplevel_actions->showRKWardHelp (); - openUrlsFromCommandLineOrDBus (warn_external, open_urls); + openUrlsFromCommandLineOrExternal(true, open_urls); } else { if (RKSettingsModuleGeneral::openRestoreFileOnLoad() && QFile::exists(".RData")) { // setNoAskSave(true); was called earlier @@ -284,7 +283,7 @@ void RKWardMainWindow::doPostInit () { setCaption (QString ()); // our version of setCaption takes care of creating a correct caption, so we do not need to provide it here } -void RKWardMainWindow::openUrlsFromCommandLineOrDBus (bool warn_external, QStringList _urls) { +void RKWardMainWindow::openUrlsFromCommandLineOrExternal(bool no_warn_external, QStringList _urls) { RK_TRACE (APP); bool any_dangerous_urls = false; @@ -297,7 +296,8 @@ void RKWardMainWindow::openUrlsFromCommandLineOrDBus (bool warn_external, QStrin urls.append (url); } - if (warn_external && any_dangerous_urls) { + // --nowarn-external, if used cross-process, must be set on the commandline in both this, *and* the calling process + if (any_dangerous_urls && !(no_warn_external && RKCommandLineArgs::get(RKCommandLineArgs::NoWarnExternal).toBool())) { RK_ASSERT (urls.size () == 1); QString message = i18n ("<p>You are about to start an RKWard dialog from outside of RKWard, probably by clicking on an 'rkward://'-link, somewhere. In case you have found this link on an external website, please bear in mind that R can be used to run arbitrary commands on your computer, <b>potentially including downloading and installing malicious software</b>. If you do not trust the source of the link you were following, you should press 'Cancel', below.</p><p>In case you click 'Continue', no R code will be run, unless and until you click 'Submit' in the dialog window, and you are encouraged to review the generated R code, before doing so.</p><p><i>Note</i>: Checking 'Do not ask again' will suppress this message for the remainder of this session, only."); if (KMessageBox::warningContinueCancel (this, message, i18n ("A note on external links"), KStandardGuiItem::cont (), KStandardGuiItem::cancel (), "external_link_warning") != KMessageBox::Continue) return; diff --git a/rkward/rkward.h b/rkward/rkward.h index c1138fdf6..4636da6b8 100644 --- a/rkward/rkward.h +++ b/rkward/rkward.h @@ -118,7 +118,7 @@ public Q_SLOTS: void setCaption (const QString &) override; /** HACK this is only to make the compiler happy with -Woverloaded-virtual */ void setCaption (const QString &dummy, bool) override { setCaption (dummy); }; - void openUrlsFromCommandLineOrDBus (bool warn_external, QStringList urls); + void openUrlsFromCommandLineOrExternal(bool no_warn_external, QStringList urls); private Q_SLOTS: void partChanged (KParts::Part *new_part); private: