File indexing completed on 2024-04-21 05:32:52

0001 /*
0002     SPDX-FileCopyrightText: 2009 Marco Martin <notmart@gmail.com>
0003     SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
0004     SPDX-FileCopyrightText: 2018 Eike Hein <hein@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <kdedmodule.h>
0012 
0013 #include <QHash>
0014 #include <QObject>
0015 #include <QPointer>
0016 #include <QSet>
0017 #include <QStringList>
0018 #include <QUrl>
0019 
0020 class KStatusNotifierItem;
0021 class QDBusServiceWatcher;
0022 
0023 /**
0024  * This plugin's purpose is to provide the user a link to the PBI extension.
0025  * It should run if the user has installed the host, but doesn't have the browser side.
0026  *
0027  * It creates an SNI for the first N times the user opens a browser with this setup.
0028  * Then we give up
0029  */
0030 
0031 class BrowserIntegrationReminder : public KDEDModule
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     BrowserIntegrationReminder(QObject *parent, const QList<QVariant> &);
0037     ~BrowserIntegrationReminder() override;
0038 
0039 private Q_SLOTS:
0040     void onResourceScoresChanged(const QString &activity,
0041                                  const QString &client,
0042                                  const QString &resource,
0043                                  double score,
0044                                  unsigned int lastUpdate,
0045                                  unsigned int firstUpdate);
0046 
0047     void onBrowserStarted(const QString &browserName);
0048 
0049     void unload();
0050     void disableAutoload();
0051 
0052 private:
0053     QHash<QString, QUrl> m_browsers;
0054     QPointer<KStatusNotifierItem> m_sni;
0055     QDBusServiceWatcher *m_watcher = nullptr;
0056     bool m_debug;
0057     int m_shownCount;
0058 };