kmail

kmpopfiltercnfrmdlg.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kmpopheadersdlg.h  -  description
00003                              -------------------
00004     begin                : Sat Nov 3 2001
00005     copyright            : (C) 2001 by Heiko Hund
00006     email                : heiko@ist.eigentlich.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef KMPOPHEADERSDLG_H
00019 #define KMPOPHEADERSDLG_H
00020 
00021 #include "kmpopheaders.h"
00022 
00023 #include <kdialogbase.h>
00024 #include <klistview.h>
00025 
00026 #include <qptrlist.h>
00027 #include <qmap.h>
00028 
00029 class QWidget;
00030 class QString;
00031 
00032 class KMPopFilterCnfrmDlg;
00036 class KMPopHeadersView : public KListView
00037 {
00038   Q_OBJECT
00039 
00040 public:
00041   KMPopHeadersView(QWidget *aParent=0, KMPopFilterCnfrmDlg *aDialog=0);
00042   ~KMPopHeadersView();
00043   static const KMPopFilterAction mapToAction(int aColumn) { return (KMPopFilterAction)aColumn;};
00044   static const int mapToColumn(KMPopFilterAction aAction) { return (int)aAction;};
00045   static const char *mUnchecked[26];
00046   static const char *mChecked[26];
00047 protected:
00048   static const char *mLater[25];
00049   static const char *mDown[20];
00050   static const char *mDel[19];
00051   void keyPressEvent( QKeyEvent *k);
00052 
00053 protected slots: // Protected slots
00054   void slotPressed(QListViewItem* aItem, const QPoint& aPoint, int aColumn);
00055 
00056 private:
00057   KMPopFilterCnfrmDlg *mDialog;
00058 };
00059 
00060 
00061 
00062 class KMPopHeadersViewItem : public KListViewItem
00063 {
00064 public:
00065   KMPopHeadersViewItem(KMPopHeadersView *aParent, KMPopFilterAction aAction);
00066   ~KMPopHeadersViewItem();
00067   void setAction(KMPopFilterAction aAction);
00068   KMPopFilterAction action() { return mAction; };
00069   virtual void paintFocus(QPainter *, const QColorGroup & cg, const QRect &r);
00070   virtual QString key(int col, bool ascending) const;
00071 protected:
00072   KMPopHeadersView *mParent;
00073   KMPopFilterAction mAction;
00074 };
00075 
00076 
00077 class KMPopFilterCnfrmDlg : public KDialogBase
00078 {
00079     friend class ::KMPopHeadersView;
00080   Q_OBJECT
00081 protected:
00082   KMPopFilterCnfrmDlg() { };
00083   QMap<QListViewItem*, KMPopHeaders*> mItemMap;
00084   QPtrList<KMPopHeadersViewItem> mDelList;
00085   QPtrList<KMPopHeaders> mDDLList;
00086   KMPopHeadersView *mFilteredHeaders;
00087   bool mLowerBoxVisible;
00088   bool mShowLaterMsgs;
00089   void setupLVI(KMPopHeadersViewItem *lvi, KMMessage *msg);
00090     
00091 
00092 public:
00093   KMPopFilterCnfrmDlg(QPtrList<KMPopHeaders> *aHeaders, const QString &aAccount, bool aShowLaterMsgs = false, QWidget *aParent=0, const char *aName=0);
00094   ~KMPopFilterCnfrmDlg();
00095 
00096 public:
00097   void setAction(QListViewItem *aItem, KMPopFilterAction aAction);
00098 
00099 protected slots: // Protected slots
00106   void slotPressed(QListViewItem *aItem, const QPoint &aPnt, int aColumn);
00107   void slotToggled(bool aOn);
00108   void slotUpdateMinimumSize();
00109 };
00110 
00111 #endif