File indexing completed on 2024-04-14 03:50:22

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2012 David Faure <faure+bluesystems@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef FRAMEWORKINTEGRATIONPLUGIN_H
0009 #define FRAMEWORKINTEGRATIONPLUGIN_H
0010 
0011 #include <KMessageBoxDontAskAgainInterface>
0012 #include <KMessageBoxNotifyInterface>
0013 #include <QObject>
0014 
0015 class KConfig;
0016 
0017 class KMessageBoxDontAskAgainConfigStorage : public KMessageBoxDontAskAgainInterface
0018 {
0019 public:
0020     KMessageBoxDontAskAgainConfigStorage()
0021         : KMessageBox_againConfig(nullptr)
0022     {
0023     }
0024     ~KMessageBoxDontAskAgainConfigStorage() override
0025     {
0026     }
0027 
0028     bool shouldBeShownTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode &result) override;
0029     bool shouldBeShownContinue(const QString &dontShowAgainName) override;
0030     void saveDontShowAgainTwoActions(const QString &dontShowAgainName, KMessageBox::ButtonCode result) override;
0031     void saveDontShowAgainContinue(const QString &dontShowAgainName) override;
0032     void enableAllMessages() override;
0033     void enableMessage(const QString &dontShowAgainName) override;
0034     void setConfig(KConfig *cfg) override
0035     {
0036         KMessageBox_againConfig = cfg;
0037     }
0038 
0039 private:
0040     KConfig *KMessageBox_againConfig;
0041 };
0042 
0043 class KMessageBoxNotify : public KMessageBoxNotifyInterface
0044 {
0045 public:
0046     void sendNotification(QMessageBox::Icon notificationType, const QString &message, QWidget *parent) override;
0047 };
0048 
0049 class KFrameworkIntegrationPlugin : public QObject
0050 {
0051     Q_PLUGIN_METADATA(IID "org.kde.FrameworkIntegrationPlugin")
0052     Q_OBJECT
0053 public:
0054     KFrameworkIntegrationPlugin();
0055 
0056 public Q_SLOTS:
0057     void reparseConfiguration();
0058 
0059 private:
0060     KMessageBoxDontAskAgainConfigStorage m_dontAskAgainConfigStorage;
0061     KMessageBoxNotify m_notify;
0062 };
0063 
0064 #endif // FRAMEWORKINTEGRATIONPLUGIN_H