Mailcommon
mailfilter.cpp
125MailFilter::ReturnCode MailFilter::execActions(ItemContext &context, bool &stopIt, bool applyOnOutbound) const
140 const QString logText = QStringLiteral("<font color=#FF0000>%1</font>").arg(i18n("A critical error occurred. Processing stops here."));
253 requiredPart = qMax(requiredPart, static_cast<int>(pattern()->requiredPart())); // no pattern means always matches?
260 requiredPartByActions = (*std::max_element(actionList.constBegin(), actionList.constEnd(), [](auto lhs, auto rhs) {
274void MailFilter::folderRemoved(const Akonadi::Collection &aFolder, const Akonadi::Collection &aNewFolder)
405 mApplicability = static_cast<AccountType>(config.readEntry("Applicability", static_cast<int>(ButImap)));
427 KMessageBox::information(nullptr, i18n("<qt>Too many filter actions in filter rule <b>%1</b>.</qt>", mPattern.name()));
461 i18n("<qt>Unknown filter action <b>%1</b><br />in filter rule <b>%2</b>.<br />Ignoring it.</qt>", resultActName, mPattern.name()));
468 QPointer<MailCommon::FilterActionMissingAccountDialog> dlg = new MailCommon::FilterActionMissingAccountDialog(mAccounts, name());
553 config.writeEntry(QStringLiteral("action-args-%1").arg(i), exportFilter ? (*it)->argsAsStringReal() : (*it)->argsAsString());
587 if (!Akonadi::AgentManager::self()->instances().isEmpty()) { // safety test to ensure that Akonadi system is ready
603 return (mPattern.isEmpty() && mActions.isEmpty()) || ((applicability() == Checked) && (bApplyOnInbound && mAccounts.isEmpty()));
619 result += QLatin1StringView("Filter name: ") + name() + QLatin1StringView(" (") + mIdentifier + QLatin1StringView(")\n");
622 result += QStringLiteral("Filter is %1\n").arg(bEnabled ? QStringLiteral("enabled") : QStringLiteral("disabled"));
659 for (QStringList::ConstIterator it2 = mAccounts.begin(), it2End = mAccounts.end(); it2 != it2End; ++it2) {
bool isValid() const
AgentType type() const
QString name() const
static AgentManager * self()
AgentInstance instance(const QString &identifier) const
QString identifier() const
bool hasKey(const char *key) const
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
virtual void argsFromString(const QString &argsStr)=0
Read extra arguments from given string.
virtual QString argsAsString() const =0
Return extra arguments as string.
@ ErrorNeedComplete
Could not process because a complete message is needed.
Definition filteraction.h:46
virtual bool argsFromStringInteractive(const QString &argsStr, const QString &filterName)
Read extra arguments from given string.
Definition filteraction.cpp:79
void add(const QString &entry, ContentType type)
Adds the given log entry under the given content type to the log.
Definition filterlog.cpp:128
static FilterLog * instance()
Returns the single global instance of the filter log.
Definition filterlog.cpp:71
static FilterActionDict * filterActionDict()
Returns the global filter action dictionary.
Definition filtermanager.cpp:96
bool applyOnAccount(const QString &id) const
Definition mailfilter.cpp:296
void setIcon(const QString &icon)
Set the icon to be used if plugged into the filter menu or toolbar.
Definition mailfilter.cpp:362
void setApplyBeforeOutbound(bool aApply)
Set whether this filter should be applied on outbound messages before sending (aApply == TRUE) or not...
Definition mailfilter.cpp:186
void folderRemoved(const Akonadi::Collection &aFolder, const Akonadi::Collection &aNewFolder)
Called from the filter manager when a folder is moved.
Definition mailfilter.cpp:274
SearchRule::RequiredPart requiredPart(const QString &id) const
Returns the required part from the item that is needed for the filter to operate.
Definition mailfilter.cpp:241
void setApplyOnInbound(bool aApply)
Set whether this filter should be applied on inbound messages (aApply == true) or not.
Definition mailfilter.cpp:201
void setConfigureShortcut(bool aShort)
Set whether this filter should be plugged into the filter menu.
Definition mailfilter.cpp:326
bool configureShortcut() const
Definition mailfilter.cpp:332
void setApplyOnExplicit(bool aApply)
Set whether this filter should be applied on explicit (CTRL-J) filtering (aApply == true) or not.
Definition mailfilter.cpp:211
void setToolbarName(const QString &toolbarName)
This sets the toolbar name for this filter.
Definition mailfilter.cpp:347
const QString asString() const
Returns the filter in a human-readable form.
Definition mailfilter.cpp:615
void setAutoNaming(bool useAutomaticNames)
Set the mode for using automatic naming for the filter.
Definition mailfilter.cpp:372
void setApplicability(AccountType aApply=All)
Set whether this filter should be applied on inbound messages for all accounts (aApply == All) or inb...
Definition mailfilter.cpp:231
QString purify(bool removeAction=true)
Remove empty rules (and actions one day).
Definition mailfilter.cpp:561
void setApplyOnOutbound(bool aApply)
Set whether this filter should be applied on outbound messages (aApply == true) or not.
Definition mailfilter.cpp:181
QString identifier() const
Returns the unique identifier of this filter.
Definition mailfilter.cpp:115
void setApplyOnAllFoldersInbound(bool aApply)
Sets whether the filter should be applied on inbound emails in all folders, not just Inbox.
Definition mailfilter.cpp:221
bool readConfig(const KConfigGroup &config, bool interactive=false)
Initialize from given config group.
Definition mailfilter.cpp:383
QList< FilterAction * > * actions()
Provides a reference to the internal action list.
Definition mailfilter.cpp:161
ReturnCode execActions(ItemContext &context, bool &stopIt, bool applyOnOutbound) const
Execute the filter action(s) on the given message.
Definition mailfilter.cpp:125
void setConfigureToolbar(bool aTool)
Set whether this filter should be plugged into the toolbar.
Definition mailfilter.cpp:337
bool applyOnAllFoldersInbound() const
Returns whether the filter should be applied on inbound emails in all folders, not just Inbox.
Definition mailfilter.cpp:226
void setApplyOnAccount(const QString &id, bool aApply=true)
Set whether this filter should be applied on inbound messages for the account with id (id).
Definition mailfilter.cpp:287
void setShortcut(const QKeySequence &shortcut)
Set the shortcut to be used if plugged into the filter menu or toolbar.
Definition mailfilter.cpp:352
void writeConfig(KConfigGroup &config, bool exportFilter) const
Write contents to given config group.
Definition mailfilter.cpp:510
bool applyBeforeOutbound() const
Definition mailfilter.cpp:196
This class is an abstraction of a search over messages.
Definition searchpattern.h:54
void writeConfig(KConfigGroup &config) const
Writes itself into config.
Definition searchpattern.cpp:194
void readConfig(const KConfigGroup &config)
Reads a search pattern from a KConfigGroup.
Definition searchpattern.cpp:121
QString purify(bool removeAction=true)
Removes all empty rules from the list.
Definition searchpattern.cpp:98
Q_SCRIPTABLE QStringList logText()
QString i18n(const char *text, const TYPE &arg...)
void information(QWidget *parent, const QString &text, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
KCOREADDONS_EXPORT QString randomString(int length)
const QList< QKeySequence > & shortcut(StandardShortcut id)
bool isEmpty() const const
QString toString(SequenceFormat format) const const
ConstIterator
Iterator
void append(QList< T > &&value)
iterator begin()
void clear()
const_iterator constBegin() const const
const_iterator constEnd() const const
iterator end()
iterator erase(const_iterator begin, const_iterator end)
bool isEmpty() const const
qsizetype removeAll(const AT &t)
bool hasNext() const const
bool hasPrevious() const const
const T & next()
const T & previous()
void toBack()
T value(const Key &key) const const
QString arg(Args &&... args) const const
bool isEmpty() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.