kmail

kmpopfiltercnfrmdlg.h
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 <tdelistview.h>
00025 
00026 #include <tqptrlist.h>
00027 #include <tqmap.h>
00028 
00029 class TQWidget;
00030 class TQString;
00031 
00032 class KMPopFilterCnfrmDlg;
00036 class KMPopHeadersView : public TDEListView
00037 {
00038   Q_OBJECT
00039   
00040 
00041 public:
00042   KMPopHeadersView(TQWidget *aParent=0, KMPopFilterCnfrmDlg *aDialog=0);
00043   ~KMPopHeadersView();
00044   static const KMPopFilterAction mapToAction(int aColumn) { return (KMPopFilterAction)aColumn;};
00045   static const int mapToColumn(KMPopFilterAction aAction) { return (int)aAction;};
00046   static const char *mUnchecked[26];
00047   static const char *mChecked[26];
00048 protected:
00049   static const char *mLater[25];
00050   static const char *mDown[20];
00051   static const char *mDel[19];
00052   void keyPressEvent( TQKeyEvent *k);
00053 
00054 protected slots: // Protected slots
00055   void slotPressed(TQListViewItem* aItem, const TQPoint& aPoint, int aColumn);
00056 
00057 private:
00058   KMPopFilterCnfrmDlg *mDialog;
00059 };
00060 
00061 
00062 
00063 class KMPopHeadersViewItem : public TDEListViewItem
00064 {
00065 public:
00066   KMPopHeadersViewItem(KMPopHeadersView *aParent, KMPopFilterAction aAction);
00067   ~KMPopHeadersViewItem();
00068   void setAction(KMPopFilterAction aAction);
00069   KMPopFilterAction action() { return mAction; };
00070   virtual void paintFocus(TQPainter *, const TQColorGroup & cg, const TQRect &r);
00071   virtual TQString key(int col, bool ascending) const;
00072 protected:
00073   KMPopHeadersView *mParent;
00074   KMPopFilterAction mAction;
00075 };
00076 
00077 
00078 class KMPopFilterCnfrmDlg : public KDialogBase
00079 {
00080     friend class ::KMPopHeadersView;
00081   Q_OBJECT
00082   
00083 protected:
00084   KMPopFilterCnfrmDlg() { };
00085   TQMap<TQListViewItem*, KMPopHeaders*> mItemMap;
00086   TQPtrList<KMPopHeadersViewItem> mDelList;
00087   TQPtrList<KMPopHeaders> mDDLList;
00088   KMPopHeadersView *mFilteredHeaders;
00089   bool mLowerBoxVisible;
00090   bool mShowLaterMsgs;
00091   void setupLVI(KMPopHeadersViewItem *lvi, KMMessage *msg);
00092     
00093 
00094 public:
00095   KMPopFilterCnfrmDlg(TQPtrList<KMPopHeaders> *aHeaders, const TQString &aAccount, bool aShowLaterMsgs = false, TQWidget *aParent=0, const char *aName=0);
00096   ~KMPopFilterCnfrmDlg();
00097 
00098 public:
00099   void setAction(TQListViewItem *aItem, KMPopFilterAction aAction);
00100 
00101 protected slots: // Protected slots
00108   void slotPressed(TQListViewItem *aItem, const TQPoint &aPnt, int aColumn);
00109   void slotToggled(bool aOn);
00110   void slotUpdateMinimumSize();
00111 };
00112 
00113 #endif