67
* Creates a new search window.
68
* @param parent The parent widget.
69
* @param name The (widget) name of the dialog.
70
* @param curFolder The folder which will be pre-selected as the base folder
71
* of search operations.
72
* @param modal Whether the dialog is to be shown modal.
74
explicit SearchWindow( KMMainWidget* parent, KMFolder *curFolder=0 );
75
virtual ~SearchWindow();
78
* Changes the base folder for search operations to a different folder.
79
* @param curFolder The folder to use as the new base for searches.
81
void activateFolder( KMFolder* curFolder );
84
* Provides access to the list of currently selected message in the listview.
85
* @return The list of currently selected search result messages.
87
QList<KMMsgBase*> selectedMessages();
90
* Provides access to the currently selected message.
91
* @return the currently selected message.
95
void setSearchPattern( const KMSearchPattern &pattern );
97
bool canMoveSelectedMessages();
100
/** Update status line widget. */
101
virtual void updStatus(void);
103
virtual void slotClose();
104
virtual void slotSearch();
105
virtual void slotStop();
106
void scheduleRename(const QString &);
107
void renameSearchFolder();
108
void openSearchFolder();
109
void folderInvalidated(KMFolder *);
110
virtual bool slotShowMsg(QTreeWidgetItem *,int);
111
void slotViewSelectedMsg();
112
virtual bool slotViewMsg( QTreeWidgetItem *, int );
113
void slotCurrentChanged(QTreeWidgetItem *);
114
virtual void updateContextMenuActions();
115
virtual void slotContextMenuRequested( QTreeWidgetItem* );
116
void slotCopySelectedMessagesToFolder( QAction* );
117
void slotMoveSelectedMessagesToFolder( QAction* );
118
virtual void slotFolderActivated();
119
void slotClearSelection();
120
void slotReplyToMsg();
121
void slotReplyAllToMsg();
122
void slotReplyListToMsg();
123
void slotForwardMsg();
124
void slotForwardAttachedMsg();
126
void slotSaveAttachments();
131
/** GUI cleanup after search */
132
virtual void searchDone();
133
virtual void slotAddMsg(int idx);
134
virtual void slotRemoveMsg(KMFolder *, quint32 serNum);
137
void setEnabledSearchButton(bool);
141
/** Reimplemented to react to Escape. */
142
virtual void keyPressEvent(QKeyEvent*);
144
/** Reimplemented to stop searching when the window is closed */
145
virtual void closeEvent(QCloseEvent*);
149
bool mCloseRequested;
150
int mFetchingInProgress;
152
Qt::SortOrder mSortOrder;
153
QPointer<KMFolderSearch> mFolder;
157
QRadioButton *mChkbxAllFolders;
158
QRadioButton *mChkbxSpecificFolders;
159
KMail::FolderRequester *mCbxFolders;
160
QCheckBox *mChkSubFolders;
161
MatchListView* mLbxMatches;
162
QLabel *mSearchFolderLbl;
163
KLineEdit *mSearchFolderEdt;
164
KPushButton *mSearchFolderOpenBtn;
165
KPushButton *mSearchResultOpenBtn;
166
KStatusBar* mStatusBar;
167
QWidget* mLastFocus; // to remember the position of the focus
168
QAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
169
*mForwardInlineAction, *mForwardAttachedAction, *mPrintAction, *mClearAction,
170
*mSaveAtchAction, *mCopyAction, *mCutAction;
171
KActionMenu *mForwardActionMenu;
172
QList<QPointer<KMFolder> > mFolders;
176
KMMainWidget* mKMMainWidget;
177
KMSearchPatternEdit *mPatternEdit;
178
KMSearchPattern *mSearchPattern;
180
static const int MSGID_COLUMN;
183
KMMessage *indexToMessage( QTreeWidgetItem *item );
187
class SearchWidgetItem : public QTreeWidgetItem
190
SearchWidgetItem(QTreeWidget* parent);
192
enum SearchWidgetItemType {
193
dateItemType = Qt::UserRole + 1
196
bool operator<(const QTreeWidgetItem &other)const;
200
// QTreeWidget sub-class for dnd support
201
// Internal, only used by SearchWindow.
202
class MatchListView : public QTreeWidget
207
MatchListView( QWidget *parent, SearchWindow* sw );
74
* Creates a new search window.
76
* @param parent The parent widget.
77
* @param collection The folder which will be pre-selected as the base folder
78
* of search operations.
80
explicit SearchWindow( KMMainWidget* parent, const Akonadi::Collection &collection = Akonadi::Collection() );
83
* Destroys the search window.
85
virtual ~SearchWindow();
88
* Changes the base folder for search operations to a different folder.
90
* @param folder The folder to use as the new base for searches.
92
void activateFolder( const Akonadi::Collection &folder );
95
* Provides access to the list of currently selected message in the listview.
97
* @return The list of currently selected search result messages.
99
Akonadi::Item::List selectedMessages() const;
102
* Provides access to the currently selected message.
104
* @return the currently selected message.
106
Akonadi::Item selectedMessage() const;
109
* Loads a search pattern into the search window, replacing the current one.
111
void setSearchPattern( const MailCommon::SearchPattern &pattern );
114
* Loads a search pattern into the search window, appending its rules to the current one.
116
void addRulesToSearchPattern( const MailCommon::SearchPattern &pattern );
211
virtual void contextMenuEvent( QContextMenuEvent* event );
212
virtual void startDrag( Qt::DropActions supportedActions );
119
/** Reimplemented to react to Escape. */
120
virtual void keyPressEvent( QKeyEvent* );
122
/** Reimplemented to stop searching when the window is closed */
123
virtual void closeEvent( QCloseEvent* );
126
virtual void updateStatusLine();
128
void updateCollectionStatisticsFinished( KJob* );
130
virtual void slotClose();
131
virtual void slotSearch();
132
virtual void slotStop();
133
void scheduleRename( const QString& );
134
void renameSearchFolder();
135
void openSearchFolder();
136
virtual bool slotShowMsg( const Akonadi::Item& );
137
void slotViewSelectedMsg();
138
virtual bool slotViewMsg( const Akonadi::Item& );
139
void slotCurrentChanged( const Akonadi::Item& );
140
virtual void updateContextMenuActions();
141
virtual void slotFolderActivated();
142
void slotClearSelection();
143
void slotReplyToMsg();
144
void slotReplyAllToMsg();
145
void slotReplyListToMsg();
146
void slotForwardMsg();
147
void slotForwardAttachedMsg();
149
void slotSaveAttachments();
152
/** GUI cleanup after search */
153
void searchDone( KJob* );
156
void setEnabledSearchButton( bool );
157
void slotSearchFolderRenameDone( KJob* );
159
void slotContextMenuRequested( const QPoint& );
215
SearchWindow* mSearchWindow;
217
void contextMenuRequested( QTreeWidgetItem* item );
163
bool mCloseRequested;
165
Qt::SortOrder mSortOrder;
166
Akonadi::Collection mFolder;
171
QRadioButton *mChkbxAllFolders;
172
QRadioButton *mChkbxSpecificFolders;
173
MailCommon::FolderRequester *mCbxFolders;
174
QCheckBox *mChkSubFolders;
175
Akonadi::ItemModel *mResultModel;
176
Akonadi::EntityTreeView *mLbxMatches;
177
QLabel *mSearchFolderLbl;
178
KLineEdit *mSearchFolderEdt;
179
KPushButton *mSearchFolderOpenBtn;
180
KPushButton *mSearchResultOpenBtn;
181
KStatusBar* mStatusBar;
182
QWidget* mLastFocus; // to remember the position of the focus
183
QAction *mReplyAction, *mReplyAllAction, *mReplyListAction, *mSaveAsAction,
184
*mForwardInlineAction, *mForwardAttachedAction, *mPrintAction, *mClearAction,
186
KActionMenu *mForwardActionMenu;
188
QByteArray mHeaderState;
190
KMMainWidget* mKMMainWidget;
191
MailCommon::SearchPatternEdit *mPatternEdit;
192
MailCommon::SearchPattern mSearchPattern;
194
Akonadi::StandardMailActionManager *mAkonadiStandardAction;
196
static const int MSGID_COLUMN;
221
#endif /*searchwindow_h*/