kmail Library API Documentation

KMFilterListBox Class Reference

This is a complex widget that is used to manipulate KMail's filter list. A complex widget that allows managing a list of KMFilter's. More...

#include <kmfilterdlg.h>

Inheritance diagram for KMFilterListBox:

QGroupBox List of all members.

Public Slots

void slotUpdateFilterName ()
void slotApplyFilterChanges ()
void slotShowLaterToggled (bool aOn)

Signals

void filterSelected (KMFilter *filter)
void resetWidgets ()

Public Methods

 KMFilterListBox (const QString &title, QWidget *parent=0, const char *name=0, bool popFilter=false)
void createFilter (const QCString &field, const QString &value)
void loadFilterList ()
bool showLaterMsgs ()

Protected Slots

void slotSelected (int aIdx)
void slotNew ()
void slotDelete ()
void slotUp ()
void slotDown ()
void slotRename ()

Protected Attributes

QPtrList< KMFilter > mFilterList
QListBoxmListBox
QPushButtonmBtnNew
QPushButtonmBtnDelete
QPushButtonmBtnUp
QPushButtonmBtnDown
QPushButtonmBtnRename
int mIdxSelItem
bool mShowLater

Detailed Description

This is a complex widget that is used to manipulate KMail's filter list. A complex widget that allows managing a list of KMFilter's.

It consists of an internal list of filters, which is a deep copy of the list KMFilterMgr manages, a QListBox displaying that list, and a few buttons used to create new filters, delete them, rename them and change the order of filters.

It does not provide means to change the actual filter (besides the name), but relies on auxiliary widgets (KMSearchPatternEdit and KMFilterActionEdit) to do that.

Communication with this widget is quite easy: simply create an instance, connect the signals filterSelected and resetWidgets with a slot that does the right thing and there you go...

This widget will operate on it's own copy of the filter list as long as you don't call slotApplyFilterChanges. It will then transfer the altered filter list back to KMFilterMgr.

Author:
Marc Mutz <Marc@Mutz.com>, based upon work by Stefan Taferner <taferner@kde.org>.
See also:
KMFilter KMFilterDlg KMFilterActionEdit KMSearchPatternEdit

Definition at line 58 of file kmfilterdlg.h.


Constructor & Destructor Documentation

KMFilterListBox::KMFilterListBox const QString   title,
QWidget   parent = 0,
const char *    name = 0,
bool    popFilter = false
 

Constuctor.

Definition at line 370 of file kmfilterdlg.cpp.

References QToolTip::add(), QWhatsThis::add(), mBtnDelete, mBtnDown, mBtnNew, mBtnRename, mBtnUp, mFilterList, mIdxSelItem, mListBox, QPtrList< KMFilter >::setAutoDelete(), QPushButton::setAutoRepeat(), QPushButton::setPixmap(), QHBox::setSpacing(), slotDelete(), slotDown(), slotNew(), slotRename(), slotSelected(), and slotUp().


Member Function Documentation

void KMFilterListBox::createFilter const QCString   field,
const QString   value
 

Called from KMFilterDlg.

Creates a new filter and presets the first rule with "field equals value". It's there mainly to support "rapid filter creation" from a context menu. You should instead call KMFilterMgr::createFilter.

See also:
KMFilterMgr::createFilter KMFilterDlg::createFilter

Definition at line 437 of file kmfilterdlg.cpp.

References KMFilterActionDesc::create, and KMSearchRule::createInstance().

Referenced by KMFilterDlg::createFilter().

void KMFilterListBox::loadFilterList  
 

Loads the filter list and selects the first filter.

Should be called when all signals are connected properly.

Definition at line 681 of file kmfilterdlg.cpp.

References QPtrList< KMFilter >::append(), QListBox::clear(), QPtrList< KMFilter >::clear(), QListBox::count(), QPtrListIterator::current(), QListBox::insertItem(), mFilterList, mIdxSelItem, mListBox, resetWidgets(), QListBox::setSelected(), and QPtrListIterator::toFirst().

Referenced by KMFilterDlg::KMFilterDlg().

bool KMFilterListBox::showLaterMsgs  
 

Returns wheather the global option 'Show Later Msgs' is set or not.

Definition at line 454 of file kmfilterdlg.cpp.

Referenced by KMFilterDlg::slotFilterSelected().

void KMFilterListBox::filterSelected KMFilter *    filter [signal]
 

Emitted when a new filter has been selected by the user or if the current filter has changed after a 'new' or 'delete' operation.

Referenced by slotSelected().

void KMFilterListBox::resetWidgets   [signal]
 

Emitted when this widgets wants the edit widgets to let go of their filter reference.

Everyone holding a reference to a filter should update it from the contents of the widgets used to edit it and set their internal reference to 0.

Referenced by loadFilterList(), slotApplyFilterChanges(), slotDelete(), and slotSelected().

void KMFilterListBox::slotUpdateFilterName   [slot]
 

Called when the name of a filter might have changed (e.g.

through changing the first rule in KMSearchPatternEdit). Updates the corresponding entry in the listbox and (if necessary) auto-names the filter.

Definition at line 459 of file kmfilterdlg.cpp.

References QString::arg(), QPtrList< KMFilter >::at(), QListBox::changeItem(), QPtrList< KMSearchRule >::first(), mFilterList, mIdxSelItem, mListBox, KMSearchPattern::name(), KMSearchPattern::setName(), QString::stripWhiteSpace(), and QListBox::text().

Referenced by slotRename().

void KMFilterListBox::slotApplyFilterChanges   [slot]
 

Called when the user clicks either 'Apply' or 'OK' in KMFilterDlg.

Updates the filter list in the KMFilterMgr.

Definition at line 488 of file kmfilterdlg.cpp.

References QPtrList< KMFilter >::append(), QPtrList< KMFilter >::clear(), QPtrListIterator::current(), QListBox::currentItem(), mFilterList, mIdxSelItem, mListBox, resetWidgets(), QListBox::selectAll(), QListBox::setSelected(), slotSelected(), and QPtrListIterator::toFirst().

void KMFilterListBox::slotShowLaterToggled bool    aOn [slot]
 

Called when the user toggles the 'Show Download Later Msgs' Checkbox in the Global Options section.

Definition at line 483 of file kmfilterdlg.cpp.

void KMFilterListBox::slotSelected int    aIdx [protected, slot]
 

Called when the user clicks on a filter in the filter list.

Calculates the corresponding filter and emits the filterSelected signal.

Definition at line 549 of file kmfilterdlg.cpp.

References QPtrList< KMFilter >::at(), filterSelected(), mFilterList, mIdxSelItem, and resetWidgets().

Referenced by KMFilterListBox(), and slotApplyFilterChanges().

void KMFilterListBox::slotNew   [protected, slot]
 

Called when the user clicks the 'New' button.

Creates a new empty filter just before the current one.

Definition at line 561 of file kmfilterdlg.cpp.

Referenced by KMFilterListBox().

void KMFilterListBox::slotDelete   [protected, slot]
 

Called when the user clicks the 'Delete' button.

Deletes the current filter.

Definition at line 568 of file kmfilterdlg.cpp.

References QListBox::count(), mFilterList, mIdxSelItem, mListBox, QPtrList< KMFilter >::remove(), QListBox::removeItem(), resetWidgets(), QListBox::selectAll(), and QListBox::setSelected().

Referenced by KMFilterListBox().

void KMFilterListBox::slotUp   [protected, slot]
 

Called when the user clicks the 'Up' button.

Moves the current filter up one line.

Definition at line 602 of file kmfilterdlg.cpp.

References mIdxSelItem.

Referenced by KMFilterListBox().

void KMFilterListBox::slotDown   [protected, slot]
 

Called when the user clicks the 'Down' button.

Moves the current filter down one line.

Definition at line 617 of file kmfilterdlg.cpp.

References QListBox::count(), mIdxSelItem, and mListBox.

Referenced by KMFilterListBox().

void KMFilterListBox::slotRename   [protected, slot]
 

Called when the user clicks the 'Rename' button.

Pops up a dialog prompting to enter the new name.

Definition at line 632 of file kmfilterdlg.cpp.

References QPtrList< KMFilter >::at(), QString::isEmpty(), mFilterList, mIdxSelItem, and slotUpdateFilterName().

Referenced by KMFilterListBox().


Member Data Documentation

QPtrList<KMFilter> KMFilterListBox::mFilterList [protected]
 

The deep copy of the filter list.

Definition at line 128 of file kmfilterdlg.h.

Referenced by KMFilterListBox(), loadFilterList(), slotApplyFilterChanges(), slotDelete(), slotRename(), slotSelected(), and slotUpdateFilterName().

QListBox* KMFilterListBox::mListBox [protected]
 

The listbox displaying the filter list.

Definition at line 130 of file kmfilterdlg.h.

Referenced by KMFilterListBox(), loadFilterList(), slotApplyFilterChanges(), slotDelete(), slotDown(), and slotUpdateFilterName().

QPushButton* KMFilterListBox::mBtnNew [protected]
 

The various action buttons.

Definition at line 132 of file kmfilterdlg.h.

Referenced by KMFilterListBox().

QPushButton * KMFilterListBox::mBtnDelete [protected]
 

The various action buttons.

Definition at line 132 of file kmfilterdlg.h.

Referenced by KMFilterListBox().

QPushButton * KMFilterListBox::mBtnUp [protected]
 

The various action buttons.

Definition at line 132 of file kmfilterdlg.h.

Referenced by KMFilterListBox().

QPushButton * KMFilterListBox::mBtnDown [protected]
 

The various action buttons.

Definition at line 132 of file kmfilterdlg.h.

Referenced by KMFilterListBox().

QPushButton * KMFilterListBox::mBtnRename [protected]
 

The various action buttons.

Definition at line 132 of file kmfilterdlg.h.

Referenced by KMFilterListBox().

int KMFilterListBox::mIdxSelItem [protected]
 

The index of the currently selected item.

Definition at line 134 of file kmfilterdlg.h.

Referenced by KMFilterListBox(), loadFilterList(), slotApplyFilterChanges(), slotDelete(), slotDown(), slotRename(), slotSelected(), slotUp(), and slotUpdateFilterName().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:36 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003