File indexing completed on 2024-12-22 05:01:16

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QLabel>
0010 class QHBoxLayout;
0011 namespace KMail
0012 {
0013 class ServerLabel : public QLabel
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit ServerLabel(const QString &toolTip, QWidget *parent = nullptr);
0018     ~ServerLabel() override;
0019 
0020 Q_SIGNALS:
0021     void clicked(const QString &serverName);
0022 
0023 protected:
0024     void mouseReleaseEvent(QMouseEvent *event) override;
0025 
0026 private:
0027     const QString mServerName;
0028 };
0029 
0030 class VacationLabel : public QLabel
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit VacationLabel(const QString &text, QWidget *parent = nullptr);
0035     ~VacationLabel() override;
0036 
0037 Q_SIGNALS:
0038     void vacationLabelClicked();
0039 
0040 protected:
0041     void mouseReleaseEvent(QMouseEvent *event) override;
0042 };
0043 
0044 class VacationScriptIndicatorWidget : public QWidget
0045 {
0046     Q_OBJECT
0047 public:
0048     explicit VacationScriptIndicatorWidget(QWidget *parent = nullptr);
0049     ~VacationScriptIndicatorWidget() override;
0050 
0051     void setVacationScriptActive(bool active, const QString &serverName);
0052 
0053     void updateIndicator();
0054 
0055     [[nodiscard]] bool hasVacationScriptActive() const;
0056 
0057 Q_SIGNALS:
0058     void clicked(const QString &serverName);
0059 
0060 private:
0061     void slotVacationLabelClicked();
0062     void createIndicator();
0063     QStringList mServerActive;
0064     QHBoxLayout *mBoxLayout = nullptr;
0065     VacationLabel *mInfo = nullptr;
0066 };
0067 }