Fix "Send to CodePaster..."

This vanished from the context menu in the diff editors with
c9ceed697f

The CodePaster::Service needs to be added to the plugin manager object
pool because it is retrieved by other plugins while avoiding the runtime
dependency on the Code Paster plugin.

Change-Id: I021a06264298729fdd3271e0805d34a742b06369
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2025-04-09 15:59:01 +02:00
parent 448db4f47c
commit f4dc189d9b

View File

@@ -22,6 +22,7 @@
#include <coreplugin/messagemanager.h>
#include <extensionsystem/iplugin.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
@@ -74,6 +75,7 @@ class CodePasterPluginPrivate : public QObject
{
public:
CodePasterPluginPrivate();
~CodePasterPluginPrivate();
void post(PasteSource pasteSources);
void post(QString data, const QString &mimeType);
@@ -173,6 +175,13 @@ CodePasterPluginPrivate::CodePasterPluginPrivate()
.setText(Tr::tr("Fetch from URL..."))
.addToContainer(menu)
.addOnTriggered(this, &CodePasterPluginPrivate::fetchUrl);
ExtensionSystem::PluginManager::addObject(&m_service);
}
CodePasterPluginPrivate::~CodePasterPluginPrivate()
{
ExtensionSystem::PluginManager::removeObject(&m_service);
}
static inline void textFromCurrentEditor(QString *text, QString *mimeType)