Commit 6ed6903a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 440524 - Expiry settings not displayed properly from Akonadi config

FIXED-IN: 5.18.0
BUG: 440524

(loading was incorrect:
-        settings.mUnreadExpireUnits = attr->readExpireUnits();
-        settings.mReadExpireUnits = attr->unreadExpireUnits();
+        settings.mUnreadExpireUnits = attr->unreadExpireUnits();
+        settings.mReadExpireUnits = attr->readExpireUnits();
)
parent 4f5ea72b
Pipeline #74444 skipped
......@@ -64,8 +64,8 @@ void CollectionExpiryPage::load(const Akonadi::Collection &collection)
settings.expiryGloballyOn = attr->isAutoExpire();
settings.daysToExpireRead = daysToExpireRead;
settings.daysToExpireUnread = daysToExpireUnread;
settings.mUnreadExpireUnits = attr->readExpireUnits();
settings.mReadExpireUnits = attr->unreadExpireUnits();
settings.mUnreadExpireUnits = attr->unreadExpireUnits();
settings.mReadExpireUnits = attr->readExpireUnits();
settings.mExpireAction = attr->expireAction();
settings.mExpireToFolderId = attr->expireToFolderId();
......
......@@ -257,3 +257,23 @@ bool CollectionExpiryWidget::canHandle(const Akonadi::Collection &col)
QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(col, false);
return fd->canDeleteMessages() && !fd->isStructural() && !MailCommon::Util::isVirtualCollection(col);
}
bool CollectionExpirySettings::isValid() const
{
const bool valid = daysToExpireRead != -1 || daysToExpireUnread != -1 || mUnreadExpireUnits != ExpireCollectionAttribute::ExpireNever
|| mReadExpireUnits != ExpireCollectionAttribute::ExpireNever || mExpireAction != ExpireCollectionAttribute::ExpireDelete || mExpireToFolderId != -1;
return valid;
}
QDebug operator<<(QDebug d, const CollectionExpirySettings &t)
{
d << " expiryGloballyOn " << t.expiryGloballyOn;
d << " expiryMessagesWithInvalidDate " << t.expiryMessagesWithInvalidDate;
d << " daysToExpireRead " << t.daysToExpireRead;
d << " daysToExpireUnread " << t.daysToExpireUnread;
d << " mUnreadExpireUnits " << t.mUnreadExpireUnits;
d << " mReadExpireUnits " << t.mReadExpireUnits;
d << " mExpireAction " << t.mExpireAction;
d << " mExpireToFolderId " << t.mExpireToFolderId;
return d;
}
......@@ -19,12 +19,7 @@ namespace MailCommon
{
class FolderRequester;
struct MAILCOMMON_EXPORT CollectionExpirySettings {
Q_REQUIRED_RESULT bool isValid() const
{
return daysToExpireRead != -1 || daysToExpireUnread != -1 || mUnreadExpireUnits != ExpireCollectionAttribute::ExpireNever
|| mReadExpireUnits != ExpireCollectionAttribute::ExpireNever || mExpireAction != ExpireCollectionAttribute::ExpireDelete
|| mExpireToFolderId != -1;
}
Q_REQUIRED_RESULT bool isValid() const;
bool expiryGloballyOn = false;
bool expiryMessagesWithInvalidDate = false;
......@@ -69,5 +64,6 @@ private:
QCheckBox *mExpireMailWithInvalidDateCB = nullptr;
};
}
MAILCOMMON_EXPORT QDebug operator<<(QDebug d, const MailCommon::CollectionExpirySettings &t);
#endif // COLLECTIONEXPIRYWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment