kmail

headerlistquicksearch.h

Go to the documentation of this file.
00001 /*  -*- mode: C++ -*-
00002     This file is part of KMail, the KDE mail client.
00003     Copyright (c) 2004 Till Adam <adam@kde.org>
00004 
00005     KMail is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     KMail is distributed in the hope that it will be useful, but
00011     WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019     In addition, as a special exception, the copyright holders give
00020     permission to link the code of this program with any edition of
00021     the Qt library by Trolltech AS, Norway (or with modified versions
00022     of Qt that use the same license as Qt), and distribute linked
00023     combinations including the two.  You must obey the GNU General
00024     Public License in all respects for all of the code used other than
00025     Qt.  If you modify this file, you may extend this exception to
00026     your version of the file, but you are not obligated to do so.  If
00027     you do not wish to do so, delete this exception statement from
00028     your version.
00029 */
00030 
00031 #ifndef KMAILHEADERLISTQUICKSEARCH_H
00032 #define KMAILHEADERLISTQUICKSEARCH_H
00033 
00034 #include "kmmsgbase.h" // for KMMsgStatus
00035 #include "kmsearchpattern.h"
00036 #include <klistviewsearchline.h>
00037 #include <qvaluevector.h>
00038 class QComboBox;
00039 class QLabel;
00040 class KListView;
00041 class KActionCollection;
00042 
00043 namespace KMail {
00044 
00045 class HeaderListQuickSearch : public KListViewSearchLine
00046 {
00047 Q_OBJECT
00048 public:
00049     HeaderListQuickSearch( QWidget *parent,
00050                                              KListView *listView,
00051                                              KActionCollection *actionCollection,
00052                                              const char *name = 0 );
00053     virtual ~HeaderListQuickSearch();
00054 
00059     bool eventFilter( QObject *watched, QEvent *event );
00060 
00064     QString currentSearchTerm() const;
00065 
00069     int currentStatus() const;
00070 
00071 public slots:
00072    void reset();
00073 
00074 signals:
00075     void requestFullSearch();
00076 
00077 protected:
00082     virtual bool itemMatches(const QListViewItem *item, const QString &s) const;
00083 
00084 private slots:
00089   void slotStatusChanged( int index );
00090 
00091 private:
00093     void insertStatus(KMail::StatusValueTypes which);
00094     QComboBox *mStatusCombo;
00095     KMMsgStatus mStatus;
00096     QValueVector<QString> statusList;
00097     mutable QString mCurrentSearchTerm;
00098 };
00099 
00100 }
00101 
00102 #endif