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 #include <qtimer.h>
00029 
00030 #include <kdialogbase.h>
00031 #include <kxmlguiclient.h>
00032 
00033 class QCheckBox;
00034 class QComboBox;
00035 class QGridLayout;
00036 class QLabel;
00037 class QLineEdit;
00038 class KListView;
00039 class QListViewItem;
00040 class QPushButton;
00041 class QRadioButton;
00042 class KAction;
00043 class KActionMenu;
00044 class KMFolder;
00045 class KMFolderSearch;
00046 class KMFolderImap;
00047 class KMFolderMgr;
00048 class KMMainWidget;
00049 class KMMessage;
00050 class KMSearchPattern;
00051 class KMSearchPatternEdit;
00052 class KStatusBar;
00053 class DwBoyerMoore;
00054 namespace KMail {
00055   class FolderRequester;
00056 }
00057 
00058 typedef QPtrList<KMMsgBase> KMMessageList;
00059 
00060 namespace KMail {
00061 
00068 class SearchWindow: public KDialogBase, virtual public KXMLGUIClient
00069 {
00070   Q_OBJECT
00071 
00072 public:
00081   SearchWindow( KMMainWidget* parent, const char* name=0,
00082                        KMFolder *curFolder=0, bool modal=false );
00083   virtual ~SearchWindow();
00084 
00089   void activateFolder( KMFolder* curFolder );
00090 
00095   KMMessageList selectedMessages();
00096 
00101   KMMessage* message();
00102 
00103   void setSearchPattern( const KMSearchPattern& pattern );
00104 
00105 protected slots:
00107   virtual void updStatus(void);
00108 
00109   virtual void slotClose();
00110   virtual void slotSearch();
00111   virtual void slotStop();
00112   void scheduleRename( const QString &);
00113   void renameSearchFolder();
00114   void openSearchFolder();
00115   void folderInvalidated(KMFolder *);
00116   virtual bool slotShowMsg( QListViewItem * );
00117   void slotViewSelectedMsg();
00118   virtual bool slotViewMsg( QListViewItem * );
00119   void slotCurrentChanged( QListViewItem * );
00120   virtual void updateContextMenuActions();
00121   virtual void slotContextMenuRequested( QListViewItem*, const QPoint &, int );
00122   virtual void copySelectedToFolder( int menuId );
00123   virtual void moveSelectedToFolder( int menuId );
00124   virtual void slotFolderActivated();
00125   void slotClearSelection();
00126   void slotReplyToMsg();
00127   void slotReplyAllToMsg();
00128   void slotReplyListToMsg();
00129   void slotForwardInlineMsg();
00130   void slotForwardAttachedMsg();
00131   void slotForwardDigestMsg();
00132   void slotRedirectMsg();
00133   void slotSaveMsg();
00134   void slotSaveAttachments();
00135   void slotPrintMsg();
00136   void slotCopyMsgs();
00137   void slotCutMsgs();
00138 
00140   virtual void searchDone();
00141   virtual void slotAddMsg(int idx);
00142   virtual void slotRemoveMsg(KMFolder *, Q_UINT32 serNum);
00143   void enableGUI();
00144 
00145   void setEnabledSearchButton(bool);
00146 
00147 protected:
00148 
00150   virtual void keyPressEvent(QKeyEvent*);
00151 
00153   virtual void closeEvent(QCloseEvent*);
00154 
00155 protected:
00156   bool mStopped;
00157   bool mCloseRequested;
00158   int mFetchingInProgress;
00159   int mSortColumn;
00160   SortOrder mSortOrder;
00161   QGuardedPtr<KMFolderSearch> mFolder;
00162   QTimer *mTimer;
00163 
00164   // GC'd by Qt
00165   QRadioButton *mChkbxAllFolders;
00166   QRadioButton *mChkbxSpecificFolders;
00167   KMail::FolderRequester *mCbxFolders;
00168   QPushButton *mBtnSearch;
00169   QPushButton *mBtnStop;
00170   QCheckBox *mChkSubFolders;
00171   KListView* mLbxMatches;
00172   QLabel *mSearchFolderLbl;
00173   QLineEdit *mSearchFolderEdt;
00174   QPushButton *mSearchFolderOpenBtn;
00175   QPushButton *mSearchResultOpenBtn;
00176   KStatusBar* mStatusBar;
00177   QWidget* mLastFocus; // to remember the position of the focus
00178   QMap<int,KMFolder*> mMenuToFolder;
00179   KAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
00180     *mForwardInlineAction, *mForwardAttachedAction, *mForwardDigestAction,
00181     *mRedirectAction, *mPrintAction, *mClearAction, *mSaveAtchAction,
00182     *mCopyAction, *mCutAction;
00183   KActionMenu *mForwardActionMenu;
00184   QValueList<QGuardedPtr<KMFolder> > mFolders;
00185   QTimer mRenameTimer;
00186 
00187   // not owned by us
00188   KMMainWidget* mKMMainWidget;
00189   KMSearchPatternEdit *mPatternEdit;
00190   KMSearchPattern *mSearchPattern;
00191 
00192   static const int MSGID_COLUMN;
00193 
00194 private:
00195   KMMessage *indexToMessage( QListViewItem *item );
00196 };
00197 
00198 } // namespace KMail
00199 #endif /*searchwindow_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys