|
|
|
@ -84,16 +84,11 @@ void ExpireJob::execute() |
|
|
|
mMaxUnreadTime = 0; |
|
|
|
mMaxUnreadTime = 0; |
|
|
|
mMaxReadTime = 0; |
|
|
|
mMaxReadTime = 0; |
|
|
|
int unreadDays, readDays; |
|
|
|
int unreadDays, readDays; |
|
|
|
bool mustDeleteExpirationAttribute = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MailCommon::ExpireCollectionAttribute *expirationAttribute |
|
|
|
const MailCommon::ExpireCollectionAttribute *expirationAttribute = mSrcFolder.attribute<MailCommon::ExpireCollectionAttribute>(); |
|
|
|
= MailCommon::Util::expirationCollectionAttribute( |
|
|
|
if (expirationAttribute) { |
|
|
|
mSrcFolder, mustDeleteExpirationAttribute); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expirationAttribute->daysToExpire(unreadDays, readDays); |
|
|
|
expirationAttribute->daysToExpire(unreadDays, readDays); |
|
|
|
if (mustDeleteExpirationAttribute) { |
|
|
|
|
|
|
|
delete expirationAttribute; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (unreadDays > 0) { |
|
|
|
if (unreadDays > 0) { |
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: deleting unread older than" << unreadDays << "days"; |
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: deleting unread older than" << unreadDays << "days"; |
|
|
|
@ -109,6 +104,10 @@ void ExpireJob::execute() |
|
|
|
deleteLater(); |
|
|
|
deleteLater(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
deleteLater(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: starting to expire in folder" << mSrcFolder.name(); |
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: starting to expire in folder" << mSrcFolder.name(); |
|
|
|
slotDoWork(); |
|
|
|
slotDoWork(); |
|
|
|
// do nothing here, we might be deleted!
|
|
|
|
// do nothing here, we might be deleted!
|
|
|
|
@ -167,12 +166,9 @@ void ExpireJob::done() |
|
|
|
|
|
|
|
|
|
|
|
// The command shouldn't kill us because it opens the folder
|
|
|
|
// The command shouldn't kill us because it opens the folder
|
|
|
|
mCancellable = false; |
|
|
|
mCancellable = false; |
|
|
|
bool mustDeleteExpirationAttribute = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MailCommon::ExpireCollectionAttribute *expirationAttribute |
|
|
|
|
|
|
|
= MailCommon::Util::expirationCollectionAttribute( |
|
|
|
|
|
|
|
mSrcFolder, mustDeleteExpirationAttribute); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MailCommon::ExpireCollectionAttribute *expirationAttribute = mSrcFolder.attribute<MailCommon::ExpireCollectionAttribute>(); |
|
|
|
|
|
|
|
if (expirationAttribute) { |
|
|
|
if (expirationAttribute->expireAction() == MailCommon::ExpireCollectionAttribute::ExpireDelete) { |
|
|
|
if (expirationAttribute->expireAction() == MailCommon::ExpireCollectionAttribute::ExpireDelete) { |
|
|
|
// Expire by deletion, i.e. move to null target folder
|
|
|
|
// Expire by deletion, i.e. move to null target folder
|
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: finished expiring in folder" |
|
|
|
qCDebug(MAILCOMMON_LOG) << "ExpireJob: finished expiring in folder" |
|
|
|
@ -205,8 +201,6 @@ void ExpireJob::done() |
|
|
|
count, mSrcFolder.name(), mMoveToFolder.name()); |
|
|
|
count, mSrcFolder.name(), mMoveToFolder.name()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (mustDeleteExpirationAttribute) { |
|
|
|
|
|
|
|
delete expirationAttribute; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!str.isEmpty()) { |
|
|
|
if (!str.isEmpty()) { |
|
|
|
@ -255,12 +249,9 @@ void ExpireJob::slotExpireDone(KJob *job) |
|
|
|
|
|
|
|
|
|
|
|
QString msg; |
|
|
|
QString msg; |
|
|
|
const int error = job->error(); |
|
|
|
const int error = job->error(); |
|
|
|
bool mustDeleteExpirationAttribute = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MailCommon::ExpireCollectionAttribute *expirationAttribute |
|
|
|
|
|
|
|
= MailCommon::Util::expirationCollectionAttribute( |
|
|
|
|
|
|
|
mSrcFolder, mustDeleteExpirationAttribute); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MailCommon::ExpireCollectionAttribute *expirationAttribute = mSrcFolder.attribute<MailCommon::ExpireCollectionAttribute>(); |
|
|
|
|
|
|
|
if (expirationAttribute) { |
|
|
|
switch (error) { |
|
|
|
switch (error) { |
|
|
|
case KJob::NoError: |
|
|
|
case KJob::NoError: |
|
|
|
if (expirationAttribute->expireAction() == MailCommon::ExpireCollectionAttribute::ExpireDelete) { |
|
|
|
if (expirationAttribute->expireAction() == MailCommon::ExpireCollectionAttribute::ExpireDelete) { |
|
|
|
@ -298,8 +289,6 @@ void ExpireJob::slotExpireDone(KJob *job) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BroadcastStatus::instance()->setStatusMsg(msg); |
|
|
|
BroadcastStatus::instance()->setStatusMsg(msg); |
|
|
|
if (mustDeleteExpirationAttribute) { |
|
|
|
|
|
|
|
delete expirationAttribute; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
deleteLater(); |
|
|
|
deleteLater(); |
|
|
|
} |
|
|
|
} |
|
|
|
|