[education/rkward/kf5] rkward: Implement tabForToolViewAdded

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit 6916260eaec72d78bc33ba388280bdd4b75715e6 by Thomas Friedrichsmeier.
Committed on 05/04/2024 at 20:42.
Pushed by tfry into branch 'kf5'.

Implement tabForToolViewAdded

M  +2    -1    rkward/rkward.h
M  +11   -0    rkward/windows/katepluginintegration.cpp
M  +9    -1    rkward/windows/rktoolwindowbar.cpp

https://invent.kde.org/education/rkward/-/commit/6916260eaec72d78bc33ba388280bdd4b75715e6

diff --git a/rkward/rkward.h b/rkward/rkward.h
index 2d5136fdb..39d87d51b 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -1,6 +1,6 @@
 /*
 rkward.h - This file is part of the RKWard project. Created: Tue Oct 29 2002
-SPDX-FileCopyrightText: 2002-2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2002-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
 SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
 SPDX-License-Identifier: GPL-2.0-or-later
 */
@@ -67,6 +67,7 @@ protected:
 	virtual void closeEvent (QCloseEvent *e) override;
 Q_SIGNALS:
 	void aboutToQuitRKWard ();
+	void tabForToolViewAdded(QWidget*, QWidget*);  // Needed from katepluginintegration
 public Q_SLOTS:
 	void setWorkspaceUnmodified () { setWorkspaceMightBeModified (false); };
 	/** open a workspace. If the current workspace is not empty, ask whether to save first.
diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index 477567c14..89d64a336 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -157,6 +157,12 @@ QObject* KatePluginIntegrationApp::loadPlugin (const QString& identifier) {
 				KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin:%1:").arg(identifier));
 				interface->readSessionConfig(group);
 			}
+			interface = qobject_cast<KTextEditor::SessionConfigInterface *>(plugin);
+			if (interface) {
+				// NOTE: The session interface may be implemented in either the view or the plugin (or neither or both)
+				KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin_plugin:%1:").arg(identifier));
+				interface->readSessionConfig(group);
+			}
 		}
 		return plugin;
 	}
@@ -213,6 +219,11 @@ void KatePluginIntegrationApp::unloadPlugin(const QString &identifier) {
 			KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin:%1:").arg(identifier));
 			interface->writeSessionConfig(group);
 		}
+		interface = qobject_cast<KTextEditor::SessionConfigInterface *>(info.plugin);
+		if (interface) {
+			KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin_plugin:%1:").arg(identifier));
+			interface->writeSessionConfig(group);
+		}
 		Q_EMIT mainWindow()->main->pluginViewDeleted(identifier, view);
 		delete view;
 	}
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 5bbd344dd..67d8368cf 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -1,6 +1,6 @@
 /*
 rktoolwindowbar - This file is part of RKWard (https://rkward.kde.org). Created: Fri Oct 12 2007
-SPDX-FileCopyrightText: 2007-2020 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2007-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
 SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
 SPDX-License-Identifier: GPL-2.0-or-later
 */
@@ -147,6 +147,14 @@ void RKToolWindowBar::addWidget (RKMDIWindow *window) {
 		reclaimDetached (window);
 	}
 
+	// This really belongs to katepart integration, but cannot be placed there, without major pains
+	// Needs to be a queued connect, as the "real" widget (listening for the call) may be constructed after it's container
+	// is being added, here.
+	QMetaObject::invokeMethod( RKWardMainWindow::getMain(),
+	[w = RKWardMainWindow::getMain(), window, tab = tab(id)] {
+		Q_EMIT w->tabForToolViewAdded(window, tab);
+	}, Qt::QueuedConnection);
+
 	show ();
 }
 



More information about the rkward-tracker mailing list