kmail

searchwindow.h

00001 /*
00002  * kmail: KDE mail client
00003  * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
00004  * Copyright (c) 2001 Aaron J. Seigo <aseigo@kde.org>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  */
00021 #ifndef searchwindow_h
00022 #define searchwindow_h
00023 
00024 #include <qvaluelist.h>
00025 #include <qptrlist.h>
00026 #include <qstringlist.h>
00027 #include <qguardedptr.h>
00028 
00029 #include <kdialogbase.h>
00030 #include <kxmlguiclient.h>
00031 
00032 class QCheckBox;
00033 class QComboBox;
00034 class QGridLayout;
00035 class QLabel;
00036 class QLineEdit;
00037 class KListView;
00038 class QListViewItem;
00039 class QPushButton;
00040 class QRadioButton;
00041 class KAction;
00042 class KActionMenu;
00043 class KMFolder;
00044 class KMFolderSearch;
00045 class KMFolderImap;
00046 class KMFolderMgr;
00047 class KMMainWidget;
00048 class KMMessage;
00049 class KMSearchPattern;
00050 class KMSearchPatternEdit;
00051 class KStatusBar;
00052 class DwBoyerMoore;
00053 namespace KMail {
00054   class FolderRequester;
00055 }
00056 
00057 typedef QPtrList<KMMsgBase> KMMessageList;
00058 
00059 namespace KMail {
00060 
00067 class SearchWindow: public KDialogBase, virtual public KXMLGUIClient
00068 {
00069   Q_OBJECT
00070 
00071 public:
00080   SearchWindow( KMMainWidget* parent, const char* name=0,
00081                        KMFolder *curFolder=0, bool modal=false );
00082   virtual ~SearchWindow();
00083 
00088   void activateFolder( KMFolder* curFolder );
00089 
00094   KMMessageList selectedMessages();
00095 
00100   KMMessage* message();
00101 
00102 protected slots:
00104   virtual void updStatus(void);
00105 
00106   virtual void slotClose();
00107   virtual void slotSearch();
00108   virtual void slotStop();
00109   void updateCreateButton( const QString &);
00110   void renameSearchFolder();
00111   void openSearchFolder();
00112   void folderInvalidated(KMFolder *);
00113   virtual bool slotShowMsg(QListViewItem *);
00114   virtual void updateContextMenuActions();
00115   virtual void slotContextMenuRequested( QListViewItem*, const QPoint &, int );
00116   virtual void copySelectedToFolder( int menuId );
00117   virtual void moveSelectedToFolder( int menuId );
00118   virtual void slotFolderActivated();
00119   void slotClearSelection();
00120   void slotReplyToMsg();
00121   void slotReplyAllToMsg();
00122   void slotReplyListToMsg();
00123   void slotForwardInlineMsg();
00124   void slotForwardAttachedMsg();
00125   void slotForwardDigestMsg();
00126   void slotRedirectMsg();
00127   void slotSaveMsg();
00128   void slotSaveAttachments();
00129   void slotPrintMsg();
00130 
00132   virtual void searchDone();
00133   virtual void slotAddMsg(int idx);
00134   virtual void slotRemoveMsg(KMFolder *, Q_UINT32 serNum);
00135   void enableGUI();
00136 
00137   void setEnabledSearchButton(bool);
00138 
00139 protected:
00140 
00142   virtual void keyPressEvent(QKeyEvent*);
00143 
00145   virtual void closeEvent(QCloseEvent*);
00146 
00147 protected:
00148   bool mStopped;
00149   bool mCloseRequested;
00150   int mFetchingInProgress;
00151   int mSortColumn;
00152   SortOrder mSortOrder;
00153   QGuardedPtr<KMFolderSearch> mFolder;
00154   QTimer *mTimer;
00155 
00156   // GC'd by Qt
00157   QRadioButton *mChkbxAllFolders;
00158   QRadioButton *mChkbxSpecificFolders;
00159   KMail::FolderRequester *mCbxFolders;
00160   QPushButton *mBtnSearch;
00161   QPushButton *mBtnStop;
00162   QCheckBox *mChkSubFolders;
00163   KListView* mLbxMatches;
00164   QLabel *mSearchFolderLbl;
00165   QLineEdit *mSearchFolderEdt;
00166   QPushButton *mSearchFolderBtn;
00167   QPushButton *mSearchFolderOpenBtn;
00168   KStatusBar* mStatusBar;
00169   QWidget* mLastFocus; // to remember the position of the focus
00170   QMap<int,KMFolder*> mMenuToFolder;
00171   KAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
00172     *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
00173     *mRedirectAction, *mPrintAction, *mClearAction, *mSaveAtchAction;
00174   KActionMenu *mForwardActionMenu;
00175   QValueList<QGuardedPtr<KMFolder> > mFolders;
00176 
00177   // not owned by us
00178   KMMainWidget* mKMMainWidget;
00179   KMSearchPatternEdit *mPatternEdit;
00180   KMSearchPattern *mSearchPattern;
00181 
00182   static const int MSGID_COLUMN;
00183 };
00184 
00185 } // namespace KMail
00186 #endif /*searchwindow_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys