36#include <KProtocolInfo>
37#include <Purpose/AlternativesModel>
38#include <KUiServerJobTracker>
40#include <QWebEngineProfile>
41#include <QWebEngineUrlScheme>
53 Q_UNUSED(settingsPath);
56 mApp->autoFill()->passwordManager()->registerBackend(
QSL(
"KWallet"), m_backend);
59 if (qgetenv(
"KDE_FULL_SESSION") == QByteArray(
"true")) {
60 mApp->autoFill()->passwordManager()->switchBackend(
QSL(
"KWallet"));
63 m_jobTracker =
new KUiServerJobTracker(
this);
65 auto manager =
mApp->downloadManager();
68 m_jobTracker->registerJob(job);
70 job->updateDescription();
74 m_jobTracker->unregisterJob(job);
79 QStringList newSchemes;
80 const auto protocols = KProtocolInfo::protocols();
81 for (
const QString &protocol : protocols) {
85 if (!QWebEngineUrlScheme::schemeByName(protocol.toUtf8()).name().isEmpty()) {
87 m_kioSchemeHandlers.append(handler);
88 mApp->webProfile()->installUrlSchemeHandler(protocol.toUtf8(), handler);
92 newSchemes.append(protocol);
93 qInfo() <<
QSL(
"KDEFrameworksIntegration: Custom scheme '%1' will be available after browser restart.").arg(protocol);
97 if (!newSchemes.isEmpty()) {
101 QStringList allowedSchemes = settings.
value(
QSL(
"AllowedSchemes"), QStringList()).toStringList();
102 allowedSchemes.append(newSchemes);
103 allowedSchemes.removeDuplicates();
104 settings.
setValue(
QSL(
"AllowedSchemes"), allowedSchemes);
109 m_sharePageMenu =
new Purpose::Menu();
110 m_sharePageMenu->setTitle(tr(
"Share page"));
111 m_sharePageMenu->setIcon(QIcon::fromTheme(QStringLiteral(
"document-share")));
112 m_sharePageMenu->model()->setInputData(QJsonObject{
113 { QStringLiteral(
"urls"), QJsonArray {QJsonValue(
QSL(
"falkon"))} },
114 { QStringLiteral(
"title"), QJsonValue(
QSL(
"falkon")) }
116 m_sharePageMenu->model()->setPluginType(QStringLiteral(
"ShareUrl"));
118 KAboutData aboutData(
QSL(
"falkon"),
QSL(
"Falkon"), QCoreApplication::applicationVersion());
119 KAboutData::setApplicationData(aboutData);
121 KCrash::initialize();
122 KCrash::setFlags(KCrash::KeepFDs);
127 mApp->autoFill()->passwordManager()->unregisterBackend(m_backend);
129 delete m_sharePageMenu;
132 mApp->webProfile()->removeUrlSchemeHandler(handler);
136 m_kioSchemeHandlers.clear();
143 m_sharePageMenu->model()->setInputData(QJsonObject{
144 { QStringLiteral(
"urls"), QJsonArray {QJsonValue(view->url().toString())} },
145 { QStringLiteral(
"title"), QJsonValue(view->
title()) }
147 m_sharePageMenu->reload();
149 menu->addAction(m_sharePageMenu->menuAction());
155 return (QString::fromLatin1(
Qz::VERSION) == QLatin1String(FALKON_VERSION));
void progressChanged(double currSpeed, qint64 received, qint64 total)
void progress(double currSpeed, qint64 received, qint64 total)
void downloadAdded(DownloadItem *item)
KDEFrameworksIntegrationPlugin()
bool testPlugin() override
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override
void init(InitState state, const QString &settingsPath) override
void beginGroup(const QString &prefix)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant())
void setValue(const QString &key, const QVariant &defaultValue=QVariant())
static QStringList internalSchemes()
static void removeSupportedScheme(const QString &scheme)
static void addSupportedScheme(const QString &scheme)
QString title(bool allowEmpty=false) const
FALKON_EXPORT const char * VERSION