MailCommon::SearchPatternEdit Class

class MailCommon::SearchPatternEdit

A widget which allows editing a set of MailCommon::SearchRule's. More...

Header: #include <MailCommon/SearchPatternEdit>
CMake: find_package(KPim6MailCommon REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::MailCommon)
Inherits: QWidget

Public Functions

SearchPatternEdit(QWidget *parent = nullptr, MailCommon::SearchPatternEdit::SearchPatternEditOptions options = (SearchPatternEditOptions)(None), MailCommon::SearchPatternEdit::SearchModeType modeType = StandardMode)
virtual ~SearchPatternEdit() override
void setPatternEditOptions(SearchPatternEdit::SearchPatternEditOptions options)
void setSearchPattern(MailCommon::SearchPattern *aPattern)
void updateSearchPattern()

Public Slots

void reset()

Signals

Detailed Description

This widget is intended to be used in the filter configuration as well as in the message search dialogs. It consists of a frame, inside which there are placed two radio buttons entitled "Match {all,any} of the following", followed by a vertical stack of MailCommon::SearchRuleWidgets (initially two) and two buttons to add and remove, resp., additional KMSearchWidget 's.

To set the widget according to a given KMSearchPattern, use setSearchPattern; to initialize it (e.g. for a new, virgin rule), use setSearchPattern with a 0 argument. The widget operates directly on a shallow(!) copy of the search rule. So while you actually don't really need searchPattern, because you can always store a pointer to the current pattern yourself, you must not modify the currently-worked-on pattern yourself while this widget holds a reference to it. The only exceptions are:

@li If you edit a derived class, you can change aspects of the class that don't interfere with the KMSearchPattern part. An example is KMFilter, whose actions you can still edit while the KMSearchPattern part of it is being acted upon by this widget.

@li You can change the name of the pattern, but only using (this widget's) setName. You cannot change the pattern's name directly, although this widget in itself doesn't let the user change it. This is because it auto-names the pattern to "<$field>:$contents" iff the pattern begins with "<".

Author: Marc Mutz <mutz@kde.org>

Member Function Documentation

[explicit] SearchPatternEdit::SearchPatternEdit(QWidget *parent = nullptr, MailCommon::SearchPatternEdit::SearchPatternEditOptions options = (SearchPatternEditOptions)(None), MailCommon::SearchPatternEdit::SearchModeType modeType = StandardMode)

Constructor. The parent parameter is passed to the underlying QGroupBox, as usual.

parent The parent widget options Search pattern edit options modeType The search mode type (Standard or Baloo)

[override virtual noexcept] SearchPatternEdit::~SearchPatternEdit()

Destroys the search pattern edit widget.

[signal] void SearchPatternEdit::maybeNameChanged()

This signal is emitted whenever the name of the processed search pattern may have changed.

[signal] void SearchPatternEdit::patternChanged()

This signal is emitted wherenever the search pattern changes in some way.

[slot] void SearchPatternEdit::reset()

Called when the widget should let go of the currently referenced filter and disable itself.

[signal] void SearchPatternEdit::returnPressed()

Emitted when the Return key is pressed in the widget.

void SearchPatternEdit::setPatternEditOptions(SearchPatternEdit::SearchPatternEditOptions options)

Sets additional pattern edit options after construction.

options The options to set

void SearchPatternEdit::setSearchPattern(MailCommon::SearchPattern *aPattern)

Sets the search pattern. Rules are inserted regardless of the return value of each rules' MailCommon::SearchRule::isEmpty. This widget makes a shallow copy of aPattern and operates directly on it.

aPattern The search pattern to edit

void SearchPatternEdit::updateSearchPattern()

Updates the search pattern according to the current widget values.