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   void slotCopyMsgs();
00131   void slotCutMsgs();
00132 
00134   virtual void searchDone();
00135   virtual void slotAddMsg(int idx);
00136   virtual void slotRemoveMsg(KMFolder *, Q_UINT32 serNum);
00137   void enableGUI();
00138 
00139   void setEnabledSearchButton(bool);
00140 
00141 protected:
00142 
00144   virtual void keyPressEvent(QKeyEvent*);
00145 
00147   virtual void closeEvent(QCloseEvent*);
00148 
00149 protected:
00150   bool mStopped;
00151   bool mCloseRequested;
00152   int mFetchingInProgress;
00153   int mSortColumn;
00154   SortOrder mSortOrder;
00155   QGuardedPtr<KMFolderSearch> mFolder;
00156   QTimer *mTimer;
00157 
00158   // GC'd by Qt
00159   QRadioButton *mChkbxAllFolders;
00160   QRadioButton *mChkbxSpecificFolders;
00161   KMail::FolderRequester *mCbxFolders;
00162   QPushButton *mBtnSearch;
00163   QPushButton *mBtnStop;
00164   QCheckBox *mChkSubFolders;
00165   KListView* mLbxMatches;
00166   QLabel *mSearchFolderLbl;
00167   QLineEdit *mSearchFolderEdt;
00168   QPushButton *mSearchFolderBtn;
00169   QPushButton *mSearchFolderOpenBtn;
00170   KStatusBar* mStatusBar;
00171   QWidget* mLastFocus; // to remember the position of the focus
00172   QMap<int,KMFolder*> mMenuToFolder;
00173   KAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
00174     *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
00175     *mRedirectAction, *mPrintAction, *mClearAction, *mSaveAtchAction,
00176     *mCopyAction, *mCutAction;
00177   KActionMenu *mForwardActionMenu;
00178   QValueList<QGuardedPtr<KMFolder> > mFolders;
00179 
00180   // not owned by us
00181   KMMainWidget* mKMMainWidget;
00182   KMSearchPatternEdit *mPatternEdit;
00183   KMSearchPattern *mSearchPattern;
00184 
00185   static const int MSGID_COLUMN;
00186 };
00187 
00188 } // namespace KMail
00189 #endif /*searchwindow_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys