Mailcommon

collectionexpirywidget.h
1/*
2 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8#include "mailcommon_export.h"
9
10#include <MailCommon/ExpireCollectionAttribute>
11#include <QWidget>
12class QCheckBox;
13class QSpinBox;
14class QRadioButton;
15class QPushButton;
16namespace MailCommon
17{
18class FolderRequester;
19struct MAILCOMMON_EXPORT CollectionExpirySettings {
20 [[nodiscard]] bool isValid() const;
21
22 bool expiryGloballyOn = false;
23 bool expiryMessagesWithInvalidDate = false;
24 int daysToExpireRead = -1;
25 int daysToExpireUnread = -1;
26 ExpireCollectionAttribute::ExpireUnits mUnreadExpireUnits = ExpireCollectionAttribute::ExpireNever;
27 ExpireCollectionAttribute::ExpireUnits mReadExpireUnits = ExpireCollectionAttribute::ExpireNever;
28 ExpireCollectionAttribute::ExpireAction mExpireAction = ExpireCollectionAttribute::ExpireDelete;
29 Akonadi::Collection::Id mExpireToFolderId = -1;
30};
31
32class MAILCOMMON_EXPORT CollectionExpiryWidget : public QWidget
33{
34 Q_OBJECT
35public:
36 explicit CollectionExpiryWidget(QWidget *parent = nullptr);
37 ~CollectionExpiryWidget() override;
38
39 void load(const MailCommon::CollectionExpirySettings &settings);
40 void save(Akonadi::Collection &collection, bool saveSettings, bool expireNow);
41 void save(const CollectionExpirySettings &collectionExpirySettings, Akonadi::Collection &collection, bool saveSettings, bool expireNow);
42 [[nodiscard]] CollectionExpirySettings settings() const;
43 void hideExpireNowButton();
44 [[nodiscard]] static bool canHandle(const Akonadi::Collection &col);
45Q_SIGNALS:
46 void saveAndExpireRequested();
47 void configChanged(bool changed = true);
48
49private:
50 [[nodiscard]] MAILCOMMON_NO_EXPORT bool validateExpireFolder(bool expireNow);
51 [[nodiscard]] MAILCOMMON_NO_EXPORT MailCommon::ExpireCollectionAttribute *assignFolderAttribute(Akonadi::Collection &collection, bool &expireNow);
52 MAILCOMMON_NO_EXPORT void slotChanged();
53 QSpinBox *const mExpireReadMailSB;
54 QSpinBox *const mExpireUnreadMailSB;
55 QRadioButton *mMoveToRB = nullptr;
56 FolderRequester *const mFolderSelector;
57 QRadioButton *mDeletePermanentlyRB = nullptr;
58 QPushButton *const mExpireNowPB;
59 QCheckBox *const mExpireMailWithInvalidDateCB;
60};
61}
62MAILCOMMON_EXPORT QDebug operator<<(QDebug d, const MailCommon::CollectionExpirySettings &t);
QAction * load(const QObject *recvr, const char *slot, QObject *parent)
bool isValid(QStringView ifopt)
const QList< QKeySequence > & save()
The filter dialog.
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.