/* ============================================================ * FlashCookieManager plugin for Falkon * Copyright (C) 2014 S. Razi Alavizadeh * Copyright (C) 2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * ============================================================ */ #ifndef FLASHCOOKIEMANAGER_H #define FLASHCOOKIEMANAGER_H #include "plugininterface.h" #include #include class BrowserWindow; class FCM_Dialog; class QTimer; class AbstractButtonInterface; struct FlashCookie { QString name; QString origin; int size; QString path; QString contents; QDateTime lastModification; bool operator ==(const FlashCookie &other) { return (this->name == other.name && this->path == other.path); } }; class FCM_Plugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) Q_PLUGIN_METADATA(IID "Falkon.Browser.plugin.FlashCookieManager") public: explicit FCM_Plugin(); DesktopFile metaData() const override; void init(InitState state, const QString &settingsPath) override; void unload() override; bool testPlugin() override; QTranslator *getTranslator(const QString &locale) override; void showSettings(QWidget *parent) override; void populateExtensionsMenu(QMenu *menu) override; void setFlashCookies(const QList &flashCookies); QList flashCookies(); QStringList newCookiesList(); void clearNewOrigins(); void clearCache(); QString flashPlayerDataPath() const; QVariantHash readSettings() const; void writeSettings(const QVariantHash &hashSettings); void removeCookie(const FlashCookie &flashCookie); private slots: void autoRefresh(); void showFlashCookieManager(); void mainWindowCreated(BrowserWindow* window); void mainWindowDeleted(BrowserWindow* window); void startStopTimer(); private: AbstractButtonInterface* createStatusBarIcon(BrowserWindow* mainWindow); void loadFlashCookies(); void loadFlashCookies(QString path); void insertFlashCookie(QString path); QString extractOriginFrom(const QString &path); bool isBlacklisted(const FlashCookie &flashCookie); bool isWhitelisted(const FlashCookie &flashCookie); void removeAllButWhitelisted(); QString sharedObjectDirName() const; QHash m_statusBarIcons; QPointer m_fcmDialog; QString m_settingsPath; QList m_flashCookies; QTimer* m_timer; mutable QVariantHash m_settingsHash; bool m_autoMode; bool m_deleteOnClose; bool m_enableNotification; QStringList m_blaklist; QStringList m_whitelist; QStringList m_newCookiesList; }; Q_DECLARE_METATYPE(FlashCookie); #endif // FLASHCOOKIEMANAGER_H