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   void setSearchPattern( const KMSearchPattern& pattern );
00103 
00104 protected slots:
00106   virtual void updStatus(void);
00107 
00108   virtual void slotClose();
00109   virtual void slotSearch();
00110   virtual void slotStop();
00111   void updateCreateButton( const QString &);
00112   void renameSearchFolder();
00113   void openSearchFolder();
00114   void folderInvalidated(KMFolder *);
00115   virtual bool slotShowMsg(QListViewItem *);
00116   virtual void updateContextMenuActions();
00117   virtual void slotContextMenuRequested( QListViewItem*, const QPoint &, int );
00118   virtual void copySelectedToFolder( int menuId );
00119   virtual void moveSelectedToFolder( int menuId );
00120   virtual void slotFolderActivated();
00121   void slotClearSelection();
00122   void slotReplyToMsg();
00123   void slotReplyAllToMsg();
00124   void slotReplyListToMsg();
00125   void slotForwardInlineMsg();
00126   void slotForwardAttachedMsg();
00127   void slotForwardDigestMsg();
00128   void slotRedirectMsg();
00129   void slotSaveMsg();
00130   void slotSaveAttachments();
00131   void slotPrintMsg();
00132   void slotCopyMsgs();
00133   void slotCutMsgs();
00134 
00136   virtual void searchDone();
00137   virtual void slotAddMsg(int idx);
00138   virtual void slotRemoveMsg(KMFolder *, Q_UINT32 serNum);
00139   void enableGUI();
00140 
00141   void setEnabledSearchButton(bool);
00142 
00143 protected:
00144 
00146   virtual void keyPressEvent(QKeyEvent*);
00147 
00149   virtual void closeEvent(QCloseEvent*);
00150 
00151 protected:
00152   bool mStopped;
00153   bool mCloseRequested;
00154   int mFetchingInProgress;
00155   int mSortColumn;
00156   SortOrder mSortOrder;
00157   QGuardedPtr<KMFolderSearch> mFolder;
00158   QTimer *mTimer;
00159 
00160   // GC'd by Qt
00161   QRadioButton *mChkbxAllFolders;
00162   QRadioButton *mChkbxSpecificFolders;
00163   KMail::FolderRequester *mCbxFolders;
00164   QPushButton *mBtnSearch;
00165   QPushButton *mBtnStop;
00166   QCheckBox *mChkSubFolders;
00167   KListView* mLbxMatches;
00168   QLabel *mSearchFolderLbl;
00169   QLineEdit *mSearchFolderEdt;
00170   QPushButton *mSearchFolderBtn;
00171   QPushButton *mSearchFolderOpenBtn;
00172   KStatusBar* mStatusBar;
00173   QWidget* mLastFocus; // to remember the position of the focus
00174   QMap<int,KMFolder*> mMenuToFolder;
00175   KAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
00176     *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
00177     *mRedirectAction, *mPrintAction, *mClearAction, *mSaveAtchAction,
00178     *mCopyAction, *mCutAction;
00179   KActionMenu *mForwardActionMenu;
00180   QValueList<QGuardedPtr<KMFolder> > mFolders;
00181 
00182   // not owned by us
00183   KMMainWidget* mKMMainWidget;
00184   KMSearchPatternEdit *mPatternEdit;
00185   KMSearchPattern *mSearchPattern;
00186 
00187   static const int MSGID_COLUMN;
00188 };
00189 
00190 } // namespace KMail
00191 #endif /*searchwindow_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys