Commit 8d4aa397 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add akregator plugin

parent 7878bf23
......@@ -23,6 +23,7 @@
#include <KLocalizedString>
#include <QVBoxLayout>
#include <QAction>
#include <viewerplugintoolmanager.h>
#include <KPIMTextEdit/kpimtextedit/texttospeechwidget.h>
......@@ -62,6 +63,18 @@ void ArticleViewerWebEngineWidgetNg::initializeLayout(KActionCollection *ac)
mArticleViewerNg->setObjectName(QStringLiteral("articleviewerng"));
layout->addWidget(mArticleViewerNg);
mViewerPluginToolManager = new MessageViewer::ViewerPluginToolManager(this, this);
mViewerPluginToolManager->setActionCollection(ac);
mViewerPluginToolManager->setPluginName(QStringLiteral("akregator"));
mViewerPluginToolManager->setServiceTypeName(QStringLiteral("Akregator/ViewerPlugin"));
if (!mViewerPluginToolManager->initializePluginList()) {
qDebug() << " Impossible to initialize plugins";
}
mViewerPluginToolManager->createView();
connect(mViewerPluginToolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this, &ArticleViewerWebEngineWidgetNg::slotActivatePlugin);
mSliderContainer = new KPIMTextEdit::SlideContainer(this);
mSliderContainer->setObjectName(QStringLiteral("slidercontainer"));
mFindBarWebView = new MessageViewer::FindBarWebEngineView(mArticleViewerNg, this);
......@@ -78,6 +91,15 @@ ArticleViewerWebEngineWidgetNg::~ArticleViewerWebEngineWidgetNg()
}
void ArticleViewerWebEngineWidgetNg::slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface)
{
const QString text = mArticleViewerNg->selectedText();
if (!text.isEmpty()) {
interface->setText(text);
}
interface->showWidget();
}
ArticleViewerWebEngine *ArticleViewerWebEngineWidgetNg::articleViewerNg() const
{
return mArticleViewerNg;
......@@ -97,3 +119,12 @@ void ArticleViewerWebEngineWidgetNg::slotSpeakText()
const QString text = mArticleViewerNg->selectedText();
mTextToSpeechWidget->say(text);
}
#if 0
QList<QAction *> ViewerPrivate::viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features)
{
if (mViewerPluginToolManager) {
return mViewerPluginToolManager->viewerPluginActionList(features);
}
return QList<QAction *>();
}
#endif
......@@ -25,6 +25,8 @@ class KActionCollection;
namespace MessageViewer
{
class FindBarWebEngineView;
class ViewerPluginToolManager;
class ViewerPluginInterface;
}
namespace KPIMTextEdit
......@@ -48,6 +50,7 @@ public:
public Q_SLOTS:
void slotSpeakText();
void slotFind();
void slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface);
private:
void initializeActions(KActionCollection *ac);
void initializeLayout(KActionCollection *ac);
......@@ -55,6 +58,7 @@ private:
ArticleViewerWebEngine *mArticleViewerNg;
KPIMTextEdit::TextToSpeechWidget *mTextToSpeechWidget;
KPIMTextEdit::SlideContainer *mSliderContainer;
MessageViewer::ViewerPluginToolManager *mViewerPluginToolManager;
};
}
#endif // ARTICLEVIEWERWEBENGINEWIDGETNG_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment