[education/rkward] rkward: Silence more warnings

Thomas Friedrichsmeier null at kde.org
Tue Jul 5 22:16:13 BST 2022


Git commit 24cff87f627fa5372b448c57b07cb01e5d1059f5 by Thomas Friedrichsmeier.
Committed on 05/07/2022 at 21:16.
Pushed by tfry into branch 'master'.

Silence more warnings

M  +12   -4    rkward/agents/rkprintagent.cpp
M  +10   -4    rkward/plugin/rkcomponentproperties.cpp
M  +6    -1    rkward/rbackend/rkrbackend.cpp
M  +9    -1    rkward/rbackend/rkrbackend.h
M  +6    -3    rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M  +1    -1    rkward/rkward.cpp
M  +6    -0    rkward/windows/rkfilebrowser.cpp
M  +0    -3    rkward/windows/rkhtmlwindow.cpp
M  +4    -0    rkward/windows/rktoolwindowbar.cpp

https://invent.kde.org/education/rkward/commit/24cff87f627fa5372b448c57b07cb01e5d1059f5

diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 4510a1ed..41081d6d 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -12,10 +12,15 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QElapsedTimer>
 #include <QUrl>
 
-#include <krun.h>
 #include <kservice.h>
 #include <kmessagebox.h>
 #include <kio_version.h>
+#if KIO_VERSION >= QT_VERSION_CHECK(5, 77, 0)
+#	include <KIO/OpenUrlJob>
+#	include <<KIO/JobUiDelegate>
+#else
+#	include <KRun>
+#endif
 #include <KLocalizedString>
 #include <KPluginFactory>
 #include <KPluginLoader>
@@ -71,10 +76,13 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 		RK_DEBUG (APP, DL_WARNING, "No valid postscript provider was found");
 		KMessageBox::sorry (RKWardMainWindow::getMain (), i18n ("No service was found to provide a KDE print dialog for PostScript files. We will try to open a generic PostScript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n ("Unable to open KDE print dialog"));
 		// fallback: If we can't find a proper part, try to invoke a standalone PS reader, instead
-#if KIO_VERSION < QT_VERSION_CHECK(5, 31, 0)
-		KRun::runUrl (QUrl::fromLocalFile (file), "application/postscript", RKWardMainWindow::getMain ());
+#if KIO_VERSION < QT_VERSION_CHECK(5, 77, 0)
+		KRun::runUrl (QUrl::fromLocalFile(file), "application/postscript", RKWardMainWindow::getMain(), KRun::RunFlags());
 #else
-		KRun::runUrl (QUrl::fromLocalFile (file), "application/postscript", RKWardMainWindow::getMain (), KRun::RunFlags());
+		auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file), "application/postscript");
+		job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, RKWardMainWindow::getMain()));
+		job->setDeleteTemporaryFile(delete_file);
+		job->start();
 #endif
 		return;
 	}
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 36337954..6bfb9c6c 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -580,8 +580,11 @@ void RKComponentPropertyInt::governorValueChanged (RKComponentPropertyBase *prop
 
 	QVariant value = property->value (governor_modifier);
 	double val = value.toDouble (&is_valid);	// QVariant's toInt() does not document rounding behavior. So we rather use a defined behavior, here.
-	if (isValid ()) internalSetValue ((int) val);
-	else internalSetValue (value.toString ());
+	if (isValid()) {
+		internalSetValue((int) val);
+	} else {
+		internalSetValue(value.toString());
+	}
 
 	emit valueChanged(this);
 }
@@ -735,8 +738,11 @@ void RKComponentPropertyDouble::governorValueChanged (RKComponentPropertyBase *p
 
 	QVariant value = property->value (governor_modifier);
 	double val = value.toDouble (&is_valid);
-	if (is_valid) internalSetValue (val);
-	else internalSetValue (value.toString ());
+	if (is_valid) {
+		internalSetValue (val);
+	} else {
+		internalSetValue (value.toString ());
+	}
 
 	emit valueChanged(this);
 }
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index fae358c6..251df2c9 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -793,7 +793,12 @@ void RBusy (int busy) {
 
 SEXP doUpdateLocale ();
 // NOTE: stdout_stderr_mutex is recursive to support fork()s, better
-RKRBackend::RKRBackend () : stdout_stderr_mutex (QMutex::Recursive) {
+#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
+#	define DUMMY_MUTEX_FLAGS
+#else
+#	define DUMMY_MUTEX_FLAGS QMutex::Recursive
+#endif
+RKRBackend::RKRBackend() : stdout_stderr_mutex(DUMMY_MUTEX_FLAGS) {
 	RK_TRACE (RBACKEND);
 
 	RK_ASSERT (this_pointer == 0);
diff --git a/rkward/rbackend/rkrbackend.h b/rkward/rbackend/rkrbackend.h
index c247d8d1..7845fd91 100644
--- a/rkward/rbackend/rkrbackend.h
+++ b/rkward/rbackend/rkrbackend.h
@@ -12,7 +12,11 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <QMap>
 #include <QVariant>
-#include <QMutex>
+#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
+#	include <QRecursiveMutex>
+#else
+#	include <QMutex>
+#endif
 #include <QStringList>
 #include <QEvent>
 #include <QTextEncoder>
@@ -186,7 +190,11 @@ handleHistoricalSubstackRequest(). Exactly which requests get handled by which f
  *  @returns: true, if output was actually fetched (or no output was available), false, if the function gave up on a locked mutex. */
 	bool fetchStdoutStderr (bool forcibly);
 /** public for technical reasons */
+#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
+	QRecursiveMutex stdout_stderr_mutex;
+#else
 	QMutex stdout_stderr_mutex;
+#endif
 
 	void setPriorityCommand (RCommandProxy *command);
 	RCommandProxy *pending_priority_command;
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index 5adf015e..a569b280 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -586,10 +586,13 @@ void RKGraphicsDevice::setActive (bool active) {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	if (!view) return;
-	if (active) view->setWindowTitle (i18nc ("Window title", "%1 (Active)", base_title));
-	else view->setWindowTitle (i18nc ("Window title", "%1 (Inactive)", base_title));
+	if (active) {
+		view->setWindowTitle(i18nc("Window title", "%1 (Active)", base_title));
+	} else {
+		view->setWindowTitle(i18nc("Window title", "%1 (Inactive)", base_title));
+	}
 	emit activeChanged(active);
-	emit captionChanged(view->windowTitle ());
+	emit captionChanged(view->windowTitle());
 }
 
 void RKGraphicsDevice::goInteractive (const QString& prompt) {
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 0d107b67..39e94a25 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -109,7 +109,7 @@ void bogusCalls () {
 //static
 RKWardMainWindow *RKWardMainWindow::rkward_mainwin = 0;
 
-RKWardMainWindow::RKWardMainWindow () : KParts::MainWindow ((QWidget *)0, (Qt::WindowFlags) KDE_DEFAULT_WINDOWFLAGS) {
+RKWardMainWindow::RKWardMainWindow() : KParts::MainWindow() {
 	RK_TRACE (APP);
 	RK_ASSERT (rkward_mainwin == 0);
 
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index 45733b86..ad548f52 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -19,6 +19,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <kfileitemlistproperties.h>
 #include <KLocalizedString>
 #include <kio/copyjob.h>
+#include <kio_version.h>
 
 #include <qdir.h>
 #include <qlayout.h>
@@ -178,8 +179,13 @@ void RKFileBrowserWidget::contextMenuHook(const KFileItem& item, QMenu* menu) {
 	menu_actions = menu->actions ();
 
 	menu->insertAction (first_sep, rename_action);
+#if KIO_VERSION >= QT_VERSION_CHECK(5,82,0)
+	fi_actions->insertOpenWithActionsTo(nullptr, menu, QStringList());
+	fi_actions->addActionsTo(menu);
+#else
 	fi_actions->addOpenWithActionsTo (menu, QString ());
 	fi_actions->addServiceActionsTo (menu);
+#endif
 
 	QList<QAction*> menu_actions_after = menu->actions ();
 	foreach (QAction* act, menu_actions_after) if (!menu_actions.contains (act)) added_service_actions.append (act);
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 3e25c99a..5940ea80 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -139,9 +139,6 @@ public:
 	}
 	bool supportsContentType (const QString &name) {
 		if (name.startsWith("text")) return true;
-#ifdef __GNUC__
-#warning TODO
-#endif
 		return false;
 	}
 	void downloadUrl (const QUrl& url) {
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index e37a1622..461f3896 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -305,7 +305,11 @@ bool RKToolWindowBar::eventFilter (QObject *obj, QEvent *ev) {
 				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveUp), i18n ("Top Sidebar"));
 				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveDown), i18n ("Bottom Sidebar"));
 				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete), i18n ("Not shown in sidebar"));
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5,78,0)
+				connect(sel, &KSelectAction::indexTriggered, this, &RKToolWindowBar::moveToolWindow);
+#else
 				connect (sel, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &RKToolWindowBar::moveToolWindow);
+#endif
 				menu.addAction (sel);
 	
 				menu.exec (e->globalPos());


More information about the rkward-tracker mailing list