File indexing completed on 2024-05-05 17:43:13
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Ivan Cukic <ivan.cukic (at) kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef PLASMAVAULT_KDED_UI_NOTICE_WIDGET_H 0008 #define PLASMAVAULT_KDED_UI_NOTICE_WIDGET_H 0009 0010 #include "dialogdsl.h" 0011 0012 class NoticeWidget : public DialogDsl::DialogModule 0013 { 0014 Q_OBJECT 0015 0016 public: 0017 enum Mode { 0018 ShowAlways, 0019 DoNotShowAgainOption, 0020 }; 0021 0022 NoticeWidget(const QString ¬iceId, const QString &message, Mode mode); 0023 0024 ~NoticeWidget() override; 0025 0026 PlasmaVault::Vault::Payload fields() const override; 0027 0028 void aboutToBeShown() override; 0029 bool shouldBeShown() const override; 0030 void aboutToBeHidden() override; 0031 0032 private: 0033 class Private; 0034 QScopedPointer<Private> d; 0035 }; 0036 0037 inline DialogDsl::ModuleFactory notice(const QByteArray ¬iceId, const QString &message, NoticeWidget::Mode mode = NoticeWidget::DoNotShowAgainOption) 0038 { 0039 return [=] { 0040 return new NoticeWidget(noticeId, message, mode); 0041 }; 0042 } 0043 0044 #endif // include guard