Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit eaa24657 authored by Laurent Montel's avatar Laurent Montel 😁

Port to new connect api

parent b7b4429b
......@@ -30,22 +30,16 @@
#include <QAction>
QAction *Akregator::createOpenLinkInNewTabAction(const QUrl &url, QObject *receiver, const char *slot, QObject *parent)
QAction *Akregator::createOpenLinkInNewTabAction(const QUrl &url, QObject *parent)
{
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18n("Open Link in New &Tab"), parent);
action->setData(url);
if (receiver && slot) {
QObject::connect(action, SIGNAL(triggered(bool)), receiver, slot);
}
return action;
}
QAction *Akregator::createOpenLinkInExternalBrowserAction(const QUrl &url, QObject *receiver, const char *slot, QObject *parent)
QAction *Akregator::createOpenLinkInExternalBrowserAction(const QUrl &url, QObject *parent)
{
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("window-new")), i18n("Open Link in External &Browser"), parent);
action->setData(url);
if (receiver && slot) {
QObject::connect(action, SIGNAL(triggered(bool)), receiver, slot);
}
return action;
}
......@@ -33,8 +33,8 @@ class QObject;
class QUrl;
namespace Akregator {
AKREGATOR_EXPORT QAction *createOpenLinkInNewTabAction(const QUrl &url, QObject *receiver = nullptr, const char *slot = nullptr, QObject *parent = nullptr);
AKREGATOR_EXPORT QAction *createOpenLinkInExternalBrowserAction(const QUrl &url, QObject *receiver = nullptr, const char *slot = nullptr, QObject *parent = nullptr);
AKREGATOR_EXPORT QAction *createOpenLinkInNewTabAction(const QUrl &url, QObject *parent = nullptr);
AKREGATOR_EXPORT QAction *createOpenLinkInExternalBrowserAction(const QUrl &url, QObject *parent = nullptr);
}
#endif // AKREGATOR_ACTIONS_H
......@@ -227,8 +227,16 @@ void ArticleViewerWebEngine::slotWebHitFinished(const WebEngineViewer::WebHitTes
const bool noContentSelected = selectedText().isEmpty();
if (noContentSelected) {
if (!mCurrentUrl.isEmpty()) {
popup.addAction(createOpenLinkInNewTabAction(mCurrentUrl, this, SLOT(slotOpenLinkInForegroundTab()), &popup));
popup.addAction(createOpenLinkInExternalBrowserAction(mCurrentUrl, this, SLOT(slotOpenLinkInBrowser()), &popup));
{
QAction *act = createOpenLinkInNewTabAction(mCurrentUrl, &popup);
connect(act, &QAction::triggered, this, &ArticleViewerWebEngine::slotOpenLinkInForegroundTab);
popup.addAction(act);
}
{
QAction *act = createOpenLinkInExternalBrowserAction(mCurrentUrl, &popup);
connect(act, &QAction::triggered, this, &ArticleViewerWebEngine::slotOpenLinkInBrowser);
popup.addAction(act);
}
popup.addSeparator();
popup.addAction(mActionCollection->action(QStringLiteral("savelinkas")));
popup.addAction(mActionCollection->action(QStringLiteral("copylinkaddress")));
......
......@@ -119,9 +119,6 @@ private Q_SLOTS:
void slotLoadStarted();
void slotLoadFinished();
void slotLinkClicked(const QUrl &url);
void slotOpenLinkInForegroundTab();
void slotOpenLinkInBackgroundTab();
void slotOpenLinkInBrowser();
void slotShowContextMenu(const QPoint &pos);
void slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result);
void slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface);
......@@ -129,6 +126,9 @@ private Q_SLOTS:
void slotCheckedUrlFinished(const QUrl &url, WebEngineViewer::CheckPhishingUrlUtil::UrlStatus status);
protected:
void slotOpenLinkInBrowser();
void slotOpenLinkInForegroundTab();
void slotOpenLinkInBackgroundTab();
ArticleViewerWebEnginePage *mPageEngine = nullptr;
QList<QAction *> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
WebEngineViewer::InterceptorManager *mNetworkAccessManager = nullptr;
......
......@@ -95,8 +95,16 @@ void AkrWebEngineViewer::slotWebHitFinished(const WebEngineViewer::WebHitTestRes
const bool noContentSelected = selectedText().isEmpty();
if (noContentSelected) {
if (!mCurrentUrl.isEmpty()) {
popup.addAction(createOpenLinkInNewTabAction(mCurrentUrl, this, SLOT(slotOpenLinkInForegroundTab()), &popup));
popup.addAction(createOpenLinkInExternalBrowserAction(mCurrentUrl, this, SLOT(slotOpenLinkInBrowser()), &popup));
{
QAction *act = createOpenLinkInNewTabAction(mCurrentUrl, &popup);
connect(act, &QAction::triggered, this, &AkrWebEngineViewer::slotOpenLinkInForegroundTab);
popup.addAction(act);
}
{
QAction *act = createOpenLinkInExternalBrowserAction(mCurrentUrl, &popup);
connect(act, &QAction::triggered, this, &AkrWebEngineViewer::slotOpenLinkInBrowser);
popup.addAction(act);
}
popup.addSeparator();
popup.addAction(mActionCollection->action(QStringLiteral("savelinkas")));
popup.addAction(mActionCollection->action(QStringLiteral("copylinkaddress")));
......
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