kmail

searchjob.h
1/*
2 * Copyright (c) 2004 Carsten Burghardt <burghardt@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 *
17 * In addition, as a special exception, the copyright holders give
18 * permission to link the code of this program with any edition of
19 * the TQt library by Trolltech AS, Norway (or with modified versions
20 * of TQt that use the same license as TQt), and distribute linked
21 * combinations including the two. You must obey the GNU General
22 * Public License in all respects for all of the code used other than
23 * TQt. If you modify this file, you may extend this exception to
24 * your version of the file, but you are not obligated to do so. If
25 * you do not wish to do so, delete this exception statement from
26 * your version.
27 */
28#ifndef SEARCHJOB_H
29#define SEARCHJOB_H
30
31#include <tqstringlist.h>
32#include "folderjob.h"
33
34class KMFolderImap;
35class KMSearchPattern;
36class KURL;
37
38namespace TDEIO {
39 class Job;
40}
41
42namespace KPIM {
43 class ProgressItem;
44}
45
46namespace KMail {
47
48class ImapAccountBase;
49
53class SearchJob : public FolderJob
54{
55 TQ_OBJECT
56
57public:
65 SearchJob( KMFolderImap* folder, ImapAccountBase* account,
66 const KMSearchPattern* pattern, TQ_UINT32 serNum = 0 );
67
68 virtual ~SearchJob();
69
70 // Execute
71 virtual void execute();
72
73protected:
74 // searches the complete folder with the pattern
75 void searchCompleteFolder();
76
77 // checks a single message with the pattern
78 void searchSingleMessage();
79
80 // creates an imap search command
81 TQString searchStringFromPattern( const KMSearchPattern* );
82
83 // returns true if all uids can be mapped to sernums
84 bool canMapAllUIDs();
85
86 // if we need to download messages
87 bool needsDownload();
88
89protected slots:
90 // search the folder
91 // is called when all uids can be mapped to sernums
92 void slotSearchFolder();
93
94 // processes the server answer
95 void slotSearchData( TDEIO::Job* job, const TQString& data );
96
97 // message is downloaded and searched
98 void slotSearchMessageArrived( KMMessage* msg );
99
100 // error handling for all cases
101 void slotSearchResult( TDEIO::Job *job );
102
103 // imap search result from a single message
104 void slotSearchDataSingleMessage( TDEIO::Job* job, const TQString& data );
105
106 // the user cancelled the search progress
107 void slotAbortSearch( KPIM::ProgressItem* item );
108
109signals:
110 // emitted when a list of matching serial numbers was found
111 void searchDone( TQValueList<TQ_UINT32>, const KMSearchPattern*, bool complete );
112
113 // emitted when a single message (identified by the serial number) was checked
114 void searchDone( TQ_UINT32, const KMSearchPattern*, bool matches );
115
116protected:
117 KMFolderImap* mFolder;
118 ImapAccountBase* mAccount;
119 const KMSearchPattern* mSearchPattern;
120 KMSearchPattern* mLocalSearchPattern;
121 TQ_UINT32 mSerNum;
122 // saves the results of the imap search
123 TQStringList mImapSearchHits;
124 // collects the serial numbers from imap and local search
125 TQValueList<TQ_UINT32> mSearchSerNums;
126 // the remaining messages that have to be downloaded for local search
127 uint mRemainingMsgs;
128 // progress item for local searches
129 KPIM::ProgressItem *mProgress;
130 bool mUngetCurrentMsg;
131
132};
133
134} // namespace
135
136#endif /* SEARCHJOB_H */
137
This is a Mime Message.
Definition: kmmessage.h:68
This class is an abstraction of a search over messages.
Search job.
Definition: searchjob.h:54
SearchJob(KMFolderImap *folder, ImapAccountBase *account, const KMSearchPattern *pattern, TQ_UINT32 serNum=0)
Creates a new job.
Definition: searchjob.cpp:53
folderdiaquotatab.h
Definition: aboutdata.cpp:40